From 74c5f973febfd0bd760514b542e42b77659a525e Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 24 Nov 2023 21:26:57 -0600 Subject: [PATCH 01/77] Add argon plasma fuel recipe (#2191) --- src/main/java/gregtech/loaders/recipe/FuelRecipes.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java index cbf1a609f19..e1181f737e0 100644 --- a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java @@ -281,10 +281,17 @@ public static void registerFuels() { .EUt((int) V[EV]) .buildAndRegister(); + RecipeMaps.PLASMA_GENERATOR_FUELS.recipeBuilder() + .fluidInputs(Argon.getPlasma(1)) + .fluidOutputs(Argon.getFluid(1)) + .duration(96) + .EUt((int) V[EV]) + .buildAndRegister(); + RecipeMaps.PLASMA_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Iron.getPlasma(1)) .fluidOutputs(Iron.getFluid(1)) - .duration(96) + .duration(128) .EUt((int) V[EV]) .buildAndRegister(); From 0420e8d2c5a83d867f64ed982c21465de596c9f5 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 25 Nov 2023 16:07:50 -0600 Subject: [PATCH 02/77] Allow spray paint to change UI color (with cfg) (#2196) --- src/main/java/gregtech/api/gui/IUIHolder.java | 4 ++++ src/main/java/gregtech/api/gui/ModularUI.java | 12 +++++++++--- .../api/metatileentity/MetaTileEntityHolder.java | 10 ++++++++++ src/main/java/gregtech/common/ConfigHolder.java | 3 +++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/api/gui/IUIHolder.java b/src/main/java/gregtech/api/gui/IUIHolder.java index 74c7eec156d..6f70c3f443c 100644 --- a/src/main/java/gregtech/api/gui/IUIHolder.java +++ b/src/main/java/gregtech/api/gui/IUIHolder.java @@ -8,4 +8,8 @@ public interface IUIHolder extends IDirtyNotifiable { boolean isRemote(); + /** UI color override to optionally use for whatever reason; return -1 to not override. */ + default int getUIColorOverride() { + return -1; + } } diff --git a/src/main/java/gregtech/api/gui/ModularUI.java b/src/main/java/gregtech/api/gui/ModularUI.java index 4a7ac29a09a..96874665a1d 100644 --- a/src/main/java/gregtech/api/gui/ModularUI.java +++ b/src/main/java/gregtech/api/gui/ModularUI.java @@ -159,15 +159,21 @@ public int getHeight() { } public float getRColorForOverlay() { - return shouldColor ? ((ConfigHolder.client.defaultUIColor & 0xFF0000) >> 16) / 255.0f : 1.0f; + return shouldColor ? ((getColor() & 0xFF0000) >> 16) / 255.0f : 1.0f; } public float getGColorForOverlay() { - return shouldColor ? ((ConfigHolder.client.defaultUIColor & 0xFF00) >> 8) / 255.0f : 1.0f; + return shouldColor ? ((getColor() & 0xFF00) >> 8) / 255.0f : 1.0f; } public float getBColorForOverlay() { - return shouldColor ? (ConfigHolder.client.defaultUIColor & 0xFF) / 255.0f : 1.0f; + return shouldColor ? (getColor() & 0xFF) / 255.0f : 1.0f; + } + + private int getColor() { + int color = holder.getUIColorOverride(); + if (color == -1) color = ConfigHolder.client.defaultUIColor; + return color; } /** diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index 5530907e88a..2949bcef5fe 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -19,6 +19,7 @@ import gregtech.api.util.TextFormattingUtil; import gregtech.client.particle.GTNameTagParticle; import gregtech.client.particle.GTParticleManager; +import gregtech.common.ConfigHolder; import gregtech.core.network.packets.PacketRecoverMTE; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -430,6 +431,15 @@ public boolean hasTESR() { return false; } + @Override + public int getUIColorOverride() { + if (metaTileEntity == null) return -1; + if (ConfigHolder.client.useSprayCanColorInUI) { + return metaTileEntity.getPaintingColor(); + } + return -1; + } + public void setCustomName(String customName) { if (!getName().equals(customName)) { this.customName = customName; diff --git a/src/main/java/gregtech/common/ConfigHolder.java b/src/main/java/gregtech/common/ConfigHolder.java index 087f71b7918..5ffbfdbec7a 100644 --- a/src/main/java/gregtech/common/ConfigHolder.java +++ b/src/main/java/gregtech/common/ConfigHolder.java @@ -393,6 +393,9 @@ public static class ClientOptions { @Config.RequiresMcRestart public int multiblockPreviewColor = 0xC6C6C6; + @Config.Comment({"Whether to use the Spray Can color in UIs when a machine is painted.", "Default: true"}) + public boolean useSprayCanColorInUI = true; + // does not require mc restart, drawn dynamically @Config.Comment({"The color to use for the text in the Multiblock Preview JEI Page.", "Default: 3355443 (0x333333), which is minecraft's dark gray color."}) From 82cfd62bd3f2090595101c787c97544ac4a2a4c0 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 25 Nov 2023 17:02:35 -0600 Subject: [PATCH 03/77] 9 slot arc furnace at EV (#2195) --- .../java/gregtech/api/recipes/RecipeMaps.java | 2 +- .../metatileentities/MetaTileEntities.java | 16 +++- .../electric/MetaTileEntityMacerator.java | 36 --------- .../SimpleMachineMetaTileEntityResizable.java | 81 +++++++++++++++++++ .../api/recipes/logic/ParallelLogicTest.java | 5 +- 5 files changed, 98 insertions(+), 42 deletions(-) delete mode 100644 src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMacerator.java create mode 100644 src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index a2132e3e15f..28daab475b7 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -81,7 +81,7 @@ public class RecipeMaps { * */ @ZenProperty - public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 4, 1, 1, new SimpleRecipeBuilder(), false) + public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, new SimpleRecipeBuilder(), false) .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) .setSound(GTSoundEvents.ARC) .onRecipeBuild(recipeBuilder -> { diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 85ba4b58807..562e819c4f4 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -70,7 +70,7 @@ public class MetaTileEntities { public static final MetaTileEntityCharger[] CHARGER = new MetaTileEntityCharger[GTValues.V.length]; //SIMPLE MACHINES SECTION public static final SimpleMachineMetaTileEntity[] ELECTRIC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final MetaTileEntityMacerator[] MACERATOR = new MetaTileEntityMacerator[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] MACERATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] ALLOY_SMELTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] ARC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; @@ -323,9 +323,10 @@ public static void init() { // Macerator, IDs 65-79 registerMetaTileEntities(MACERATOR, 65, "macerator", (tier, voltageName) -> - new MetaTileEntityMacerator( + new SimpleMachineMetaTileEntityResizable( gregtechId(String.format("%s.%s", "macerator", voltageName)), RecipeMaps.MACERATOR_RECIPES, + -1, switch (tier) { case 1, 2 -> 1; case 3 -> 3; @@ -338,7 +339,16 @@ public static void init() { registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, Textures.ALLOY_SMELTER_OVERLAY, true); // Arc Furnace, IDs 95-109 - registerSimpleMetaTileEntity(ARC_FURNACE, 95, "arc_furnace", RecipeMaps.ARC_FURNACE_RECIPES, Textures.ARC_FURNACE_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); + registerMetaTileEntities(ARC_FURNACE, 95, "arc_furnace", (tier, voltageName) -> + new SimpleMachineMetaTileEntityResizable( + gregtechId(String.format("%s.%s", "arc_furnace", voltageName)), + RecipeMaps.ARC_FURNACE_RECIPES, + -1, + tier >= GTValues.EV ? 9 : 4, + Textures.ARC_FURNACE_OVERLAY, + tier, + false, + GTUtility.hvCappedTankSizeFunction)); // Assembler, IDs 110-124 registerSimpleMetaTileEntity(ASSEMBLER, 110, "assembler", RecipeMaps.ASSEMBLER_RECIPES, Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMacerator.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMacerator.java deleted file mode 100644 index 2cc444f36fc..00000000000 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMacerator.java +++ /dev/null @@ -1,36 +0,0 @@ -package gregtech.common.metatileentities.electric; - -import gregtech.api.capability.impl.NotifiableItemStackHandler; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.SimpleMachineMetaTileEntity; -import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.recipes.RecipeMap; -import gregtech.client.renderer.ICubeRenderer; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.items.IItemHandlerModifiable; - -public class MetaTileEntityMacerator extends SimpleMachineMetaTileEntity { - - private final int outputAmount; - - public MetaTileEntityMacerator(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int outputAmount, ICubeRenderer renderer, int tier) { - super(metaTileEntityId, recipeMap, renderer, tier, true); - this.outputAmount = outputAmount; - initializeInventory(); - } - - @Override - protected IItemHandlerModifiable createExportItemHandler() { - return new NotifiableItemStackHandler(this, outputAmount, this, true); - } - - @Override - public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityMacerator(metaTileEntityId, workable.getRecipeMap(), outputAmount, renderer, getTier()); - } - - @Override - public int getItemOutputLimit() { - return outputAmount; - } -} diff --git a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java new file mode 100644 index 00000000000..a6c3e345f7d --- /dev/null +++ b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java @@ -0,0 +1,81 @@ +package gregtech.common.metatileentities.electric; + +import gregtech.api.capability.impl.NotifiableItemStackHandler; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.SimpleMachineMetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.recipes.RecipeMap; +import gregtech.client.renderer.ICubeRenderer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.items.IItemHandlerModifiable; + +import java.util.function.Function; + +/** + * Class for simple machines which have variable item I/O slot amounts depending on tier. + */ +public class SimpleMachineMetaTileEntityResizable extends SimpleMachineMetaTileEntity { + + private final int inputAmount; + private final int outputAmount; + + /** + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + */ + public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, + RecipeMap recipeMap, + int inputAmount, + int outputAmount, + ICubeRenderer renderer, + int tier) { + super(metaTileEntityId, recipeMap, renderer, tier, true); + this.inputAmount = inputAmount; + this.outputAmount = outputAmount; + initializeInventory(); + } + + /** + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + */ + public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, + RecipeMap recipeMap, + int inputAmount, + int outputAmount, + ICubeRenderer renderer, + int tier, + boolean hasFrontFacing, + Function tankScalingFunction) { + super(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, tankScalingFunction); + this.inputAmount = inputAmount; + this.outputAmount = outputAmount; + initializeInventory(); + } + + @Override + protected IItemHandlerModifiable createImportItemHandler() { + if (inputAmount != -1) { + return new NotifiableItemStackHandler(this, inputAmount, this, false); + } + return super.createImportItemHandler(); + } + + @Override + protected IItemHandlerModifiable createExportItemHandler() { + if (outputAmount != -1) { + return new NotifiableItemStackHandler(this, outputAmount, this, true); + } + return super.createExportItemHandler(); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, outputAmount, renderer, getTier()); + } + + @Override + public int getItemOutputLimit() { + return outputAmount; + } +} diff --git a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java index 024be7394ff..3f1e5b89eac 100644 --- a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java @@ -14,7 +14,7 @@ import gregtech.api.util.OverlayedFluidHandler; import gregtech.api.util.OverlayedItemHandler; import gregtech.common.metatileentities.MetaTileEntities; -import gregtech.common.metatileentities.electric.MetaTileEntityMacerator; +import gregtech.common.metatileentities.electric.SimpleMachineMetaTileEntityResizable; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import net.minecraft.init.Blocks; @@ -871,9 +871,10 @@ public void doParallelRecipes_ExistingEUValueTest() { .output(Items.CARROT) .build().getResult(); - MetaTileEntityMacerator macerator = MetaTileEntities.registerMetaTileEntity(1, new MetaTileEntityMacerator( + SimpleMachineMetaTileEntityResizable macerator = MetaTileEntities.registerMetaTileEntity(1, new SimpleMachineMetaTileEntityResizable( gregtechId("macerator"), RecipeMaps.MACERATOR_RECIPES, + -1, 4, null, GTValues.EV)); From 20451280b14f6896894363d196b738083ae30a20 Mon Sep 17 00:00:00 2001 From: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Sun, 26 Nov 2023 00:57:19 +0100 Subject: [PATCH 04/77] Add TileEntity neighbor cache & Pipe improvements (#2098) Co-authored-by: TechLord22 <37029404+TechLord22@users.noreply.github.com> --- .../api/block/machines/BlockMachine.java | 30 +++-- .../impl/EnergyContainerBatteryBuffer.java | 2 +- .../impl/EnergyContainerHandler.java | 2 +- src/main/java/gregtech/api/cover/Cover.java | 19 ++- .../gregtech/api/cover/CoverableView.java | 7 ++ .../api/metatileentity/MetaTileEntity.java | 32 +++--- .../metatileentity/MetaTileEntityHolder.java | 4 +- .../NeighborCacheTileEntityBase.java | 63 ++++++++++ .../metatileentity/SyncedTileEntityBase.java | 7 ++ .../TickableTileEntityBase.java | 2 +- .../interfaces/IGregTechTileEntity.java | 2 +- .../interfaces/INeighborCache.java | 27 +++++ .../java/gregtech/api/pipenet/IRoutePath.java | 37 ++++++ .../gregtech/api/pipenet/PipeNetWalker.java | 67 ++++++----- .../gregtech/api/pipenet/block/BlockPipe.java | 30 ++--- .../api/pipenet/block/ItemBlockPipe.java | 5 +- .../api/pipenet/longdist/ILDEndpoint.java | 3 +- .../pipenet/longdist/LongDistanceNetwork.java | 8 +- .../longdist/LongDistancePipeType.java | 4 +- .../gregtech/api/pipenet/tile/IPipeTile.java | 16 ++- .../tile/PipeCoverableImplementation.java | 12 +- .../api/pipenet/tile/TileEntityPipeBase.java | 5 +- .../materials/OrganicChemistryMaterials.java | 1 - .../java/gregtech/api/util/GTUtility.java | 28 +++++ .../gregtech/common/covers/CoverConveyor.java | 10 +- .../gregtech/common/covers/CoverPump.java | 4 +- .../converter/ConverterTrait.java | 12 +- .../MetaTileEntityWorldAccelerator.java | 7 +- .../multi/MetaTileEntityCokeOvenHatch.java | 2 +- .../multi/MetaTileEntityTankValve.java | 2 +- .../MetaTileEntityCentralMonitor.java | 2 +- .../MetaTileEntityLargeCombustionEngine.java | 2 +- .../MetaTileEntityComputationHatch.java | 2 +- .../MetaTileEntityOpticalDataHatch.java | 2 +- .../storage/MetaTileEntityCreativeChest.java | 2 +- .../storage/MetaTileEntityCreativeEnergy.java | 2 +- .../storage/MetaTileEntityCreativeTank.java | 2 +- .../MetaTileEntityLongDistanceEndpoint.java | 23 +++- .../common/pipelike/cable/net/EnergyNet.java | 9 +- .../pipelike/cable/net/EnergyNetHandler.java | 8 +- .../pipelike/cable/net/EnergyNetWalker.java | 10 +- .../pipelike/cable/net/EnergyRoutePath.java | 52 +++++++++ .../common/pipelike/cable/net/RoutePath.java | 57 --------- .../pipelike/cable/tile/TileEntityCable.java | 1 + .../MetaTileEntityLDFluidEndpoint.java | 2 +- .../tile/TileEntityFluidPipeTickable.java | 91 +++++++++------ .../MetaTileEntityLDItemEndpoint.java | 2 +- .../pipelike/itempipe/net/ItemNetHandler.java | 108 ++++++++---------- .../pipelike/itempipe/net/ItemNetWalker.java | 8 +- .../pipelike/itempipe/net/ItemPipeNet.java | 75 +----------- .../pipelike/itempipe/net/ItemRoutePath.java | 68 +++++++++++ .../common/pipelike/laser/BlockLaserPipe.java | 4 +- .../pipelike/laser/LaserPipeProperties.java | 8 +- .../pipelike/laser/net/LaserNetHandler.java | 10 +- .../pipelike/laser/net/LaserNetWalker.java | 29 ++--- .../pipelike/laser/net/LaserPipeNet.java | 103 ++--------------- .../pipelike/laser/net/LaserRoutePath.java | 67 +++++++++++ .../laser/tile/TileEntityLaserPipe.java | 1 + .../pipelike/optical/BlockOpticalPipe.java | 4 +- .../optical/OpticalPipeProperties.java | 10 +- .../optical/net/OpticalNetHandler.java | 8 +- .../optical/net/OpticalNetWalker.java | 29 ++--- .../pipelike/optical/net/OpticalPipeNet.java | 90 ++------------- .../optical/net/OpticalRoutePath.java | 57 +++++++++ .../theoneprobe/provider/LDPipeProvider.java | 2 +- 65 files changed, 801 insertions(+), 599 deletions(-) create mode 100644 src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java create mode 100644 src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java create mode 100644 src/main/java/gregtech/api/pipenet/IRoutePath.java create mode 100644 src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java delete mode 100644 src/main/java/gregtech/common/pipelike/cable/net/RoutePath.java create mode 100644 src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java create mode 100644 src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java create mode 100644 src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index bea90f6bbb6..71a4b8fdab3 100644 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -18,6 +18,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pipenet.IBlockAppearance; +import gregtech.api.util.GTUtility; import gregtech.client.renderer.handler.MetaTileEntityRenderer; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; @@ -57,6 +58,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -266,9 +268,9 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc // Color machines on place if holding spray can in off-hand if (placer instanceof EntityPlayer) { ItemStack offhand = placer.getHeldItemOffhand(); - for (int i = 0; i < EnumDyeColor.values().length; i++) { + for (int i = 0; i < EnumDyeColor.values().length; i++) { if (offhand.isItemEqual(MetaItems.SPRAY_CAN_DYES[i].getStackForm())) { - MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0 , 0); + MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); break; } } @@ -371,10 +373,24 @@ public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess b @Override public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { - MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); - if (metaTileEntity != null) { - metaTileEntity.updateInputRedstoneSignals(); - metaTileEntity.onNeighborChanged(); + TileEntity holder = worldIn.getTileEntity(pos); + if (holder instanceof IGregTechTileEntity gregTechTile) { + EnumFacing facing = GTUtility.getFacingToNeighbor(pos, fromPos); + if (facing != null) gregTechTile.onNeighborChanged(facing); + MetaTileEntity metaTileEntity = gregTechTile.getMetaTileEntity(); + if (metaTileEntity != null) { + metaTileEntity.updateInputRedstoneSignals(); + metaTileEntity.onNeighborChanged(); + } + } + } + + @Override + public void onNeighborChange(IBlockAccess world, @NotNull BlockPos pos, @NotNull BlockPos neighbor) { + TileEntity holder = world.getTileEntity(pos); + if (holder instanceof IGregTechTileEntity gregTechTile) { + EnumFacing facing = GTUtility.getFacingToNeighbor(pos, neighbor); + if (facing != null) gregTechTile.onNeighborChanged(facing); } } @@ -484,7 +500,7 @@ protected Pair getParticleTexture(World world, Bloc @Override public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull Entity entity) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); - if(metaTileEntity == null) { + if (metaTileEntity == null) { return super.canEntityDestroy(state, world, pos, entity); } return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && metaTileEntity.getWitherProof()); diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java index 987ace8b396..bfe8fb75dbc 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java @@ -85,7 +85,7 @@ public void update() { } EnumFacing outFacing = metaTileEntity.getFrontFacing(); - TileEntity tileEntity = metaTileEntity.getWorld().getTileEntity(metaTileEntity.getPos().offset(outFacing)); + TileEntity tileEntity = metaTileEntity.getNeighbor(outFacing); if (tileEntity == null) { return; } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java index b848d92739d..51b10e197ca 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java @@ -199,7 +199,7 @@ public void update() { long amperesUsed = 0; for (EnumFacing side : EnumFacing.VALUES) { if (!outputsEnergy(side)) continue; - TileEntity tileEntity = metaTileEntity.getWorld().getTileEntity(metaTileEntity.getPos().offset(side)); + TileEntity tileEntity = metaTileEntity.getNeighbor(side); EnumFacing oppositeSide = side.getOpposite(); if (tileEntity != null && tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide)) { IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide); diff --git a/src/main/java/gregtech/api/cover/Cover.java b/src/main/java/gregtech/api/cover/Cover.java index 9af03bde4ca..f3862653c43 100644 --- a/src/main/java/gregtech/api/cover/Cover.java +++ b/src/main/java/gregtech/api/cover/Cover.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -48,6 +49,23 @@ public interface Cover { return getCoverableView().getPos(); } + /** + * @return the tile entity at the cover's position + */ + default @Nullable TileEntity getTileEntityHere() { + CoverableView view = getCoverableView(); + return view.getWorld().getTileEntity(view.getPos()); + } + + /** + * @param facing the side to get the neighbor at + * @return the neighbor tile entity at the side + */ + default @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) { + CoverableView view = getCoverableView(); + return view.getNeighbor(facing); + } + /** * Mark the CoverableView as needing to be saved to the chunk */ @@ -95,7 +113,6 @@ default boolean isTickable() { */ boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side); - /** * Called when the cover is first attached on the Server Side. * Do NOT sync custom data to client here. It will overwrite the attach cover packet! diff --git a/src/main/java/gregtech/api/cover/CoverableView.java b/src/main/java/gregtech/api/cover/CoverableView.java index b3e69a70f25..9f19aaa853c 100644 --- a/src/main/java/gregtech/api/cover/CoverableView.java +++ b/src/main/java/gregtech/api/cover/CoverableView.java @@ -1,6 +1,7 @@ package gregtech.api.cover; import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -23,6 +24,12 @@ public interface CoverableView extends ICapabilityProvider { */ @UnknownNullability BlockPos getPos(); + /** + * @param facing the side to get the neighbor at + * @return the neighbor tile entity at the side + */ + @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing); + /** * Mark the CoverableView as needing to be saved to the chunk */ diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index e7cf9b3f980..b17d84cb1e5 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -53,7 +53,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockPos.PooledMutableBlockPos; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -73,9 +72,8 @@ import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -177,6 +175,11 @@ public long getOffsetTimer() { return holder == null ? 0L : holder.getOffsetTimer(); } + @Override + public @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) { + return holder != null ? holder.getNeighbor(facing) : null; + } + @Override public final void writeCustomData(int discriminator, @NotNull Consumer<@NotNull PacketBuffer> dataWriter) { if (holder != null) { @@ -188,7 +191,7 @@ public void addDebugInfo(List list) { } @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { } /** @@ -215,7 +218,9 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.crowbar")); } - /** Override this to completely remove the "Tool Info" tooltip section */ + /** + * Override this to completely remove the "Tool Info" tooltip section + */ public boolean showToolUsages() { return true; } @@ -364,7 +369,7 @@ public void addNotifiedOutput(T output) { * * @param trait trait object to add */ - void addMetaTileEntityTrait(@Nonnull MTETrait trait) { + void addMetaTileEntityTrait(@NotNull MTETrait trait) { this.mteTraits.put(trait.getName(), trait); this.mteTraitByNetworkId.put(trait.getNetworkID(), trait); } @@ -376,7 +381,7 @@ void addMetaTileEntityTrait(@Nonnull MTETrait trait) { * @return the trait associated with the name */ @Nullable - public final MTETrait getMTETrait(@Nonnull String name) { + public final MTETrait getMTETrait(@NotNull String name) { return this.mteTraits.get(name); } @@ -470,7 +475,7 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac * * @return true if something happened, so tools will get damaged and animations will be played */ - public final boolean onToolClick(EntityPlayer playerIn, @Nonnull Set toolClasses, EnumHand hand, CuboidRayTraceResult hitResult) { + public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set toolClasses, EnumHand hand, CuboidRayTraceResult hitResult) { // the side hit from the machine grid EnumFacing gridSideHit = CoverRayTracer.determineGridSideHit(hitResult); Cover cover = gridSideHit == null ? null : getCoverAtSide(gridSideHit); @@ -1050,10 +1055,8 @@ public void pullItemsFromNearbyHandlers(EnumFacing... allowedFaces) { } private void transferToNearby(Capability capability, BiConsumer transfer, EnumFacing... allowedFaces) { - PooledMutableBlockPos blockPos = PooledMutableBlockPos.retain(); for (EnumFacing nearbyFacing : allowedFaces) { - blockPos.setPos(getPos()).move(nearbyFacing); - TileEntity tileEntity = getWorld().getTileEntity(blockPos); + TileEntity tileEntity = getNeighbor(nearbyFacing); if (tileEntity == null) { continue; } @@ -1065,7 +1068,6 @@ private void transferToNearby(Capability capability, BiConsumer tra } transfer.accept(thisCap, otherCap); } - blockPos.release(); } public final int getOutputRedstoneSignal(@Nullable EnumFacing side) { @@ -1449,7 +1451,7 @@ public boolean doTickProfileMessage() { return true; } - public boolean canRenderMachineGrid(@Nonnull ItemStack mainHandStack, @Nonnull ItemStack offHandStack) { + public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { final String[] tools = {ToolClasses.WRENCH, ToolClasses.SCREWDRIVER}; return ToolHelper.isTool(mainHandStack, tools) || ToolHelper.isTool(offHandStack, tools); @@ -1469,9 +1471,9 @@ public boolean canVoidRecipeFluidOutputs() { return false; } - @Nonnull + @NotNull @Method(modid = GTValues.MODID_APPENG) - public AECableType getCableConnectionType(@Nonnull AEPartLocation part) { + public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return AECableType.NONE; } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index 2949bcef5fe..dd6847048ea 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -259,7 +259,7 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) /** * @return double array of length 2, with index 0 being the average time and index 1 the worst time, in ns. - * If there is no tick time, it will return null. + * If there is no tick time, it will return null. */ public double[] getTimeStatistics() { if (timeStatistics.length > 0) { @@ -271,7 +271,7 @@ public double[] getTimeStatistics() { worstTickTime = tickTime; } } - return new double[] { averageTickTime, worstTickTime }; + return new double[]{averageTickTime, worstTickTime}; } return null; } diff --git a/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java new file mode 100644 index 00000000000..6eb7cb8f8ce --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java @@ -0,0 +1,63 @@ +package gregtech.api.metatileentity; + +import gregtech.api.metatileentity.interfaces.INeighborCache; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +public abstract class NeighborCacheTileEntityBase extends SyncedTileEntityBase implements INeighborCache { + + private final TileEntity[] neighbors = new TileEntity[6]; + private boolean neighborsInvalidated = false; + + public NeighborCacheTileEntityBase() { + invalidateNeighbors(); + } + + protected void invalidateNeighbors() { + if (!this.neighborsInvalidated) { + Arrays.fill(this.neighbors, this); + this.neighborsInvalidated = true; + } + } + + @Override + public void setWorld(@NotNull World worldIn) { + super.setWorld(worldIn); + invalidateNeighbors(); + } + + @Override + public void setPos(@NotNull BlockPos posIn) { + super.setPos(posIn); + invalidateNeighbors(); + } + + @Override + public void invalidate() { + super.invalidate(); + invalidateNeighbors(); + } + + @Override + public @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) { + if (world == null || pos == null) return null; + int i = facing.getIndex(); + TileEntity neighbor = this.neighbors[i]; + if (neighbor == this || (neighbor != null && neighbor.isInvalid())) { + neighbor = world.getTileEntity(pos.offset(facing)); + this.neighbors[i] = neighbor; + this.neighborsInvalidated = false; + } + return neighbor; + } + + public void onNeighborChanged(@NotNull EnumFacing facing) { + this.neighbors[facing.getIndex()] = this; + } +} diff --git a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java index 361b5c5573c..8bd1c85e58c 100644 --- a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java @@ -14,6 +14,8 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; import net.minecraftforge.common.util.Constants; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,6 +27,11 @@ public abstract class SyncedTileEntityBase extends BlockStateTileEntity implemen private final PacketDataList updates = new PacketDataList(); + public @Nullable TileEntity getNeighbor(EnumFacing facing) { + if (world == null || pos == null) return null; + return world.getTileEntity(pos.offset(facing)); + } + @Override public final void writeCustomData(int discriminator, @NotNull Consumer<@NotNull PacketBuffer> dataWriter) { ByteBuf backedBuffer = Unpooled.buffer(); diff --git a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java index c3c402d6b08..64db1834ab9 100644 --- a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java @@ -3,7 +3,7 @@ import gregtech.api.GTValues; import net.minecraft.util.ITickable; -public abstract class TickableTileEntityBase extends SyncedTileEntityBase implements ITickable { +public abstract class TickableTileEntityBase extends NeighborCacheTileEntityBase implements ITickable { private long timer = 0L; diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/IGregTechTileEntity.java b/src/main/java/gregtech/api/metatileentity/interfaces/IGregTechTileEntity.java index ed553ed4653..43446101414 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/IGregTechTileEntity.java @@ -9,7 +9,7 @@ * Also delivers most of the Information about TileEntities. *

*/ -public interface IGregTechTileEntity extends IHasWorldObjectAndCoords, ISyncedTileEntity, IUIHolder { +public interface IGregTechTileEntity extends IHasWorldObjectAndCoords, INeighborCache, ISyncedTileEntity, IUIHolder { MetaTileEntity getMetaTileEntity(); diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java new file mode 100644 index 00000000000..cb952e4bff0 --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java @@ -0,0 +1,27 @@ +package gregtech.api.metatileentity.interfaces; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An interface defining access to cached neighboring tile entities to a block or tile entity + */ +public interface INeighborCache extends IHasWorldObjectAndCoords { + + /** + * @param facing the side at which the neighbor is located + * @return the neighboring tile entity at the side + */ + default @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) { + return world().getTileEntity(pos().offset(facing)); + } + + /** + * Called when an adjacent neighboring block has changed at a side in some way + * + * @param facing the side at which the neighbor has changed + */ + void onNeighborChanged(@NotNull EnumFacing facing); +} diff --git a/src/main/java/gregtech/api/pipenet/IRoutePath.java b/src/main/java/gregtech/api/pipenet/IRoutePath.java new file mode 100644 index 00000000000..b1291e025bc --- /dev/null +++ b/src/main/java/gregtech/api/pipenet/IRoutePath.java @@ -0,0 +1,37 @@ +package gregtech.api.pipenet; + +import gregtech.api.pipenet.tile.IPipeTile; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.common.capabilities.Capability; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnknownNullability; + +public interface IRoutePath> { + + @NotNull + T getTargetPipe(); + + @NotNull + default BlockPos getTargetPipePos() { + return getTargetPipe().getPipePos(); + } + + @NotNull + EnumFacing getTargetFacing(); + + int getDistance(); + + @Nullable + default TileEntity getTargetTileEntity() { + return getTargetPipe().getNeighbor(getTargetFacing()); + } + + @Nullable + default I getTargetCapability(Capability capability) { + TileEntity tile = getTargetTileEntity(); + return tile == null ? null : tile.getCapability(capability, getTargetFacing().getOpposite()); + } +} diff --git a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java index f82fe85d0df..970b2720b89 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java +++ b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java @@ -3,6 +3,7 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GTLog; import gregtech.common.pipelike.itempipe.net.ItemNetWalker; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -21,12 +22,15 @@ */ public abstract class PipeNetWalker> { - private PipeNetWalker root; + protected PipeNetWalker root; private final World world; - private final Set walked = new HashSet<>(); - private final List pipes = new ArrayList<>(); + private Set walked; + private final List nextPipeFacings = new ArrayList<>(5); + private final List nextPipes = new ArrayList<>(5); private List> walkers; private final BlockPos.MutableBlockPos currentPos; + private T currentPipe; + private EnumFacing from = null; private int walkedBlocks; private boolean invalid; private boolean running; @@ -112,11 +116,13 @@ public void traversePipeNet() { public void traversePipeNet(int maxWalks) { if (invalid) throw new IllegalStateException("This walker already walked. Create a new one if you want to walk again"); + root = this; + walked = new ObjectOpenHashSet<>(); int i = 0; running = true; while (running && !walk() && i++ < maxWalks) ; running = false; - root.walked.clear(); + walked = null; if (i >= maxWalks) GTLog.logger.fatal("The walker reached the maximum amount of walks {}", i); invalid = true; @@ -129,18 +135,23 @@ private boolean walk() { return true; } - if (pipes.size() == 0) + if (nextPipeFacings.isEmpty()) return true; - if (pipes.size() == 1) { - currentPos.move(pipes.get(0)); + if (nextPipeFacings.size() == 1) { + currentPos.setPos(nextPipes.get(0).getPipePos()); + currentPipe = nextPipes.get(0); + from = nextPipeFacings.get(0).getOpposite(); walkedBlocks++; return !isRunning(); } walkers = new ArrayList<>(); - for (EnumFacing side : pipes) { + for (int i = 0; i < nextPipeFacings.size(); i++) { + EnumFacing side = nextPipeFacings.get(i); PipeNetWalker walker = Objects.requireNonNull(createSubWalker(world, side, currentPos.offset(side), walkedBlocks + 1), "Walker can't be null"); walker.root = root; + walker.currentPipe = nextPipes.get(i); + walker.from = side.getOpposite(); walkers.add(walker); } } @@ -153,49 +164,51 @@ private boolean walk() { } } - return !isRunning() || walkers.size() == 0; + return !isRunning() || walkers.isEmpty(); } private boolean checkPos() { - pipes.clear(); - TileEntity thisPipe = world.getTileEntity(currentPos); - if (!(thisPipe instanceof IPipeTile)) { - GTLog.logger.fatal("PipeWalker expected a pipe, but found {} at {}", thisPipe, currentPos); - return false; - } - if (!getBasePipeClass().isAssignableFrom(thisPipe.getClass())) { - return false; + nextPipeFacings.clear(); + nextPipes.clear(); + if (currentPipe == null) { + TileEntity thisPipe = world.getTileEntity(currentPos); + if (!(thisPipe instanceof IPipeTile)) { + GTLog.logger.fatal("PipeWalker expected a pipe, but found {} at {}", thisPipe, currentPos); + return false; + } + if (!getBasePipeClass().isAssignableFrom(thisPipe.getClass())) { + return false; + } + currentPipe = (T) thisPipe; } - T pipeTile = (T) thisPipe; + T pipeTile = currentPipe; checkPipe(pipeTile, currentPos); - root.walked.add(pipeTile.getPipePos().toLong()); + root.walked.add(pipeTile); - BlockPos.PooledMutableBlockPos pos = BlockPos.PooledMutableBlockPos.retain(); // check for surrounding pipes and item handlers for (EnumFacing accessSide : getSurroundingPipeSides()) { //skip sides reported as blocked by pipe network - if (!pipeTile.isConnected(accessSide)) + if (accessSide == from || !pipeTile.isConnected(accessSide)) continue; - pos.setPos(currentPos).move(accessSide); - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = pipeTile.getNeighbor(accessSide); if (tile != null && getBasePipeClass().isAssignableFrom(tile.getClass())) { T otherPipe = (T) tile; if (!otherPipe.isConnected(accessSide.getOpposite()) || otherPipe.isFaceBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) continue; if (isValidPipe(pipeTile, otherPipe, currentPos, accessSide)) { - pipes.add(accessSide); + nextPipeFacings.add(accessSide); + nextPipes.add(otherPipe); continue; } } checkNeighbour(pipeTile, currentPos, accessSide, tile); } - pos.release(); return true; } - protected boolean isWalked(IPipeTile pipe) { - return root.walked.contains(pipe.getPipePos().toLong()); + protected boolean isWalked(T pipe) { + return root.walked.contains(pipe); } /** diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 90e8eff91ca..2fccb22fdf8 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -46,6 +46,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -187,18 +188,10 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { pipeTile.getCoverableImplementation().updateInputRedstoneSignals(); + EnumFacing facing = GTUtility.getFacingToNeighbor(pos, fromPos); + if (facing == null) return; + pipeTile.onNeighborChanged(facing); if (!ConfigHolder.machines.gt6StylePipesCables) { - EnumFacing facing = null; - for (EnumFacing facing1 : EnumFacing.values()) { - if (GTUtility.arePosEqual(fromPos, pos.offset(facing1))) { - facing = facing1; - break; - } - } - if (facing == null) { - //not our neighbor - return; - } boolean open = pipeTile.isConnected(facing); boolean canConnect = pipeTile.getCoverableImplementation().getCoverAtSide(facing) != null || canConnect(pipeTile, facing); if (!open && canConnect && state.getBlock() != blockIn) @@ -210,6 +203,17 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, } } + @Override + public void onNeighborChange(@NotNull IBlockAccess world, @NotNull BlockPos pos, @NotNull BlockPos neighbor) { + IPipeTile pipeTile = getPipeTileEntity(world, pos); + if (pipeTile != null) { + EnumFacing facing = GTUtility.getFacingToNeighbor(pos, neighbor); + if (facing != null) { + pipeTile.onNeighborChanged(facing); + } + } + } + @Override public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, @Nonnull BlockPos changedBlockPos) { PipeNet net = getWorldPipeNet(world).getNetFromPos(observerPos); @@ -556,7 +560,7 @@ public boolean canConnect(IPipeTile selfTile, EnumFacing if (cover != null && !cover.canPipePassThrough()) { return false; } - TileEntity other = selfTile.getPipeWorld().getTileEntity(selfTile.getPipePos().offset(facing)); + TileEntity other = selfTile.getNeighbor(facing); if (other instanceof IPipeTile) { cover = ((IPipeTile) other).getCoverableImplementation().getCoverAtSide(facing.getOpposite()); if (cover != null && !cover.canPipePassThrough()) @@ -582,7 +586,7 @@ private List getCollisionBox(IBlockAccess world, BlockPos pos, @ if (pipeType == null) { return Collections.emptyList(); } - int actualConnections = getPipeTileEntity(world, pos).getVisualConnections(); + int actualConnections = pipeTile.getVisualConnections(); float thickness = pipeType.getThickness(); List result = new ArrayList<>(); CoverHolder coverHolder = pipeTile.getCoverableImplementation(); diff --git a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java index 19d7bac4e74..6d4a2bd32b0 100644 --- a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java @@ -39,9 +39,8 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play selfTile.setConnection(side.getOpposite(), true, false); } for (EnumFacing facing : EnumFacing.VALUES) { - TileEntity te = world.getTileEntity(pos.offset(facing)); - if (te instanceof IPipeTile) { - IPipeTile otherPipe = ((IPipeTile) te); + TileEntity te = selfTile.getNeighbor(facing); + if (te instanceof IPipeTile otherPipe) { if (otherPipe.isConnected(facing.getOpposite())) { if (otherPipe.getPipeBlock().canPipesConnect(otherPipe, facing.getOpposite(), selfTile)) { selfTile.setConnection(facing, true, true); diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java index 98cd68c6965..73bc47eda2a 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java @@ -1,6 +1,7 @@ package gregtech.api.pipenet.longdist; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.interfaces.INeighborCache; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -8,7 +9,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public interface ILDEndpoint extends ILDNetworkPart{ +public interface ILDEndpoint extends ILDNetworkPart, INeighborCache { /** * @return the current type of this endpoint (input, output or none) diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java index 52a6981ca76..fda17edbd71 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java @@ -124,7 +124,7 @@ public void onRemoveEndpoint(ILDEndpoint endpoint) { if (this.endpoints.remove(endpoint)) { invalidateEndpoints(); } - onRemovePipe(endpoint.getPos()); + onRemovePipe(endpoint.pos()); } /** @@ -140,8 +140,8 @@ public void onPlacePipe(BlockPos pos) { */ public void onPlaceEndpoint(ILDEndpoint endpoint) { addEndpoint(endpoint); - this.longDistancePipeBlocks.add(endpoint.getPos()); - this.world.putNetwork(endpoint.getPos(), this); + this.longDistancePipeBlocks.add(endpoint.pos()); + this.world.putNetwork(endpoint.pos(), this); } /** @@ -439,7 +439,7 @@ public NBTTagCompound writeToNBT(@NotNull NBTTagCompound nbtTagCompound) { NBTTagList endpoints = new NBTTagList(); tag.setTag("endpoints", endpoints); for (ILDEndpoint endpoint : network.endpoints) { - endpoints.appendTag(new NBTTagLong(endpoint.getPos().toLong())); + endpoints.appendTag(new NBTTagLong(endpoint.pos().toLong())); } } nbtTagCompound.setTag("nets", list); diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java index 0a67ad9530d..39c01a82157 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java @@ -55,8 +55,8 @@ public int getMinLength() { } public boolean satisfiesMinLength(ILDEndpoint endpoint1, ILDEndpoint endpoint2) { - BlockPos p = endpoint2.getPos(); - return endpoint1 != endpoint2 && endpoint1.getPos().getDistance(p.getX(), p.getY(), p.getZ()) >= getMinLength(); + BlockPos p = endpoint2.pos(); + return endpoint1 != endpoint2 && endpoint1.pos().getDistance(p.getX(), p.getY(), p.getZ()) >= getMinLength(); } @Nonnull diff --git a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java index fac90eab56c..0500179f2c3 100644 --- a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java +++ b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java @@ -1,23 +1,35 @@ package gregtech.api.pipenet.tile; +import gregtech.api.metatileentity.interfaces.INeighborCache; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.unification.material.Material; import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.function.Consumer; -public interface IPipeTile & IPipeType, NodeDataType> { +public interface IPipeTile & IPipeType, NodeDataType> extends INeighborCache { World getPipeWorld(); BlockPos getPipePos(); + @Override + default World world() { + return getPipeWorld(); + } + + @Override + default BlockPos pos() { + return getPipePos(); + } + default long getTickTimer() { return getPipeWorld().getTotalWorldTime(); } diff --git a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java index 78440cc124d..c36150247d7 100644 --- a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java +++ b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java @@ -9,14 +9,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.EnumMap; import java.util.function.Consumer; @@ -254,6 +255,15 @@ public BlockPos getPos() { return holder.getPipePos(); } + public TileEntity getTileEntityHere() { + return holder instanceof TileEntity te ? te : getWorld().getTileEntity(getPos()); + } + + @Override + public @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) { + return holder.getNeighbor(facing); + } + @Override public long getOffsetTimer() { return holder.getTickTimer(); diff --git a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java index b788d89863f..954e425a9b7 100644 --- a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.Cover; +import gregtech.api.metatileentity.NeighborCacheTileEntityBase; import gregtech.api.metatileentity.SyncedTileEntityBase; import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; @@ -30,7 +31,7 @@ import static gregtech.api.capability.GregtechDataCodes.*; -public abstract class TileEntityPipeBase & IPipeType, NodeDataType> extends SyncedTileEntityBase implements IPipeTile { +public abstract class TileEntityPipeBase & IPipeType, NodeDataType> extends NeighborCacheTileEntityBase implements IPipeTile { protected final PipeCoverableImplementation coverableImplementation = new PipeCoverableImplementation(this); protected int paintingColor = -1; @@ -209,7 +210,7 @@ public void setConnection(EnumFacing side, boolean connected, boolean fromNeighb if (isConnected(side) == connected) { return; } - TileEntity tile = getWorld().getTileEntity(getPos().offset(side)); + TileEntity tile = getNeighbor(side); // block connections if Pipe Types do not match if (connected && tile instanceof IPipeTile pipeTile && diff --git a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java index 55d8aff27c3..0c36894670f 100644 --- a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java @@ -23,7 +23,6 @@ public static void register() { .build() .setFormula("Si(CH3)2O", true); - Nitrobenzene = new Material.Builder(1001, gregtechId("nitrobenzene")) .gas() .color(0x704936) diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index 081a8267f66..b5daa38c18c 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -54,6 +54,7 @@ import net.minecraftforge.items.IItemHandlerModifiable; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -340,6 +341,33 @@ public static EnumFacing determineWrenchingSide(EnumFacing facing, float x, floa return null; } + /** + * Calculates on which side the neighbor is relative to the main pos. + * + * @param main main pos + * @param neighbor neighbor pos + * @return position of neighbor relative to main or null the neighbor pos is not a neighbor + */ + @Nullable + public static EnumFacing getFacingToNeighbor(@NotNull BlockPos main, @NotNull BlockPos neighbor) { + int difX = neighbor.getX() - main.getX(); + int difY = neighbor.getY() - main.getY(); + int difZ = neighbor.getZ() - main.getZ(); + if (difX != 0) { + if (difY != 0 || difZ != 0 || (difX != 1 && difX != -1)) return null; + return difX > 0 ? EnumFacing.EAST : EnumFacing.WEST; + } + if (difY != 0) { + if (difZ != 0 || (difY != 1 && difY != -1)) return null; + return difY > 0 ? EnumFacing.UP : EnumFacing.DOWN; + } + if (difZ != 0) { + if (difZ != 1 && difZ != -1) return null; + return difZ > 0 ? EnumFacing.SOUTH : EnumFacing.NORTH; + } + return null; + } + /** * @return a list of itemstack linked with given item handler * modifications in list will reflect on item handler and wise-versa diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index 2ccc29e8135..e666591730b 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -81,12 +81,12 @@ public void setTransferRate(int transferRate) { if (getWorld() != null && getWorld().isRemote) { // tile at cover holder pos - TileEntity te = getWorld().getTileEntity(getPos()); + TileEntity te = getTileEntityHere(); if (te instanceof TileEntityItemPipe) { ((TileEntityItemPipe) te).resetTransferred(); } // tile neighbour to holder pos at attached side - te = getWorld().getTileEntity(getPos().offset(getAttachedSide())); + te = getNeighbor(getAttachedSide()); if (te instanceof TileEntityItemPipe) { ((TileEntityItemPipe) te).resetTransferred(); } @@ -139,7 +139,7 @@ public void update() { long timer = coverable.getOffsetTimer(); if (timer % 5 == 0 && isWorkingAllowed && itemsLeftToTransferLastSecond > 0) { EnumFacing side = getAttachedSide(); - TileEntity tileEntity = getWorld().getTileEntity(getPos().offset(side)); + TileEntity tileEntity = coverable.getNeighbor(side); IItemHandler itemHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); IItemHandler myItemHandler = coverable.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); if (itemHandler != null && myItemHandler != null) { @@ -492,8 +492,8 @@ public ModularUI createUI(EntityPlayer player) { ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); - if (getWorld().getTileEntity(getPos()) instanceof TileEntityItemPipe || - getWorld().getTileEntity(getPos().offset(getAttachedSide())) instanceof TileEntityItemPipe) { + if (getTileEntityHere() instanceof TileEntityItemPipe || + getNeighbor(getAttachedSide()) instanceof TileEntityItemPipe) { final ImageCycleButtonWidget distributionModeButton = new ImageCycleButtonWidget(149, 166, 20, 20, GuiTextures.DISTRIBUTION_MODE, 3, () -> distributionMode.ordinal(), val -> setDistributionMode(DistributionMode.values()[val])) diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index 6f3d197fd86..bbf9b29f772 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -29,7 +29,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; @@ -132,8 +131,7 @@ public void update() { } protected int doTransferFluids(int transferLimit) { - BlockPos pos = getPos().offset(getAttachedSide()); - TileEntity tileEntity = getWorld().getTileEntity(pos); + TileEntity tileEntity = getNeighbor(getAttachedSide()); IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide().getOpposite()); IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); if (fluidHandler == null || myFluidHandler == null) { diff --git a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java index e2264ac4a98..3838fb1a910 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java +++ b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java @@ -10,7 +10,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; @@ -24,7 +23,7 @@ public class ConverterTrait extends MTETrait { /** * If TRUE, the front facing of the machine will OUTPUT EU, other sides INPUT FE. - * + *

* If FALSE, the front facing of the machine will OUTPUT FE, other sides INPUT EU. */ private boolean feToEu; @@ -37,8 +36,6 @@ public class ConverterTrait extends MTETrait { private long usedAmps; - private BlockPos frontPos; - public ConverterTrait(MetaTileEntityConverter mte, int amps, boolean feToEu) { super(mte); this.amps = amps; @@ -138,17 +135,12 @@ protected void pushEnergy() { } protected T getCapabilityAtFront(Capability capability) { - TileEntity tile = metaTileEntity.getWorld().getTileEntity(frontPos == null ? frontPos = metaTileEntity.getPos().offset(metaTileEntity.getFrontFacing()) : frontPos); + TileEntity tile = metaTileEntity.getNeighbor(metaTileEntity.getFrontFacing()); if (tile == null) return null; EnumFacing opposite = metaTileEntity.getFrontFacing().getOpposite(); return tile.getCapability(capability, opposite); } - @Override - public void onFrontFacingSet(EnumFacing newFrontFacing) { - this.frontPos = null; - } - // -- GTCEu Energy-------------------------------------------- public class EUContainer implements IEnergyContainer { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java index b129079af12..34b3ca6c69c 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java @@ -164,14 +164,13 @@ public void update() { int currentTick = FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter(); if (currentTick != lastTick) { // Prevent other tick accelerators from accelerating us World world = getWorld(); - BlockPos currentPos = getPos(); + final BlockPos currentPos = getPos(); lastTick = currentTick; if (isTEMode()) { energyContainer.removeEnergy(energyPerTick); for (EnumFacing neighbourFace : EnumFacing.VALUES) { - TileEntity neighbourTile = world.getTileEntity(currentPos.offset(neighbourFace)); - if (neighbourTile instanceof ITickable && !neighbourTile.isInvalid() && considerTile(neighbourTile)) { - ITickable neighbourTickTile = (ITickable) neighbourTile; + TileEntity neighbourTile = getNeighbor(neighbourFace); + if (neighbourTile instanceof ITickable neighbourTickTile && !neighbourTile.isInvalid() && considerTile(neighbourTile)) { for (int i = 0; i < speed; i++) { neighbourTickTile.update(); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java index 5cd959a9d35..6713e5caf40 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java @@ -54,7 +54,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, public void update() { super.update(); if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock()) { - TileEntity tileEntity = getWorld().getTileEntity(getPos().offset(getFrontFacing())); + TileEntity tileEntity = getNeighbor(getFrontFacing()); IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java index 17326c47a54..9197bbab4b5 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java @@ -68,7 +68,7 @@ public int getDefaultPaintingColor() { public void update() { super.update(); if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock() && getFrontFacing() == EnumFacing.DOWN) { - TileEntity tileEntity = getWorld().getTileEntity(getPos().offset(getFrontFacing())); + TileEntity tileEntity = getNeighbor(getFrontFacing()); IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java index f47a913a370..94334c5e427 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java @@ -91,7 +91,7 @@ public MetaTileEntityCentralMonitor(ResourceLocation metaTileEntityId) { private EnergyNet getEnergyNet() { if (!this.getWorld().isRemote) { - TileEntity te = this.getWorld().getTileEntity(this.getPos().offset(frontFacing.getOpposite())); + TileEntity te = getNeighbor(frontFacing.getOpposite()); if (te instanceof TileEntityCable) { TileEntityPipeBase tileEntityCable = (TileEntityCable) te; EnergyNet currentEnergyNet = this.currentEnergyNet.get(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 1fa8cfc2d17..dec10605d52 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -5,9 +5,9 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.MultiblockFuelRecipeLogic; +import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.*; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java index cc5952450b6..175c8775eef 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java @@ -111,7 +111,7 @@ public boolean canBridge(@Nonnull Collection seen) @Nullable private IOpticalComputationProvider getOpticalNetProvider() { - TileEntity tileEntity = getWorld().getTileEntity(getPos().offset(getFrontFacing())); + TileEntity tileEntity = getNeighbor(getFrontFacing()); if (tileEntity == null) return null; if (tileEntity instanceof TileEntityOpticalPipe) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java index 67bdeb87f55..de63e673534 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java @@ -73,7 +73,7 @@ public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection getDataInfo() { textComponents.add(new TextComponentString("Network:")); textComponents.add(new TextComponentString(" - " + network.getTotalSize() + " pipes")); ILDEndpoint in = network.getActiveInputIndex(), out = network.getActiveOutputIndex(); - textComponents.add(new TextComponentString(" - input: " + (in == null ? "none" : in.getPos()))); - textComponents.add(new TextComponentString(" - output: " + (out == null ? "none" : out.getPos()))); + textComponents.add(new TextComponentString(" - input: " + (in == null ? "none" : in.pos()))); + textComponents.add(new TextComponentString(" - output: " + (out == null ? "none" : out.pos()))); } if (isInput()) { textComponents.add(new TextComponentString("Input endpoint")); @@ -248,4 +249,22 @@ public List getDataInfo() { } return textComponents; } + + @Override + public World world() { + return getWorld(); + } + + @Override + public BlockPos pos() { + return getPos(); + } + + @Override + public void onNeighborChanged(@NotNull EnumFacing facing) { + } + + @Override + public void markAsDirty() { + } } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java index c81b02f63ae..26cd507f124 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java @@ -4,6 +4,7 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.WireProperties; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -16,21 +17,21 @@ public class EnergyNet extends PipeNet { private long energyFluxPerSec; private long lastTime; - private final Map> NET_DATA = new HashMap<>(); + private final Map> NET_DATA = new Object2ObjectOpenHashMap<>(); protected EnergyNet(WorldPipeNet world) { super(world); } - public List getNetData(BlockPos pipePos) { - List data = NET_DATA.get(pipePos); + public List getNetData(BlockPos pipePos) { + List data = NET_DATA.get(pipePos); if (data == null) { data = EnergyNetWalker.createNetData(getWorldData(), pipePos); if (data == null) { // walker failed, don't cache so it tries again on next insertion return Collections.emptyList(); } - data.sort(Comparator.comparingInt(RoutePath::getDistance)); + data.sort(Comparator.comparingInt(EnergyRoutePath::getDistance)); NET_DATA.put(pipePos, data); } return data; diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java index a7de8f0d777..dbb47628a7b 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java @@ -58,21 +58,21 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage } long amperesUsed = 0L; - for (RoutePath path : net.getNetData(cable.getPos())) { + for (EnergyRoutePath path : net.getNetData(cable.getPos())) { if (path.getMaxLoss() >= voltage) { // Will lose all the energy with this path, so don't use it continue; } - if (GTUtility.arePosEqual(cable.getPos(), path.getPipePos()) && side == path.getFaceToHandler()) { + if (GTUtility.arePosEqual(cable.getPos(), path.getTargetPipePos()) && side == path.getTargetFacing()) { // Do not insert into source handler continue; } - IEnergyContainer dest = path.getHandler(cable.getWorld()); + IEnergyContainer dest = path.getHandler(); if (dest == null) continue; - EnumFacing facing = path.getFaceToHandler().getOpposite(); + EnumFacing facing = path.getTargetFacing().getOpposite(); if (!dest.inputsEnergy(facing) || dest.getEnergyCanBeInserted() <= 0) continue; long pathVoltage = voltage - path.getMaxLoss(); diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java index cf04b25227f..3603d3fc85d 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java @@ -16,7 +16,7 @@ public class EnergyNetWalker extends PipeNetWalker { - public static List createNetData(World world, BlockPos sourcePipe) { + public static List createNetData(World world, BlockPos sourcePipe) { if (!(world.getTileEntity(sourcePipe) instanceof TileEntityCable)) { return null; } @@ -25,11 +25,11 @@ public static List createNetData(World world, BlockPos sourcePipe) { return walker.isFailed() ? null : walker.routes; } - private final List routes; + private final List routes; private TileEntityCable[] pipes = {}; private int loss; - protected EnergyNetWalker(World world, BlockPos sourcePipe, int walkedBlocks, List routes) { + protected EnergyNetWalker(World world, BlockPos sourcePipe, int walkedBlocks, List routes) { super(world, sourcePipe, walkedBlocks); this.routes = routes; } @@ -50,10 +50,12 @@ protected void checkPipe(TileEntityCable pipeTile, BlockPos pos) { @Override protected void checkNeighbour(TileEntityCable pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { + // assert that the last added pipe is the current pipe + if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException("The current pipe is not the last added pipe. Something went seriously wrong!"); if (neighbourTile != null) { IEnergyContainer container = neighbourTile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, faceToNeighbour.getOpposite()); if (container != null) { - routes.add(new RoutePath(new BlockPos(pipePos), faceToNeighbour, pipes, getWalkedBlocks(), loss)); + routes.add(new EnergyRoutePath(faceToNeighbour, pipes, getWalkedBlocks(), loss)); } } } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java new file mode 100644 index 00000000000..a3b42b46174 --- /dev/null +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java @@ -0,0 +1,52 @@ +package gregtech.common.pipelike.cable.net; + +import gregtech.api.capability.GregtechCapabilities; +import gregtech.api.capability.IEnergyContainer; +import gregtech.api.pipenet.IRoutePath; +import gregtech.common.pipelike.cable.tile.TileEntityCable; +import net.minecraft.util.EnumFacing; +import org.jetbrains.annotations.NotNull; + +public class EnergyRoutePath implements IRoutePath { + + private final TileEntityCable targetPipe; + private final EnumFacing destFacing; + private final int distance; + private final TileEntityCable[] path; + private final long maxLoss; + + public EnergyRoutePath(EnumFacing destFacing, TileEntityCable[] path, int distance, long maxLoss) { + this.targetPipe = path[path.length - 1]; + this.destFacing = destFacing; + this.path = path; + this.distance = distance; + this.maxLoss = maxLoss; + } + + @Override + public @NotNull TileEntityCable getTargetPipe() { + return targetPipe; + } + + @Override + public @NotNull EnumFacing getTargetFacing() { + return destFacing; + } + + @Override + public int getDistance() { + return distance; + } + + public long getMaxLoss() { + return maxLoss; + } + + public TileEntityCable[] getPath() { + return path; + } + + public IEnergyContainer getHandler() { + return getTargetCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER); + } +} diff --git a/src/main/java/gregtech/common/pipelike/cable/net/RoutePath.java b/src/main/java/gregtech/common/pipelike/cable/net/RoutePath.java deleted file mode 100644 index 811a29fd9e5..00000000000 --- a/src/main/java/gregtech/common/pipelike/cable/net/RoutePath.java +++ /dev/null @@ -1,57 +0,0 @@ -package gregtech.common.pipelike.cable.net; - -import gregtech.api.capability.GregtechCapabilities; -import gregtech.api.capability.IEnergyContainer; -import gregtech.common.pipelike.cable.tile.TileEntityCable; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class RoutePath { - private final BlockPos destPipePos; - private final EnumFacing destFacing; - private final int distance; - private final TileEntityCable[] path; - private final long maxLoss; - - public RoutePath(BlockPos destPipePos, EnumFacing destFacing, TileEntityCable[] path, int distance, long maxLoss) { - this.destPipePos = destPipePos; - this.destFacing = destFacing; - this.path = path; - this.distance = distance; - this.maxLoss = maxLoss; - } - - public int getDistance() { - return distance; - } - - public long getMaxLoss() { - return maxLoss; - } - - public TileEntityCable[] getPath() { - return path; - } - - public BlockPos getPipePos() { - return destPipePos; - } - - public EnumFacing getFaceToHandler() { - return destFacing; - } - - public BlockPos getHandlerPos() { - return destPipePos.offset(destFacing); - } - - public IEnergyContainer getHandler(World world) { - TileEntity tile = world.getTileEntity(getHandlerPos()); - if (tile != null) { - return tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, destFacing.getOpposite()); - } - return null; - } -} diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java index a175823166a..3d1fe5a26d1 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java @@ -170,6 +170,7 @@ private void uninsulate() { world.setBlockState(pos, newBlock.getDefaultState()); TileEntityCable newCable = (TileEntityCable) world.getTileEntity(pos); if (newCable != null) { // should never be null + // TODO: use transfer data method newCable.setPipeData(newBlock, newBlock.getItemPipeType(null), getPipeMaterial()); for (EnumFacing facing : EnumFacing.VALUES) { if (isConnected(facing)) { diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java index 516209c7153..aa6817e0493 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java @@ -66,7 +66,7 @@ public T getCapability(Capability capability, EnumFacing side) { ILDEndpoint endpoint = getLink(); if (endpoint != null) { EnumFacing outputFacing = endpoint.getOutputFacing(); - TileEntity te = getWorld().getTileEntity(endpoint.getPos().offset(outputFacing)); + TileEntity te = endpoint.getNeighbor(outputFacing); if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java index a3bc3558e16..9b9102c7661 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java @@ -1,17 +1,16 @@ package gregtech.common.pipelike.fluidpipe.tile; import gregtech.api.GTValues; -import gregtech.api.capability.IPropertyFluidFilter; +import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.Cover; +import gregtech.api.cover.CoverableView; import gregtech.api.fluids.FluidConstants; import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.metatileentity.IDataInfoProvider; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.unification.material.properties.FluidPipeProperties; import gregtech.api.util.EntityDamageUtil; -import gregtech.api.util.GTUtility; import gregtech.api.util.TextFormattingUtil; import gregtech.common.covers.CoverPump; import gregtech.common.covers.ManualImportExportMode; @@ -37,10 +36,9 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; -import org.apache.commons.lang3.tuple.MutableTriple; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; @@ -109,7 +107,7 @@ public boolean supportsTicking() { private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Tank, From, Amount to receive - List> tanks = new ArrayList<>(); + List tanks = new ArrayList<>(); int amount = fluid.amount; FluidStack maxFluid = fluid.copy(); @@ -124,9 +122,10 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { continue; } - IFluidHandler fluidHandler = getFluidHandlerAt(facing, facing.getOpposite()); - if (fluidHandler == null) - continue; + TileEntity neighbor = getNeighbor(facing); + if (neighbor == null) continue; + IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite()); + if (fluidHandler == null) continue; IFluidHandler pipeTank = tank; Cover cover = getCoverableImplementation().getCoverAtSide(facing); @@ -135,19 +134,12 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { if (cover != null) { pipeTank = cover.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, pipeTank); // Shutter covers return null capability when active, so check here to prevent NPE - if (pipeTank == null) continue; + if (pipeTank == null || checkForPumpCover(cover)) continue; } else { - MetaTileEntity tile = GTUtility.getMetaTileEntity(world, pos.offset(facing)); - if (tile != null) cover = tile.getCoverAtSide(facing.getOpposite()); - } - - if (cover instanceof CoverPump coverPump) { - int pipeThroughput = getNodeData().getThroughput() * 20; - if (coverPump.getTransferRate() > pipeThroughput) { - coverPump.setTransferRate(pipeThroughput); - } - if (coverPump.getManualImportExportMode() == ManualImportExportMode.DISABLED) { - continue; + CoverableView coverable = neighbor.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); + if (coverable != null) { + cover = coverable.getCoverAtSide(facing.getOpposite()); + if (checkForPumpCover(cover)) continue; } } @@ -159,7 +151,7 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { int filled = Math.min(fluidHandler.fill(maxFluid, false), drainable.amount); if (filled > 0) { - tanks.add(MutableTriple.of(fluidHandler, pipeTank, filled)); + tanks.add(new FluidTransaction(fluidHandler, pipeTank, filled)); availableCapacity += filled; } maxFluid.amount = amount; // Because some mods do actually modify input fluid stack @@ -172,29 +164,39 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { final double maxAmount = Math.min(getCapacityPerTank() / 2, fluid.amount); // Now distribute - for (MutableTriple triple : tanks) { + for (FluidTransaction transaction : tanks) { if (availableCapacity > maxAmount) { - triple.setRight((int) Math.floor(triple.getRight() * maxAmount / availableCapacity)); // Distribute fluids based on percentage available space at destination + transaction.amount = (int) Math.floor(transaction.amount * maxAmount / availableCapacity); // Distribute fluids based on percentage available space at destination } - if (triple.getRight() == 0) { - if (tank.getFluidAmount() <= 0) - break; // If there is no more stored fluid, stop transferring to prevent dupes - triple.setRight(1); // If the percent is not enough to give at least 1L, try to give 1L - } else if (triple.getRight() < 0) { + if (transaction.amount == 0) { + if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent dupes + transaction.amount = 1; // If the percent is not enough to give at least 1L, try to give 1L + } else if (transaction.amount < 0) { continue; } FluidStack toInsert = fluid.copy(); - toInsert.amount = triple.getRight(); + toInsert.amount = transaction.amount; - int inserted = triple.getLeft().fill(toInsert, true); + int inserted = transaction.target.fill(toInsert, true); if (inserted > 0) { - triple.getMiddle().drain(inserted, true); + transaction.pipeTank.drain(inserted, true); + } + } + } + + private boolean checkForPumpCover(@Nullable Cover cover) { + if (cover instanceof CoverPump coverPump) { + int pipeThroughput = getNodeData().getThroughput() * 20; + if (coverPump.getTransferRate() > pipeThroughput) { + coverPump.setTransferRate(pipeThroughput); } + return coverPump.getManualImportExportMode() == ManualImportExportMode.DISABLED; } + return false; } - public void checkAndDestroy(@Nonnull FluidStack stack) { + public void checkAndDestroy(@NotNull FluidStack stack) { Fluid fluid = stack.getFluid(); FluidPipeProperties prop = getNodeData(); @@ -383,9 +385,9 @@ public FluidStack[] getContainedFluids() { return fluids; } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound nbt) { super.writeToNBT(nbt); NBTTagList list = new NBTTagList(); for (int i = 0; i < getFluidTanks().length; i++) { @@ -402,7 +404,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { } @Override - public void readFromNBT(@Nonnull NBTTagCompound nbt) { + public void readFromNBT(@NotNull NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = (NBTTagList) nbt.getTag("Fluids"); createTanksList(); @@ -414,7 +416,7 @@ public void readFromNBT(@Nonnull NBTTagCompound nbt) { } } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); @@ -441,4 +443,17 @@ public List getDataInfo() { } return list; } + + private static class FluidTransaction { + + public final IFluidHandler target; + public final IFluidHandler pipeTank; + public int amount; + + private FluidTransaction(IFluidHandler target, IFluidHandler pipeTank, int amount) { + this.target = target; + this.pipeTank = pipeTank; + this.amount = amount; + } + } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java index 47800d3c7e9..94e15ccd456 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java @@ -67,7 +67,7 @@ public T getCapability(Capability capability, EnumFacing side) { ILDEndpoint endpoint = getLink(); if (endpoint != null) { EnumFacing outputFacing = endpoint.getOutputFacing(); - TileEntity te = getWorld().getTileEntity(endpoint.getPos().offset(outputFacing)); + TileEntity te = endpoint.getNeighbor(outputFacing); if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java index 832037609cb..448a5402158 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java @@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -31,7 +30,6 @@ public class ItemNetHandler implements IItemHandler { private ItemPipeNet net; private TileEntityItemPipe pipe; - private final World world; private final EnumFacing facing; private final Object2IntMap simulatedTransfersGlobalRoundRobin = new Object2IntOpenHashMap<>(); private int simulatedTransfers = 0; @@ -41,7 +39,6 @@ public ItemNetHandler(ItemPipeNet net, TileEntityItemPipe pipe, EnumFacing facin this.net = net; this.pipe = pipe; this.facing = facing; - this.world = pipe.getWorld(); } public void updateNetwork(ItemPipeNet net) { @@ -76,8 +73,8 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } copyTransferred(); - Cover pipeCover = getCoverOnPipe(pipe.getPipePos(), facing); - Cover tileCover = getCoverOnNeighbour(pipe.getPipePos(), facing); + Cover pipeCover = this.pipe.getCoverableImplementation().getCoverAtSide(facing); + Cover tileCover = getCoverOnNeighbour(this.pipe, facing); boolean pipeConveyor = pipeCover instanceof CoverConveyor, tileConveyor = tileCover instanceof CoverConveyor; // abort if there are two conveyors @@ -101,8 +98,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate public static boolean checkImportCover(Cover cover, boolean onPipe, ItemStack stack) { if (cover == null) return true; - if (cover instanceof CoverItemFilter) { - CoverItemFilter filter = (CoverItemFilter) cover; + if (cover instanceof CoverItemFilter filter) { return (filter.getFilterMode() != ItemFilterMode.FILTER_BOTH && (filter.getFilterMode() != ItemFilterMode.FILTER_INSERT || !onPipe) && (filter.getFilterMode() != ItemFilterMode.FILTER_EXTRACT || onPipe)) || filter.testItemStack(stack); @@ -111,7 +107,7 @@ public static boolean checkImportCover(Cover cover, boolean onPipe, ItemStack st } public ItemStack insertFirst(ItemStack stack, boolean simulate) { - for (ItemPipeNet.Inventory inv : net.getNetData(pipe.getPipePos(), facing)) { + for (ItemRoutePath inv : net.getNetData(pipe.getPipePos(), facing)) { stack = insert(inv, stack, simulate); if (stack.isEmpty()) return ItemStack.EMPTY; @@ -120,20 +116,19 @@ public ItemStack insertFirst(ItemStack stack, boolean simulate) { } public ItemStack insertRoundRobin(ItemStack stack, boolean simulate, boolean global) { - List handlers = net.getNetData(pipe.getPipePos(), facing); - if (handlers.size() == 0) + List routePaths = net.getNetData(pipe.getPipePos(), facing); + if (routePaths.isEmpty()) return stack; - if (handlers.size() == 1) - return insert(handlers.get(0), stack, simulate); - List handlersCopy = new ArrayList<>(handlers); - int original = stack.getCount(); + if (routePaths.size() == 1) + return insert(routePaths.get(0), stack, simulate); + List routePathsCopy = new ArrayList<>(routePaths); if (global) { - stack = insertToHandlersEnhanced(handlersCopy, stack, handlers.size(), simulate); + stack = insertToHandlersEnhanced(routePathsCopy, stack, routePaths.size(), simulate); } else { - stack = insertToHandlers(handlersCopy, stack, simulate); - if (!stack.isEmpty() && handlersCopy.size() > 0) - stack = insertToHandlers(handlersCopy, stack, simulate); + stack = insertToHandlers(routePathsCopy, stack, simulate); + if (!stack.isEmpty() && !routePathsCopy.isEmpty()) + stack = insertToHandlers(routePathsCopy, stack, simulate); } return stack; @@ -148,14 +143,14 @@ public ItemStack insertRoundRobin(ItemStack stack, boolean simulate, boolean glo * @param simulate simulate * @return remainder */ - private ItemStack insertToHandlers(List copy, ItemStack stack, boolean simulate) { - Iterator handlerIterator = copy.listIterator(); + private ItemStack insertToHandlers(List copy, ItemStack stack, boolean simulate) { + Iterator routePathIterator = copy.listIterator(); int inserted = 0; int count = stack.getCount(); int c = count / copy.size(); int m = c == 0 ? count % copy.size() : 0; - while (handlerIterator.hasNext()) { - ItemPipeNet.Inventory handler = handlerIterator.next(); + while (routePathIterator.hasNext()) { + ItemRoutePath routePath = routePathIterator.next(); int amount = c; if (m > 0) { @@ -166,7 +161,7 @@ private ItemStack insertToHandlers(List copy, ItemStack s if (amount == 0) break; ItemStack toInsert = stack.copy(); toInsert.setCount(amount); - int r = insert(handler, toInsert, simulate).getCount(); + int r = insert(routePath, toInsert, simulate).getCount(); if (r < amount) { inserted += (amount - r); } @@ -175,7 +170,7 @@ private ItemStack insertToHandlers(List copy, ItemStack s } if (r > 0) - handlerIterator.remove(); + routePathIterator.remove(); } ItemStack remainder = stack.copy(); @@ -183,14 +178,14 @@ private ItemStack insertToHandlers(List copy, ItemStack s return remainder; } - private ItemStack insertToHandlersEnhanced(List copy, ItemStack stack, int dest, boolean simulate) { + private ItemStack insertToHandlersEnhanced(List copy, ItemStack stack, int dest, boolean simulate) { List transferred = new ArrayList<>(); IntList steps = new IntArrayList(); int min = Integer.MAX_VALUE; ItemStack simStack; // find inventories that are not full and get the amount that was inserted in total - for (ItemPipeNet.Inventory inv : copy) { + for (ItemRoutePath inv : copy) { simStack = stack.copy(); int ins = stack.getCount() - insert(inv, simStack, true, true).getCount(); if (ins <= 0) @@ -285,9 +280,9 @@ private ItemStack insertToHandlersEnhanced(List copy, Ite for (EnhancedRoundRobinData data : transferred) { ItemStack toInsert = stack.copy(); toInsert.setCount(data.toTransfer); - int ins = data.toTransfer - insert(data.inventory, toInsert, simulate).getCount(); + int ins = data.toTransfer - insert(data.routePath, toInsert, simulate).getCount(); inserted += ins; - transferTo(data.inventory, simulate, ins); + transferTo(data.routePath, simulate, ins); } ItemStack remainder = stack.copy(); @@ -295,17 +290,18 @@ private ItemStack insertToHandlersEnhanced(List copy, Ite return remainder; } - public ItemStack insert(ItemPipeNet.Inventory handler, ItemStack stack, boolean simulate) { - return insert(handler, stack, simulate, false); + public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simulate) { + return insert(routePath, stack, simulate, false); } - public ItemStack insert(ItemPipeNet.Inventory handler, ItemStack stack, boolean simulate, boolean ignoreLimit) { - int allowed = ignoreLimit ? stack.getCount() : checkTransferable(handler.getProperties().getTransferRate(), stack.getCount(), simulate); - if (allowed == 0 || !handler.matchesFilters(stack)) { + public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simulate, boolean ignoreLimit) { + int allowed = ignoreLimit ? stack.getCount() : checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); + if (allowed == 0 || !routePath.matchesFilters(stack)) { return stack; } - Cover pipeCover = getCoverOnPipe(handler.getPipePos(), handler.getFaceToHandler()); - Cover tileCover = getCoverOnNeighbour(handler.getPipePos(), handler.getFaceToHandler()); + Cover pipeCover = routePath.getTargetPipe().getCoverableImplementation().getCoverAtSide(routePath.getTargetFacing()); + Cover tileCover = getCoverOnNeighbour(routePath.getTargetPipe(), routePath.getTargetFacing()); + if (pipeCover != null) { testHandler.setStackInSlot(0, stack.copy()); IItemHandler itemHandler = pipeCover.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, testHandler); @@ -315,7 +311,7 @@ public ItemStack insert(ItemPipeNet.Inventory handler, ItemStack stack, boolean } testHandler.setStackInSlot(0, ItemStack.EMPTY); } - IItemHandler neighbourHandler = handler.getHandler(world); + IItemHandler neighbourHandler = routePath.getHandler(); if (pipeCover instanceof CoverRoboticArm && ((CoverRoboticArm) pipeCover).getConveyorMode() == CoverConveyor.ConveyorMode.EXPORT) { return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) pipeCover, stack, simulate, allowed, ignoreLimit); } @@ -343,21 +339,12 @@ private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate return remainder; } - public Cover getCoverOnPipe(BlockPos pos, EnumFacing handlerFacing) { - TileEntity tile = pipe.getWorld().getTileEntity(pos); - if (tile instanceof TileEntityItemPipe) { - CoverHolder coverHolder = ((TileEntityItemPipe) tile).getCoverableImplementation(); - return coverHolder.getCoverAtSide(handlerFacing); - } - return null; - } - - public Cover getCoverOnNeighbour(BlockPos pos, EnumFacing handlerFacing) { - TileEntity tile = pipe.getWorld().getTileEntity(pos.offset(handlerFacing)); + public Cover getCoverOnNeighbour(TileEntityItemPipe itemPipe, EnumFacing facing) { + TileEntity tile = itemPipe.getNeighbor(facing); if (tile != null) { - CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, handlerFacing.getOpposite()); + CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); if (coverHolder == null) return null; - return coverHolder.getCoverAtSide(handlerFacing.getOpposite()); + return coverHolder.getCoverAtSide(facing.getOpposite()); } return null; } @@ -448,22 +435,22 @@ public int getSlotLimit(int i) { return 64; } - private void transferTo(ItemPipeNet.Inventory handler, boolean simulate, int amount) { + private void transferTo(ItemRoutePath routePath, boolean simulate, int amount) { if (simulate) - simulatedTransfersGlobalRoundRobin.merge(handler.toFacingPos(), amount, Integer::sum); + simulatedTransfersGlobalRoundRobin.merge(routePath.toFacingPos(), amount, Integer::sum); else - pipe.getTransferred().merge(handler.toFacingPos(), amount, Integer::sum); + pipe.getTransferred().merge(routePath.toFacingPos(), amount, Integer::sum); } - private boolean contains(ItemPipeNet.Inventory handler, boolean simulate) { - return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(handler.toFacingPos()) : pipe.getTransferred().containsKey(handler.toFacingPos()); + private boolean contains(ItemRoutePath routePath, boolean simulate) { + return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(routePath.toFacingPos()) : pipe.getTransferred().containsKey(routePath.toFacingPos()); } - private int didTransferTo(ItemPipeNet.Inventory handler, boolean simulate) { + private int didTransferTo(ItemRoutePath routePath, boolean simulate) { if (simulate) - return simulatedTransfersGlobalRoundRobin.getInt(handler.toFacingPos()); - return pipe.getTransferred().getInt(handler.toFacingPos()); + return simulatedTransfersGlobalRoundRobin.getInt(routePath.toFacingPos()); + return pipe.getTransferred().getInt(routePath.toFacingPos()); } private void resetTransferred(boolean simulated) { @@ -480,15 +467,16 @@ private void decrementBy(int amount) { } private static class EnhancedRoundRobinData { - private final ItemPipeNet.Inventory inventory; + + private final ItemRoutePath routePath; private final int maxInsertable; private int transferred; private int toTransfer = 0; - private EnhancedRoundRobinData(ItemPipeNet.Inventory inventory, int maxInsertable, int transferred) { + private EnhancedRoundRobinData(ItemRoutePath routePath, int maxInsertable, int transferred) { this.maxInsertable = maxInsertable; this.transferred = transferred; - this.inventory = inventory; + this.routePath = routePath; } } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java index 154f14bacd9..00ea1d8faff 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java @@ -24,7 +24,7 @@ public class ItemNetWalker extends PipeNetWalker { - public static List createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { + public static List createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { if (!(world.getTileEntity(sourcePipe) instanceof TileEntityItemPipe)) { return null; } @@ -36,13 +36,13 @@ public static List createNetData(World world, BlockPos so } private ItemPipeProperties minProperties; - private final List inventories; + private final List inventories; private final List> filters = new ArrayList<>(); private final EnumMap>> nextFilters = new EnumMap<>(EnumFacing.class); private BlockPos sourcePipe; private EnumFacing facingToHandler; - protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, ItemPipeProperties properties) { + protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, ItemPipeProperties properties) { super(world, sourcePipe, distance); this.inventories = inventories; this.minProperties = properties; @@ -89,7 +89,7 @@ protected void checkNeighbour(TileEntityItemPipe pipeTile, BlockPos pipePos, Enu if (moreFilters != null && !moreFilters.isEmpty()) { filters.addAll(moreFilters); } - inventories.add(new ItemPipeNet.Inventory(new BlockPos(pipePos), faceToNeighbour, getWalkedBlocks(), minProperties, filters)); + inventories.add(new ItemRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks(), minProperties, filters)); } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java index 13a562f3d23..2aa9a845661 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java @@ -4,36 +4,29 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.ItemPipeProperties; -import gregtech.api.util.FacingPos; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; import java.util.*; -import java.util.function.Predicate; public class ItemPipeNet extends PipeNet { - private final Map> NET_DATA = new HashMap<>(); + private final Map> NET_DATA = new HashMap<>(); public ItemPipeNet(WorldPipeNet> world) { super(world); } - public List getNetData(BlockPos pipePos, EnumFacing facing) { - List data = NET_DATA.get(pipePos); + public List getNetData(BlockPos pipePos, EnumFacing facing) { + List data = NET_DATA.get(pipePos); if (data == null) { data = ItemNetWalker.createNetData(getWorldData(), pipePos, facing); if (data == null) { // walker failed, don't cache so it tries again on next insertion return Collections.emptyList(); } - data.sort(Comparator.comparingInt(inv -> inv.properties.getPriority())); + data.sort(Comparator.comparingInt(inv -> inv.getProperties().getPriority())); NET_DATA.put(pipePos, data); } return data; @@ -66,64 +59,4 @@ protected void writeNodeData(ItemPipeProperties nodeData, NBTTagCompound tagComp protected ItemPipeProperties readNodeData(NBTTagCompound tagCompound) { return new ItemPipeProperties(tagCompound.getInteger("Range"), tagCompound.getFloat("Rate")); } - - public static class Inventory { - private final BlockPos pipePos; - private final EnumFacing faceToHandler; - private final int distance; - private final ItemPipeProperties properties; - private final List> filters; - - public Inventory(BlockPos pipePos, EnumFacing facing, int distance, ItemPipeProperties properties, List> filters) { - this.pipePos = pipePos; - this.faceToHandler = facing; - this.distance = distance; - this.properties = properties; - this.filters = filters; - } - - public BlockPos getPipePos() { - return pipePos; - } - - public EnumFacing getFaceToHandler() { - return faceToHandler; - } - - public int getDistance() { - return distance; - } - - public ItemPipeProperties getProperties() { - return properties; - } - - public List> getFilters() { - return filters; - } - - public boolean matchesFilters(ItemStack stack) { - for (Predicate filter : filters) { - if (!filter.test(stack)) { - return false; - } - } - return true; - } - - public BlockPos getHandlerPos() { - return pipePos.offset(faceToHandler); - } - - public IItemHandler getHandler(World world) { - TileEntity tile = world.getTileEntity(getHandlerPos()); - if (tile != null) - return tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, faceToHandler.getOpposite()); - return null; - } - - public FacingPos toFacingPos() { - return new FacingPos(pipePos, faceToHandler); - } - } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java new file mode 100644 index 00000000000..057cd665609 --- /dev/null +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java @@ -0,0 +1,68 @@ +package gregtech.common.pipelike.itempipe.net; + +import gregtech.api.pipenet.IRoutePath; +import gregtech.api.unification.material.properties.ItemPipeProperties; +import gregtech.api.util.FacingPos; +import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; + +import javax.annotation.Nonnull; +import java.util.List; +import java.util.function.Predicate; + +public class ItemRoutePath implements IRoutePath { + + private final TileEntityItemPipe targetPipe; + private final EnumFacing faceToHandler; + private final int distance; + private final ItemPipeProperties properties; + private final Predicate filters; + + public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int distance, ItemPipeProperties properties, List> filters) { + this.targetPipe = targetPipe; + this.faceToHandler = facing; + this.distance = distance; + this.properties = properties; + this.filters = stack -> { + for (Predicate filter : filters) + if (!filter.test(stack)) return false; + return true; + }; + } + + @Nonnull + @Override + public TileEntityItemPipe getTargetPipe() { + return targetPipe; + } + + @Nonnull + @Override + public EnumFacing getTargetFacing() { + return faceToHandler; + } + + @Override + public int getDistance() { + return distance; + } + + public ItemPipeProperties getProperties() { + return properties; + } + + public boolean matchesFilters(ItemStack stack) { + return filters.test(stack); + } + + public IItemHandler getHandler() { + return getTargetCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + } + + public FacingPos toFacingPos() { + return new FacingPos(getTargetPipePos(), faceToHandler); + } +} diff --git a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java index 5fc67130575..4f2f07029fd 100644 --- a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java @@ -38,7 +38,7 @@ public class BlockLaserPipe extends BlockPipe pipeT @Override protected LaserPipeProperties getFallbackType() { - return new LaserPipeProperties(); + return LaserPipeProperties.INSTANCE; } @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/LaserPipeProperties.java b/src/main/java/gregtech/common/pipelike/laser/LaserPipeProperties.java index 354b218e163..e2872f43b85 100644 --- a/src/main/java/gregtech/common/pipelike/laser/LaserPipeProperties.java +++ b/src/main/java/gregtech/common/pipelike/laser/LaserPipeProperties.java @@ -1,12 +1,6 @@ package gregtech.common.pipelike.laser; -import javax.annotation.Nonnull; - public class LaserPipeProperties { - public LaserPipeProperties() { - } - - public LaserPipeProperties(@Nonnull LaserPipeProperties ignoredOther) { - } + public static final LaserPipeProperties INSTANCE = new LaserPipeProperties(); } diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java index 56be15e6f5a..513598063b1 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java @@ -4,22 +4,20 @@ import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class LaserNetHandler implements ILaserContainer { + private LaserPipeNet net; private final TileEntityLaserPipe pipe; private final EnumFacing facing; - private final World world; public LaserNetHandler(LaserPipeNet net, @Nonnull TileEntityLaserPipe pipe, @Nullable EnumFacing facing) { this.net = net; this.pipe = pipe; this.facing = facing; - this.world = pipe.getWorld(); } public void updateNetwork(LaserPipeNet net) { @@ -28,7 +26,7 @@ public void updateNetwork(LaserPipeNet net) { private void setPipesActive() { for (BlockPos pos : net.getAllNodes().keySet()) { - if (world.getTileEntity(pos) instanceof TileEntityLaserPipe laserPipe) { + if (pipe.getWorld().getTileEntity(pos) instanceof TileEntityLaserPipe laserPipe) { laserPipe.setActive(true, 100); } } @@ -40,12 +38,12 @@ private ILaserContainer getInnerContainer() { return null; } - LaserPipeNet.LaserData data = net.getNetData(pipe.getPipePos(), facing); + LaserRoutePath data = net.getNetData(pipe.getPipePos(), facing); if (data == null) { return null; } - return data.getHandler(world); + return data.getHandler(); } @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java index b6a9c1b9aad..e085988ab57 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java @@ -4,7 +4,6 @@ import gregtech.api.capability.ILaserContainer; import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; -import gregtech.common.pipelike.laser.LaserPipeProperties; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -14,35 +13,34 @@ public class LaserNetWalker extends PipeNetWalker { + public static final LaserRoutePath FAILED_MARKER = new LaserRoutePath(null, null, 0); + @Nullable - public static LaserPipeNet.LaserData createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { - LaserNetWalker walker = new LaserNetWalker(world, sourcePipe, 1, null, null); + public static LaserRoutePath createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { + LaserNetWalker walker = new LaserNetWalker(world, sourcePipe, 1); walker.sourcePipe = sourcePipe; walker.facingToHandler = faceToSourceHandler; walker.axis = faceToSourceHandler.getAxis(); walker.traversePipeNet(); - return walker.isFailed() ? null : walker.laserData; + return walker.isFailed() ? FAILED_MARKER : walker.routePath; } private static final EnumFacing[] X_AXIS_FACINGS = {EnumFacing.WEST, EnumFacing.EAST}; private static final EnumFacing[] Y_AXIS_FACINGS = {EnumFacing.UP, EnumFacing.DOWN}; private static final EnumFacing[] Z_AXIS_FACINGS = {EnumFacing.NORTH, EnumFacing.SOUTH}; - private LaserPipeProperties minProperties; - private LaserPipeNet.LaserData laserData; + private LaserRoutePath routePath; private BlockPos sourcePipe; private EnumFacing facingToHandler; private EnumFacing.Axis axis; - protected LaserNetWalker(World world, BlockPos sourcePipe, int distance, LaserPipeNet.LaserData laserData, LaserPipeProperties properties) { + protected LaserNetWalker(World world, BlockPos sourcePipe, int distance) { super(world, sourcePipe, distance); - this.laserData = laserData; - this.minProperties = properties; } @Override protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { - LaserNetWalker walker = new LaserNetWalker(world, nextPos, walkedBlocks, laserData, minProperties); + LaserNetWalker walker = new LaserNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; walker.axis = axis; @@ -60,12 +58,6 @@ protected EnumFacing[] getSurroundingPipeSides() { @Override protected void checkPipe(TileEntityLaserPipe pipeTile, BlockPos pos) { - LaserPipeProperties pipeProperties = pipeTile.getNodeData(); - if (minProperties == null) { - minProperties = pipeProperties; - } else { - minProperties = new LaserPipeProperties(pipeProperties); - } } @Override @@ -74,10 +66,11 @@ protected void checkNeighbour(TileEntityLaserPipe pipeTile, BlockPos pipePos, En return; } - if (laserData == null) { + if (((LaserNetWalker) root).routePath == null) { ILaserContainer handler = neighbourTile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, faceToNeighbour.getOpposite()); if (handler != null) { - laserData = new LaserPipeNet.LaserData(new BlockPos(pipePos), faceToNeighbour, getWalkedBlocks(), minProperties); + ((LaserNetWalker) root).routePath = new LaserRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); + stop(); } } } diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java index 19a08a8ca96..7bd9478c42c 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java @@ -1,42 +1,36 @@ package gregtech.common.pipelike.laser.net; -import gregtech.api.capability.GregtechTileCapabilities; -import gregtech.api.capability.ILaserContainer; import gregtech.api.pipenet.Node; import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.laser.LaserPipeProperties; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Map; public class LaserPipeNet extends PipeNet { - private final Map netData = new Object2ObjectOpenHashMap<>(); + private final Map netData = new Object2ObjectOpenHashMap<>(); public LaserPipeNet(WorldPipeNet> world) { super(world); } @Nullable - public LaserData getNetData(BlockPos pipePos, EnumFacing facing) { - LaserData data = netData.get(pipePos); - if (data == null) { - data = LaserNetWalker.createNetData(getWorldData(), pipePos, facing); - if (data == null) { - // walker failed, don't cache, so it tries again on next insertion - return null; - } - - netData.put(pipePos, data); + public LaserRoutePath getNetData(BlockPos pipePos, EnumFacing facing) { + if (netData.containsKey(pipePos)) { + return netData.get(pipePos); + } + LaserRoutePath data = LaserNetWalker.createNetData(getWorldData(), pipePos, facing); + if (data == LaserNetWalker.FAILED_MARKER) { + // walker failed, don't cache, so it tries again on next insertion + return null; } + netData.put(pipePos, data); return data; } @@ -59,85 +53,10 @@ protected void transferNodeData(Map> transfe @Override protected void writeNodeData(LaserPipeProperties nodeData, NBTTagCompound tagCompound) { - } @Override protected LaserPipeProperties readNodeData(NBTTagCompound tagCompound) { - return new LaserPipeProperties(); - } - - // jabel moment - public static class LaserData { - - private final BlockPos pipePos; - private final EnumFacing faceToHandler; - private final int distance; - private final LaserPipeProperties properties; - - public LaserData(BlockPos pipePos, EnumFacing faceToHandler, int distance, LaserPipeProperties properties) { - this.pipePos = pipePos; - this.faceToHandler = faceToHandler; - this.distance = distance; - this.properties = properties; - } - - /** - * Gets the current position of the pipe - * @return The position of the pipe - */ - @Nonnull - public BlockPos getPipePos() { - return pipePos; - } - - /** - * Gets the current face to handler - * @return The face to handler - */ - @Nonnull - public EnumFacing getFaceToHandler() { - return faceToHandler; - } - - - /** - * Gets the manhattan distance traveled during walking - * @return The distance in blocks - */ - public int getDistance() { - return distance; - } - - /** - * Gets the laser pipe properties of the current pipe - * @return The properties of the pipe. - */ - @Nonnull - public LaserPipeProperties getProperties() { - return properties; - } - - /** - * @return The position of where the handler would be - */ - @Nonnull - public BlockPos getHandlerPos() { - return pipePos.offset(faceToHandler); - } - - /** - * Gets the handler if it exists - * @param world the world to get the handler from - * @return the handler - */ - @Nullable - public ILaserContainer getHandler(@Nonnull World world) { - TileEntity tile = world.getTileEntity(getHandlerPos()); - if (tile != null) { - return tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, faceToHandler.getOpposite()); - } - return null; - } + return LaserPipeProperties.INSTANCE; } } diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java new file mode 100644 index 00000000000..48d23dbe268 --- /dev/null +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java @@ -0,0 +1,67 @@ +package gregtech.common.pipelike.laser.net; + +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.ILaserContainer; +import gregtech.api.pipenet.IRoutePath; +import gregtech.common.pipelike.laser.LaserPipeProperties; +import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; +import net.minecraft.util.EnumFacing; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +// jabel moment +public class LaserRoutePath implements IRoutePath { + + private final TileEntityLaserPipe targetPipe; + private final EnumFacing faceToHandler; + private final int distance; + + public LaserRoutePath(TileEntityLaserPipe targetPipe, EnumFacing faceToHandler, int distance) { + this.targetPipe = targetPipe; + this.faceToHandler = faceToHandler; + this.distance = distance; + } + + /** + * Gets the current face to handler + * + * @return The face to handler + */ + @Nonnull + public EnumFacing getFaceToHandler() { + return faceToHandler; + } + + + @Nonnull + @Override + public TileEntityLaserPipe getTargetPipe() { + return targetPipe; + } + + @Nonnull + @Override + public EnumFacing getTargetFacing() { + return faceToHandler; + } + + /** + * Gets the manhattan distance traveled during walking + * + * @return The distance in blocks + */ + public int getDistance() { + return distance; + } + + /** + * Gets the handler if it exists + * + * @return the handler + */ + @Nullable + public ILaserContainer getHandler() { + return getTargetCapability(GregtechTileCapabilities.CAPABILITY_LASER); + } +} diff --git a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java index ab71e18eafe..c9801ac42f2 100644 --- a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java @@ -24,6 +24,7 @@ import java.util.EnumMap; public class TileEntityLaserPipe extends TileEntityPipeBase { + private final EnumMap handlers = new EnumMap<>(EnumFacing.class); // the LaserNetHandler can only be created on the server, so we have an empty placeholder for the client private final ILaserContainer clientCapability = new DefaultLaserContainer(); diff --git a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java index ea3aca0b0ea..a562aba2875 100644 --- a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java @@ -35,7 +35,7 @@ public class BlockOpticalPipe extends BlockPipe p @Override protected OpticalPipeProperties getFallbackType() { - return new OpticalPipeProperties(); + return OpticalPipeProperties.INSTANCE; } @Override diff --git a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeProperties.java b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeProperties.java index 75a50d5b354..f4a47a3a0d7 100644 --- a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeProperties.java +++ b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeProperties.java @@ -1,14 +1,6 @@ package gregtech.common.pipelike.optical; -import javax.annotation.Nonnull; - public class OpticalPipeProperties { - public OpticalPipeProperties() { - - } - - public OpticalPipeProperties(@Nonnull OpticalPipeProperties other) { - - } + public static final OpticalPipeProperties INSTANCE = new OpticalPipeProperties(); } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java index fcf562689e2..3e5ede5700c 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java @@ -80,10 +80,10 @@ private boolean isNetInvalidForTraversal() { private boolean traverseRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { if (isNetInvalidForTraversal()) return false; - OpticalPipeNet.OpticalInventory inv = net.getNetData(pipe.getPipePos(), facing); + OpticalRoutePath inv = net.getNetData(pipe.getPipePos(), facing); if (inv == null) return false; - IOpticalDataAccessHatch hatch = inv.getDataHatch(world); + IOpticalDataAccessHatch hatch = inv.getDataHatch(); if (hatch == null || seen.contains(hatch)) return false; if (hatch.isTransmitter()) { @@ -114,10 +114,10 @@ private boolean traverseCanBridge(@Nonnull Collection seen) { if (isNetInvalidForTraversal()) return null; - OpticalPipeNet.OpticalInventory inv = net.getNetData(pipe.getPipePos(), facing); + OpticalRoutePath inv = net.getNetData(pipe.getPipePos(), facing); if (inv == null) return null; - IOpticalComputationProvider hatch = inv.getComputationHatch(world); + IOpticalComputationProvider hatch = inv.getComputationHatch(); if (hatch == null || seen.contains(hatch)) return null; return hatch; } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java index ebd11e9340c..cd32b810f89 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java @@ -3,7 +3,6 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; -import gregtech.common.pipelike.optical.OpticalPipeProperties; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -14,29 +13,28 @@ public class OpticalNetWalker extends PipeNetWalker { + public static final OpticalRoutePath FAILED_MARKER = new OpticalRoutePath(null, null, 0); + @Nullable - public static OpticalPipeNet.OpticalInventory createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { - OpticalNetWalker walker = new OpticalNetWalker(world, sourcePipe, 1, null, null); + public static OpticalRoutePath createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { + OpticalNetWalker walker = new OpticalNetWalker(world, sourcePipe, 1); walker.sourcePipe = sourcePipe; walker.facingToHandler = faceToSourceHandler; walker.traversePipeNet(); - return walker.isFailed() ? null : walker.inventory; + return walker.isFailed() ? FAILED_MARKER : walker.routePath; } - private OpticalPipeProperties minProperties; - private OpticalPipeNet.OpticalInventory inventory; + private OpticalRoutePath routePath; private BlockPos sourcePipe; private EnumFacing facingToHandler; - protected OpticalNetWalker(World world, BlockPos sourcePipe, int distance, OpticalPipeNet.OpticalInventory inventory, OpticalPipeProperties properties) { + protected OpticalNetWalker(World world, BlockPos sourcePipe, int distance) { super(world, sourcePipe, distance); - this.inventory = inventory; - this.minProperties = properties; } @Override protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { - OpticalNetWalker walker = new OpticalNetWalker(world, nextPos, walkedBlocks, inventory, minProperties); + OpticalNetWalker walker = new OpticalNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; return walker; @@ -44,12 +42,6 @@ protected PipeNetWalker createSubWalker(World world, Enum @Override protected void checkPipe(TileEntityOpticalPipe pipeTile, BlockPos pos) { - OpticalPipeProperties pipeProperties = pipeTile.getNodeData(); - if (minProperties == null) { - minProperties = pipeProperties; - } else { - minProperties = new OpticalPipeProperties(pipeProperties); - } } @Override @@ -58,10 +50,11 @@ protected void checkNeighbour(TileEntityOpticalPipe pipeTile, BlockPos pipePos, return; } - if (inventory == null) { + if (((OpticalNetWalker) root).routePath == null) { if (neighbourTile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, faceToNeighbour.getOpposite()) || neighbourTile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, faceToNeighbour.getOpposite())) { - inventory = new OpticalPipeNet.OpticalInventory(new BlockPos(pipePos), faceToNeighbour, getWalkedBlocks(), minProperties); + ((OpticalNetWalker) root).routePath = new OpticalRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); + stop(); } } } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java index d0f7cd4981d..4708a4dbd90 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java @@ -1,45 +1,37 @@ package gregtech.common.pipelike.optical.net; -import gregtech.api.capability.GregtechTileCapabilities; -import gregtech.api.capability.IDataAccessHatch; -import gregtech.api.capability.IOpticalComputationProvider; -import gregtech.api.capability.IOpticalDataAccessHatch; import gregtech.api.pipenet.Node; import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; -import gregtech.api.util.FacingPos; import gregtech.common.pipelike.optical.OpticalPipeProperties; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Map; public class OpticalPipeNet extends PipeNet { - private final Map NET_DATA = new Object2ObjectOpenHashMap<>(); + private final Map NET_DATA = new Object2ObjectOpenHashMap<>(); public OpticalPipeNet(WorldPipeNet> world) { super(world); } @Nullable - public OpticalInventory getNetData(BlockPos pipePos, EnumFacing facing) { - OpticalInventory data = NET_DATA.get(pipePos); - if (data == null) { - data = OpticalNetWalker.createNetData(getWorldData(), pipePos, facing); - if (data == null) { - // walker failed, don't cache, so it tries again on next insertion - return null; - } - - NET_DATA.put(pipePos, data); + public OpticalRoutePath getNetData(BlockPos pipePos, EnumFacing facing) { + if (NET_DATA.containsKey(pipePos)) { + return NET_DATA.get(pipePos); + } + OpticalRoutePath data = OpticalNetWalker.createNetData(getWorldData(), pipePos, facing); + if (data == OpticalNetWalker.FAILED_MARKER) { + // walker failed, don't cache, so it tries again on next insertion + return null; } + + NET_DATA.put(pipePos, data); return data; } @@ -67,65 +59,7 @@ protected void writeNodeData(OpticalPipeProperties nodeData, NBTTagCompound tagC @Override protected OpticalPipeProperties readNodeData(NBTTagCompound tagCompound) { - return new OpticalPipeProperties(); + return OpticalPipeProperties.INSTANCE; } - public static class OpticalInventory { - - private final BlockPos pipePos; - private final EnumFacing faceToHandler; - private final int distance; - private final OpticalPipeProperties properties; - - public OpticalInventory(BlockPos pipePos, EnumFacing faceToHandler, int distance, OpticalPipeProperties properties) { - this.pipePos = pipePos; - this.faceToHandler = faceToHandler; - this.distance = distance; - this.properties = properties; - } - - public BlockPos getPipePos() { - return pipePos; - } - - public EnumFacing getFaceToHandler() { - return faceToHandler; - } - - public int getDistance() { - return distance; - } - - public OpticalPipeProperties getProperties() { - return properties; - } - - public BlockPos getHandlerPos() { - return pipePos.offset(faceToHandler); - } - - @Nullable - public IOpticalDataAccessHatch getDataHatch(@Nonnull World world) { - TileEntity tile = world.getTileEntity(getHandlerPos()); - if (tile != null) { - IDataAccessHatch hatch = tile.getCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, faceToHandler.getOpposite()); - return hatch instanceof IOpticalDataAccessHatch opticalHatch ? opticalHatch : null; - } - return null; - } - - @Nullable - public IOpticalComputationProvider getComputationHatch(@Nonnull World world) { - TileEntity tile = world.getTileEntity(getHandlerPos()); - if (tile != null) { - return tile.getCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, faceToHandler.getOpposite()); - } - return null; - } - - @Nonnull - public FacingPos toFacingPos() { - return new FacingPos(pipePos, faceToHandler); - } - } } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java new file mode 100644 index 00000000000..9489a4d5ca9 --- /dev/null +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java @@ -0,0 +1,57 @@ +package gregtech.common.pipelike.optical.net; + +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.IDataAccessHatch; +import gregtech.api.capability.IOpticalComputationProvider; +import gregtech.api.capability.IOpticalDataAccessHatch; +import gregtech.api.pipenet.IRoutePath; +import gregtech.api.util.FacingPos; +import gregtech.common.pipelike.optical.OpticalPipeProperties; +import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class OpticalRoutePath implements IRoutePath { + + private final TileEntityOpticalPipe targetPipe; + private final EnumFacing faceToHandler; + private final int distance; + + public OpticalRoutePath(TileEntityOpticalPipe targetPipe, EnumFacing faceToHandler, int distance) { + this.targetPipe = targetPipe; + this.faceToHandler = faceToHandler; + this.distance = distance; + } + + @Nonnull + @Override + public TileEntityOpticalPipe getTargetPipe() { + return targetPipe; + } + + @Nonnull + @Override + public EnumFacing getTargetFacing() { + return faceToHandler; + } + + public int getDistance() { + return distance; + } + + @Nullable + public IOpticalDataAccessHatch getDataHatch() { + IDataAccessHatch dataAccessHatch = getTargetCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS); + return dataAccessHatch instanceof IOpticalDataAccessHatch opticalHatch ? opticalHatch : null; + } + + @Nullable + public IOpticalComputationProvider getComputationHatch() { + return getTargetCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER); + } +} diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java index 3117f442f91..d6340587d22 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java @@ -43,7 +43,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer addIOText(probeInfo, endpoint); if (entityPlayer.isSneaking()) { - BlockPos otherPos = other.getPos(); + BlockPos otherPos = other.pos(); String prefix = null; if (other.isInput()) { prefix = "{*gregtech.top.ld_pipe_input_endpoint*}"; From f7612eafb5bfd0e9d9f64966e9ef340f555990be Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:05:20 -0600 Subject: [PATCH 05/77] Better vanilla block rotation (#2193) --- .../gregtech/common/ToolEventHandlers.java | 33 +++-- .../items/tool/BlockRotatingBehavior.java | 16 ++- .../tool/rotation/CustomBlockRotations.java | 127 ++++++++++++++++++ .../rotation/ICustomRotationBehavior.java | 24 ++++ src/main/java/gregtech/tools/ToolsModule.java | 7 + 5 files changed, 197 insertions(+), 10 deletions(-) create mode 100644 src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java create mode 100644 src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index 3b3030f6646..8cb08b82576 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -20,6 +20,8 @@ import gregtech.api.pipenet.tile.TileEntityPipeBase; import gregtech.api.util.GTUtility; import gregtech.api.util.TaskScheduler; +import gregtech.common.items.tool.rotation.CustomBlockRotations; +import gregtech.common.items.tool.rotation.ICustomRotationBehavior; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -56,6 +58,7 @@ import org.lwjgl.opengl.GL11; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.Iterator; import java.util.Set; import java.util.function.BooleanSupplier; @@ -213,7 +216,7 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) boolean sneaking = player.isSneaking(); // Grid overlays - if (tile != null && shouldRenderGridOverlays(state, tile, stack, player.getHeldItemOffhand(), sneaking) && + if (shouldRenderGridOverlays(state, tile, stack, player.getHeldItemOffhand(), sneaking) && renderGridOverlays(player, pos, state, event.getTarget().sideHit, tile, event.getPartialTicks())) { event.setCanceled(true); return; @@ -286,7 +289,7 @@ private static void postRenderDamagedBlocks() { } @SideOnly(Side.CLIENT) - private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, TileEntity tile, ItemStack mainHand, ItemStack offHand, boolean isSneaking) { + private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, ItemStack mainHand, ItemStack offHand, boolean isSneaking) { if (state.getBlock() instanceof BlockPipe pipe) { if (isSneaking && (mainHand.isEmpty() || mainHand.getItem().getClass() == Item.getItemFromBlock(pipe).getClass())) { return true; @@ -324,13 +327,22 @@ private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, Tile if (mte.canRenderMachineGrid(mainHand, offHand)) return true; } } - CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, null); - if (coverHolder == null) return false; - final boolean hasAnyCover = coverHolder.hasAnyCover(); - final boolean acceptsCovers = coverHolder.acceptsCovers(); + if (ToolHelper.isTool(mainHand, ToolClasses.WRENCH)) { + ICustomRotationBehavior behavior = CustomBlockRotations.getCustomRotation(state.getBlock()); + if (behavior != null && behavior.showGrid()) return true; + } + + if (tile != null) { + CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, null); + if (coverHolder == null) return false; - return GTUtility.isCoverBehaviorItem(mainHand, () -> hasAnyCover, coverDefinition -> acceptsCovers); + final boolean hasAnyCover = coverHolder.hasAnyCover(); + final boolean acceptsCovers = coverHolder.acceptsCovers(); + + return GTUtility.isCoverBehaviorItem(mainHand, () -> hasAnyCover, coverDefinition -> acceptsCovers); + } + return false; } private static float rColour; @@ -383,7 +395,12 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos GL11.glPopMatrix(); } } else { - drawGridOverlays(box); + ICustomRotationBehavior behavior = CustomBlockRotations.getCustomRotation(state.getBlock()); + if (behavior != null && behavior.showGrid()) { + drawGridOverlays(facing, box, side -> behavior.showXOnSide(state, side)); + } else { + drawGridOverlays(box); + } } GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); diff --git a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java index 41e29a4067c..ac3193aa5c6 100644 --- a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java @@ -1,10 +1,14 @@ package gregtech.common.items.tool; +import codechicken.lib.raytracer.RayTracer; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.common.items.tool.rotation.CustomBlockRotations; +import gregtech.common.items.tool.rotation.ICustomRotationBehavior; import net.minecraft.block.Block; import net.minecraft.block.BlockRailBase; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -34,14 +38,22 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo return EnumActionResult.PASS; } - Block b = world.getBlockState(pos).getBlock(); + IBlockState state = world.getBlockState(pos); + Block b = state.getBlock(); // leave rail rotation to Crowbar only if (b instanceof BlockRailBase) { return EnumActionResult.FAIL; } if (!player.isSneaking() && world.canMineBlockBody(player, pos)) { - if (b.rotateBlock(world, pos, side)) { + // Special cases for vanilla blocks where the default rotation behavior is less than ideal + ICustomRotationBehavior behavior = CustomBlockRotations.getCustomRotation(b); + if (behavior != null) { + if (behavior.customRotate(state, world, pos, RayTracer.retraceBlock(world, player, pos))) { + ToolHelper.onActionDone(player, world, hand); + return EnumActionResult.SUCCESS; + } + } else if (b.rotateBlock(world, pos, side)) { ToolHelper.onActionDone(player, world, hand); return EnumActionResult.SUCCESS; } diff --git a/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java new file mode 100644 index 00000000000..94cd7c3f8c3 --- /dev/null +++ b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java @@ -0,0 +1,127 @@ +package gregtech.common.items.tool.rotation; + +import gregtech.api.cover.CoverRayTracer; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirectional; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockHorizontal; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; +import org.jetbrains.annotations.ApiStatus; + +import java.util.Map; + +public class CustomBlockRotations { + + private static final Map CUSTOM_BEHAVIOR_MAP = new Object2ObjectOpenHashMap<>(); + + @ApiStatus.Internal + public static void init() { + // nice little way to initialize an inner-class enum + CustomRotations.init(); + } + + public static void registerCustomRotation(Block block, ICustomRotationBehavior behavior) { + CUSTOM_BEHAVIOR_MAP.put(block, behavior); + } + + public static ICustomRotationBehavior getCustomRotation(Block block) { + return CUSTOM_BEHAVIOR_MAP.get(block); + } + + public static final ICustomRotationBehavior BLOCK_HORIZONTAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override + public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { + EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); + if (gridSide == null) return false; + if (gridSide.getAxis() == EnumFacing.Axis.Y) return false; + + if (gridSide != state.getValue(BlockHorizontal.FACING)) { + state = state.withProperty(BlockHorizontal.FACING, gridSide); + world.setBlockState(pos, state); + return true; + } + return false; + } + + @Override + public boolean showXOnSide(IBlockState state, EnumFacing facing) { + return state.getValue(BlockHorizontal.FACING) == facing; + } + }; + + public static final ICustomRotationBehavior BLOCK_DIRECTIONAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override + public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { + EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); + if (gridSide == null) return false; + + if (gridSide != state.getValue(BlockDirectional.FACING)) { + state = state.withProperty(BlockDirectional.FACING, gridSide); + world.setBlockState(pos, state); + return true; + } + return false; + } + + @Override + public boolean showXOnSide(IBlockState state, EnumFacing facing) { + return state.getValue(BlockDirectional.FACING) == facing; + } + }; + + private enum CustomRotations { + + // BlockDirectional + PISTON(Blocks.PISTON, BLOCK_DIRECTIONAL_BEHAVIOR), + STICKY_PISTON(Blocks.STICKY_PISTON, BLOCK_DIRECTIONAL_BEHAVIOR), + DROPPER(Blocks.DROPPER, BLOCK_DIRECTIONAL_BEHAVIOR), + DISPENSER(Blocks.DISPENSER, BLOCK_DIRECTIONAL_BEHAVIOR), + OBSERVER(Blocks.OBSERVER, BLOCK_DIRECTIONAL_BEHAVIOR), + + // BlockHorizontal + FURNACE(Blocks.FURNACE, BLOCK_HORIZONTAL_BEHAVIOR), + LIT_FURNACE(Blocks.LIT_FURNACE, BLOCK_HORIZONTAL_BEHAVIOR), + PUMPKIN(Blocks.PUMPKIN, BLOCK_HORIZONTAL_BEHAVIOR), + LIT_PUMPKIN(Blocks.LIT_PUMPKIN, BLOCK_HORIZONTAL_BEHAVIOR), + CHEST(Blocks.CHEST, BLOCK_HORIZONTAL_BEHAVIOR), + TRAPPED_CHEST(Blocks.TRAPPED_CHEST, BLOCK_HORIZONTAL_BEHAVIOR), + ENDER_CHEST(Blocks.ENDER_CHEST, BLOCK_HORIZONTAL_BEHAVIOR), + + // Custom facings + + // Cannot face up, and uses a custom BlockState property key + HOPPER(Blocks.HOPPER, new ICustomRotationBehavior() { + @Override + public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { + EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); + if (gridSide == null || gridSide == EnumFacing.UP) return false; + + if (gridSide != state.getValue(BlockHopper.FACING)) { + state = state.withProperty(BlockHopper.FACING, gridSide); + world.setBlockState(pos, state); + return true; + } + return false; + } + + @Override + public boolean showXOnSide(IBlockState state, EnumFacing facing) { + return state.getValue(BlockHopper.FACING) == facing; + } + }), + + ; + + CustomRotations(Block block, ICustomRotationBehavior behavior) { + registerCustomRotation(block, behavior); + } + + private static void init() {} + } +} diff --git a/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java new file mode 100644 index 00000000000..f39c3cdcb1d --- /dev/null +++ b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java @@ -0,0 +1,24 @@ +package gregtech.common.items.tool.rotation; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; + +public interface ICustomRotationBehavior { + + /** Custom implementation of {@link Block#rotateBlock(World, BlockPos, EnumFacing)} for when that behavior isn't ideal. */ + boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult); + + /** Whether to show the 9-sectioned highlight grid when looking at this block while holding a Wrench. */ + default boolean showGrid() { + return true; + } + + /** Whether to draw an X on a provided side in the 9-sectioned highlight grid. */ + default boolean showXOnSide(IBlockState state, EnumFacing facing) { + return false; + } +} diff --git a/src/main/java/gregtech/tools/ToolsModule.java b/src/main/java/gregtech/tools/ToolsModule.java index 85fa3e8a003..d625768caec 100644 --- a/src/main/java/gregtech/tools/ToolsModule.java +++ b/src/main/java/gregtech/tools/ToolsModule.java @@ -2,12 +2,14 @@ import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; +import gregtech.common.items.tool.rotation.CustomBlockRotations; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; import gregtech.tools.enchants.EnchantmentEnderDamage; import gregtech.tools.enchants.EnchantmentHardHammer; import net.minecraft.enchantment.Enchantment; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -38,6 +40,11 @@ public List> getEventBusSubscribers() { return Collections.singletonList(ToolsModule.class); } + @Override + public void preInit(FMLPreInitializationEvent event) { + CustomBlockRotations.init(); + } + @SubscribeEvent public static void registerEnchantments(RegistryEvent.Register event) { event.getRegistry().register(EnchantmentEnderDamage.INSTANCE); From 9fac3b1dda2f393b394827188c20c2db5b7d1722 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:05:32 -0600 Subject: [PATCH 06/77] Fix AoE issues (#2194) --- .../java/gregtech/api/items/toolitem/ToolHelper.java | 12 +++++++++++- src/main/java/gregtech/common/EventHandlers.java | 9 ++++----- src/main/java/gregtech/common/ToolEventHandlers.java | 4 +++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java index 002858aac70..52423c510f7 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java @@ -456,13 +456,23 @@ private static boolean isBlockAoEHarvestable(ItemStack stack, World world, Entit // natural to mine, but avoid exploits like mining Obsidian quickly by instead targeting Stone. return false; } + state = state.getActualState(world, pos); return stack.canHarvestBlock(state); } + public static boolean canMineWithPick(String tool) { + return ToolClasses.WRENCH.equals(tool) || ToolClasses.WIRE_CUTTER.equals(tool); + } + // encompasses all vanilla special case tool checks for harvesting public static boolean isToolEffective(IBlockState state, Set toolClasses, int harvestLevel) { Block block = state.getBlock(); - if (toolClasses.contains(block.getHarvestTool(state))) { + String harvestTool = block.getHarvestTool(state); + if (canMineWithPick(harvestTool) && ConfigHolder.machines.requireGTToolsForBlocks) { + if (!toolClasses.contains(harvestTool)) return false; + } + + if (toolClasses.contains(harvestTool)) { return block.getHarvestLevel(state) <= harvestLevel; } diff --git a/src/main/java/gregtech/common/EventHandlers.java b/src/main/java/gregtech/common/EventHandlers.java index ad4a4f3da8f..dbe8d76fd7d 100644 --- a/src/main/java/gregtech/common/EventHandlers.java +++ b/src/main/java/gregtech/common/EventHandlers.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.toolitem.ToolClasses; +import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.pipenet.longdist.LongDistanceNetwork; import gregtech.api.pipenet.tile.IPipeTile; @@ -117,7 +118,7 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE if (event.canHarvest()) { ItemStack item = event.getEntityPlayer().getHeldItemMainhand(); String tool = event.getTargetBlock().getBlock().getHarvestTool(event.getTargetBlock()); - if (!canMineWithPick(tool)) { + if (!ToolHelper.canMineWithPick(tool)) { return; } if (ConfigHolder.machines.requireGTToolsForBlocks) { @@ -136,14 +137,12 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE public static void onDestroySpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) { ItemStack item = event.getEntityPlayer().getHeldItemMainhand(); String tool = event.getState().getBlock().getHarvestTool(event.getState()); - if (tool != null && !item.isEmpty() && canMineWithPick(tool) && item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { + if (tool != null && !item.isEmpty() && ToolHelper.canMineWithPick(tool) && item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { event.setNewSpeed(event.getNewSpeed() * 0.75f); } } - public static boolean canMineWithPick(String tool) { - return ToolClasses.WRENCH.equals(tool) || ToolClasses.WIRE_CUTTER.equals(tool); - } + @SubscribeEvent(priority = EventPriority.LOW) public static void onEntityLivingFallEvent(LivingFallEvent event) { diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index 8cb08b82576..77ba6c49b70 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -223,7 +223,9 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) } // AoE selection box and block damage overlay - if (!sneaking && stack.getItem() instanceof IGTTool) { + if (!sneaking && stack.getItem() instanceof IGTTool tool) { + state = state.getActualState(player.world, pos); + if (!ToolHelper.isToolEffective(state, tool.getToolClasses(stack), tool.getTotalHarvestLevel(stack))) return; Set validPositions = ToolHelper.getHarvestableBlocks(stack, player.world, player, event.getTarget()); if (validPositions.isEmpty()) return; From 58f0feae03afa800589c706fab36d99e6ebf80b1 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:06:00 -0600 Subject: [PATCH 07/77] Refactor World Accelerator (#2175) --- .../metatileentities/MetaTileEntities.java | 2 +- .../MetaTileEntityWorldAccelerator.java | 285 +++++++++++------- .../resources/assets/gregtech/lang/en_us.lang | 17 +- 3 files changed, 184 insertions(+), 120 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 562e819c4f4..2bd9f3efa0a 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -142,7 +142,7 @@ public class MetaTileEntities { public static final MetaTileEntityBlockBreaker[] BLOCK_BREAKER = new MetaTileEntityBlockBreaker[4]; public static final MetaTileEntityItemCollector[] ITEM_COLLECTOR = new MetaTileEntityItemCollector[4]; public static final MetaTileEntityFisher[] FISHER = new MetaTileEntityFisher[4]; - public static final MetaTileEntityWorldAccelerator[] WORLD_ACCELERATOR = new MetaTileEntityWorldAccelerator[8]; // no ULV, no MAX + public static final MetaTileEntityWorldAccelerator[] WORLD_ACCELERATOR = new MetaTileEntityWorldAccelerator[8]; // LV-UV public static MetaTileEntityMachineHatch MACHINE_HATCH; public static MetaTileEntityPassthroughHatchItem PASSTHROUGH_HATCH_ITEM; public static MetaTileEntityPassthroughHatchFluid PASSTHROUGH_HATCH_FLUID; diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java index 34b3ca6c69c..36738c40390 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java @@ -36,73 +36,38 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; import static gregtech.api.capability.GregtechDataCodes.SYNC_TILE_MODE; public class MetaTileEntityWorldAccelerator extends TieredMetaTileEntity implements IControllable { - private static final String COFH_CLASS_NAME = "cofh.thermalexpansion.block.device.TileDeviceBase"; - private static final Map> blacklistedClasses = new Object2ObjectOpenHashMap<>(); private static final Object2BooleanFunction> blacklistCache = new Object2BooleanOpenHashMap<>(); private static boolean gatheredClasses = false; - private static boolean considerTile(TileEntity tile) { - if (tile instanceof IGregTechTileEntity || tile instanceof TileEntityPipeBase) return false; - - if (!gatheredClasses) { - for (String name : ConfigHolder.machines.worldAcceleratorBlacklist) { - if (!blacklistedClasses.containsKey(name)) { - try { - blacklistedClasses.put(name, Class.forName(name)); - } catch (ClassNotFoundException ignored) { - GTLog.logger.warn("Could not find class {} for World Accelerator Blacklist.", name); - } - } - } - try { - blacklistedClasses.put(COFH_CLASS_NAME, Class.forName(COFH_CLASS_NAME)); - } catch (ClassNotFoundException ignored) {/**/} - - gatheredClasses = true; - } - - final Class tileClass = tile.getClass(); - if (blacklistCache.containsKey(tileClass)) { - return blacklistCache.getBoolean(tileClass); - } else { - for (Class clazz : blacklistedClasses.values()) { - if (clazz.isAssignableFrom(tileClass)) { - blacklistCache.put(tileClass, false); - return false; - } - } - blacklistCache.put(tileClass, true); - return true; - } - } - - private final long energyPerTick; private final int speed; private boolean tileMode = false; private boolean isActive = false; private boolean isPaused = false; private int lastTick; - private Supplier> range; + + // Variables for Random Tick mode optimization + // limit = ((tier - min) / (max - min)) * 2^tier + private static final int[] SUCCESS_LIMITS = {1, 8, 27, 64, 125, 216, 343, 512}; + private final int successLimit; + private BlockPos bottomLeftCorner; public MetaTileEntityWorldAccelerator(ResourceLocation metaTileEntityId, int tier) { super(metaTileEntityId, tier); - //consume 8 amps - this.energyPerTick = GTValues.V[tier] * getMaxInputOutputAmperage(); this.lastTick = 0; this.speed = (int) Math.pow(2, tier); + this.successLimit = SUCCESS_LIMITS[tier - 1]; initializeInventory(); } @@ -119,14 +84,15 @@ protected void reinitializeEnergyContainer() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.world_accelerator.description")); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.power_usage", getRandomTickModeAmperage(), getTEModeAmperage())); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.acceleration", speed)); tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in", getMaxInputOutputAmperage())); tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area")); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_tile")); - tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2, getTier() * 2)); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2 + 1, getTier() * 2 + 1)); } @Override @@ -139,71 +105,106 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t @Override protected long getMaxInputOutputAmperage() { + // Take in 8A so that we have a little extra room for cable loss/gaining a buffer in TE mode. + // Could change this to 5A for random tick mode, but I think it's not very important. return 8L; } + protected long getRandomTickModeAmperage() { + return 3L; + } + + protected long getTEModeAmperage() { + return 6L; + } + @Override public void update() { super.update(); if (!getWorld().isRemote) { - if (isPaused) { - if (isActive) { - setActive(false); - } - return; - } - if (energyContainer.getEnergyStored() < energyPerTick) { - if (isActive) { - setActive(false); + if (isPaused && isActive) { + setActive(false); + } else if (!isPaused) { + int currentTick = FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter(); + if (currentTick != lastTick) { // Prevent other tick accelerators from accelerating us + lastTick = currentTick; + boolean wasSuccessful = isTEMode() ? handleTEMode() : handleRandomTickMode(); + if (!wasSuccessful) { + setActive(false); + } else if (!isActive) { + setActive(true); + } } - return; } - if (!isActive) { - setActive(true); + } + } + + private boolean handleTEMode() { + if (!drawEnergy(getTEModeAmperage() * GTValues.V[getTier()])) return false; + + World world = getWorld(); + BlockPos pos = getPos(); + for (EnumFacing facing : EnumFacing.VALUES) { + TileEntity te = getNeighbor(facing); + + if (!(te instanceof ITickable tickable)) continue; + if (te.isInvalid()) continue; + if (!canTileAccelerate(te)) continue; + + for (int i = 0; i < speed; i++) { + tickable.update(); } - int currentTick = FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter(); - if (currentTick != lastTick) { // Prevent other tick accelerators from accelerating us - World world = getWorld(); - final BlockPos currentPos = getPos(); - lastTick = currentTick; - if (isTEMode()) { - energyContainer.removeEnergy(energyPerTick); - for (EnumFacing neighbourFace : EnumFacing.VALUES) { - TileEntity neighbourTile = getNeighbor(neighbourFace); - if (neighbourTile instanceof ITickable neighbourTickTile && !neighbourTile.isInvalid() && considerTile(neighbourTile)) { - for (int i = 0; i < speed; i++) { - neighbourTickTile.update(); - } - } - } - } else { - energyContainer.removeEnergy(energyPerTick / 2); - if (range == null) { - int area = getTier() * 2; - range = () -> BlockPos.getAllInBoxMutable(currentPos.add(-area, -area, -area), currentPos.add(area, area, area)); - } - for (BlockPos.MutableBlockPos pos : range.get()) { - if (pos.getY() > 256 || pos.getY() < 0) { // Early termination - continue; - } - if (world.isBlockLoaded(pos)) { - for (int i = 0; i < speed; i++) { - if (GTValues.RNG.nextInt(100) < getTier()) { - // Rongmario: - // randomTick instead of updateTick since some modders can mistake where to put their code. - // Fresh IBlockState before every randomTick, this could easily change after every randomTick call - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - if (block.getTickRandomly()) { - block.randomTick(world, pos.toImmutable(), state, world.rand); - } - } - } - } - } - } + } + return true; + } + + private boolean handleRandomTickMode() { + if (!drawEnergy(getRandomTickModeAmperage() * GTValues.V[getTier()])) return false; + + World world = getWorld(); + int maxHeight = world.getHeight(); + // room for hitting ourselves randomly, or blocks not loaded, or blocks outside of height limits + int attempts = successLimit * 3; + BlockPos cornerPos = getCornerPos(); + BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(cornerPos); + int randRange = (getTier() << 1) + 1; + for (int i = 0, j = 0; i < successLimit && j < attempts; j++) { + int x = GTValues.RNG.nextInt(randRange); + int y = GTValues.RNG.nextInt(randRange); + int z = GTValues.RNG.nextInt(randRange); + mutablePos.setPos( + cornerPos.getX() + x, + cornerPos.getY() + y, + cornerPos.getZ() + z); + + if (mutablePos.getY() > maxHeight || mutablePos.getY() < 0) continue; + if (!world.isBlockLoaded(mutablePos)) continue; + if (mutablePos.equals(getPos())) continue; + + IBlockState state = world.getBlockState(mutablePos); + Block block = state.getBlock(); + if (block.getTickRandomly()) { + block.randomTick(world, mutablePos.toImmutable(), state, world.rand); } + i++; // success, whether it actually ticked or not + } + return true; + } + + private boolean drawEnergy(long usage) { + if (energyContainer.getEnergyStored() < usage) return false; + energyContainer.removeEnergy(usage); + return true; + } + + private BlockPos getCornerPos() { + if (bottomLeftCorner == null) { + bottomLeftCorner = new BlockPos( + getPos().getX() - getTier(), + getPos().getY() - getTier(), + getPos().getZ() - getTier()); } + return bottomLeftCorner; } @Override @@ -241,11 +242,14 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci } public void setTEMode(boolean inverted) { - tileMode = inverted; - if (!getWorld().isRemote) { - writeCustomData(SYNC_TILE_MODE, b -> b.writeBoolean(tileMode)); - notifyBlockUpdate(); - markDirty(); + if (tileMode != inverted) { + this.tileMode = inverted; + World world = getWorld(); + if (world != null && !world.isRemote) { + writeCustomData(SYNC_TILE_MODE, b -> b.writeBoolean(tileMode)); + notifyBlockUpdate(); + markDirty(); + } } } @@ -258,6 +262,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean("TileMode", tileMode); data.setBoolean("isPaused", isPaused); + data.setBoolean("IsActive", isActive); return data; } @@ -266,6 +271,7 @@ public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); tileMode = data.getBoolean("TileMode"); isPaused = data.getBoolean("isPaused"); + isActive = data.getBoolean("IsActive"); } @Override @@ -273,6 +279,7 @@ public void writeInitialSyncData(PacketBuffer buf) { super.writeInitialSyncData(buf); buf.writeBoolean(tileMode); buf.writeBoolean(isPaused); + buf.writeBoolean(isActive); } @Override @@ -280,6 +287,7 @@ public void receiveInitialSyncData(PacketBuffer buf) { super.receiveInitialSyncData(buf); this.tileMode = buf.readBoolean(); this.isPaused = buf.readBoolean(); + this.isActive = buf.readBoolean(); } @Override @@ -288,18 +296,20 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == IS_WORKING) { this.isActive = buf.readBoolean(); scheduleRenderUpdate(); - } - if (dataId == SYNC_TILE_MODE) { + } else if (dataId == SYNC_TILE_MODE) { this.tileMode = buf.readBoolean(); scheduleRenderUpdate(); } } protected void setActive(boolean active) { - this.isActive = active; - markDirty(); - if (!getWorld().isRemote) { - writeCustomData(IS_WORKING, buf -> buf.writeBoolean(active)); + if (this.isActive != active) { + this.isActive = active; + markDirty(); + World world = getWorld(); + if (world != null && !world.isRemote) { + writeCustomData(IS_WORKING, buf -> buf.writeBoolean(active)); + } } } @@ -309,9 +319,11 @@ public boolean isWorkingEnabled() { } @Override - public void setWorkingEnabled(boolean b) { - isPaused = !b; - notifyBlockUpdate(); + public void setWorkingEnabled(boolean isWorkingEnabled) { + if (this.isPaused != isWorkingEnabled) { + this.isPaused = isWorkingEnabled; + notifyBlockUpdate(); + } } @Override @@ -321,4 +333,51 @@ public T getCapability(Capability capability, EnumFacing side) { } return super.getCapability(capability, side); } + + private static void gatherWorldAcceleratorBlacklist() { + if (!gatheredClasses) { + for (String name : ConfigHolder.machines.worldAcceleratorBlacklist) { + if (!blacklistedClasses.containsKey(name)) { + try { + blacklistedClasses.put(name, Class.forName(name)); + } catch (ClassNotFoundException ignored) { + GTLog.logger.warn("Could not find class {} for World Accelerator Blacklist!", name); + } + } + } + + try { + // Block CoFH tile entities by default, non-overridable + String cofhTileClass = "cofh.thermalexpansion.block.device.TileDeviceBase"; + blacklistedClasses.put(cofhTileClass, Class.forName(cofhTileClass)); + } catch (ClassNotFoundException ignored) {/**/} + + gatheredClasses = true; + } + } + + private static boolean canTileAccelerate(TileEntity tile) { + // Check GT tiles first + if (tile instanceof IGregTechTileEntity || tile instanceof TileEntityPipeBase) return false; + + gatherWorldAcceleratorBlacklist(); + + final Class tileClass = tile.getClass(); + if (blacklistCache.containsKey(tileClass)) { + // Tile already tracked, return the value + return blacklistCache.getBoolean(tileClass); + } + + // Tile not tracked, see if it is a subclass of a blacklisted class or not + for (Class clazz : blacklistedClasses.values()) { + if (clazz.isAssignableFrom(tileClass)) { + // Is a subclass, so it cannot be accelerated + blacklistCache.put(tileClass, false); + return false; + } + } + // Is not a subclass, so it can be accelerated + blacklistCache.put(tileClass, true); + return true; + } } diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 2aaf2a64db9..e178e75b770 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4390,19 +4390,24 @@ gregtech.machine.fisher.requirement=Requires a %,dx%,d centered square of water # World Accelerator gregtech.machine.world_accelerator.lv.name=Basic World Accelerator +gregtech.machine.world_accelerator.lv.tooltip=Tick accelerates Blocks gregtech.machine.world_accelerator.mv.name=Advanced World Accelerator +gregtech.machine.world_accelerator.mv.tooltip=Tick accelerates Blocks gregtech.machine.world_accelerator.hv.name=Advanced World Accelerator II +gregtech.machine.world_accelerator.hv.tooltip=Tick accelerates Blocks gregtech.machine.world_accelerator.ev.name=Advanced World Accelerator III +gregtech.machine.world_accelerator.ev.tooltip=Tick accelerates Blocks gregtech.machine.world_accelerator.iv.name=Elite World Accelerator +gregtech.machine.world_accelerator.iv.tooltip=Time in a §mBottle§r§7 Block gregtech.machine.world_accelerator.luv.name=Elite World Accelerator II +gregtech.machine.world_accelerator.luv.tooltip=Time in a §mBottle§r§7 Block gregtech.machine.world_accelerator.zpm.name=Elite World Accelerator III +gregtech.machine.world_accelerator.zpm.tooltip=Time in a §mBottle§r§7 Block gregtech.machine.world_accelerator.uv.name=Ultimate World Accelerator -gregtech.machine.world_accelerator.uhv.name=Epic World Accelerator -gregtech.machine.world_accelerator.uev.name=Epic World Accelerator II -gregtech.machine.world_accelerator.uiv.name=Epic World Accelerator III -gregtech.machine.world_accelerator.uxv.name=Epic World Accelerator IV -gregtech.machine.world_accelerator.opv.name=Legendary World Accelerator -gregtech.machine.world_accelerator.description=Tick accelerates nearby blocks in one of 2 modes: §fTile Entity§7 or §fRandom Tick§7. Use Screwdriver to change mode. +gregtech.machine.world_accelerator.uv.tooltip=Time Anomaly +gregtech.machine.world_accelerator.description=Use §fScrewdriver§7 to change mode between §fRandom Tick§7 and §fTile Entity§7 modes. +gregtech.machine.world_accelerator.power_usage=Uses up to §f%dA§7 in Random Tick mode, §f%dA§7 in Tile Entity mode. +gregtech.machine.world_accelerator.acceleration=§dAccelerates up to: §f%dx gregtech.machine.world_accelerator.working_area=§bWorking Area: gregtech.machine.world_accelerator.working_area_tile= Tile Entity Mode:§f Adjacent Blocks gregtech.machine.world_accelerator.working_area_random= Random Tick Mode:§f %dx%d From b34aea7fe5ce4f9d492ac58daac14b80de54244a Mon Sep 17 00:00:00 2001 From: Tictim Date: Sun, 26 Nov 2023 13:10:49 +0900 Subject: [PATCH 08/77] Very Important PR (#2197) --- src/main/java/gregtech/common/CommonProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/CommonProxy.java b/src/main/java/gregtech/common/CommonProxy.java index cf6f67486c1..04c05dde5fe 100644 --- a/src/main/java/gregtech/common/CommonProxy.java +++ b/src/main/java/gregtech/common/CommonProxy.java @@ -332,7 +332,7 @@ public static void registerRecipesLowest(RegistryEvent.Register event) GTRecipeManager.loadLatest(); // On initial load we need to postpone cache flushing until FMLPostInitializationEvent - // to account for WoodMachineRecipes#postInit(). + // to account for post-init recipe registration if (Loader.instance().hasReachedState(LoaderState.AVAILABLE)) GTRecipeInputCache.disableCache(); } From dbd62e99803bf319f7ee856624f6dbb1e655f88c Mon Sep 17 00:00:00 2001 From: StarL0stGaming <65464466+StarL0st@users.noreply.github.com> Date: Sun, 26 Nov 2023 13:19:51 -0700 Subject: [PATCH 09/77] Add Pick Block support to Super Tanks (#2169) --- .../api/metatileentity/MetaTileEntity.java | 9 +++++++-- .../metatileentities/MetaTileEntityClipboard.java | 2 +- .../storage/MetaTileEntityQuantumTank.java | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index b17d84cb1e5..eb6a7d5606f 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -43,6 +43,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -807,7 +808,7 @@ public final ItemStack getStackForm() { public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) { } - public ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { + public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { IndexedCuboid6 hitCuboid = result.cuboid6; if (hitCuboid.data instanceof CoverRayTracer.CoverSideData coverSideData) { Cover cover = getCoverAtSide(coverSideData.side); @@ -818,12 +819,16 @@ public ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { if (cover != null) { return cover.getPickItem(); } - return getStackForm(); + return getPickItem(player); } else { return ItemStack.EMPTY; } } + public ItemStack getPickItem(EntityPlayer player) { + return getStackForm(); + } + /** * Whether this tile entity represents completely opaque cube * diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java index 3e6365ad95a..191cf952abf 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java @@ -520,7 +520,7 @@ public boolean showToolUsages() { } @Override - public ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { + public ItemStack getPickItem(EntityPlayer player) { return this.getClipboard(); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index fcc72c15dda..e1a0627775c 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -593,6 +593,20 @@ protected void setVoiding(boolean isPartialVoid) { } } + @Override + public ItemStack getPickItem(EntityPlayer player) { + if(!player.isCreative()) return super.getPickItem(player); + + ItemStack baseItemStack = getStackForm(); + NBTTagCompound tag = new NBTTagCompound(); + + this.writeItemStackData(tag); + if(!tag.isEmpty()) { + baseItemStack.setTagCompound(tag); + } + return baseItemStack; + } + @Override public boolean needsSneakToRotate() { return true; From 0e716f81ffe856ea783e2698c1e7758967a5b5c1 Mon Sep 17 00:00:00 2001 From: Tictim Date: Mon, 27 Nov 2023 06:33:15 +0900 Subject: [PATCH 10/77] GTParticle/bloom effect refactor and cleanup (#2073) --- .../api/block/VariantActiveBlock.java | 8 +- src/main/java/gregtech/api/cover/Cover.java | 2 +- .../api/metatileentity/MetaTileEntity.java | 2 +- .../metatileentity/MetaTileEntityHolder.java | 34 +- .../gui/widgets/AnimaWidgetGroup.java | 4 +- .../terminal/os/menu/TerminalMenuWidget.java | 4 +- .../gregtech/api/util/interpolate/Eases.java | 59 ++- .../gregtech/api/util/interpolate/IEase.java | 12 + .../java/gregtech/asm/hooks/CTMHooks.java | 17 +- .../java/gregtech/asm/hooks/CTMModHooks.java | 6 +- .../gregtech/asm/hooks/LittleTilesHooks.java | 7 +- .../client/event/ClientEventHandler.java | 5 +- .../model/ActiveVariantBlockBakedModel.java | 6 +- .../client/model/EmissiveOreBakedModel.java | 2 +- .../customtexture/CustomTextureModel.java | 4 +- .../client/model/lamp/LampBakedModel.java | 2 +- .../client/particle/GTBloomParticle.java | 31 ++ .../client/particle/GTLaserBeamParticle.java | 119 +++-- .../client/particle/GTNameTagParticle.java | 63 ++- .../client/particle/GTOverheatParticle.java | 117 +++-- .../gregtech/client/particle/GTParticle.java | 213 +++------ .../client/particle/GTParticleManager.java | 212 ++++----- .../client/particle/GTTexturedParticle.java | 73 --- .../particle/GTTexturedShaderParticle.java | 90 ---- .../client/particle/IGTParticleHandler.java | 25 - .../client/renderer/ICustomRenderFast.java | 21 - .../client/renderer/IRenderSetup.java | 35 ++ .../renderer/pipe/LaserPipeRenderer.java | 4 +- .../texture/cube/OrientedOverlayRenderer.java | 2 +- .../texture/cube/SidedCubeRenderer.java | 2 +- .../cube/SimpleOrientedCubeRenderer.java | 12 +- .../texture/cube/SimpleOverlayRenderer.java | 2 +- .../texture/cube/SimpleSidedCubeRenderer.java | 2 +- .../texture/custom/FireboxActiveRenderer.java | 2 +- .../shader/postprocessing/BloomEffect.java | 73 +-- .../shader/postprocessing/BloomType.java | 41 ++ .../shader/postprocessing/IPostRender.java | 12 - .../client/utils/BloomEffectUtil.java | 438 ++++++++++++++---- .../client/utils/EffectRenderContext.java | 133 ++++++ .../gregtech/client/utils/IBloomEffect.java | 35 ++ .../gregtech/client/utils/RenderUtil.java | 27 +- .../gregtech/common/blocks/BlockLamp.java | 5 +- .../common/blocks/BlockLampBorderless.java | 9 +- .../java/gregtech/common/blocks/BlockOre.java | 3 +- .../MetaTileEntityPrimitiveBlastFurnace.java | 2 +- .../electric/MetaTileEntityAssemblyLine.java | 21 +- .../electric/MetaTileEntityFusionReactor.java | 106 +++-- .../pipelike/cable/tile/TileEntityCable.java | 2 +- .../common/pipelike/laser/BlockLaserPipe.java | 9 +- .../terminal/app/appstore/AppCardWidget.java | 2 +- .../terminal/app/appstore/AppPageWidget.java | 4 +- .../app/guide/widget/GuidePageWidget.java | 14 +- .../widget/GuidePageEditorWidget.java | 12 +- 53 files changed, 1254 insertions(+), 893 deletions(-) create mode 100644 src/main/java/gregtech/client/particle/GTBloomParticle.java delete mode 100644 src/main/java/gregtech/client/particle/GTTexturedParticle.java delete mode 100644 src/main/java/gregtech/client/particle/GTTexturedShaderParticle.java delete mode 100644 src/main/java/gregtech/client/particle/IGTParticleHandler.java delete mode 100644 src/main/java/gregtech/client/renderer/ICustomRenderFast.java create mode 100644 src/main/java/gregtech/client/renderer/IRenderSetup.java create mode 100644 src/main/java/gregtech/client/shader/postprocessing/BloomType.java delete mode 100644 src/main/java/gregtech/client/shader/postprocessing/IPostRender.java create mode 100644 src/main/java/gregtech/client/utils/EffectRenderContext.java create mode 100644 src/main/java/gregtech/client/utils/IBloomEffect.java diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index affb72ce7ce..439d6302329 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -88,15 +88,16 @@ protected boolean canSilkHarvest() { return false; } + @Nonnull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { + public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { return layer == getRenderLayer() || - layer == (isBloomEnabled(getState(state)) ? BloomEffectUtil.getRealBloomLayer() : BlockRenderLayer.CUTOUT); + layer == BloomEffectUtil.getEffectiveBloomLayer(isBloomEnabled(getState(state))); } @Nonnull @@ -123,8 +124,9 @@ protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{VARIANT, ACTIVE_DEPRECATED}, new IUnlistedProperty[]{ACTIVE}); } + @Nonnull @Override - public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { IExtendedBlockState ext = ((IExtendedBlockState) state) .withProperty(ACTIVE, Minecraft.getMinecraft().world != null && isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos)); diff --git a/src/main/java/gregtech/api/cover/Cover.java b/src/main/java/gregtech/api/cover/Cover.java index f3862653c43..b6f9c4c0a7a 100644 --- a/src/main/java/gregtech/api/cover/Cover.java +++ b/src/main/java/gregtech/api/cover/Cover.java @@ -234,7 +234,7 @@ void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translatio @SideOnly(Side.CLIENT) default boolean canRenderInLayer(@NotNull BlockRenderLayer renderLayer) { - return renderLayer == BlockRenderLayer.CUTOUT_MIPPED || renderLayer == BloomEffectUtil.getRealBloomLayer(); + return renderLayer == BlockRenderLayer.CUTOUT_MIPPED || renderLayer == BloomEffectUtil.getEffectiveBloomLayer(); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index eb6a7d5606f..b05b5790c7b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -264,7 +264,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @SideOnly(Side.CLIENT) public boolean canRenderInLayer(BlockRenderLayer renderLayer) { return renderLayer == BlockRenderLayer.CUTOUT_MIPPED || - renderLayer == BloomEffectUtil.getRealBloomLayer() || + renderLayer == BloomEffectUtil.getEffectiveBloomLayer() || (renderLayer == BlockRenderLayer.TRANSLUCENT && !getWorld().getBlockState(getPos()).getValue(BlockMachine.OPAQUE)); } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index dd6847048ea..8f8b7266275 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -444,30 +444,28 @@ public void setCustomName(String customName) { if (!getName().equals(customName)) { this.customName = customName; if (world.isRemote) { - if (hasCustomName()) { - if (nameTagParticle == null) { - nameTagParticle = new GTNameTagParticle(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, getName()); - nameTagParticle.setOnUpdate(p -> { - if (isInvalid() || !world.isBlockLoaded(pos, false)) { - p.setExpired(); - } - }); - GTParticleManager.INSTANCE.addEffect(nameTagParticle); - } else { - nameTagParticle.name = getName(); - } - } else { - if (nameTagParticle != null) { - nameTagParticle.setExpired(); - nameTagParticle = null; - } - } + updateNameTagParticle(); } else { markAsDirty(); } } } + @SideOnly(Side.CLIENT) + private void updateNameTagParticle(){ + if (hasCustomName()) { + if (nameTagParticle == null) { + nameTagParticle = new GTNameTagParticle(this, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5); + GTParticleManager.INSTANCE.addEffect(nameTagParticle); + } + } else { + if (nameTagParticle != null) { + nameTagParticle.setExpired(); + nameTagParticle = null; + } + } + } + @Nonnull @Override public String getName() { diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java index a99eb6db1cf..0083a6c5313 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java @@ -37,7 +37,7 @@ public void updateScreenOnFrame() { public final void maximizeWidget(Consumer callback) { this.scale = 0; setVisible(true); - interpolator = new Interpolator(0, 1, 10, Eases.EaseLinear, + interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value-> scale = value.floatValue(), value-> { interpolator = null; @@ -51,7 +51,7 @@ public final void maximizeWidget(Consumer callback) { @SideOnly(Side.CLIENT) public final void minimizeWidget(Consumer callback) { this.scale = 1; - interpolator = new Interpolator(1, 0, 10, Eases.EaseLinear, + interpolator = new Interpolator(1, 0, 10, Eases.LINEAR, value-> scale = value.floatValue(), value-> { setVisible(false); diff --git a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java index 9286b375af4..75ea235e1a4 100644 --- a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java +++ b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java @@ -127,7 +127,7 @@ public void removeComponents() { public void hideMenu() { if (!isHide && interpolator == null) { int y = getSelfPosition().y; - interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x - getSize().width, 6, Eases.EaseLinear, + interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x - getSize().width, 6, Eases.LINEAR, value-> setSelfPosition(new Position(value.intValue(), y)), value-> { setVisible(false); @@ -144,7 +144,7 @@ public void showMenu() { if (isHide && interpolator == null) { setVisible(true); int y = getSelfPosition().y; - interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x + getSize().width, 6, Eases.EaseLinear, + interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x + getSize().width, 6, Eases.LINEAR, value-> setSelfPosition(new Position(value.intValue(), y)), value-> { interpolator = null; diff --git a/src/main/java/gregtech/api/util/interpolate/Eases.java b/src/main/java/gregtech/api/util/interpolate/Eases.java index 87f74763cb4..a631c47ab13 100644 --- a/src/main/java/gregtech/api/util/interpolate/Eases.java +++ b/src/main/java/gregtech/api/util/interpolate/Eases.java @@ -1,24 +1,47 @@ package gregtech.api.util.interpolate; -public enum Eases implements IEase{ - EaseLinear(input-> input), - EaseQuadIn(input-> input * input), - EaseQuadInOut(input->{ - if((input /= 0.5f) < 1) { - return 0.5f * input * input; - } - return -0.5f * ((--input) * (input - 2) - 1); - }), - EaseQuadOut(input->-input * (input - 2)); +import org.jetbrains.annotations.ApiStatus; +public enum Eases implements IEase { + LINEAR { + @Override + public float getInterpolation(float t) { + return t; + } + }, + QUAD_IN { + @Override + public float getInterpolation(float t) { + return t * t; + } + }, + QUAD_IN_OUT { + @Override + public float getInterpolation(float t) { + if (t <= 0.5f) return 2f * t * t; + t = -2f * t + 2f; + return 1f - t * t * 0.5f; + } + }, + QUAD_OUT { + @Override + public float getInterpolation(float t) { + return -t * (t - 2); + } + }; - IEase ease; + // Deprecated names below - will be removed on future update - Eases(IEase ease){ - this.ease = ease; - } - @Override - public float getInterpolation(float t) { - return ease.getInterpolation(t); - } + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static final Eases EaseLinear = LINEAR; + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static final Eases EaseQuadIn = QUAD_IN; + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static final Eases EaseQuadInOut = QUAD_IN_OUT; + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static final Eases EaseQuadOut = QUAD_OUT; } diff --git a/src/main/java/gregtech/api/util/interpolate/IEase.java b/src/main/java/gregtech/api/util/interpolate/IEase.java index cb4c02b0e4e..86ff5a06a46 100644 --- a/src/main/java/gregtech/api/util/interpolate/IEase.java +++ b/src/main/java/gregtech/api/util/interpolate/IEase.java @@ -1,5 +1,17 @@ package gregtech.api.util.interpolate; +/** + * Object representation of an easing function.

+ * Easing functions describe numerical change rate of values, on a timescale of {@code 0 ~ 1}. + * @see Eases + */ +@FunctionalInterface public interface IEase { + /** + * Get change rate of values on specific time {@code t}. + * + * @param t Specific time to sample the rate. Value in a range of {@code 0 ~ 1} is expected. + * @return Numerical value interpolated by the easing function. The returned value has range of {@code 0 ~ 1}. + */ float getInterpolation(float t); } diff --git a/src/main/java/gregtech/asm/hooks/CTMHooks.java b/src/main/java/gregtech/asm/hooks/CTMHooks.java index fb001ec8eb5..97a29daf6e3 100644 --- a/src/main/java/gregtech/asm/hooks/CTMHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMHooks.java @@ -18,25 +18,26 @@ public class CTMHooks { public static ThreadLocal ENABLE = new ThreadLocal<>(); - public static boolean checkLayerWithOptiFine(boolean flag, byte layers, BlockRenderLayer layer) { + public static boolean checkLayerWithOptiFine(boolean canRenderInLayer, byte layers, BlockRenderLayer layer) { if (Shaders.isOptiFineShaderPackLoaded()) { - if (flag) { - if (layer == BloomEffectUtil.BLOOM) return false; - } else if (((layers >> BloomEffectUtil.BLOOM.ordinal()) & 1) == 1 && layer == BloomEffectUtil.getRealBloomLayer()) { + if (canRenderInLayer) { + if (layer == BloomEffectUtil.getBloomLayer()) return false; + } else if ((layers >> BloomEffectUtil.getBloomLayer().ordinal() & 1) == 1 && + layer == BloomEffectUtil.getEffectiveBloomLayer()) { return true; } } - return flag; + return canRenderInLayer; } public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, IBakedModel bakedModel, IBlockState state, EnumFacing side, long rand) { if (Shaders.isOptiFineShaderPackLoaded() && CTMHooks.ENABLE.get() == null) { - if (layer == BloomEffectUtil.BLOOM) { + if (layer == BloomEffectUtil.getBloomLayer()) { return Collections.emptyList(); - } else if (layer == BloomEffectUtil.getRealBloomLayer()) { + } else if (layer == BloomEffectUtil.getEffectiveBloomLayer()) { CTMHooks.ENABLE.set(true); List result = new ArrayList<>(ret); - ForgeHooksClient.setRenderLayer(BloomEffectUtil.BLOOM); + ForgeHooksClient.setRenderLayer(BloomEffectUtil.getBloomLayer()); result.addAll(bakedModel.getQuads(state, side, rand)); ForgeHooksClient.setRenderLayer(layer); CTMHooks.ENABLE.set(null); diff --git a/src/main/java/gregtech/asm/hooks/CTMModHooks.java b/src/main/java/gregtech/asm/hooks/CTMModHooks.java index 05c75c85542..02b37430e95 100644 --- a/src/main/java/gregtech/asm/hooks/CTMModHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMModHooks.java @@ -23,15 +23,15 @@ public class CTMModHooks { } public static boolean canRenderInLayer(IModelCTM model, IBlockState state, BlockRenderLayer layer) { - boolean flag = model.canRenderInLayer(state, layer); + boolean canRenderInLayer = model.canRenderInLayer(state, layer); if (model instanceof ModelCTM && layers != null) { try { - return CTMHooks.checkLayerWithOptiFine(flag, layers.getByte(model), layer); + return CTMHooks.checkLayerWithOptiFine(canRenderInLayer, layers.getByte(model), layer); } catch (Exception ignored) { layers = null; GTLog.logger.error("CTMModHooks Field error"); } } - return flag; + return canRenderInLayer; } } diff --git a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java index c1ea6d37bc1..c8186bd733d 100644 --- a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java +++ b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java @@ -24,7 +24,7 @@ public static class BloomLayeredRenderBoxCache extends LayeredRenderBoxCache { private List translucent = null; public List get(BlockRenderLayer layer) { - if (layer == BloomEffectUtil.BLOOM) { + if (layer == BloomEffectUtil.getBloomLayer()) { return bloom; } switch (layer) { @@ -41,7 +41,7 @@ public List get(BlockRenderLayer layer) { } public void set(List cubes, BlockRenderLayer layer) { - if (layer == BloomEffectUtil.BLOOM) { + if (layer == BloomEffectUtil.getBloomLayer()) { bloom = cubes; } switch (layer) { @@ -76,7 +76,7 @@ public void sort() { if (!OptifineHelper.isActive()) return; - for (Iterator iterator = solid.iterator(); iterator.hasNext();) { + for (Iterator iterator = solid.iterator(); iterator.hasNext(); ) { LittleRenderBox littleRenderingCube = iterator.next(); if (littleRenderingCube.needsResorting) { cutout_mipped.add(littleRenderingCube); @@ -84,6 +84,5 @@ public void sort() { } } } - } } diff --git a/src/main/java/gregtech/client/event/ClientEventHandler.java b/src/main/java/gregtech/client/event/ClientEventHandler.java index 6aee3649f37..35f9773cbe3 100644 --- a/src/main/java/gregtech/client/event/ClientEventHandler.java +++ b/src/main/java/gregtech/client/event/ClientEventHandler.java @@ -43,6 +43,7 @@ @Mod.EventBusSubscriber(Side.CLIENT) public class ClientEventHandler { + @SuppressWarnings("ConstantValue") @SubscribeEvent(priority = EventPriority.HIGHEST) public static void onDrawBlockHighlight(DrawBlockHighlightEvent event) { if (event.getTarget().getBlockPos() == null) { @@ -83,8 +84,8 @@ public static void onRenderWorldLast(RenderWorldLastEvent event) { @SubscribeEvent public static void onRenderGameOverlayPre(RenderGameOverlayEvent.Pre event) { TerminalARRenderer.renderGameOverlayEvent(event); - if (ConfigHolder.misc.debug && event instanceof RenderGameOverlayEvent.Text) { - GTParticleManager.debugOverlay((RenderGameOverlayEvent.Text) event); + if (ConfigHolder.misc.debug && event instanceof RenderGameOverlayEvent.Text text) { + GTParticleManager.debugOverlay(text); } } diff --git a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java index e1b07554437..3bbd8a638b4 100644 --- a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java +++ b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java @@ -84,15 +84,15 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin // If bloom is disabled (either by model specific bloom config or the presence of O**ifine shaders) // it is rendered on CUTOUT layer instead. if (getBloomConfig()) { - return MinecraftForgeClient.getRenderLayer() == BloomEffectUtil.BLOOM ? + return MinecraftForgeClient.getRenderLayer() == BloomEffectUtil.getBloomLayer() ? getBloomQuads(m, state, side, rand) : m.getQuads(state, side, rand); } else { - if (MinecraftForgeClient.getRenderLayer() == BloomEffectUtil.BLOOM) { + if (MinecraftForgeClient.getRenderLayer() == BloomEffectUtil.getBloomLayer()) { return Collections.emptyList(); } else if (MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.CUTOUT) { List quads = new ArrayList<>(m.getQuads(state, side, rand)); - ForgeHooksClient.setRenderLayer(BloomEffectUtil.BLOOM); + ForgeHooksClient.setRenderLayer(BloomEffectUtil.getBloomLayer()); quads.addAll(getBloomQuads(m, state, side, rand)); ForgeHooksClient.setRenderLayer(BlockRenderLayer.CUTOUT); return quads; diff --git a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java index 84dd5f32097..5362c802ac4 100644 --- a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java +++ b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java @@ -35,7 +35,7 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin return quads; } else if (layer == BlockRenderLayer.CUTOUT_MIPPED) { return getBaseModel().getQuads(null, side, 0); - } else if (layer == BloomEffectUtil.getRealBloomLayer()) { + } else if (layer == BloomEffectUtil.getEffectiveBloomLayer()) { return getOverlayQuads(side, rand); } else { return Collections.emptyList(); diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java index 0ed0f99ce7e..6b7b4101407 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java @@ -51,8 +51,8 @@ public IModel getVanillaParent() { } public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - boolean flag = (layers < 0 && state.getBlock().getRenderLayer() == layer) || ((layers >> layer.ordinal()) & 1) == 1; - return CTMHooks.checkLayerWithOptiFine(flag, layers, layer); + boolean canRenderInLayer = (layers < 0 && state.getBlock().getRenderLayer() == layer) || ((layers >> layer.ordinal()) & 1) == 1; + return CTMHooks.checkLayerWithOptiFine(canRenderInLayer, layers, layer); } @Override diff --git a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java index 443992be3b7..0a72161fa1a 100644 --- a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java +++ b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java @@ -62,7 +62,7 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin return getFilteredQuads(true, true, state, side, rand); } else if (layer == BlockRenderLayer.SOLID) { return getFilteredQuads(false, true, state, side, rand); - } else if (layer == BloomEffectUtil.BLOOM || layer == BlockRenderLayer.CUTOUT) { + } else if (layer == BloomEffectUtil.getBloomLayer() || layer == BlockRenderLayer.CUTOUT) { return getFilteredQuads(true, false, state, side, rand); } else { return Collections.emptyList(); diff --git a/src/main/java/gregtech/client/particle/GTBloomParticle.java b/src/main/java/gregtech/client/particle/GTBloomParticle.java new file mode 100644 index 00000000000..e674d796a21 --- /dev/null +++ b/src/main/java/gregtech/client/particle/GTBloomParticle.java @@ -0,0 +1,31 @@ +package gregtech.client.particle; + +import gregtech.client.renderer.IRenderSetup; +import gregtech.client.shader.postprocessing.BloomType; +import gregtech.client.utils.BloomEffectUtil; +import gregtech.client.utils.IBloomEffect; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class GTBloomParticle extends GTParticle implements IBloomEffect { + + private final BloomEffectUtil.BloomRenderTicket ticket; + + public GTBloomParticle(double posX, double posY, double posZ) { + super(posX, posY, posZ); + + this.ticket = BloomEffectUtil.registerBloomRender(getBloomRenderSetup(), getBloomType(), this); + } + + @Nullable + protected abstract IRenderSetup getBloomRenderSetup(); + + @Nonnull + protected abstract BloomType getBloomType(); + + @Override + protected void onExpired() { + this.ticket.invalidate(); + } +} diff --git a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java index 98bf9e7223d..affc28b8c64 100644 --- a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java +++ b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java @@ -1,7 +1,10 @@ package gregtech.client.particle; import codechicken.lib.vec.Vector3; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.client.renderer.IRenderSetup; import gregtech.client.renderer.fx.LaserBeamRenderer; +import gregtech.client.utils.EffectRenderContext; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -9,17 +12,19 @@ import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) -public class GTLaserBeamParticle extends GTParticle{ - private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class GTLaserBeamParticle extends GTParticle { + + @Nullable + private final MetaTileEntity mte; + @Nullable private ResourceLocation body; + @Nullable private ResourceLocation head; private Vector3 direction; private float beamHeight = 0.075f; @@ -28,48 +33,48 @@ public class GTLaserBeamParticle extends GTParticle{ private float emit; private boolean doubleVertical; - public GTLaserBeamParticle(World worldIn, Vector3 startPos, Vector3 endPos) { - super(worldIn, startPos.x, startPos.y, startPos.z); - this.setMotionless(true); - this.setImmortal(); - this.setRenderRange(64); + public GTLaserBeamParticle(@Nullable MetaTileEntity mte, @Nonnull Vector3 startPos, @Nonnull Vector3 endPos) { + super(startPos.x, startPos.y, startPos.z); + this.mte = mte; this.direction = endPos.copy().subtract(startPos); + this.setRenderRange(64); } @Override - public boolean shouldRendered(Entity entityIn, float partialTicks) { - if (squareRenderRange < 0) return true; - Vec3d eyePos = entityIn.getPositionEyes(partialTicks); - return eyePos.squareDistanceTo(posX, posY, posZ) <= squareRenderRange || - eyePos.squareDistanceTo(posX + direction.x, posY + direction.y, posZ + direction.z) <= squareRenderRange; + public boolean shouldRender(@Nonnull EffectRenderContext context) { + double renderRange = getSquaredRenderRange(); + if (renderRange < 0) return true; + Vec3d eyePos = context.renderViewEntity().getPositionEyes(context.partialTicks()); + return eyePos.squareDistanceTo(posX, posY, posZ) <= renderRange || + eyePos.squareDistanceTo(posX + direction.x, posY + direction.y, posZ + direction.z) <= renderRange; } /** * Set beam body texture - * + * * @param body texture resource. */ - public GTLaserBeamParticle setBody(ResourceLocation body) { + public GTLaserBeamParticle setBody(@Nullable ResourceLocation body) { this.body = body; return this; } /** * Set head body texture - * + * * @param head texture resource. */ - public GTLaserBeamParticle setHead(ResourceLocation head) { + public GTLaserBeamParticle setHead(@Nullable ResourceLocation head) { this.head = head; return this; } - public GTLaserBeamParticle setStartPos(Vector3 startPos) { + public GTLaserBeamParticle setStartPos(@Nonnull Vector3 startPos) { this.direction.add(posX, posY, posZ).subtract(startPos); return this; } - public GTLaserBeamParticle setEndPos(Vector3 endPos) { + public GTLaserBeamParticle setEndPos(@Nonnull Vector3 endPos) { this.direction = endPos.copy().subtract(posX, posY, posZ); return this; } @@ -95,6 +100,7 @@ public float getAlpha() { /** * Set emit speed. + * * @param emit emit speed. from start to end. */ public GTLaserBeamParticle setEmit(float emit) { @@ -104,9 +110,10 @@ public GTLaserBeamParticle setEmit(float emit) { /** * Is 3D beam rendered by two perpendicular quads. - *

- * It is not about performance, some textures are suitable for this, some are not, please choose according to the texture used. - *

+ *

+ * It is not about performance, some textures are suitable for this, some are not, please choose according to the + * texture used. + *

*/ public GTLaserBeamParticle setDoubleVertical(boolean doubleVertical) { this.doubleVertical = doubleVertical; @@ -119,17 +126,29 @@ public boolean shouldDisableDepth() { } @Override - public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - GlStateManager.translate(posX - interpPosX, posY - interpPosY, posZ - interpPosZ); + public void onUpdate() { + if (mte == null || mte.isValid() && + mte.getWorld().isBlockLoaded(mte.getPos(), false) && + mte.getWorld().getTileEntity(mte.getPos()) == mte.getHolder()) { + return; + } + setExpired(); + } + + @Override + public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + GlStateManager.translate(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); Vector3 cameraDirection = null; if (!doubleVertical) { - cameraDirection = new Vector3(posX, posY, posZ).subtract(new Vector3(entityIn.getPositionEyes(partialTicks))); + Vec3d positionEyes = context.renderViewEntity().getPositionEyes(context.partialTicks()); + cameraDirection = new Vector3(posX, posY, posZ).subtract(new Vector3(positionEyes)); } - TextureManager renderEngine = MINECRAFT.getRenderManager().renderEngine; + TextureManager renderEngine = Minecraft.getMinecraft().getRenderManager().renderEngine; ITextureObject bodyTexture = null; if (body != null) { bodyTexture = renderEngine.getTexture(body); + //noinspection ConstantValue if (bodyTexture == null) { bodyTexture = new SimpleTexture(body); renderEngine.loadTexture(body, bodyTexture); @@ -138,27 +157,50 @@ public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialT ITextureObject headTexture = null; if (head != null) { headTexture = renderEngine.getTexture(head); + //noinspection ConstantValue if (headTexture == null) { headTexture = new SimpleTexture(head); renderEngine.loadTexture(head, headTexture); } } - float offset = - emit * (MINECRAFT.player.ticksExisted + partialTicks); - LaserBeamRenderer.renderRawBeam(bodyTexture == null ? -1 : bodyTexture.getGlTextureId(), headTexture == null ? -1 : headTexture.getGlTextureId(), direction, cameraDirection, beamHeight, headWidth, alpha, offset); - GlStateManager.translate(interpPosX - posX, interpPosY - posY, interpPosZ - posZ); + float offset = -emit * (Minecraft.getMinecraft().player.ticksExisted + context.partialTicks()); + LaserBeamRenderer.renderRawBeam(bodyTexture == null ? -1 : + bodyTexture.getGlTextureId(), headTexture == null ? -1 : + headTexture.getGlTextureId(), direction, cameraDirection, beamHeight, headWidth, alpha, offset); + GlStateManager.translate(context.cameraX() - posX, context.cameraY() - posY, context.cameraZ() - posZ); + } + + @Nullable + @Override + public IRenderSetup getRenderSetup() { + return SETUP; } @Override - public IGTParticleHandler getGLHandler() { - return HANDLER; + public String toString() { + return "GTLaserBeamParticle{" + + "mte=" + mte + + ", body=" + body + + ", head=" + head + + ", direction=" + direction + + ", beamHeight=" + beamHeight + + ", headWidth=" + headWidth + + ", alpha=" + alpha + + ", emit=" + emit + + ", doubleVertical=" + doubleVertical + + ", posX=" + posX + + ", posY=" + posY + + ", posZ=" + posZ + + '}'; } - public static IGTParticleHandler HANDLER = new IGTParticleHandler() { + private static final IRenderSetup SETUP = new IRenderSetup() { + float lastBrightnessX; float lastBrightnessY; @Override - public void preDraw(BufferBuilder buffer) { + public void preDraw(@Nonnull BufferBuilder buffer) { GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); lastBrightnessX = OpenGlHelper.lastBrightnessX; lastBrightnessY = OpenGlHelper.lastBrightnessY; @@ -168,12 +210,11 @@ public void preDraw(BufferBuilder buffer) { } @Override - public void postDraw(BufferBuilder buffer) { + public void postDraw(@Nonnull BufferBuilder buffer) { GlStateManager.enableCull(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); } - }; } diff --git a/src/main/java/gregtech/client/particle/GTNameTagParticle.java b/src/main/java/gregtech/client/particle/GTNameTagParticle.java index 9e43396fecf..6e7dbc03d18 100644 --- a/src/main/java/gregtech/client/particle/GTNameTagParticle.java +++ b/src/main/java/gregtech/client/particle/GTNameTagParticle.java @@ -1,36 +1,47 @@ package gregtech.client.particle; +import gregtech.api.metatileentity.MetaTileEntityHolder; +import gregtech.client.utils.EffectRenderContext; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class GTNameTagParticle extends GTParticle{ - private static final FontRenderer FONT_RENDERER = Minecraft.getMinecraft().fontRenderer; - public String name; - - public GTNameTagParticle(World worldIn, double posXIn, double posYIn, double posZIn, String name) { - super(worldIn, posXIn, posYIn, posZIn); - this.setMotionless(true); - this.setImmortal(); + +import javax.annotation.Nonnull; +import java.util.Objects; + +public class GTNameTagParticle extends GTParticle { + + private final MetaTileEntityHolder metaTileEntityHolder; + + public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, double posZ) { + super(posX, posY, posZ); + this.metaTileEntityHolder = Objects.requireNonNull(metaTileEntityHolder); this.setRenderRange(64); - this.name = name; } @Override - public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - float rotationYaw = entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks; - float rotationPitch = entityIn.prevRotationPitch + (entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks; + public void onUpdate() { + if (metaTileEntityHolder.isInvalid() || + !metaTileEntityHolder.getWorld().isBlockLoaded(metaTileEntityHolder.getPos(), false) || + !metaTileEntityHolder.hasCustomName()) { + setExpired(); + } + } + + @Override + public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + String name = this.metaTileEntityHolder.getName(); + if (name.isEmpty()) return; + + Entity renderViewEntity = context.renderViewEntity(); + float rotationYaw = renderViewEntity.prevRotationYaw + (renderViewEntity.rotationYaw - renderViewEntity.prevRotationYaw) * context.partialTicks(); + float rotationPitch = renderViewEntity.prevRotationPitch + (renderViewEntity.rotationPitch - renderViewEntity.prevRotationPitch) * context.partialTicks(); GlStateManager.pushMatrix(); - GlStateManager.translate(posX -interpPosX, posY - interpPosY, posZ - interpPosZ); + GlStateManager.translate(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-rotationYaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(rotationPitch, 1.0F, 0.0F, 0.0F); @@ -38,7 +49,7 @@ public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialT GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - int width = FONT_RENDERER.getStringWidth(name) / 2; + int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(name) / 2; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); @@ -51,8 +62,18 @@ public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialT GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); - FONT_RENDERER.drawString(name, -width, 0, -1); + Minecraft.getMinecraft().fontRenderer.drawString(name, -width, 0, -1); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } + + @Override + public String toString() { + return "GTNameTagParticle{" + + "metaTileEntityHolder=" + metaTileEntityHolder + + ", posX=" + posX + + ", posY=" + posY + + ", posZ=" + posZ + + '}'; + } } diff --git a/src/main/java/gregtech/client/particle/GTOverheatParticle.java b/src/main/java/gregtech/client/particle/GTOverheatParticle.java index c1e7f5a6229..d3e518f5e57 100644 --- a/src/main/java/gregtech/client/particle/GTOverheatParticle.java +++ b/src/main/java/gregtech/client/particle/GTOverheatParticle.java @@ -2,8 +2,10 @@ import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; +import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.postprocessing.BloomEffect; -import gregtech.client.utils.BloomEffectUtil; +import gregtech.client.shader.postprocessing.BloomType; +import gregtech.client.utils.EffectRenderContext; import gregtech.client.utils.RenderBufferHelper; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; @@ -13,25 +15,25 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; /** * @author brachy84 */ -public class GTOverheatParticle extends GTParticle { +public class GTOverheatParticle extends GTBloomParticle { /** - * http://www.vendian.org/mncharity/dir3/blackbody/ + * Source */ - public static final int[] blackBodyColors = { + private static final int[] blackBodyColors = { 0xFF3300, // 1000 K 0xFF5300, // 1200 K 0xFF6500, // 1400 K @@ -138,28 +140,29 @@ public static int getBlackBodyColor(int temperature) { if (index >= blackBodyColors.length - 1) return blackBodyColors[blackBodyColors.length - 1]; int color = blackBodyColors[index]; - return RenderUtil.colorInterpolator(color, blackBodyColors[index + 1]).apply(temperature % 200 / 200f); + return RenderUtil.interpolateColor(color, blackBodyColors[index + 1], temperature % 200 / 200f); } + private final TileEntityCable tileEntity; + protected final int meltTemp; protected int temperature = 293; - protected final BlockPos pos; protected List pipeBoxes; protected boolean insulated; protected float alpha = 0; protected int color = blackBodyColors[0]; - public GTOverheatParticle(World worldIn, BlockPos pos, int meltTemp, List pipeBoxes, boolean insulated) { - super(worldIn, pos.getX(), pos.getY(), pos.getZ()); - this.pos = pos; + public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, boolean insulated) { + super(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()); + this.tileEntity = tileEntity; this.meltTemp = meltTemp; + this.pipeBoxes = pipeBoxes; updatePipeBoxes(pipeBoxes); this.insulated = insulated; - this.motionless = true; } - public void updatePipeBoxes(List pipeBoxes) { + public void updatePipeBoxes(@Nonnull List pipeBoxes) { this.pipeBoxes = pipeBoxes; for (Cuboid6 cuboid : this.pipeBoxes) { cuboid.expand(0.001); @@ -176,7 +179,7 @@ public void setTemperature(int temperature) { alpha = 0f; } else if (temperature < 1000) { alpha = (temperature - 500f) / 500f; - alpha *= 0.8; + alpha *= 0.8f; } else { alpha = 0.8f; } @@ -185,8 +188,7 @@ public void setTemperature(int temperature) { @Override public void onUpdate() { - TileEntity te = world.getTileEntity(pos); - if (!(te instanceof TileEntityCable) || !((TileEntityCable) te).isParticleAlive()) { + if (tileEntity.isInvalid() || !tileEntity.isParticleAlive()) { setExpired(); return; } @@ -197,71 +199,88 @@ public void onUpdate() { } private void spawnSmoke() { + BlockPos pos = tileEntity.getPos(); float xPos = pos.getX() + 0.5F; float yPos = pos.getY() + 0.9F; float zPos = pos.getZ() + 0.5F; float ySpd = 0.3F + 0.1F * GTValues.RNG.nextFloat(); - world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, 0, ySpd, 0); + tileEntity.getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, 0, ySpd, 0); } @Override - public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - if (insulated) - return; + public String toString() { + return "GTOverheatParticle{" + + "tileEntity=" + tileEntity + + ", meltTemp=" + meltTemp + + ", temperature=" + temperature + + ", pipeBoxes=" + pipeBoxes + + ", insulated=" + insulated + + ", alpha=" + alpha + + ", color=" + color + + '}'; + } - BloomEffectUtil.requestCustomBloom(RENDER_HANDLER, buffer1 -> { - float red = (color >> 16) & 0xFF, green = (color >> 8) & 0xFF, blue = color & 0xFF; - red /= 255; - green /= 255; - blue /= 255; + @Nullable + @Override + protected IRenderSetup getBloomRenderSetup() { + return SETUP; + } - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.pushMatrix(); - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.translate(posX - interpPosX, posY - interpPosY, posZ - interpPosZ); - buffer.begin(7, DefaultVertexFormats.POSITION_COLOR); - for (Cuboid6 cuboid : pipeBoxes) { - RenderBufferHelper.renderCubeFace(bufferbuilder, cuboid, red, green, blue, alpha, true); - } - tessellator.draw(); - GlStateManager.popMatrix(); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - }); + @Nonnull + @Override + protected BloomType getBloomType() { + ConfigHolder.HeatEffectBloom heatEffectBloom = ConfigHolder.client.shader.heatEffectBloom; + return BloomType.fromValue(heatEffectBloom.useShader ? heatEffectBloom.bloomStyle : -1); } - static BloomEffectUtil.IBloomRenderFast RENDER_HANDLER = new BloomEffectUtil.IBloomRenderFast() { - @Override - public int customBloomStyle() { - return ConfigHolder.client.shader.heatEffectBloom.useShader ? ConfigHolder.client.shader.heatEffectBloom.bloomStyle : -1; + @Override + public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + float red = ((color >> 16) & 0xFF) / 255f; + float green = ((color >> 8) & 0xFF) / 255f; + float blue = (color & 0xFF) / 255f; + + buffer.setTranslation(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); + for (Cuboid6 cuboid : pipeBoxes) { + RenderBufferHelper.renderCubeFace(buffer, cuboid, red, green, blue, alpha, true); } + } + + @Override + public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + return !this.insulated; + } + + private static final IRenderSetup SETUP = new IRenderSetup() { float lastBrightnessX; float lastBrightnessY; @Override @SideOnly(Side.CLIENT) - public void preDraw(BufferBuilder buffer) { + public void preDraw(@Nonnull BufferBuilder buffer) { BloomEffect.strength = (float) ConfigHolder.client.shader.heatEffectBloom.strength; BloomEffect.baseBrightness = (float) ConfigHolder.client.shader.heatEffectBloom.baseBrightness; BloomEffect.highBrightnessThreshold = (float) ConfigHolder.client.shader.heatEffectBloom.highBrightnessThreshold; BloomEffect.lowBrightnessThreshold = (float) ConfigHolder.client.shader.heatEffectBloom.lowBrightnessThreshold; BloomEffect.step = 1; - lastBrightnessX = OpenGlHelper.lastBrightnessX; - lastBrightnessY = OpenGlHelper.lastBrightnessY; + this.lastBrightnessX = OpenGlHelper.lastBrightnessX; + this.lastBrightnessY = OpenGlHelper.lastBrightnessY; GlStateManager.color(1, 1, 1, 1); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); } @Override @SideOnly(Side.CLIENT) - public void postDraw(BufferBuilder buffer) { + public void postDraw(@Nonnull BufferBuilder buffer) { + buffer.setTranslation(0, 0, 0); + Tessellator.getInstance().draw(); GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); } }; diff --git a/src/main/java/gregtech/client/particle/GTParticle.java b/src/main/java/gregtech/client/particle/GTParticle.java index 84a7982bb82..3a142f040ab 100644 --- a/src/main/java/gregtech/client/particle/GTParticle.java +++ b/src/main/java/gregtech/client/particle/GTParticle.java @@ -1,191 +1,120 @@ package gregtech.client.particle; -import net.minecraft.client.particle.Particle; +import gregtech.client.renderer.IRenderSetup; +import gregtech.client.utils.EffectRenderContext; import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.entity.Entity; -import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** - * Created with IntelliJ IDEA. - * - * @Author: KilaBash - * @Date: 2021/08/31 - * @Description: + * A custom particle implementation with framework for more advanced rendering capabilities.

+ * GTParticle instances are managed by {@link GTParticleManager}. GTParticle instances with same {@link IRenderSetup}s + * will be drawn together as a batch. */ @SideOnly(Side.CLIENT) -public abstract class GTParticle extends Particle { - protected int texturesCount = 1; - protected int squareRenderRange = -1; - protected boolean motionless = false; - protected Consumer onUpdate; - - public GTParticle(World worldIn, double posXIn, double posYIn, double posZIn) { - super(worldIn, posXIn, posYIn, posZIn); - } +public abstract class GTParticle { + + public double posX; + public double posY; + public double posZ; + + private double renderRange = -1; + private double squaredRenderRange = -1; - public GTParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) { - super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + private boolean expired; + + protected GTParticle(double posX, double posY, double posZ) { + this.posX = posX; + this.posY = posY; + this.posZ = posZ; } - @Override - public int getFXLayer() { - return shouldDisableDepth() ? 1 : 0; + public boolean shouldRender(@Nonnull EffectRenderContext context) { + if (squaredRenderRange < 0) return true; + return context.renderViewEntity().getPositionEyes(context.partialTicks()) + .squareDistanceTo(posX, posY, posZ) <= squaredRenderRange; } - public boolean shouldRendered(Entity entityIn, float partialTicks) { - if (squareRenderRange < 0) return true; - return entityIn.getPositionEyes(partialTicks).squareDistanceTo(posX, posY, posZ) <= squareRenderRange; + public final boolean isAlive() { + return !expired; } - /** - * Set the render range, over the range do not render. - *

- * -1 -- always render. - *

- */ - public void setRenderRange(int renderRange) { - this.squareRenderRange = renderRange * renderRange; + public final boolean isExpired() { + return expired; } - /** - * Particles can live forever now. - */ - public void setImmortal() { - this.particleAge = -1; + public final void setExpired() { + if (this.expired) return; + this.expired = true; + onExpired(); } /** - * It can stop motion. It always has a motion before {@link Particle#onUpdate()} + * @return {@code true} to render the particle with + * {@link net.minecraft.client.renderer.GlStateManager#depthMask(boolean) depth mask} feature disabled; in other + * words, render the particle without modifying depth buffer. */ - public void setMotionless(boolean motionless) { - this.motionless = motionless; + public boolean shouldDisableDepth() { + return false; } /** - * Set color blend of this particle. + * @return render range. If the distance between particle and render view entity exceeds this value, the particle + * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and the + * particle will be rendered regardless of the distance. */ - public void setColor(int color) { - this.setRBGColorF((color >> 16 & 255) / 255.0F, - (color >> 8 & 255) / 255.0F, - (color & 255) / 255.0F); - this.setAlphaF((color >> 24 & 255) / 255.0F); + public final double getRenderRange() { + return this.renderRange; } /** - * Set scale of this particle. + * @return squared render range, or negative value if render distance check is disabled. */ - public void setScale(float scale) { - this.particleScale = scale; + public final double getSquaredRenderRange() { + return this.squaredRenderRange; } /** - * Set Gravity of this particle. + * Sets the render range. If the distance between particle and render view entity exceeds this value, the particle + * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and the + * particle will be rendered regardless of the distance. + * + * @param renderRange Render range */ - public void setGravity(float gravity) { - this.particleGravity = gravity; + public final void setRenderRange(double renderRange) { + this.renderRange = renderRange; + if (renderRange >= 0) this.squaredRenderRange = renderRange * renderRange; + else this.squaredRenderRange = -1; } /** - * Set sub-texture coord. + * Update the particle. This method is called each tick. */ - public void setTexturesIndex(int particleTextureIndexX, int particleTextureIndexY) { - this.particleTextureIndexX = particleTextureIndexX; - this.particleTextureIndexY = particleTextureIndexY; - } + public void onUpdate() {} /** - * How many sub-textures in the current texture. it always 16 in the {@link Particle}. but we allow the bigger or smaller texture in the GTParticle. + * Called once on expiration. */ - public void setTexturesCount(int texturesCount) { - this.texturesCount = texturesCount; - } + protected void onExpired() {} /** - * Update each tick + * Render the particle. If this particle has non-null {@link #getRenderSetup()} associated, this method will be + * called between a {@link IRenderSetup#preDraw(BufferBuilder)} call and a + * {@link IRenderSetup#postDraw(BufferBuilder)} call. + * + * @param buffer buffer builder + * @param context render context */ - public void setOnUpdate(Consumer onUpdate) { - this.onUpdate = onUpdate; - } - - public void setParticleTextureIndex(int particleTextureIndex) { - this.particleTextureIndexX = particleTextureIndex % texturesCount; - this.particleTextureIndexY = particleTextureIndex / texturesCount; - } - - public float getTexturesCount() { - return texturesCount; - } - - public boolean isMotionless() { - return motionless; - } - - public int getRenderRange() { - return squareRenderRange >= 0 ? -1 : (int) Math.sqrt(squareRenderRange); - } - - @Override - public void onUpdate() { - if (this.onUpdate != null) { - onUpdate.accept(this); - } - if (this.particleAge >= 0 && this.particleAge++ >= this.particleMaxAge) { - this.setExpired(); - } - - if (!motionless) { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - - this.motionY -= 0.04D * (double)this.particleGravity; - this.move(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; - - if (this.onGround) { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - } - } - } + public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) {} - @Override - public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - float minU = this.particleTextureIndexX * 1F / texturesCount; - float maxU = minU + 1F / texturesCount;//0.0624375F; - float minV = this.particleTextureIndexY * 1F / texturesCount; - float maxV = minV + 1F / texturesCount;//0.0624375F; - float scale = 0.1F * this.particleScale; - - if (this.particleTexture != null) { - minU = this.particleTexture.getMinU(); - maxU = this.particleTexture.getMaxU(); - minV = this.particleTexture.getMinV(); - maxV = this.particleTexture.getMaxV(); - } - - float renderX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); - float renderY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); - float renderZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); - int brightnessForRender = this.getBrightnessForRender(partialTicks); - int j = brightnessForRender >> 16 & 65535; - int k = brightnessForRender & 65535; - buffer.pos(renderX - rotationX * scale - rotationXY * scale, renderY - rotationZ * scale, (renderZ - rotationYZ * scale - rotationXZ * scale)).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - buffer.pos(renderX - rotationX * scale + rotationXY * scale, renderY + rotationZ * scale, (renderZ - rotationYZ * scale + rotationXZ * scale)).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - buffer.pos(renderX + rotationX * scale + rotationXY * scale, (renderY + rotationZ * scale), (renderZ + rotationYZ * scale + rotationXZ * scale)).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - buffer.pos(renderX + rotationX * scale - rotationXY * scale, (renderY - rotationZ * scale), (renderZ + rotationYZ * scale - rotationXZ * scale)).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - } - - /*** - * Do not create an instance here; use a static instance plz + /** + * @return Render setup for this particle, if exists */ - public IGTParticleHandler getGLHandler() { - return IGTParticleHandler.DEFAULT_FX_HANDLER; + @Nullable + public IRenderSetup getRenderSetup() { + return null; } } diff --git a/src/main/java/gregtech/client/particle/GTParticleManager.java b/src/main/java/gregtech/client/particle/GTParticleManager.java index d245854faeb..79a4a7e8b91 100644 --- a/src/main/java/gregtech/client/particle/GTParticleManager.java +++ b/src/main/java/gregtech/client/particle/GTParticleManager.java @@ -1,14 +1,15 @@ package gregtech.client.particle; import gregtech.api.util.GTLog; +import gregtech.client.renderer.IRenderSetup; +import gregtech.client.utils.EffectRenderContext; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; -import net.minecraft.util.Tuple; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -16,167 +17,167 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; +import javax.annotation.Nonnull; import java.util.*; /** - * //TODO - One day switch to using GPU instances for rendering when particle is under pressure. - * - * @Author: KilaBash - * @Date: 2021/08/31 - * @Description: ParticleManger register, spawn, efficient rendering, update our custom particles. + * Singleton class responsible for managing, updating and rendering {@link GTParticle} instances. */ @SideOnly(Side.CLIENT) public class GTParticleManager { - public final static GTParticleManager INSTANCE = new GTParticleManager(); + public static final GTParticleManager INSTANCE = new GTParticleManager(); + + @Nullable private static World currentWorld = null; - private static final Minecraft mc = Minecraft.getMinecraft(); - private final Map> renderQueueBack = new HashMap<>(); - private final Map> renderQueueFront = new HashMap<>(); - private final Queue> newParticleQueue = new ArrayDeque<>(); + private final Map<@Nullable IRenderSetup, ArrayDeque> depthEnabledParticles = new Object2ObjectLinkedOpenHashMap<>(); + private final Map<@Nullable IRenderSetup, ArrayDeque> depthDisabledParticles = new Object2ObjectLinkedOpenHashMap<>(); - public void addEffect(GTParticle... particles) { - for (GTParticle particle : particles) { - if (particle.getGLHandler() != null) { - newParticleQueue.add(new Tuple<>(particle.getGLHandler(), particle)); - } - } + private final List newParticleQueue = new ArrayList<>(); + + public void addEffect(@Nonnull GTParticle particles) { + newParticleQueue.add(particles); } public void updateEffects() { - updateEffectLayer(); + if (!depthEnabledParticles.isEmpty()) { + updateQueue(depthEnabledParticles); + } + if (!depthDisabledParticles.isEmpty()) { + updateQueue(depthDisabledParticles); + } if (!newParticleQueue.isEmpty()) { - for (Tuple handlerParticle = newParticleQueue.poll(); handlerParticle != null; handlerParticle = newParticleQueue.poll()) { - IGTParticleHandler handler = handlerParticle.getFirst(); - GTParticle particle = handlerParticle.getSecond(); - Map> renderQueue = particle.getFXLayer() > 0 ? renderQueueFront : renderQueueBack; - if (!renderQueue.containsKey(handler)) { - renderQueue.put(handler, new ArrayDeque<>()); - } - ArrayDeque arrayDeque = renderQueue.get(handler); - if (arrayDeque.size() > 6000) { - arrayDeque.removeFirst().setExpired(); + for (GTParticle particle : newParticleQueue) { + var queue = particle.shouldDisableDepth() ? depthDisabledParticles : depthEnabledParticles; + + ArrayDeque particles = queue.computeIfAbsent(particle.getRenderSetup(), setup -> new ArrayDeque<>()); + + if (particles.size() > 6000) { + particles.removeFirst().setExpired(); } - arrayDeque.add(particle); + particles.add(particle); } + newParticleQueue.clear(); } } - private void updateEffectLayer() { - if (!renderQueueBack.isEmpty()) { - updateQueue(renderQueueBack); - } - if (!renderQueueFront.isEmpty()) { - updateQueue(renderQueueFront); - } - } + private void updateQueue(Map> renderQueue) { + Iterator> it = renderQueue.values().iterator(); + while (it.hasNext()) { + ArrayDeque particles = it.next(); - private void updateQueue(Map> renderQueue) { - Iterator>> entryIterator = renderQueue.entrySet().iterator(); - while (entryIterator.hasNext()) { - Map.Entry> entry = entryIterator.next(); - Iterator iterator = entry.getValue().iterator(); - while (iterator.hasNext()) { - Particle particle = iterator.next(); - tickParticle(particle); - if (!particle.isAlive()) { - iterator.remove(); + Iterator it2 = particles.iterator(); + while (it2.hasNext()) { + GTParticle particle = it2.next(); + if (particle.isAlive()) { + try { + particle.onUpdate(); + } catch (RuntimeException exception) { + GTLog.logger.error("particle update error: {}", particle.toString(), exception); + particle.setExpired(); + } + if (particle.isAlive()) continue; } + it2.remove(); } - if (entry.getValue().isEmpty()) { - entryIterator.remove(); + + if (particles.isEmpty()) { + it.remove(); } } } public void clearAllEffects(boolean cleanNewQueue) { if (cleanNewQueue) { - for (Tuple tuple : newParticleQueue) { - tuple.getSecond().setExpired(); + for (GTParticle particle : newParticleQueue) { + particle.setExpired(); } newParticleQueue.clear(); } - for (ArrayDeque particles : renderQueueBack.values()) { - particles.forEach(Particle::setExpired); + for (ArrayDeque particles : depthEnabledParticles.values()) { + for (GTParticle particle : particles) { + particle.setExpired(); + } } - for (ArrayDeque particles : renderQueueFront.values()) { - particles.forEach(Particle::setExpired); + for (ArrayDeque particles : depthDisabledParticles.values()) { + for (GTParticle particle : particles) { + particle.setExpired(); + } } - renderQueueBack.clear(); - renderQueueFront.clear(); + depthEnabledParticles.clear(); + depthDisabledParticles.clear(); } - private void tickParticle(final Particle particle) { - try { - particle.onUpdate(); - } - catch (Throwable throwable) { - GTLog.logger.error("particle update error: {}", particle.toString(), throwable); - particle.setExpired(); - } - } + public void renderParticles(@Nonnull Entity renderViewEntity, float partialTicks) { + if (depthEnabledParticles.isEmpty() && depthDisabledParticles.isEmpty()) return; + + EffectRenderContext instance = EffectRenderContext.getInstance().update(renderViewEntity, partialTicks); - public void renderParticles(Entity entityIn, float partialTicks) { - if (renderQueueBack.isEmpty() && renderQueueFront.isEmpty()) return; - float rotationX = ActiveRenderInfo.getRotationX(); - float rotationZ = ActiveRenderInfo.getRotationZ(); - float rotationYZ = ActiveRenderInfo.getRotationYZ(); - float rotationXY = ActiveRenderInfo.getRotationXY(); - float rotationXZ = ActiveRenderInfo.getRotationXZ(); - Particle.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double) partialTicks; - Particle.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double) partialTicks; - Particle.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double) partialTicks; - Particle.cameraViewDir = entityIn.getLook(partialTicks); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.alphaFunc(GL11.GL_GREATER, 0); - Tessellator tessellator = Tessellator.getInstance(); GlStateManager.disableLighting(); - renderGlParticlesInLayer(renderQueueBack, tessellator, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); + if (!depthDisabledParticles.isEmpty()) { + GlStateManager.depthMask(false); - GlStateManager.depthMask(false); - renderGlParticlesInLayer(renderQueueFront, tessellator, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); + renderGlParticlesInLayer(depthDisabledParticles, instance); + + GlStateManager.depthMask(true); + } + + renderGlParticlesInLayer(depthEnabledParticles, instance); - GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); } - private static void renderGlParticlesInLayer(Map> renderQueue, Tessellator tessellator, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - for (Map.Entry> entry : renderQueue.entrySet()) { - IGTParticleHandler handler = entry.getKey(); - ArrayDeque particles = entry.getValue(); + private static void renderGlParticlesInLayer(@Nonnull Map<@Nullable IRenderSetup, ArrayDeque> renderQueue, + @Nonnull EffectRenderContext context) { + for (var e : renderQueue.entrySet()) { + @Nullable + IRenderSetup handler = e.getKey(); + ArrayDeque particles = e.getValue(); if (particles.isEmpty()) continue; - BufferBuilder buffer = tessellator.getBuffer(); - handler.preDraw(buffer); - for (final GTParticle particle : particles) { - if (particle.shouldRendered(entityIn, partialTicks)) { + + boolean initialized = false; + BufferBuilder buffer = Tessellator.getInstance().getBuffer(); + for (GTParticle particle : particles) { + if (particle.shouldRender(context)) { try { - particle.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY); - } - catch (Throwable throwable) { + if (!initialized) { + initialized = true; + if (handler != null) { + handler.preDraw(buffer); + } + } + particle.renderParticle(buffer, context); + } catch (Throwable throwable) { GTLog.logger.error("particle render error: {}", particle.toString(), throwable); particle.setExpired(); } } } - handler.postDraw(buffer); + if (initialized && handler != null) { + handler.postDraw(buffer); + } } } public static void clientTick(TickEvent.ClientTickEvent event) { - if (event.phase != TickEvent.Phase.END || mc.isGamePaused()) { + if (event.phase != TickEvent.Phase.END || Minecraft.getMinecraft().isGamePaused()) { return; } - if (currentWorld != mc.world) { + WorldClient world = Minecraft.getMinecraft().world; + if (currentWorld != world) { INSTANCE.clearAllEffects(currentWorld != null); - currentWorld = mc.world; + currentWorld = world; } if (currentWorld != null) { @@ -185,24 +186,25 @@ public static void clientTick(TickEvent.ClientTickEvent event) { } public static void renderWorld(RenderWorldLastEvent event) { - Entity entity = mc.getRenderViewEntity(); - INSTANCE.renderParticles(entity == null ? mc.player : entity, event.getPartialTicks()); + Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); + INSTANCE.renderParticles(entity == null ? Minecraft.getMinecraft().player : entity, event.getPartialTicks()); } public static void debugOverlay(RenderGameOverlayEvent.Text event) { if (event.getLeft().size() >= 5) { String particleTxt = event.getLeft().get(4); - particleTxt += "." + TextFormatting.GOLD + " PARTICLE-BACK: " + GTParticleManager.getStatistics(INSTANCE.renderQueueBack) + "PARTICLE-FRONt: " + GTParticleManager.getStatistics(INSTANCE.renderQueueFront); + particleTxt += "." + TextFormatting.GOLD + + " PARTICLE-BACK: " + count(INSTANCE.depthEnabledParticles) + + "PARTICLE-FRONT: " + count(INSTANCE.depthDisabledParticles); event.getLeft().set(4, particleTxt); } } - public static String getStatistics(Map> renderQueue) { + private static int count(Map<@Nullable IRenderSetup, ArrayDeque> renderQueue) { int g = 0; for (Deque queue : renderQueue.values()) { g += queue.size(); } - return " GLFX: " + g; + return g; } - } diff --git a/src/main/java/gregtech/client/particle/GTTexturedParticle.java b/src/main/java/gregtech/client/particle/GTTexturedParticle.java deleted file mode 100644 index 38e4c3cee5c..00000000000 --- a/src/main/java/gregtech/client/particle/GTTexturedParticle.java +++ /dev/null @@ -1,73 +0,0 @@ -package gregtech.client.particle; - -import gregtech.api.gui.resources.ResourceHelper; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created with IntelliJ IDEA. - * - * @Author: KilaBash - * @Date: 2021/09/01 - * @Description: - */ -@SideOnly(Side.CLIENT) -public class GTTexturedParticle extends GTParticle { - private static final Map textureMap = new HashMap<>(); - - private ResourceLocation customTexture; - - public GTTexturedParticle(World worldIn, double posXIn, double posYIn, double posZIn, ResourceLocation texture, int textureCount) { - super(worldIn, posXIn, posYIn, posZIn); - setTexture(texture); - setTexturesCount(textureCount); - } - - public GTTexturedParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, ResourceLocation texture, int textureCount) { - super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); - setTexture(texture); - setTexturesCount(textureCount); - } - - public void setTexture(ResourceLocation texture) { - this.customTexture = texture; - if (!textureMap.containsKey(texture)) { - textureMap.put(texture, new TexturedParticleHandler(texture)); - } - } - - @Override - public final IGTParticleHandler getGLHandler() { - return textureMap.get(customTexture); - } - - private static class TexturedParticleHandler implements IGTParticleHandler { - private final ResourceLocation texture; - - public TexturedParticleHandler(ResourceLocation texture) { - this.texture = texture; - } - - @Override - public void preDraw(BufferBuilder buffer) { - ResourceHelper.bindTexture(texture); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - buffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); - } - - @Override - public void postDraw(BufferBuilder buffer) { - Tessellator.getInstance().draw(); - } - } - -} diff --git a/src/main/java/gregtech/client/particle/GTTexturedShaderParticle.java b/src/main/java/gregtech/client/particle/GTTexturedShaderParticle.java deleted file mode 100644 index 06d6bdf58ab..00000000000 --- a/src/main/java/gregtech/client/particle/GTTexturedShaderParticle.java +++ /dev/null @@ -1,90 +0,0 @@ -package gregtech.client.particle; - -import codechicken.lib.render.shader.ShaderProgram; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.EXTFramebufferObject; - -import static org.lwjgl.opengl.GL11.glGetInteger; - -/** - * Created with IntelliJ IDEA. - * - * @Author: KilaBash - * @Date: 2021/09/01 - * @Description: using shader program render the texture in FBO and then bind this texture for particle. - */ -@SideOnly(Side.CLIENT) -public abstract class GTTexturedShaderParticle extends GTParticle { - public GTTexturedShaderParticle(World worldIn, double posXIn, double posYIn, double posZIn) { - super(worldIn, posXIn, posYIn, posZIn); - } - - @Override - public abstract FBOShaderHandler getGLHandler(); - - public abstract static class FBOShaderHandler implements IGTParticleHandler, ShaderProgram.IUniformCallback { - protected final ShaderProgram program; - private final Framebuffer fbo; - - public FBOShaderHandler(ShaderProgram program) { - this.program = program; - fbo = new Framebuffer(1000, 1000, false); - } - - public void hookPreDraw() { - program.useShader(); - } - - @Override - public final void preDraw(BufferBuilder buffer) { - if (program != null) { - int lastID = glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT); - fbo.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); - fbo.framebufferClear(); - fbo.bindFramebuffer(true); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.viewport(0, 0, 1000, 1000); - Tessellator tessellator = Tessellator.getInstance(); - - hookPreDraw(); - - buffer.begin(7, DefaultVertexFormats.POSITION_TEX); - buffer.pos(-1, 1, 0).tex(0, 0).endVertex(); - buffer.pos(-1, -1, 0).tex(0, 1).endVertex(); - buffer.pos(1, -1, 0).tex(1, 1).endVertex(); - buffer.pos(1, 1, 0).tex(1, 0).endVertex(); - - tessellator.draw(); - - program.releaseShader(); - - Minecraft minecraft = Minecraft.getMinecraft(); - GlStateManager.viewport(0, 0, minecraft.displayWidth, minecraft.displayHeight); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - fbo.unbindFramebufferTexture(); - OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); - - GlStateManager.bindTexture(fbo.framebufferTexture); - } - GlStateManager.color(1,1,1,1); - buffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); - } - - @Override - public final void postDraw(BufferBuilder buffer) { - Tessellator.getInstance().draw(); - } - - } -} diff --git a/src/main/java/gregtech/client/particle/IGTParticleHandler.java b/src/main/java/gregtech/client/particle/IGTParticleHandler.java deleted file mode 100644 index 815e0b1a6fc..00000000000 --- a/src/main/java/gregtech/client/particle/IGTParticleHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package gregtech.client.particle; - -import gregtech.client.renderer.ICustomRenderFast; -import net.minecraft.client.renderer.BufferBuilder; - -/** - * Created with IntelliJ IDEA. - * - * @Author: KilaBash - * @Date: 2021/08/31 - * @Description: copyright Created by brandon3055 on 30/11/2016. - */ - -public interface IGTParticleHandler extends ICustomRenderFast { - IGTParticleHandler DEFAULT_FX_HANDLER = new IGTParticleHandler() { - @Override - public void preDraw(BufferBuilder buffer) { - - } - - @Override - public void postDraw(BufferBuilder buffer) { - } - }; -} diff --git a/src/main/java/gregtech/client/renderer/ICustomRenderFast.java b/src/main/java/gregtech/client/renderer/ICustomRenderFast.java deleted file mode 100644 index ede27ae19d8..00000000000 --- a/src/main/java/gregtech/client/renderer/ICustomRenderFast.java +++ /dev/null @@ -1,21 +0,0 @@ -package gregtech.client.renderer; - -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface ICustomRenderFast { - /** - * Run any pre render gl code here. - * You can also start drawing quads. - */ - @SideOnly(Side.CLIENT) - void preDraw(BufferBuilder buffer); - - /** - * Run any post render gl code here. - * This is where you would draw if you started drawing in preDraw - */ - @SideOnly(Side.CLIENT) - void postDraw(BufferBuilder buffer); -} diff --git a/src/main/java/gregtech/client/renderer/IRenderSetup.java b/src/main/java/gregtech/client/renderer/IRenderSetup.java new file mode 100644 index 00000000000..48e43d7b142 --- /dev/null +++ b/src/main/java/gregtech/client/renderer/IRenderSetup.java @@ -0,0 +1,35 @@ +package gregtech.client.renderer; + +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nonnull; + +/** + *

+ * Object representation of GL setup code. Any recurring render setup / cleanup code should probably go here. + *

+ *

+ * During render, render calls with identical render setup instance will be drawn in a batch. + * Providing proper {@link Object#equals(Object) equals()} and {@link Object#hashCode() hashCode()} implementation is + * recommended for non-singleton render setup implementations. + *

+ */ +@SideOnly(Side.CLIENT) +public interface IRenderSetup { + + /** + * Run any pre render gl code here. + * + * @param buffer Buffer builder + */ + void preDraw(@Nonnull BufferBuilder buffer); + + /** + * Run any post render gl code here. + * + * @param buffer Buffer builder + */ + void postDraw(@Nonnull BufferBuilder buffer); +} diff --git a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java index 5b2a7b8122a..3502a70ae3d 100644 --- a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java @@ -51,7 +51,7 @@ public void buildRenderer(PipeRenderContext renderContext, BlockPipe bl @Override protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, PipeRenderContext renderContext) { - if (active && layer == BloomEffectUtil.getRealBloomLayer() && (renderContext.getConnections() & 0b111111) != 0) { + if (active && layer == BloomEffectUtil.getEffectiveBloomLayer() && (renderContext.getConnections() & 0b111111) != 0) { Cuboid6 innerCuboid = BlockPipe.getSideBox(null, renderContext.getPipeThickness()); if ((renderContext.getConnections() & 0b111111) != 0) { for (EnumFacing side : EnumFacing.VALUES) { @@ -82,7 +82,7 @@ protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderSta @Override protected boolean canRenderInLayer(BlockRenderLayer layer) { - return super.canRenderInLayer(layer) || layer == BloomEffectUtil.getRealBloomLayer(); + return super.canRenderInLayer(layer) || layer == BloomEffectUtil.getEffectiveBloomLayer(); } @Override diff --git a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java index a4fad1705ba..e91a25d51e1 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java @@ -194,7 +194,7 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), rotation); - Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, emissiveSprite, BloomEffectUtil.getRealBloomLayer()); + Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); } else { // have to still render both overlays or else textures will be broken Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java index 6f7e64df9c5..bce57fb7a62 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java @@ -95,7 +95,7 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, BloomEffectUtil.getRealBloomLayer()); + Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); } else { Textures.renderFace(renderState, translation, pipeline, facing, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java index 9534ba2b4bf..5c4fb6b5d61 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java @@ -87,14 +87,14 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] lightPipeline = ConfigHolder.client.machinesEmissiveTextures ? ArrayUtils.add(pipeline, new LightMapOperation(240, 240)) : pipeline; - if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getRealBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getRealBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getRealBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BACK)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BloomEffectUtil.getRealBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BACK)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getRealBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.RIGHT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BloomEffectUtil.getRealBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.RIGHT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java index d854adf62b8..01d92f3b8ab 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java @@ -63,7 +63,7 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getRealBloomLayer()); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java index 58c5fbd3cac..b005e0102a1 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java @@ -98,7 +98,7 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getRealBloomLayer()); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java index 68d7512b0cb..bdbd37ad9a2 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java @@ -34,7 +34,7 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace); if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && facing != EnumFacing.DOWN) { Textures.renderFace(renderState, translation, ArrayUtils.add(pipeline, new LightMapOperation(240, 240)), facing, bounds, emissiveSprite, - ConfigHolder.client.machinesEmissiveTextures ? BloomEffectUtil.getRealBloomLayer() : BlockRenderLayer.CUTOUT_MIPPED); + BloomEffectUtil.getEffectiveBloomLayer(ConfigHolder.client.machinesEmissiveTextures, BlockRenderLayer.CUTOUT_MIPPED)); } } } diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java index 5a15051e5be..1b154a7085a 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java @@ -13,8 +13,10 @@ @SideOnly(Side.CLIENT) public class BloomEffect { - private static Framebuffer[] BUFFERS_D; - private static Framebuffer[] BUFFERS_U; + + private static Framebuffer[] downSampleFBO; + private static Framebuffer[] upSampleFBO; + public static float strength = (float) ConfigHolder.client.shader.strength; public static float baseBrightness = (float) ConfigHolder.client.shader.baseBrightness; public static float highBrightnessThreshold = (float) ConfigHolder.client.shader.highBrightnessThreshold; @@ -52,38 +54,38 @@ private static void blend(Framebuffer bloom, Framebuffer backgroundFBO) { } private static void cleanUP(int lastWidth, int lastHeight) { - if (BUFFERS_D == null || BUFFERS_D.length != ConfigHolder.client.shader.nMips) { - if (BUFFERS_D != null) { - for (int i = 0; i < BUFFERS_D.length; i++) { - BUFFERS_D[i].deleteFramebuffer(); - BUFFERS_U[i].deleteFramebuffer(); + if (downSampleFBO == null || downSampleFBO.length != ConfigHolder.client.shader.nMips) { + if (downSampleFBO != null) { + for (int i = 0; i < downSampleFBO.length; i++) { + downSampleFBO[i].deleteFramebuffer(); + upSampleFBO[i].deleteFramebuffer(); } } - BUFFERS_D = new Framebuffer[ConfigHolder.client.shader.nMips]; - BUFFERS_U = new Framebuffer[ConfigHolder.client.shader.nMips]; + downSampleFBO = new Framebuffer[ConfigHolder.client.shader.nMips]; + upSampleFBO = new Framebuffer[ConfigHolder.client.shader.nMips]; int resX = lastWidth / 2; int resY = lastHeight / 2; for (int i = 0; i < ConfigHolder.client.shader.nMips; i++) { - BUFFERS_D[i] = new Framebuffer(resX, resY, false); - BUFFERS_U[i] = new Framebuffer(resX, resY, false); - BUFFERS_D[i].setFramebufferColor(0, 0, 0, 0); - BUFFERS_U[i].setFramebufferColor(0, 0, 0, 0); - BUFFERS_D[i].setFramebufferFilter(GL11.GL_LINEAR); - BUFFERS_U[i].setFramebufferFilter(GL11.GL_LINEAR); + downSampleFBO[i] = new Framebuffer(resX, resY, false); + upSampleFBO[i] = new Framebuffer(resX, resY, false); + downSampleFBO[i].setFramebufferColor(0, 0, 0, 0); + upSampleFBO[i].setFramebufferColor(0, 0, 0, 0); + downSampleFBO[i].setFramebufferFilter(GL11.GL_LINEAR); + upSampleFBO[i].setFramebufferFilter(GL11.GL_LINEAR); resX /= 2; resY /= 2; } - } else if (RenderUtil.updateFBOSize(BUFFERS_D[0], lastWidth / 2, lastHeight / 2)) { + } else if (RenderUtil.updateFBOSize(downSampleFBO[0], lastWidth / 2, lastHeight / 2)) { int resX = lastWidth / 2; int resY = lastHeight / 2; for (int i = 0; i < ConfigHolder.client.shader.nMips; i++) { - RenderUtil.updateFBOSize(BUFFERS_D[i], resX, resY); - RenderUtil.updateFBOSize(BUFFERS_U[i], resX, resY); - BUFFERS_D[i].setFramebufferFilter(GL11.GL_LINEAR); - BUFFERS_U[i].setFramebufferFilter(GL11.GL_LINEAR); + RenderUtil.updateFBOSize(downSampleFBO[i], resX, resY); + RenderUtil.updateFBOSize(upSampleFBO[i], resX, resY); + downSampleFBO[i].setFramebufferFilter(GL11.GL_LINEAR); + upSampleFBO[i].setFramebufferFilter(GL11.GL_LINEAR); resX /= 2; resY /= 2; } @@ -101,16 +103,16 @@ public static void renderLOG(Framebuffer highLightFBO, Framebuffer backgroundFBO public static void renderUnity(Framebuffer highLightFBO, Framebuffer backgroundFBO) { cleanUP(backgroundFBO.framebufferWidth, backgroundFBO.framebufferHeight); - renderDownSampling(highLightFBO, BUFFERS_D[0]); - for (int i = 0; i < BUFFERS_D.length - 1; i++) { - renderDownSampling(BUFFERS_D[i], BUFFERS_D[i + 1]); + renderDownSampling(highLightFBO, downSampleFBO[0]); + for (int i = 0; i < downSampleFBO.length - 1; i++) { + renderDownSampling(downSampleFBO[i], downSampleFBO[i + 1]); } - renderUpSampling(BUFFERS_D[BUFFERS_D.length - 1], BUFFERS_D[BUFFERS_D.length - 2], BUFFERS_U[BUFFERS_D.length - 2]); - for (int i = BUFFERS_U.length - 2; i > 0; i--) { - renderUpSampling(BUFFERS_U[i], BUFFERS_D[i - 1], BUFFERS_U[i-1]); + renderUpSampling(downSampleFBO[downSampleFBO.length - 1], downSampleFBO[downSampleFBO.length - 2], upSampleFBO[downSampleFBO.length - 2]); + for (int i = upSampleFBO.length - 2; i > 0; i--) { + renderUpSampling(upSampleFBO[i], downSampleFBO[i - 1], upSampleFBO[i - 1]); } - renderUpSampling(BUFFERS_U[0], highLightFBO, PingPongBuffer.swap()); + renderUpSampling(upSampleFBO[0], highLightFBO, PingPongBuffer.swap()); GlStateManager.setActiveTexture(GL13.GL_TEXTURE1); GlStateManager.bindTexture(0); @@ -148,8 +150,8 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background // blur all mips int[] kernelSizeArray = new int[]{3, 5, 7, 9, 11}; highLightFBO.bindFramebufferTexture(); - for (int i = 0; i < BUFFERS_D.length; i++) { - Framebuffer buffer_h = BUFFERS_D[i]; + for (int i = 0; i < downSampleFBO.length; i++) { + Framebuffer buffer_h = downSampleFBO[i]; int kernel = kernelSizeArray[i]; Shaders.renderFullImageInFBO(buffer_h, Shaders.S_BLUR, uniformCache -> { uniformCache.glUniform2F("texSize", buffer_h.framebufferWidth, buffer_h.framebufferHeight); @@ -157,7 +159,7 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background uniformCache.glUniform1I("kernel_radius", kernel); }).bindFramebufferTexture(); - Framebuffer buffer_v = BUFFERS_U[i]; + Framebuffer buffer_v = upSampleFBO[i]; Shaders.renderFullImageInFBO(buffer_v, Shaders.S_BLUR, uniformCache -> { uniformCache.glUniform2F("texSize", buffer_v.framebufferWidth, buffer_v.framebufferHeight); uniformCache.glUniform2F("blurDir", 0, step); @@ -166,13 +168,13 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background } // composite all mips - for (int i = 0; i < BUFFERS_D.length; i++) { + for (int i = 0; i < downSampleFBO.length; i++) { GlStateManager.setActiveTexture(GL13.GL_TEXTURE0 + i); GlStateManager.enableTexture2D(); - BUFFERS_U[i].bindFramebufferTexture(); + upSampleFBO[i].bindFramebufferTexture(); } - Shaders.renderFullImageInFBO(BUFFERS_D[0], Shaders.COMPOSITE, uniformCache -> { + Shaders.renderFullImageInFBO(downSampleFBO[0], Shaders.COMPOSITE, uniformCache -> { uniformCache.glUniform1I("blurTexture1", 0); uniformCache.glUniform1I("blurTexture2", 1); uniformCache.glUniform1I("blurTexture3", 2); @@ -182,12 +184,11 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background uniformCache.glUniform1F("bloomRadius", 1); }); - for (int i = BUFFERS_D.length - 1; i >= 0; i--) { + for (int i = downSampleFBO.length - 1; i >= 0; i--) { GlStateManager.setActiveTexture(GL13.GL_TEXTURE0 + i); GlStateManager.bindTexture(0); } - blend(BUFFERS_D[0], backgroundFBO); + blend(downSampleFBO[0], backgroundFBO); } - } diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java new file mode 100644 index 00000000000..8b65f89503f --- /dev/null +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java @@ -0,0 +1,41 @@ +package gregtech.client.shader.postprocessing; + +import javax.annotation.Nonnull; + +public enum BloomType { + /** + * Simple Gaussian Blur + */ + GAUSSIAN, + /** + * Unity Bloom + */ + UNITY, + /** + * Unreal Bloom + */ + UNREAL, + /** + * No bloom at all :O + */ + DISABLED; + + public int getValue() { + return switch (this) { + case GAUSSIAN -> 0; + case UNITY -> 1; + case UNREAL -> 2; + case DISABLED -> -1; + }; + } + + @Nonnull + public static BloomType fromValue(int value) { + return switch (value) { + case 0 -> GAUSSIAN; + case 1 -> UNITY; + case 2 -> UNREAL; + default -> DISABLED; + }; + } +} diff --git a/src/main/java/gregtech/client/shader/postprocessing/IPostRender.java b/src/main/java/gregtech/client/shader/postprocessing/IPostRender.java deleted file mode 100644 index 7f32ff804df..00000000000 --- a/src/main/java/gregtech/client/shader/postprocessing/IPostRender.java +++ /dev/null @@ -1,12 +0,0 @@ -package gregtech.client.shader.postprocessing; - -/** - * Created with IntelliJ IDEA. - * - * @Author: KilaBash - * @Date: 2021/10/03 - * @Description: - */ -public interface IPostRender { - void render(double x, double y, double z, float partialTicks); -} diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index 2a889adcbb7..b77529a6b4c 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -1,45 +1,189 @@ package gregtech.client.utils; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import gregtech.client.renderer.ICustomRenderFast; +import com.github.bsideup.jabel.Desugar; +import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.Shaders; import gregtech.client.shader.postprocessing.BloomEffect; +import gregtech.client.shader.postprocessing.BloomType; import gregtech.common.ConfigHolder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.shader.Framebuffer; import net.minecraft.entity.Entity; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.world.World; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.reflect.FieldUtils; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; import org.lwjgl.opengl.GL11; +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Consumer; -import static org.lwjgl.opengl.GL11.GL_LINEAR; - @SideOnly(Side.CLIENT) public class BloomEffectUtil { + private static final Map> BLOOM_RENDERS = new Object2ObjectOpenHashMap<>(); + private static final List SCHEDULED_BLOOM_RENDERS = new ArrayList<>(); + + /** + * @deprecated use {@link #getBloomLayer()} + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static BlockRenderLayer BLOOM; - private static Framebuffer BLOOM_FBO; - private static Map>> RENDER_FAST; - public static BlockRenderLayer getRealBloomLayer(){ - return Shaders.isOptiFineShaderPackLoaded() ? BlockRenderLayer.CUTOUT : BLOOM; + private static BlockRenderLayer bloom; + private static Framebuffer bloomFBO; + + @Nullable + private static World currentWorld = null; + + /** + * @return {@link BlockRenderLayer} instance for the bloom render layer. + */ + @Nonnull + public static BlockRenderLayer getBloomLayer() { + return Objects.requireNonNull(bloom, "Bloom effect is not initialized yet"); + } + + /** + * @deprecated renamed for clarity; use {@link #getEffectiveBloomLayer()}. + */ + @Nonnull + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static BlockRenderLayer getRealBloomLayer() { + return getEffectiveBloomLayer(); + } + + /** + * Get "effective bloom layer", i.e. the actual render layer that emissive textures get rendered. Effective bloom + * layers can be changed depending on external factors, such as presence of Optifine. If the actual bloom layer is + * disabled, {@link BlockRenderLayer#CUTOUT} is returned instead. + * + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if + * bloom layer is disabled + * @see #getEffectiveBloomLayer(BlockRenderLayer) + */ + @Nonnull + public static BlockRenderLayer getEffectiveBloomLayer() { + return getEffectiveBloomLayer(BlockRenderLayer.CUTOUT); + } + + /** + * Get "effective bloom layer", i.e. the actual render layer that emissive textures get rendered. Effective bloom + * layers can be changed depending on external factors, such as presence of Optifine. If the actual bloom layer is + * disabled, the fallback layer specified is returned instead. + * + * @param fallback Block render layer to be returned when bloom layer is disabled + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is + * disabled + * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) + */ + @Contract("null -> _; !null -> !null") + public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) { + return Shaders.isOptiFineShaderPackLoaded() ? fallback : bloom; + } + + /** + * Get "effective bloom layer", i.e. the actual render layer that emissive textures get rendered. Effective bloom + * layers can be changed depending on external factors, such as presence of Optifine. If the actual bloom layer is + * disabled, {@link BlockRenderLayer#CUTOUT} is returned instead. + * + * @param isBloomActive Whether bloom layer should be active. If this value is {@code false}, {@code fallback} layer + * will be returned. Has no effect if Optifine is present. + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if + * bloom layer is disabled + * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) + */ + @Nonnull + public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive) { + return getEffectiveBloomLayer(isBloomActive, BlockRenderLayer.CUTOUT); + } + + /** + * Get "effective bloom layer", i.e. the actual render layer that emissive textures get rendered. Effective bloom + * layers can be changed depending on external factors, such as presence of Optifine. If the actual bloom layer is + * disabled, the fallback layer specified is returned instead. + * + * @param isBloomActive Whether bloom layer should be active. If this value is {@code false}, {@code fallback} layer + * will be returned. Has no effect if Optifine is present. + * @param fallback Block render layer to be returned when bloom layer is disabled + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is + * disabled + */ + @Contract("_, null -> _; _, !null -> !null") + public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive, BlockRenderLayer fallback) { + return Shaders.isOptiFineShaderPackLoaded() || !isBloomActive ? fallback : bloom; + } + + /** + * @return bloom framebuffer object + */ + @Nullable + public static Framebuffer getBloomFBO() { + return bloomFBO; + } + + /** + *

+ * Register a custom bloom render callback for subsequent world render. The render call persists until it is + * manually freed by calling {@link BloomRenderTicket#invalidate()}, or automatically freed on client world change. + *

+ *

+ * This method does nothing if Optifine is present. + *

+ * + * @param setup Render setup, if exists + * @param bloomType Type of the bloom + * @param render Rendering callback + * @return Ticket for the registered bloom render callback + * @throws NullPointerException if {@code bloomType == null || render == null} + */ + @Nonnull + @CheckReturnValue + public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup, + @Nonnull BloomType bloomType, + @Nonnull IBloomEffect render) { + BloomRenderTicket ticket = new BloomRenderTicket(setup, bloomType, render); + if (Shaders.isOptiFineShaderPackLoaded()) { + ticket.invalidate(); + } else { + SCHEDULED_BLOOM_RENDERS.add(ticket); + } + return ticket; + } + + /** + * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public static void requestCustomBloom(IBloomRenderFast handler, Consumer render) { + BloomType bloomType = BloomType.fromValue(handler.customBloomStyle()); + registerBloomRender(handler, bloomType, (b, c) -> render.accept(b)).legacy = true; } + @SuppressWarnings({"rawtypes", "unchecked"}) public static void init() { - BLOOM = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[]{String.class}, "Bloom"); + bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[]{String.class}, "Bloom"); + BLOOM = bloom; if (Loader.isModLoaded("nothirium")) { try { //Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to that too. @@ -52,100 +196,110 @@ public static void init() { throw new RuntimeException(e); } } - RENDER_FAST = Maps.newHashMap(); } + // Calls injected via ASM + @SuppressWarnings("unused") public static void initBloomRenderLayer(BufferBuilder[] worldRenderers) { - worldRenderers[BLOOM.ordinal()] = new BufferBuilder(131072); + worldRenderers[bloom.ordinal()] = new BufferBuilder(131072); } - public static int renderBloomBlockLayer(RenderGlobal renderglobal, BlockRenderLayer blockRenderLayer, double partialTicks, int pass, Entity entity) { + // Calls injected via ASM + @SuppressWarnings("unused") + public static int renderBloomBlockLayer(RenderGlobal renderGlobal, + BlockRenderLayer blockRenderLayer, // 70% sure it's translucent uh yeah + double partialTicks, + int pass, + Entity entity) { Minecraft mc = Minecraft.getMinecraft(); mc.profiler.endStartSection("BTLayer"); + if (Shaders.isOptiFineShaderPackLoaded()) { - int result = renderglobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); - RENDER_FAST.clear(); - return result; - } else if (!ConfigHolder.client.shader.emissiveTexturesBloom) { + return renderGlobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); + } + + preDraw(); + + EffectRenderContext context = EffectRenderContext.getInstance().update(entity, (float) partialTicks); + + if (!ConfigHolder.client.shader.emissiveTexturesBloom) { GlStateManager.depthMask(true); - renderglobal.renderBlockLayer(BloomEffectUtil.BLOOM, partialTicks, pass, entity); + renderGlobal.renderBlockLayer(bloom, partialTicks, pass, entity); - // render fast - if (!RENDER_FAST.isEmpty()) { + if (!BLOOM_RENDERS.isEmpty()) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); - RENDER_FAST.forEach((handler, list)->{ - handler.preDraw(buffer); - list.forEach(consumer->consumer.accept(buffer)); - handler.postDraw(buffer); - }); - RENDER_FAST.clear(); + for (List list : BLOOM_RENDERS.values()) { + draw(buffer, context, list); + } } + postDraw(); GlStateManager.depthMask(false); - return renderglobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); + + return renderGlobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); } Framebuffer fbo = mc.getFramebuffer(); - if (BLOOM_FBO == null || BLOOM_FBO.framebufferWidth != fbo.framebufferWidth || BLOOM_FBO.framebufferHeight != fbo.framebufferHeight || (fbo.isStencilEnabled() && !BLOOM_FBO.isStencilEnabled())) { - if (BLOOM_FBO == null) { - BLOOM_FBO = new Framebuffer(fbo.framebufferWidth, fbo.framebufferHeight, false); - BLOOM_FBO.setFramebufferColor(0, 0, 0, 0); + if (bloomFBO == null || + bloomFBO.framebufferWidth != fbo.framebufferWidth || + bloomFBO.framebufferHeight != fbo.framebufferHeight || + (fbo.isStencilEnabled() && !bloomFBO.isStencilEnabled())) { + if (bloomFBO == null) { + bloomFBO = new Framebuffer(fbo.framebufferWidth, fbo.framebufferHeight, false); + bloomFBO.setFramebufferColor(0, 0, 0, 0); } else { - BLOOM_FBO.createBindFramebuffer(fbo.framebufferWidth, fbo.framebufferHeight); + bloomFBO.createBindFramebuffer(fbo.framebufferWidth, fbo.framebufferHeight); } - if (fbo.isStencilEnabled() && !BLOOM_FBO.isStencilEnabled()) { - BLOOM_FBO.enableStencil(); + + if (fbo.isStencilEnabled() && !bloomFBO.isStencilEnabled()) { + bloomFBO.enableStencil(); } + if (DepthTextureUtil.isLastBind() && DepthTextureUtil.isUseDefaultFBO()) { - RenderUtil.hookDepthTexture(BLOOM_FBO, DepthTextureUtil.framebufferDepthTexture); + RenderUtil.hookDepthTexture(bloomFBO, DepthTextureUtil.framebufferDepthTexture); } else { - RenderUtil.hookDepthBuffer(BLOOM_FBO, fbo.depthBuffer); + RenderUtil.hookDepthBuffer(bloomFBO, fbo.depthBuffer); } - BLOOM_FBO.setFramebufferFilter(GL_LINEAR); - } - + bloomFBO.setFramebufferFilter(GL11.GL_LINEAR); + } GlStateManager.depthMask(true); - fbo.bindFramebuffer(true); - // render fast - if (!RENDER_FAST.isEmpty()) { + if (!BLOOM_RENDERS.isEmpty()) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); - RENDER_FAST.forEach((handler, list)->{ - handler.preDraw(buffer); - list.forEach(consumer->consumer.accept(buffer)); - handler.postDraw(buffer); - }); + for (List list : BLOOM_RENDERS.values()) { + draw(buffer, context, list); + } } // render to BLOOM BUFFER - BLOOM_FBO.framebufferClear(); - BLOOM_FBO.bindFramebuffer(false); + bloomFBO.framebufferClear(); + bloomFBO.bindFramebuffer(false); - renderglobal.renderBlockLayer(BloomEffectUtil.BLOOM, partialTicks, pass, entity); + renderGlobal.renderBlockLayer(bloom, partialTicks, pass, entity); GlStateManager.depthMask(false); // fast render bloom layer to main fbo - BLOOM_FBO.bindFramebufferTexture(); + bloomFBO.bindFramebufferTexture(); Shaders.renderFullImageInFBO(fbo, Shaders.IMAGE_F, null); // reset transparent layer render state and render OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, fbo.framebufferObject); GlStateManager.enableBlend(); mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - GlStateManager.shadeModel(7425); + GlStateManager.shadeModel(GL11.GL_SMOOTH); - int result = renderglobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); + int result = renderGlobal.renderBlockLayer(blockRenderLayer, partialTicks, pass, entity); mc.profiler.endStartSection("bloom"); // blend bloom + transparent fbo.bindFramebufferTexture(); GlStateManager.blendFunc(GL11.GL_DST_ALPHA, GL11.GL_ZERO); - Shaders.renderFullImageInFBO(BLOOM_FBO, Shaders.IMAGE_F, null); + Shaders.renderFullImageInFBO(bloomFBO, Shaders.IMAGE_F, null); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // render bloom effect to fbo @@ -155,19 +309,15 @@ public static int renderBloomBlockLayer(RenderGlobal renderglobal, BlockRenderLa BloomEffect.lowBrightnessThreshold = (float) ConfigHolder.client.shader.lowBrightnessThreshold; BloomEffect.step = (float) ConfigHolder.client.shader.step; switch (ConfigHolder.client.shader.bloomStyle) { - case 0: - BloomEffect.renderLOG(BLOOM_FBO, fbo); - break; - case 1: - BloomEffect.renderUnity(BLOOM_FBO, fbo); - break; - case 2: - BloomEffect.renderUnreal(BLOOM_FBO, fbo); - break; - default: + case 0 -> BloomEffect.renderLOG(bloomFBO, fbo); + case 1 -> BloomEffect.renderUnity(bloomFBO, fbo); + case 2 -> BloomEffect.renderUnreal(bloomFBO, fbo); + default -> { + postDraw(); GlStateManager.depthMask(false); GlStateManager.disableBlend(); return result; + } } GlStateManager.depthMask(false); @@ -176,22 +326,20 @@ public static int renderBloomBlockLayer(RenderGlobal renderglobal, BlockRenderLa GlStateManager.disableBlend(); Shaders.renderFullImageInFBO(fbo, Shaders.IMAGE_F, null); - - //********** render custom bloom ************ - // render fast - if (!RENDER_FAST.isEmpty()) { + if (!BLOOM_RENDERS.isEmpty()) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); - RENDER_FAST.forEach((handler, list)->{ + for (var e : BLOOM_RENDERS.entrySet()) { + BloomRenderKey key = e.getKey(); + List list = e.getValue(); + GlStateManager.depthMask(true); - BLOOM_FBO.framebufferClear(); - BLOOM_FBO.bindFramebuffer(true); + bloomFBO.framebufferClear(); + bloomFBO.bindFramebuffer(true); - handler.preDraw(buffer); - list.forEach(consumer->consumer.accept(buffer)); - handler.postDraw(buffer); + draw(buffer, context, list); GlStateManager.depthMask(false); @@ -199,57 +347,149 @@ public static int renderBloomBlockLayer(RenderGlobal renderglobal, BlockRenderLa fbo.bindFramebufferTexture(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_DST_ALPHA, GL11.GL_ZERO); - Shaders.renderFullImageInFBO(BLOOM_FBO, Shaders.IMAGE_F, null); + Shaders.renderFullImageInFBO(bloomFBO, Shaders.IMAGE_F, null); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - switch (handler.customBloomStyle()) { - case 0: - BloomEffect.renderLOG(BLOOM_FBO, fbo); - break; - case 1: - BloomEffect.renderUnity(BLOOM_FBO, fbo); - break; - case 2: - BloomEffect.renderUnreal(BLOOM_FBO, fbo); - break; - default: + switch (key.bloomType) { + case GAUSSIAN -> BloomEffect.renderLOG(bloomFBO, fbo); + case UNITY -> BloomEffect.renderUnity(bloomFBO, fbo); + case UNREAL -> BloomEffect.renderUnreal(bloomFBO, fbo); + default -> { GlStateManager.disableBlend(); - return; + continue; + } } // render bloom blend result to fbo GlStateManager.disableBlend(); Shaders.renderFullImageInFBO(fbo, Shaders.IMAGE_F, null); - }); - RENDER_FAST.clear(); + } + postDraw(); } return result; } - public static Framebuffer getBloomFBO() { - return BLOOM_FBO; + private static void draw(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context, + @Nonnull List tickets) { + boolean initialized = false; + @Nullable + IRenderSetup renderSetup = null; + for (BloomRenderTicket ticket : tickets) { + if (!ticket.isValid() || !ticket.render.shouldRenderBloomEffect(context)) continue; + if (!initialized) { + initialized = true; + renderSetup = ticket.renderSetup; + if (renderSetup != null) { + renderSetup.preDraw(buffer); + } + } + ticket.render.renderBloomEffect(buffer, context); + if (ticket.legacy) ticket.invalidate(); + } + if (initialized && renderSetup != null) { + renderSetup.postDraw(buffer); + } } - public static void requestCustomBloom(IBloomRenderFast handler, Consumer render) { - RENDER_FAST.computeIfAbsent(handler, (x)->Lists.newLinkedList()).add(render); + private static void preDraw() { + WorldClient world = Minecraft.getMinecraft().world; + if (currentWorld != world) { + for (List list : BLOOM_RENDERS.values()) { + for (BloomRenderTicket ticket : list) { + ticket.invalidate(); + } + } + BLOOM_RENDERS.clear(); + if (currentWorld != null) { + for (BloomRenderTicket ticket : SCHEDULED_BLOOM_RENDERS) { + ticket.invalidate(); + } + SCHEDULED_BLOOM_RENDERS.clear(); + } + currentWorld = world; + } + + for (BloomRenderTicket ticket : SCHEDULED_BLOOM_RENDERS) { + if (!ticket.isValid()) continue; + BLOOM_RENDERS.computeIfAbsent(new BloomRenderKey(ticket.renderSetup, ticket.bloomType), + k -> new ArrayList<>()).add(ticket); + } + SCHEDULED_BLOOM_RENDERS.clear(); + } + + private static void postDraw() { + for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext(); ) { + List list = it.next(); + + if (!list.isEmpty()) { + if (!list.removeIf(ticket -> !ticket.isValid()) || !list.isEmpty()) continue; + } + + it.remove(); + } + } + + @Desugar + private record BloomRenderKey(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType) {} + + public static final class BloomRenderTicket { + + @Nullable + private final IRenderSetup renderSetup; + private final BloomType bloomType; + private final IBloomEffect render; + + private boolean valid = true; + /** + * Used to mark bloom tickets made by legacy API; this ticket will be automatically expired after 1 render call. + * Remove this method in 2.9 as well as the deprecated method. + */ + private boolean legacy; + + BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, @Nonnull IBloomEffect render) { + this.renderSetup = renderSetup; + this.bloomType = Objects.requireNonNull(bloomType, "bloomType == null"); + this.render = Objects.requireNonNull(render, "render == null"); + } + + @Nullable + public IRenderSetup getRenderSetup() { + return this.renderSetup; + } + + @Nonnull + public BloomType getBloomType() { + return this.bloomType; + } + + public boolean isValid() { + return this.valid; + } + + public void invalidate() { + this.valid = false; + } } - public interface IBloomRenderFast extends ICustomRenderFast { + /** + * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + public interface IBloomRenderFast extends IRenderSetup { /** * Custom Bloom Style. * - * @return - * 0 - Simple Gaussian Blur Bloom + * @return 0 - Simple Gaussian Blur Bloom *

- * 1 - Unity Bloom + * 1 - Unity Bloom *

*

* 2 - Unreal Bloom *

*/ - int customBloomStyle(); - + int customBloomStyle(); } } diff --git a/src/main/java/gregtech/client/utils/EffectRenderContext.java b/src/main/java/gregtech/client/utils/EffectRenderContext.java new file mode 100644 index 00000000000..3c296072d36 --- /dev/null +++ b/src/main/java/gregtech/client/utils/EffectRenderContext.java @@ -0,0 +1,133 @@ +package gregtech.client.utils; + +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.Vec3d; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.Objects; + +/** + * Collection of various information for rendering purposes. + */ +public final class EffectRenderContext { + + private static final EffectRenderContext instance = new EffectRenderContext(); + + public static EffectRenderContext getInstance() { + return instance; + } + + @Nullable + private Entity renderViewEntity; + private float partialTicks; + private double cameraX; + private double cameraY; + private double cameraZ; + @Nonnull + private Vec3d cameraViewDir = Vec3d.ZERO; + private float rotationX; + private float rotationZ; + private float rotationYZ; + private float rotationXY; + private float rotationXZ; + + @Nonnull + public EffectRenderContext update(@Nonnull Entity renderViewEntity, float partialTicks) { + this.renderViewEntity = renderViewEntity; + this.partialTicks = partialTicks; + + this.cameraX = renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; + this.cameraY = renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; + this.cameraZ = renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; + this.cameraViewDir = renderViewEntity.getLook(partialTicks); + + this.rotationX = ActiveRenderInfo.getRotationX(); + this.rotationZ = ActiveRenderInfo.getRotationZ(); + this.rotationYZ = ActiveRenderInfo.getRotationYZ(); + this.rotationXY = ActiveRenderInfo.getRotationXY(); + this.rotationXZ = ActiveRenderInfo.getRotationXZ(); + + return this; + } + + /** + * @return render view entity + */ + @Nonnull + public Entity renderViewEntity() { + return Objects.requireNonNull(renderViewEntity, "renderViewEntity not available yet"); + } + + /** + * @return partial ticks + */ + public float partialTicks() { + return partialTicks; + } + + /** + * @return X position of the camera (interpolated X position of the render view entity) + */ + public double cameraX() { + return cameraX; + } + + /** + * @return Y position of the camera (interpolated Y position of the render view entity) + */ + public double cameraY() { + return cameraY; + } + + /** + * @return Z position of the camera (interpolated Z position of the render view entity) + */ + public double cameraZ() { + return cameraZ; + } + + /** + * @return view direction of the camera + */ + @Nonnull + public Vec3d cameraViewDir() { + return cameraViewDir; + } + + /** + * @return X rotation of the render view entity + */ + public float rotationX() { + return rotationX; + } + + /** + * @return Z rotation of the render view entity + */ + public float rotationZ() { + return rotationZ; + } + + /** + * @return YZ rotation of the render view entity + */ + public float rotationYZ() { + return rotationYZ; + } + + /** + * @return XY rotation of the render view entity + */ + public float rotationXY() { + return rotationXY; + } + + /** + * @return XZ rotation of the render view entity + */ + public float rotationXZ() { + return rotationXZ; + } +} diff --git a/src/main/java/gregtech/client/utils/IBloomEffect.java b/src/main/java/gregtech/client/utils/IBloomEffect.java new file mode 100644 index 00000000000..0f755b376bd --- /dev/null +++ b/src/main/java/gregtech/client/utils/IBloomEffect.java @@ -0,0 +1,35 @@ +package gregtech.client.utils; + +import gregtech.client.renderer.IRenderSetup; +import gregtech.client.shader.postprocessing.BloomType; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nonnull; + +/** + * Render callback interface for {@link BloomEffectUtil#registerBloomRender(IRenderSetup, BloomType, IBloomEffect)}. + */ +@FunctionalInterface +public interface IBloomEffect { + + /** + * Render the bloom effect. + * + * @param buffer buffer builder + * @param context render context + */ + @SideOnly(Side.CLIENT) + void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context); + + /** + * @param context render context + * @return if this effect should be rendered; returning {@code false} skips {@link #renderBloomEffect(BufferBuilder, + * EffectRenderContext)} call. + */ + @SideOnly(Side.CLIENT) + default boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + return true; + } +} diff --git a/src/main/java/gregtech/client/utils/RenderUtil.java b/src/main/java/gregtech/client/utils/RenderUtil.java index 867176251d6..ff6f613f5c0 100644 --- a/src/main/java/gregtech/client/utils/RenderUtil.java +++ b/src/main/java/gregtech/client/utils/RenderUtil.java @@ -28,10 +28,10 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL30; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.awt.image.BufferedImage; import java.util.*; -import java.util.function.Function; @SideOnly(Side.CLIENT) public class RenderUtil { @@ -273,23 +273,22 @@ public static Matrix4 adjustTrans(Matrix4 translation, EnumFacing side, int laye return trans; } - public static Function colorInterpolator(int color1, int color2) { - int a = color1 >> 24 & 255; - int r = color1 >> 16 & 255; - int g = color1 >> 8 & 255; - int b = color1 & 255; + public static int interpolateColor(int color1, int color2, float blend) { + int a1 = color1 >> 24 & 255; + int r1 = color1 >> 16 & 255; + int g1 = color1 >> 8 & 255; + int b1 = color1 & 255; int a2 = color2 >> 24 & 255; int r2 = color2 >> 16 & 255; int g2 = color2 >> 8 & 255; int b2 = color2 & 255; - return (f) -> { - int A = (int) (a * (1 - f) + a2 * (f)); - int R = (int) (r * (1 - f) + r2 * (f)); - int G = (int) (g * (1 - f) + g2 * (f)); - int B = (int) (b * (1 - f) + b2 * (f)); - return A << 24 | R << 16 | G << 8 | B; - }; + + int a = (int) (a1 * (1 - blend) + a2 * blend); + int r = (int) (r1 * (1 - blend) + r2 * blend); + int g = (int) (g1 * (1 - blend) + g2 * blend); + int b = (int) (b1 * (1 - blend) + b2 * blend); + return a << 24 | r << 16 | g << 8 | b; } public static void renderRect(float x, float y, float width, float height, float z, int color) { @@ -625,7 +624,7 @@ public static BakedQuad makeEmissive(BakedQuad quad) { } UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format) { @Override - public void put(int element, float... data) { + public void put(int element, @Nonnull float... data) { if (this.getVertexFormat().getElement(element) == DefaultVertexFormats.TEX_2S) super.put(element, 480.0f / 0xFFFF, 480.0f / 0xFFFF); else super.put(element, data); diff --git a/src/main/java/gregtech/common/blocks/BlockLamp.java b/src/main/java/gregtech/common/blocks/BlockLamp.java index 3c443c5d9fd..76d0260f932 100644 --- a/src/main/java/gregtech/common/blocks/BlockLamp.java +++ b/src/main/java/gregtech/common/blocks/BlockLamp.java @@ -179,8 +179,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - if (layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.CUTOUT) return true; - return isLightActive(state) && state.getValue(BLOOM) && layer == BloomEffectUtil.getRealBloomLayer(); + if (layer == BlockRenderLayer.SOLID) return true; + return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM)); } @SideOnly(Side.CLIENT) @@ -197,6 +197,7 @@ public void onModelRegister() { ModelLoader.setCustomStateMapper(this, b -> models); } + @Nonnull @SideOnly(Side.CLIENT) protected LampModelType getModelType() { return LampModelType.LAMP; diff --git a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java index 2bc2534cd43..26467f777b4 100644 --- a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java +++ b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java @@ -1,12 +1,13 @@ package gregtech.common.blocks; import gregtech.client.model.lamp.LampModelType; -import gregtech.client.shader.Shaders; import gregtech.client.utils.BloomEffectUtil; import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumDyeColor; import net.minecraft.util.BlockRenderLayer; +import javax.annotation.Nonnull; + public class BlockLampBorderless extends BlockLamp { public BlockLampBorderless(EnumDyeColor color) { @@ -14,11 +15,11 @@ public BlockLampBorderless(EnumDyeColor color) { } @Override - public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - return isLightActive(state) && state.getValue(BLOOM) && !Shaders.isOptiFineShaderPackLoaded() ? - layer == BloomEffectUtil.BLOOM : layer == BlockRenderLayer.SOLID; + public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), BlockRenderLayer.SOLID); } + @Nonnull @Override protected LampModelType getModelType() { return LampModelType.BORDERLESS_LAMP; diff --git a/src/main/java/gregtech/common/blocks/BlockOre.java b/src/main/java/gregtech/common/blocks/BlockOre.java index a9b784ea6b8..13499872741 100644 --- a/src/main/java/gregtech/common/blocks/BlockOre.java +++ b/src/main/java/gregtech/common/blocks/BlockOre.java @@ -177,7 +177,8 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList= beamCount && particle != null) { particle.setExpired(); @@ -292,8 +294,9 @@ private void readParticles(@Nonnull PacketBuffer buf) { } @Nonnull - private GTLaserBeamParticle createALParticles(World world, Vector3 startPos, Vector3 endPos) { - GTLaserBeamParticle particle = new GTLaserBeamParticle(world, startPos, endPos) + @SideOnly(Side.CLIENT) + private GTLaserBeamParticle createALParticles(Vector3 startPos, Vector3 endPos) { + return new GTLaserBeamParticle(this, startPos, endPos) .setBody(LASER_LOCATION) .setBeamHeight(0.125f) // Try commenting or adjusting on the next four lines to see what happens @@ -301,14 +304,6 @@ private GTLaserBeamParticle createALParticles(World world, Vector3 startPos, Vec .setHead(LASER_HEAD_LOCATION) .setHeadWidth(0.1f) .setEmit(0.2f); - - particle.setOnUpdate(p -> { - if (!isValid() || !getWorld().isBlockLoaded(getPos(), false) || getWorld().getTileEntity(getPos()) != this.getHolder()) { - p.setExpired(); - } - }); - - return particle; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index 6b26846fdfb..aaa13d17686 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -3,12 +3,16 @@ import com.google.common.collect.Lists; import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.GTValues; -import gregtech.api.capability.*; +import gregtech.api.capability.GregtechDataCodes; +import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.*; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.gui.widgets.*; +import gregtech.api.gui.widgets.ImageCycleButtonWidget; +import gregtech.api.gui.widgets.ImageWidget; +import gregtech.api.gui.widgets.IndicatorImageWidget; +import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -20,30 +24,28 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.FusionEUToStartProperty; +import gregtech.api.util.RelativeDirection; import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; -import gregtech.api.util.RelativeDirection; import gregtech.api.util.interpolate.Eases; import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.IRenderSetup; import gregtech.client.renderer.texture.Textures; import gregtech.client.shader.postprocessing.BloomEffect; -import gregtech.client.utils.BloomEffectUtil; -import gregtech.client.utils.RenderBufferHelper; -import gregtech.client.utils.RenderUtil; +import gregtech.client.shader.postprocessing.BloomType; +import gregtech.client.utils.*; import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockFusionCasing; import gregtech.common.blocks.BlockGlassCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -55,7 +57,6 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -68,14 +69,18 @@ import java.util.Objects; import java.util.function.DoubleSupplier; -public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity { +public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity, IBloomEffect { private final int tier; private EnergyContainerList inputEnergyContainers; private long heat = 0; // defined in TileEntityFusionReactor but serialized in FusionRecipeLogic + @Nullable private Integer color; private final FusionProgressSupplier progressBarSupplier; + @SideOnly(Side.CLIENT) + private BloomEffectUtil.BloomRenderTicket bloomRenderTicket; + public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) { super(metaTileEntityId, RecipeMaps.FUSION_RECIPES); this.recipeMapWorkable = new FusionRecipeLogic(this); @@ -256,7 +261,7 @@ protected void updateFormedValid() { } super.updateFormedValid(); if (recipeMapWorkable.isWorking() && color == null) { - if (recipeMapWorkable.getPreviousRecipe() != null && recipeMapWorkable.getPreviousRecipe().getFluidOutputs().size() > 0) { + if (recipeMapWorkable.getPreviousRecipe() != null && !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { int newColor = 0xFF000000 | recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); if (!Objects.equals(color, newColor)) { color = newColor; @@ -615,32 +620,41 @@ protected void setActive(boolean active) { } @Override + @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { - if (color != null && MinecraftForgeClient.getRenderPass() == 0) { - final int c = color; - BloomEffectUtil.requestCustomBloom(RENDER_HANDLER, (buffer) -> { - int color = RenderUtil.colorInterpolator(c, -1).apply(Eases.EaseQuadIn.getInterpolation(Math.abs((Math.abs(getOffsetTimer() % 50) + partialTicks) - 25) / 25)); - float a = (float) (color >> 24 & 255) / 255.0F; - float r = (float) (color >> 16 & 255) / 255.0F; - float g = (float) (color >> 8 & 255) / 255.0F; - float b = (float) (color & 255) / 255.0F; - Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); - if (entity != null) { - buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR); - EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getAxis(); - RenderBufferHelper.renderRing(buffer, - x + relativeBack.getXOffset() * 7 + 0.5, - y + relativeBack.getYOffset() * 7 + 0.5, - z + relativeBack.getZOffset() * 7 + 0.5, - 6, 0.2, 10, 20, - r, g, b, a, axis); - Tessellator.getInstance().draw(); - } - }); + if (this.color != null && this.bloomRenderTicket == null) { + this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), this); } } + @Override + @SideOnly(Side.CLIENT) + public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + Integer c = color; + if (c == null) return; + int color = RenderUtil.interpolateColor(c, -1, Eases.QUAD_IN.getInterpolation( + Math.abs((Math.abs(getOffsetTimer() % 50) + context.partialTicks()) - 25) / 25)); + float a = (float) (color >> 24 & 255) / 255.0F; + float r = (float) (color >> 16 & 255) / 255.0F; + float g = (float) (color >> 8 & 255) / 255.0F; + float b = (float) (color & 255) / 255.0F; + EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getAxis(); + + RenderBufferHelper.renderRing(buffer, + getPos().getX() - context.cameraX() + relativeBack.getXOffset() * 7 + 0.5, + getPos().getY() - context.cameraY() + relativeBack.getYOffset() * 7 + 0.5, + getPos().getZ() - context.cameraZ() + relativeBack.getZOffset() * 7 + 0.5, + 6, 0.2, 10, 20, + r, g, b, a, axis); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + return this.color != null; + } + @Override public AxisAlignedBB getRenderBoundingBox() { EnumFacing relativeRight = RelativeDirection.RIGHT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); @@ -661,18 +675,21 @@ public boolean isGlobalRenderer() { return true; } - static BloomEffectUtil.IBloomRenderFast RENDER_HANDLER = new BloomEffectUtil.IBloomRenderFast() { - @Override - public int customBloomStyle() { - return ConfigHolder.client.shader.fusionBloom.useShader ? ConfigHolder.client.shader.fusionBloom.bloomStyle : -1; - } + private static BloomType getBloomType() { + ConfigHolder.FusionBloom fusionBloom = ConfigHolder.client.shader.fusionBloom; + return BloomType.fromValue(fusionBloom.useShader ? fusionBloom.bloomStyle : -1); + } + + @SideOnly(Side.CLIENT) + private static final class FusionBloomSetup implements IRenderSetup { + + private static final FusionBloomSetup INSTANCE = new FusionBloomSetup(); float lastBrightnessX; float lastBrightnessY; @Override - @SideOnly(Side.CLIENT) - public void preDraw(BufferBuilder buffer) { + public void preDraw(@Nonnull BufferBuilder buffer) { BloomEffect.strength = (float) ConfigHolder.client.shader.fusionBloom.strength; BloomEffect.baseBrightness = (float) ConfigHolder.client.shader.fusionBloom.baseBrightness; BloomEffect.highBrightnessThreshold = (float) ConfigHolder.client.shader.fusionBloom.highBrightnessThreshold; @@ -684,13 +701,16 @@ public void preDraw(BufferBuilder buffer) { GlStateManager.color(1, 1, 1, 1); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.disableTexture2D(); + + buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR); } @Override - @SideOnly(Side.CLIENT) - public void postDraw(BufferBuilder buffer) { + public void postDraw(@Nonnull BufferBuilder buffer) { + Tessellator.getInstance().draw(); + GlStateManager.enableTexture2D(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); } - }; + } } diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java index 3d1fe5a26d1..913c7f429ef 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java @@ -217,7 +217,7 @@ public int getMeltTemp() { @SideOnly(Side.CLIENT) public void createParticle() { - particle = new GTOverheatParticle(world, pos, meltTemp, getPipeBoxes(), getPipeType().insulationLevel >= 0); + particle = new GTOverheatParticle(this, meltTemp, getPipeBoxes(), getPipeType().insulationLevel >= 0); GTParticleManager.INSTANCE.addEffect(particle); } diff --git a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java index 4f2f07029fd..4caca6cedca 100644 --- a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java @@ -26,10 +26,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; +import javax.annotation.Nullable; public class BlockLaserPipe extends BlockPipe { @@ -102,7 +101,7 @@ public void setTileEntityData(TileEntityPipeBase items) { + public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { items.add(new ItemStack(this, 1, this.pipeType.ordinal())); } @@ -139,8 +138,8 @@ public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { } @Override - public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { + public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { if (layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.CUTOUT) return true; - return layer == BloomEffectUtil.getRealBloomLayer(); + return layer == BloomEffectUtil.getEffectiveBloomLayer(); } } diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java index e1e162a3db3..8d6c31e5b51 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java @@ -124,7 +124,7 @@ public void hookDrawInForeground(int mouseX, int mouseY) { int maxAlpha = 100; // 0-255!!!!! float partialTicks = Minecraft.getMinecraft().getRenderPartialTicks(); if (alpha != maxAlpha && interpolator == null) { - interpolator = new Interpolator(0, maxAlpha, dur, Eases.EaseLinear, + interpolator = new Interpolator(0, maxAlpha, dur, Eases.LINEAR, value-> alpha = value.intValue(), value-> interpolator = null); interpolator.start(); diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java index 725fdb98c64..380f4fd325f 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java @@ -251,7 +251,7 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe if (hover + 1 > stage) { if (lineWidth != end && (interpolator == null || back)) { back = false; - interpolator = new Interpolator(lineWidth, end, (end - lineWidth) / 15, Eases.EaseLinear, + interpolator = new Interpolator(lineWidth, end, (end - lineWidth) / 15, Eases.LINEAR, value-> lineWidth = value.intValue(), value-> interpolator = null); interpolator.start(); @@ -259,7 +259,7 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe } else { if (lineWidth != 0 && (interpolator == null || !back)) { back = true; - interpolator = new Interpolator(lineWidth, 0, lineWidth / 15, Eases.EaseLinear, + interpolator = new Interpolator(lineWidth, 0, lineWidth / 15, Eases.LINEAR, value-> lineWidth = value.intValue(), value-> interpolator = null); interpolator.start(); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java index eab2dfdc307..e0cd3599b4f 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java @@ -13,11 +13,12 @@ import gregtech.api.util.interpolate.Interpolator; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class GuidePageWidget extends DraggableScrollableWidgetGroup { public static final Map REGISTER_WIDGETS = new HashMap<>(); + static { //register guide widgets REGISTER_WIDGETS.put(TextBoxWidget.NAME, new TextBoxWidget()); REGISTER_WIDGETS.put(ImageWidget.NAME, new ImageWidget()); @@ -25,6 +26,7 @@ public class GuidePageWidget extends DraggableScrollableWidgetGroup { REGISTER_WIDGETS.put(SlotListWidget.NAME, new SlotListWidget()); REGISTER_WIDGETS.put(TankListWidget.NAME, new TankListWidget()); } + protected TextBoxWidget title; protected List stream = new ArrayList<>(); protected List fixed = new ArrayList<>(); @@ -150,7 +152,7 @@ public void onPositionUpdate(Widget widget, Position oldPosition) { } protected int getStreamBottom() { - if (stream!= null && stream.size() > 0) { + if (stream != null && stream.size() > 0) { Widget widget = stream.get(stream.size() - 1); return widget.getSize().height + widget.getSelfPosition().y + scrollYOffset; } else { @@ -164,13 +166,13 @@ public void updateScreen() { super.updateScreen(); } - public void jumpToRef(String ref){ + public void jumpToRef(String ref) { if (interpolator != null && !interpolator.isFinish()) return; for (Widget widget : widgets) { if (widget instanceof IGuideWidget && ref.equals(((IGuideWidget) widget).getRef())) { - interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, Eases.EaseQuadOut, - value-> setScrollYOffset(value.intValue()), - value-> interpolator = null); + interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, Eases.QUAD_OUT, + value -> setScrollYOffset(value.intValue()), + value -> interpolator = null); interpolator.start(); } } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java index b56f60aaf27..1c78005ebd0 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java @@ -189,7 +189,7 @@ public void moveUp(Widget widget) { int offsetU = widget.getPosition().y - target.getPosition().y; int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; - interpolator = new Interpolator(0, 1, 10, Eases.EaseLinear, value->{ + interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU))); target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD))); if (widget == selected) { @@ -197,7 +197,7 @@ public void moveUp(Widget widget) { } widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && widget.getSelfPosition().y + widget.getSize().height > 0); target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && target.getSelfPosition().y + target.getSize().height > 0); - }, value->{ + }, value -> { interpolator = null; stream.remove(widget); stream.add(index - 1, widget); @@ -222,7 +222,7 @@ public void moveDown(Widget widget) { int offsetU = target.getPosition().y - widget.getPosition().y; int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; - interpolator = new Interpolator(0, 1, 10, Eases.EaseLinear, value->{ + interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 + value.floatValue() * offsetD))); target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 - value.floatValue() * offsetU))); if (widget == selected) { @@ -230,7 +230,7 @@ public void moveDown(Widget widget) { } widget.setVisible(widget.getSelfPosition().y < getSize().height - xBarHeight && widget.getSelfPosition().y + widget.getSize().height > 0); target.setVisible(target.getSelfPosition().y < getSize().height - xBarHeight && target.getSelfPosition().y + target.getSize().height > 0); - }, value->{ + }, value -> { interpolator = null; stream.remove(widget); stream.add(index + 1, widget); @@ -316,7 +316,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { protected boolean hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { int x = getPosition().x; int width = getSize().width; - if(title.isVisible()) { + if (title.isVisible()) { title.drawInBackground(mouseX, mouseY, partialTicks, context); } for (Widget widget : stream) { @@ -354,7 +354,7 @@ protected boolean hookDrawInBackground(int mouseX, int mouseY, float partialTick selected.getPosition().y - 20, 0xffff0000, true); } - if(toolButtons.isVisible()) { + if (toolButtons.isVisible()) { customPositionSizeWidget.drawInBackground(mouseX, mouseY, partialTicks, context); toolButtons.drawInBackground(mouseX, mouseY, partialTicks, context); } From 91aa525b35ae794565b80b399ce4482d69899745 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:34:38 -0600 Subject: [PATCH 11/77] Limit multiblock recipe tier by energy hatches (#2139) --- .../capability/impl/AbstractRecipeLogic.java | 2 +- .../capability/impl/BoilerRecipeLogic.java | 2 +- .../capability/impl/EnergyContainerList.java | 27 ++++ .../impl/MultiblockRecipeLogic.java | 71 ++++++--- .../capability/impl/PrimitiveRecipeLogic.java | 2 +- .../capability/impl/RecipeLogicEnergy.java | 2 +- .../api/capability/impl/RecipeLogicSteam.java | 2 +- .../impl/SteamMultiblockRecipeLogic.java | 2 +- .../multiblock/MultiblockDisplayText.java | 25 +++- .../RecipeMapMultiblockController.java | 1 + .../electric/MetaTileEntityCrackingUnit.java | 2 + .../MetaTileEntityElectricBlastFurnace.java | 1 + .../electric/MetaTileEntityFusionReactor.java | 2 +- .../electric/MetaTileEntityMultiSmelter.java | 2 + .../MetaTileEntityProcessingArray.java | 11 +- .../electric/MetaTileEntityPyrolyseOven.java | 2 + .../MetaTileEntityResearchStation.java | 2 + .../MetaTileEntityLargeCombustionEngine.java | 2 +- .../MetaTileEntityMachineRecipeLoader.java | 135 +++++++----------- .../resources/assets/gregtech/lang/en_us.lang | 3 + .../impl/AbstractRecipeLogicTest.java | 2 +- 21 files changed, 180 insertions(+), 120 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 5e8f2a3cffb..9f222dce3be 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -110,7 +110,7 @@ public AbstractRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, bo /** * @return the maximum voltage the machine can use/handle for recipe searching */ - protected abstract long getMaxVoltage(); + public abstract long getMaxVoltage(); /** * diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index 211a9777d30..d16ecba4bbd 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -306,7 +306,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { GTLog.logger.error("Large Boiler called getMaxVoltage(), this should not be possible!"); return 0; } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java index b136aef0bb5..4d296a86e78 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java @@ -14,17 +14,32 @@ public class EnergyContainerList implements IEnergyContainer { private final long inputAmperage; private final long outputAmperage; + /** The highest single energy container's input voltage in the list. */ + private final long highestInputVoltage; + /** The number of energy containers at the highest input voltage in the list. */ + private final int numHighestInputContainers; + public EnergyContainerList(@Nonnull List energyContainerList) { this.energyContainerList = energyContainerList; long totalInputVoltage = 0; long totalOutputVoltage = 0; long inputAmperage = 0; long outputAmperage = 0; + long highestInputVoltage = 0; + int numHighestInputContainers = 0; for (IEnergyContainer container : energyContainerList) { totalInputVoltage += container.getInputVoltage() * container.getInputAmperage(); totalOutputVoltage += container.getOutputVoltage() * container.getOutputAmperage(); inputAmperage += container.getInputAmperage(); outputAmperage += container.getOutputAmperage(); + if (container.getInputVoltage() > highestInputVoltage) { + highestInputVoltage = container.getInputVoltage(); + } + } + for (IEnergyContainer container : energyContainerList) { + if (container.getInputVoltage() == highestInputVoltage) { + numHighestInputContainers++; + } } long[] voltageAmperage = calculateVoltageAmperage(totalInputVoltage, inputAmperage); @@ -33,6 +48,8 @@ public EnergyContainerList(@Nonnull List energyContainerList) voltageAmperage = calculateVoltageAmperage(totalOutputVoltage, outputAmperage); this.outputVoltage = voltageAmperage[0]; this.outputAmperage = voltageAmperage[1]; + this.highestInputVoltage = highestInputVoltage; + this.numHighestInputContainers = numHighestInputContainers; } /** @@ -163,6 +180,16 @@ public long getEnergyCapacity() { return energyCapacity; } + /** The highest single voltage of an energy container in this list. */ + public long getHighestInputVoltage() { + return highestInputVoltage; + } + + /** The number of parts with voltage specified in {@link EnergyContainerList#getHighestInputVoltage()} in this list. */ + public int getNumHighestInputContainers() { + return numHighestInputContainers; + } + /** * Always < 4. A list with amps > 4 will always be compacted into more voltage at fewer amps. * diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java index a1527987d85..f46d95abaa1 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java @@ -302,7 +302,31 @@ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePrope @Override public long getMaximumOverclockVoltage() { - return getMaxVoltage(); + IEnergyContainer energyContainer = getEnergyContainer(); + if (energyContainer instanceof EnergyContainerList) { + long voltage; + long amperage; + if (energyContainer.getInputVoltage() > energyContainer.getOutputVoltage()) { + voltage = energyContainer.getInputVoltage(); + amperage = energyContainer.getInputAmperage(); + } else { + voltage = energyContainer.getOutputVoltage(); + amperage = energyContainer.getOutputAmperage(); + } + + if (amperage == 1) { + // amperage is 1 when the energy is not exactly on a tier + + // the voltage for recipe search is always on tier, so take the closest lower tier + return GTValues.V[GTUtility.getFloorTierByVoltage(voltage)]; + } else { + // amperage != 1 means the voltage is exactly on a tier + // ignore amperage, since only the voltage is relevant for recipe search + // amps are never > 3 in an EnergyContainerList + return voltage; + } + } + return Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); } @Nonnull @@ -370,32 +394,35 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { IEnergyContainer energyContainer = getEnergyContainer(); - if (energyContainer instanceof EnergyContainerList) { - long voltage; - long amperage; - if (energyContainer.getInputVoltage() > energyContainer.getOutputVoltage()) { - voltage = energyContainer.getInputVoltage(); - amperage = energyContainer.getInputAmperage(); - } else { - voltage = energyContainer.getOutputVoltage(); - amperage = energyContainer.getOutputAmperage(); - } - - if (amperage == 1) { - // amperage is 1 when the energy is not exactly on a tier - - // the voltage for recipe search is always on tier, so take the closest lower tier + if (!consumesEnergy()) { + // Generators + long voltage = energyContainer.getOutputVoltage(); + long amperage = energyContainer.getOutputAmperage(); + if (energyContainer instanceof EnergyContainerList && amperage == 1) { + // Amperage is 1 when the energy is not exactly on a tier. + // The voltage for recipe search is always on tier, so take the closest lower tier. + // List check is done because single hatches will always be a "clean voltage," no need + // for any additional checks. return GTValues.V[GTUtility.getFloorTierByVoltage(voltage)]; + } + return voltage; + } else { + // Machines + if (energyContainer instanceof EnergyContainerList energyList) { + long highestVoltage = energyList.getHighestInputVoltage(); + if (energyList.getNumHighestInputContainers() > 1) { + // allow tier + 1 if there are multiple hatches present at the highest tier + int tier = GTUtility.getTierByVoltage(highestVoltage); + return GTValues.V[Math.min(tier + 1, GTValues.MAX)]; + } else { + return highestVoltage; + } } else { - // amperage != 1 means the voltage is exactly on a tier - // ignore amperage, since only the voltage is relevant for recipe search - // amps are never > 3 in an EnergyContainerList - return voltage; + return energyContainer.getInputVoltage(); } } - return Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); } @Nullable diff --git a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java index 2555e02a53c..683b51ffda9 100644 --- a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java @@ -39,7 +39,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return GTValues.LV; } diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java index c45a10ffb09..c618fa377b0 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java @@ -41,7 +41,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return Math.max(energyContainer.get().getInputVoltage(), energyContainer.get().getOutputVoltage()); } diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java index a52d6601318..c2944e24a0b 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java @@ -221,7 +221,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return GTValues.V[GTValues.LV]; } diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java index 2799bea054c..70cee480210 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java @@ -111,7 +111,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return GTValues.V[GTValues.LV]; } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java index 89dbefb0111..cf34d8094b9 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java @@ -89,14 +89,35 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { // wrap in text component to keep it from being formatted ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); - textList.add(TextComponentUtil.translationWithColor( + ITextComponent bodyText = TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick", - energyFormatted, voltageName)); + energyFormatted, voltageName); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick_hover"); + textList.add(TextComponentUtil.setHover(bodyText, hoverText)); } return this; } + /** + * Adds the max Recipe Tier that this multiblock can use for recipe lookup. + *
+ * Added if the structure is formed and if the passed tier is a valid energy tier index for {@link GTValues#VNF}. + */ + public Builder addEnergyTierLine(int tier) { + if (!isStructureFormed) return this; + if (tier < GTValues.ULV || tier > GTValues.MAX) return this; + + ITextComponent voltageName = new TextComponentString(GTValues.VNF[tier]); + ITextComponent bodyText = TextComponentUtil.translationWithColor( + TextFormatting.GRAY, + "gregtech.multiblock.max_recipe_tier", + voltageName); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_recipe_tier_hover"); + textList.add(TextComponentUtil.setHover(bodyText, hoverText)); + return this; + } + /** * Adds the exact EU/t that this multiblock needs to run. *
diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index 07c8f87228e..25857cf5538 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -139,6 +139,7 @@ protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addParallelsLine(recipeMapWorkable.getParallelLimit()) .addWorkingStatusLine() .addProgressLine(recipeMapWorkable.getProgressPercent()); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java index 931e411ea97..5386c82fa0c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java @@ -12,6 +12,7 @@ import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; +import gregtech.api.util.GTUtility; import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -80,6 +81,7 @@ protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addCustom(tl -> { // Coil energy discount line if (isStructureFormed()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java index 87e6362b5c7..2136e3a2d91 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java @@ -69,6 +69,7 @@ protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addCustom(tl -> { // Coil heat capacity line if (isStructureFormed()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index aaa13d17686..957fbbe570f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -554,7 +554,7 @@ protected double getOverclockingVoltageMultiplier() { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return Math.min(GTValues.V[tier], super.getMaxVoltage()); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java index 68919a5bc94..f6c6f6241de 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java @@ -11,6 +11,7 @@ import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.machines.RecipeMapFurnace; +import gregtech.api.util.GTUtility; import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; @@ -50,6 +51,7 @@ protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addCustom(tl -> { if (isStructureFormed()) { // Heating coil discount diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java index 34dab5a22af..a680fd7e0bd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java @@ -107,12 +107,14 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override protected void addDisplayText(List textList) { + ProcessingArrayWorkable logic = (ProcessingArrayWorkable) recipeMapWorkable; + MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addEnergyTierLine(logic.currentMachineStack == ItemStack.EMPTY ? -1 : logic.machineTier) .addCustom(tl -> { if (isStructureFormed()) { - ProcessingArrayWorkable logic = (ProcessingArrayWorkable) recipeMapWorkable; // Machine mode text // Shared text components for both states @@ -357,6 +359,13 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul return super.findRecipe(Math.min(super.getMaxVoltage(), this.machineVoltage), inputs, fluidInputs); } + @Override + public long getMaxVoltage() { + // Allow the PA to use as much power as provided, since tier is gated by the machine anyway. + // UI text uses the machine stack's tier instead of the getMaxVoltage() tier as well. + return super.getMaximumOverclockVoltage(); + } + @Override protected int getNumberOfOCs(int recipeEUt) { if (!isAllowOverclocking()) return 0; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java index 90e6a0c5cbb..6aa26293409 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java @@ -12,6 +12,7 @@ import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; +import gregtech.api.util.GTUtility; import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -99,6 +100,7 @@ protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) .setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive()) .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addCustom(tl -> { if (isStructureFormed()) { int processingSpeed = coilTier == 0 ? 75 : 50 * (coilTier + 1); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java index cad1696cfa5..e7c20439a0c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java @@ -19,6 +19,7 @@ import gregtech.api.pattern.PatternMatchContext; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMaps; +import gregtech.api.util.GTUtility; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; @@ -221,6 +222,7 @@ protected void addDisplayText(List textList) { "gregtech.multiblock.work_paused", "gregtech.machine.research_station.researching") .addEnergyUsageLine(recipeMapWorkable.getEnergyContainer()) + .addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage())) .addComputationUsageExactLine(getRecipeMapWorkable().getCurrentDrawnCWUt()) .addParallelsLine(recipeMapWorkable.getParallelLimit()) .addWorkingStatusLine() diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index dec10605d52..7499bbf37f4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -370,7 +370,7 @@ protected boolean shouldSearchForRecipes() { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { //this multiplies consumption through parallel if (isOxygenBoosted) return GTValues.V[tier] * 2; diff --git a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java index ef3da2ffa86..838e6ecc757 100644 --- a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java @@ -617,101 +617,86 @@ public static void init() { // 4A Energy Hatches ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[EV]) .input(ENERGY_INPUT_HATCH[EV]) - .input(POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_EV) .input(wireGtQuadruple, Aluminium, 2) + .input(plate, Titanium, 2) .output(ENERGY_INPUT_HATCH_4A[0]) .duration(100).EUt(VA[HV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[IV]) .input(ENERGY_INPUT_HATCH[IV]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_IV) .input(wireGtQuadruple, Tungsten, 2) + .input(plate, TungstenSteel, 2) .output(ENERGY_INPUT_HATCH_4A[1]) .duration(100).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[LuV]) .input(ENERGY_INPUT_HATCH[LuV]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_LuV) .input(wireGtQuadruple, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 2) .output(ENERGY_INPUT_HATCH_4A[2]) .duration(100).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[ZPM]) .input(ENERGY_INPUT_HATCH[ZPM]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_ZPM) .input(wireGtQuadruple, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 2) .output(ENERGY_INPUT_HATCH_4A[3]) .duration(100).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[UV]) .input(ENERGY_INPUT_HATCH[UV]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_UV) .input(wireGtQuadruple, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 2) .output(ENERGY_INPUT_HATCH_4A[4]) .duration(100).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(ENERGY_INPUT_HATCH[UHV], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(wireGtDouble, RutheniumTriniumAmericiumNeutronate) + .input(ENERGY_INPUT_HATCH[UHV]) .input(wireGtQuadruple, Europium, 2) + .input(plate, Neutronium, 2) .output(ENERGY_INPUT_HATCH_4A[5]) .duration(100).EUt(VA[UV]).buildAndRegister(); // 16A Energy Hatches ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[IV]) + .input(TRANSFORMER[IV]) .input(ENERGY_INPUT_HATCH_4A[1]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_IV) .input(wireGtOctal, Tungsten, 2) + .input(plate, TungstenSteel, 4) .output(ENERGY_INPUT_HATCH_16A[0]) .duration(200).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[LuV]) + .input(TRANSFORMER[LuV]) .input(ENERGY_INPUT_HATCH_4A[2]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_LuV) .input(wireGtOctal, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 4) .output(ENERGY_INPUT_HATCH_16A[1]) .duration(200).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[ZPM]) + .input(TRANSFORMER[ZPM]) .input(ENERGY_INPUT_HATCH_4A[3]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_ZPM) .input(wireGtOctal, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 4) .output(ENERGY_INPUT_HATCH_16A[2]) .duration(200).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[UV]) + .input(TRANSFORMER[UV]) .input(ENERGY_INPUT_HATCH_4A[4]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_UV) .input(wireGtOctal, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 4) .output(ENERGY_INPUT_HATCH_16A[3]) .duration(200).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() + .input(HI_AMP_TRANSFORMER[UV]) .input(ENERGY_INPUT_HATCH_4A[5], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(wireGtDouble, RutheniumTriniumAmericiumNeutronate) .input(wireGtOctal, Europium, 2) + .input(plate, Neutronium, 4) .output(ENERGY_INPUT_HATCH_16A[4]) .duration(200).EUt(VA[UV]).buildAndRegister(); @@ -720,145 +705,127 @@ public static void init() { ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[IV]) .input(ENERGY_INPUT_HATCH_16A[0]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_IV, 2) .input(wireGtHex, Tungsten, 2) + .input(plate, TungstenSteel, 6) .output(SUBSTATION_ENERGY_INPUT_HATCH[0]) .duration(400).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[LuV]) .input(ENERGY_INPUT_HATCH_16A[1]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_LuV, 2) .input(wireGtHex, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 6) .output(SUBSTATION_ENERGY_INPUT_HATCH[1]) .duration(400).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[ZPM]) .input(ENERGY_INPUT_HATCH_16A[2]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_ZPM, 2) .input(wireGtHex, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 6) .output(SUBSTATION_ENERGY_INPUT_HATCH[2]) .duration(400).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[UV]) .input(ENERGY_INPUT_HATCH_16A[3]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_UV, 2) .input(wireGtHex, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 6) .output(SUBSTATION_ENERGY_INPUT_HATCH[3]) .duration(400).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(ENERGY_INPUT_HATCH_16A[4], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate) + .input(POWER_TRANSFORMER[UV]) + .input(ENERGY_INPUT_HATCH_16A[4]) .input(wireGtHex, Europium, 2) + .input(plate, Neutronium, 6) .output(SUBSTATION_ENERGY_INPUT_HATCH[4]) .duration(400).EUt(VA[UV]).buildAndRegister(); // 4A Dynamo Hatches ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[EV]) .input(ENERGY_OUTPUT_HATCH[EV]) - .input(POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_EV) .input(wireGtQuadruple, Aluminium, 2) + .input(plate, Titanium, 2) .output(ENERGY_OUTPUT_HATCH_4A[0]) .duration(100).EUt(VA[HV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[IV]) .input(ENERGY_OUTPUT_HATCH[IV]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_IV) .input(wireGtQuadruple, Tungsten, 2) + .input(plate, TungstenSteel, 2) .output(ENERGY_OUTPUT_HATCH_4A[1]) .duration(100).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[LuV]) .input(ENERGY_OUTPUT_HATCH[LuV]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_LuV) .input(wireGtQuadruple, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 2) .output(ENERGY_OUTPUT_HATCH_4A[2]) .duration(100).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(TRANSFORMER[ZPM]) .input(ENERGY_OUTPUT_HATCH[ZPM]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_ZPM) .input(wireGtQuadruple, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 2) .output(ENERGY_OUTPUT_HATCH_4A[3]) .duration(100).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(TRANSFORMER[UV]) .input(ENERGY_OUTPUT_HATCH[UV]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(VOLTAGE_COIL_UV) .input(wireGtQuadruple, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 2) .output(ENERGY_OUTPUT_HATCH_4A[4]) .duration(100).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(ENERGY_OUTPUT_HATCH[UHV], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT) - .input(wireGtDouble, RutheniumTriniumAmericiumNeutronate) + .input(ENERGY_OUTPUT_HATCH[UHV]) .input(wireGtQuadruple, Europium, 2) + .input(plate, Neutronium, 2) .output(ENERGY_OUTPUT_HATCH_4A[5]) .duration(100).EUt(VA[UV]).buildAndRegister(); // 16A Dynamo Hatches ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[IV]) + .input(TRANSFORMER[IV]) .input(ENERGY_OUTPUT_HATCH_4A[1]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_IV) .input(wireGtOctal, Tungsten, 2) + .input(plate, TungstenSteel, 4) .output(ENERGY_OUTPUT_HATCH_16A[0]) .duration(200).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[LuV]) + .input(TRANSFORMER[LuV]) .input(ENERGY_OUTPUT_HATCH_4A[2]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_LuV) .input(wireGtOctal, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 4) .output(ENERGY_OUTPUT_HATCH_16A[1]) .duration(200).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[ZPM]) + .input(TRANSFORMER[ZPM]) .input(ENERGY_OUTPUT_HATCH_4A[3]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_ZPM) .input(wireGtOctal, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 4) .output(ENERGY_OUTPUT_HATCH_16A[2]) .duration(200).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(HI_AMP_TRANSFORMER[UV]) + .input(TRANSFORMER[UV]) .input(ENERGY_OUTPUT_HATCH_4A[4]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(VOLTAGE_COIL_UV) .input(wireGtOctal, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 4) .output(ENERGY_OUTPUT_HATCH_16A[3]) .duration(200).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(ENERGY_OUTPUT_HATCH_4A[5], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .input(wireGtDouble, RutheniumTriniumAmericiumNeutronate) + .input(HI_AMP_TRANSFORMER[UV]) + .input(ENERGY_OUTPUT_HATCH_4A[5]) .input(wireGtOctal, Europium, 2) + .input(plate, Neutronium, 4) .output(ENERGY_OUTPUT_HATCH_16A[4]) .duration(200).EUt(VA[UV]).buildAndRegister(); @@ -867,44 +834,40 @@ public static void init() { ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[IV]) .input(ENERGY_OUTPUT_HATCH_16A[0]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_IV, 2) .input(wireGtHex, Tungsten, 2) + .input(plate, TungstenSteel, 6) .output(SUBSTATION_ENERGY_OUTPUT_HATCH[0]) .duration(400).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[LuV]) .input(ENERGY_OUTPUT_HATCH_16A[1]) - .input(HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_LuV, 2) .input(wireGtHex, NiobiumTitanium, 2) + .input(plate, RhodiumPlatedPalladium, 6) .output(SUBSTATION_ENERGY_OUTPUT_HATCH[1]) .duration(400).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[ZPM]) .input(ENERGY_OUTPUT_HATCH_16A[2]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_ZPM, 2) .input(wireGtHex, VanadiumGallium, 2) + .input(plate, NaquadahAlloy, 6) .output(SUBSTATION_ENERGY_OUTPUT_HATCH[2]) .duration(400).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(POWER_TRANSFORMER[UV]) .input(ENERGY_OUTPUT_HATCH_16A[3]) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(VOLTAGE_COIL_UV, 2) .input(wireGtHex, YttriumBariumCuprate, 2) + .input(plate, Darmstadtium, 6) .output(SUBSTATION_ENERGY_OUTPUT_HATCH[3]) .duration(400).EUt(VA[ZPM]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() - .input(ENERGY_OUTPUT_HATCH_16A[4], 2) - .input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 4) - .input(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate) + .input(POWER_TRANSFORMER[UV]) + .input(ENERGY_OUTPUT_HATCH_16A[4]) .input(wireGtHex, Europium, 2) + .input(plate, Neutronium, 6) .output(SUBSTATION_ENERGY_OUTPUT_HATCH[4]) .duration(400).EUt(VA[UV]).buildAndRegister(); diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index e178e75b770..38f6999c437 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -5515,7 +5515,10 @@ gregtech.multiblock.invalid_structure=Invalid structure. gregtech.multiblock.invalid_structure.tooltip=This block is a controller of the multiblock structure. For building help, see structure template in JEI. gregtech.multiblock.validation_failed=Invalid amount of inputs/outputs. gregtech.multiblock.max_energy_per_tick=Max EU/t: %s (%s) +gregtech.multiblock.max_energy_per_tick_hover=The maximum EU/t available for running recipes or overclocking gregtech.multiblock.max_energy_per_tick_amps=Max EU/t: %s (%sA %s) +gregtech.multiblock.max_recipe_tier=Max Recipe Tier: %s +gregtech.multiblock.max_recipe_tier_hover=The maximum tier of recipes that can be run gregtech.multiblock.generation_eu=Outputting: §a%s EU/t gregtech.multiblock.universal.no_problems=No Maintenance Problems! gregtech.multiblock.universal.has_problems=Has Maintenance Problems! diff --git a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java index 42e58ebf008..ecd26210a42 100644 --- a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java @@ -77,7 +77,7 @@ protected boolean drawEnergy(int recipeEUt, boolean simulate) { } @Override - protected long getMaxVoltage() { + public long getMaxVoltage() { return 32; } }; From d0c17006a4d516252c3f0ebf7829d6ac81830872 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:06:49 -0600 Subject: [PATCH 12/77] Spotless Formatting (#1802) Co-authored-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- .editorconfig | 461 +++++- .github/workflows/pr_testing.yml | 23 + gradle.properties | 2 +- spotless.importorder | 9 + src/main/java/gregtech/GregTechMod.java | 24 +- src/main/java/gregtech/api/GTValues.java | 32 +- src/main/java/gregtech/api/GregTechAPI.java | 51 +- .../gregtech/api/GregTechAPIInternal.java | 1 + .../api/block/BlockCustomParticle.java | 32 +- .../api/block/BlockStateTileEntity.java | 1 - .../api/block/BuiltInRenderBlock.java | 1 - .../api/block/ICustomParticleBlock.java | 6 +- .../api/block/IStateHarvestLevel.java | 1 + .../api/block/UnlistedBooleanProperty.java | 1 + .../api/block/VariantActiveBlock.java | 34 +- .../java/gregtech/api/block/VariantBlock.java | 24 +- .../gregtech/api/block/VariantItemBlock.java | 1 - .../api/block/machines/BlockMachine.java | 96 +- .../api/block/machines/MachineItemBlock.java | 50 +- .../gregtech/api/capability/FeCompat.java | 13 +- .../api/capability/GregtechCapabilities.java | 1 + .../api/capability/GregtechDataCodes.java | 1 - .../capability/GregtechTileCapabilities.java | 1 + .../api/capability/IControllable.java | 1 - .../api/capability/IDataAccessHatch.java | 3 +- .../api/capability/IElectricItem.java | 1 - .../api/capability/IEnergyContainer.java | 13 +- .../java/gregtech/api/capability/IFilter.java | 32 +- .../capability/IFilteredFluidContainer.java | 8 +- .../api/capability/IHPCAComponentHatch.java | 3 +- .../api/capability/ILaserContainer.java | 3 +- .../api/capability/IMaintenanceHatch.java | 5 +- .../java/gregtech/api/capability/IMiner.java | 1 - .../api/capability/IMultipleRecipeMaps.java | 1 + .../api/capability/IMultipleTankHandler.java | 14 +- .../api/capability/INotifiableHandler.java | 1 - .../api/capability/IObjectHolder.java | 12 +- .../IOpticalComputationProvider.java | 3 +- .../api/capability/IPropertyFluidFilter.java | 14 +- .../gregtech/api/capability/IWorkable.java | 3 +- .../capability/SimpleCapabilityManager.java | 7 +- .../capability/impl/AbstractRecipeLogic.java | 74 +- .../capability/impl/BoilerRecipeLogic.java | 31 +- .../api/capability/impl/CleanroomLogic.java | 19 +- .../impl/CombinedCapabilityProvider.java | 3 +- .../capability/impl/CommonFluidFilters.java | 7 + .../impl/ComputationRecipeLogic.java | 3 +- .../api/capability/impl/EUToFEProvider.java | 11 +- .../api/capability/impl/ElectricItem.java | 21 +- .../impl/EnergyContainerBatteryBuffer.java | 25 +- .../impl/EnergyContainerBatteryCharger.java | 12 +- .../impl/EnergyContainerHandler.java | 29 +- .../capability/impl/EnergyContainerList.java | 12 +- .../capability/impl/FilteredFluidHandler.java | 1 + .../capability/impl/FilteredItemHandler.java | 6 +- .../api/capability/impl/FluidDrillLogic.java | 29 +- .../capability/impl/FluidHandlerProxy.java | 6 +- .../api/capability/impl/FluidTankList.java | 9 +- .../api/capability/impl/FuelRecipeLogic.java | 8 +- .../impl/GTFluidHandlerItemStack.java | 3 +- .../impl/GTSimpleFluidHandlerItemStack.java | 4 +- .../impl/GhostCircuitItemStackHandler.java | 10 +- .../impl/HeatingCoilRecipeLogic.java | 6 +- .../api/capability/impl/ItemHandlerList.java | 8 +- .../api/capability/impl/ItemHandlerProxy.java | 9 +- .../impl/LaserContainerHandler.java | 20 +- .../api/capability/impl/MultiFluidFilter.java | 7 +- .../impl/MultiblockFuelRecipeLogic.java | 12 +- .../impl/MultiblockRecipeLogic.java | 39 +- .../capability/impl/NotifiableFluidTank.java | 1 + .../impl/NotifiableItemStackHandler.java | 7 +- .../capability/impl/PrimitiveRecipeLogic.java | 3 +- .../capability/impl/PropertyFluidFilter.java | 1 + .../capability/impl/RecipeLogicEnergy.java | 3 +- .../api/capability/impl/RecipeLogicSteam.java | 18 +- .../capability/impl/SingleFluidFilter.java | 1 + .../capability/impl/SteamMultiWorkable.java | 1 - .../impl/SteamMultiblockRecipeLogic.java | 16 +- .../api/capability/impl/miner/MinerLogic.java | 77 +- .../impl/miner/MultiblockMinerLogic.java | 16 +- .../impl/miner/SteamMinerLogic.java | 3 +- src/main/java/gregtech/api/cover/Cover.java | 41 +- .../java/gregtech/api/cover/CoverBase.java | 18 +- .../gregtech/api/cover/CoverDefinition.java | 7 +- .../java/gregtech/api/cover/CoverHolder.java | 34 +- .../gregtech/api/cover/CoverRayTracer.java | 24 +- .../gregtech/api/cover/CoverSaveHandler.java | 10 +- .../gregtech/api/cover/CoverUIFactory.java | 7 +- .../java/gregtech/api/cover/CoverUtil.java | 3 +- .../java/gregtech/api/cover/CoverWithUI.java | 1 + .../gregtech/api/cover/CoverableView.java | 15 +- .../api/damagesources/DamageSourceTool.java | 3 +- .../api/damagesources/DamageSources.java | 1 + .../gregtech/api/event/MaterialInfoEvent.java | 3 +- .../gregtech/api/fluids/FluidBuilder.java | 17 +- .../java/gregtech/api/fluids/FluidState.java | 1 + .../java/gregtech/api/fluids/GTFluid.java | 8 +- .../gregtech/api/fluids/GTFluidBlock.java | 16 +- .../api/fluids/GTFluidRegistration.java | 8 +- .../api/fluids/attribute/AttributedFluid.java | 8 +- .../api/fluids/attribute/FluidAttribute.java | 4 +- .../api/fluids/attribute/FluidAttributes.java | 3 +- .../api/fluids/store/FluidStorage.java | 10 +- .../api/fluids/store/FluidStorageKey.java | 4 +- .../java/gregtech/api/gui/BlankUIHolder.java | 5 +- .../java/gregtech/api/gui/GuiTextures.java | 665 +++++--- .../java/gregtech/api/gui/INativeWidget.java | 2 + .../java/gregtech/api/gui/ISizeProvider.java | 11 +- src/main/java/gregtech/api/gui/ModularUI.java | 32 +- src/main/java/gregtech/api/gui/UIFactory.java | 15 +- src/main/java/gregtech/api/gui/Widget.java | 93 +- .../gregtech/api/gui/impl/FakeModularGui.java | 60 +- .../api/gui/impl/FakeModularGuiContainer.java | 24 +- .../api/gui/impl/ModularUIContainer.java | 29 +- .../gregtech/api/gui/impl/ModularUIGui.java | 30 +- .../ingredient/IGhostIngredientTarget.java | 1 - .../api/gui/ingredient/IIngredientSlot.java | 1 - .../IRecipeTransferHandlerWidget.java | 7 +- .../gui/resources/AdoptableTextureArea.java | 41 +- .../api/gui/resources/ColorRectTexture.java | 15 +- .../api/gui/resources/FileTexture.java | 21 +- .../api/gui/resources/IGuiTexture.java | 5 +- .../api/gui/resources/ItemStackTexture.java | 11 +- .../api/gui/resources/ModifyGuiTexture.java | 14 +- .../api/gui/resources/ResourceHelper.java | 8 +- .../api/gui/resources/ShaderTexture.java | 19 +- .../api/gui/resources/SizedTextureArea.java | 4 +- .../api/gui/resources/SteamTexture.java | 15 +- .../api/gui/resources/TextTexture.java | 5 +- .../api/gui/resources/TextureArea.java | 21 +- .../api/gui/resources/URLTexture.java | 15 +- .../AnimatedPictureTexture.java | 6 +- .../picturetexture/OrdinaryTexture.java | 4 +- .../picturetexture/PictureTexture.java | 15 +- .../picturetexture/VideoTexture.java | 10 +- .../gui/resources/utils/DownloadThread.java | 9 +- .../api/gui/resources/utils/GifDecoder.java | 137 +- .../api/gui/resources/utils/ImageUtils.java | 11 +- .../resources/utils/ProcessedImageData.java | 18 +- .../api/gui/resources/utils/TextureCache.java | 3 + .../api/gui/widgets/AbstractWidgetGroup.java | 19 +- .../api/gui/widgets/AdvancedTextWidget.java | 18 +- .../api/gui/widgets/BlockableSlotWidget.java | 10 +- .../api/gui/widgets/ClickButtonWidget.java | 10 +- .../CraftingStationInputWidgetGroup.java | 18 +- .../api/gui/widgets/CycleButtonWidget.java | 22 +- .../api/gui/widgets/DrawableWidget.java | 6 +- .../api/gui/widgets/DynamicLabelWidget.java | 2 +- .../gui/widgets/FluidContainerSlotWidget.java | 6 +- .../gui/widgets/GhostCircuitSlotWidget.java | 5 +- .../gui/widgets/ImageCycleButtonWidget.java | 22 +- .../api/gui/widgets/ImageTextFieldWidget.java | 17 +- .../gregtech/api/gui/widgets/ImageWidget.java | 2 +- .../gui/widgets/IncrementButtonWidget.java | 8 +- .../api/gui/widgets/IndicatorImageWidget.java | 4 +- .../gregtech/api/gui/widgets/LabelWidget.java | 2 +- .../api/gui/widgets/PhantomFluidWidget.java | 26 +- .../api/gui/widgets/PhantomSlotWidget.java | 13 +- .../api/gui/widgets/PhantomTankWidget.java | 23 +- .../api/gui/widgets/ProgressWidget.java | 28 +- .../api/gui/widgets/RecipeProgressWidget.java | 19 +- .../api/gui/widgets/ScrollableListWidget.java | 18 +- .../api/gui/widgets/ServerWidgetGroup.java | 1 + .../api/gui/widgets/SimpleTextWidget.java | 10 +- .../api/gui/widgets/SliderWidget.java | 16 +- .../gregtech/api/gui/widgets/SlotWidget.java | 31 +- .../api/gui/widgets/SortingButtonWidget.java | 4 +- .../api/gui/widgets/SuppliedImageWidget.java | 3 +- .../gui/widgets/SyncableColorRectWidget.java | 11 +- .../gregtech/api/gui/widgets/TabGroup.java | 14 +- .../gregtech/api/gui/widgets/TankWidget.java | 45 +- .../api/gui/widgets/TextFieldWidget.java | 23 +- .../api/gui/widgets/TextFieldWidget2.java | 9 +- .../api/gui/widgets/ToggleButtonWidget.java | 15 +- .../api/gui/widgets/WidgetUIAccess.java | 2 +- .../tab/HorizontalTabListRenderer.java | 53 +- .../gui/widgets/tab/IGuiTextureTabInfo.java | 11 +- .../api/gui/widgets/tab/ITabInfo.java | 4 +- .../api/gui/widgets/tab/ItemTabInfo.java | 10 +- .../api/gui/widgets/tab/TabListRenderer.java | 4 +- .../widgets/tab/VerticalTabListRenderer.java | 55 +- .../java/gregtech/api/items/OreDictNames.java | 1 - .../api/items/armor/ArmorLogicSuite.java | 14 +- .../api/items/armor/ArmorMetaItem.java | 38 +- .../gregtech/api/items/armor/ArmorUtils.java | 51 +- .../api/items/armor/DummyArmorLogic.java | 1 + .../gregtech/api/items/armor/IArmorItem.java | 36 +- .../gregtech/api/items/armor/IArmorLogic.java | 27 +- .../api/items/armor/ISpecialArmorLogic.java | 6 +- .../api/items/behavior/CoverItemBehavior.java | 5 +- .../behavior/MonitorPluginBaseBehavior.java | 82 +- .../behavior/ProxyHolderPluginBehavior.java | 2 + .../gregtech/api/items/gui/ItemUIFactory.java | 2 +- .../api/items/gui/PlayerInventoryHolder.java | 1 + .../items/gui/PlayerInventoryUIFactory.java | 5 +- .../itemhandlers/GTItemStackHandler.java | 1 + .../InaccessibleItemStackHandler.java | 2 + .../items/materialitem/MetaPrefixItem.java | 25 +- .../items/metaitem/DefaultSubItemHandler.java | 10 +- .../api/items/metaitem/ElectricStats.java | 13 +- .../items/metaitem/FilteredFluidStats.java | 4 +- .../api/items/metaitem/FoodStats.java | 10 +- .../api/items/metaitem/FoodUseManager.java | 10 +- .../gregtech/api/items/metaitem/MetaItem.java | 111 +- .../api/items/metaitem/MetaOreDictItem.java | 24 +- .../api/items/metaitem/MusicDiscStats.java | 8 +- .../api/items/metaitem/StandardMetaItem.java | 1 - .../metaitem/stats/IEnchantabilityHelper.java | 1 - .../items/metaitem/stats/IFoodBehavior.java | 4 +- .../items/metaitem/stats/IItemBehaviour.java | 26 +- .../stats/IItemCapabilityProvider.java | 1 - .../items/metaitem/stats/IItemComponent.java | 3 +- .../stats/IItemDurabilityManager.java | 14 +- .../stats/IItemMaxStackSizeProvider.java | 1 - .../metaitem/stats/IItemModelManager.java | 3 +- .../metaitem/stats/IItemNameProvider.java | 1 - .../items/metaitem/stats/IItemUseManager.java | 9 +- .../items/metaitem/stats/ISubItemHandler.java | 1 - .../metaitem/stats/ItemFluidContainer.java | 1 + .../api/items/toolitem/EnchantmentLevel.java | 1 + .../gregtech/api/items/toolitem/IGTTool.java | 179 ++- .../api/items/toolitem/IGTToolDefinition.java | 5 +- .../api/items/toolitem/ItemGTAxe.java | 57 +- .../api/items/toolitem/ItemGTHoe.java | 57 +- .../api/items/toolitem/ItemGTSword.java | 49 +- .../api/items/toolitem/ItemGTTool.java | 59 +- .../api/items/toolitem/ToolBuilder.java | 10 +- .../items/toolitem/ToolDefinitionBuilder.java | 14 +- .../api/items/toolitem/ToolHelper.java | 118 +- .../items/toolitem/TreeFellingListener.java | 9 +- .../items/toolitem/aoe/AoESymmetrical.java | 5 +- .../toolitem/behavior/IToolBehavior.java | 46 +- .../api/metatileentity/IDataInfoProvider.java | 4 +- .../IFastRenderMetaTileEntity.java | 9 +- .../IMachineHatchMultiblock.java | 3 +- .../api/metatileentity/IVoidable.java | 5 +- .../gregtech/api/metatileentity/MTETrait.java | 15 +- .../api/metatileentity/MetaTileEntity.java | 177 +- .../metatileentity/MetaTileEntityHolder.java | 106 +- .../MetaTileEntityUIFactory.java | 4 +- .../NeighborCacheTileEntityBase.java | 2 + .../SimpleGeneratorMetaTileEntity.java | 51 +- .../SimpleMachineMetaTileEntity.java | 86 +- .../metatileentity/SteamMetaTileEntity.java | 39 +- .../metatileentity/SyncedTileEntityBase.java | 9 +- .../TickableTileEntityBase.java | 5 +- .../metatileentity/TieredMetaTileEntity.java | 26 +- .../WorkableTieredMetaTileEntity.java | 70 +- .../interfaces/IHasWorldObjectAndCoords.java | 1 + .../interfaces/INeighborCache.java | 1 + .../interfaces/ISyncedTileEntity.java | 1 + .../multiblock/CleanroomType.java | 13 +- .../multiblock/DummyCleanroom.java | 4 +- .../multiblock/FuelMultiblockController.java | 45 +- .../multiblock/IBatteryData.java | 3 +- .../multiblock/IMultiblockAbilityPart.java | 1 - .../multiblock/IMultiblockPart.java | 1 - .../multiblock/IProgressBarMultiblock.java | 8 +- .../MultiMapMultiblockController.java | 36 +- .../multiblock/MultiblockAbility.java | 52 +- .../multiblock/MultiblockControllerBase.java | 98 +- .../multiblock/MultiblockDisplayText.java | 67 +- .../multiblock/MultiblockWithDisplayBase.java | 58 +- .../multiblock/ParallelLogicType.java | 3 +- .../RecipeMapMultiblockController.java | 69 +- ...ecipeMapPrimitiveMultiblockController.java | 13 +- .../RecipeMapSteamMultiblockController.java | 25 +- .../gregtech/api/modules/IGregTechModule.java | 45 +- .../gregtech/api/modules/IModuleManager.java | 1 + .../gregtech/api/modules/ModuleContainer.java | 3 +- .../modules/ModuleContainerRegistryEvent.java | 3 +- .../java/gregtech/api/network/IPacket.java | 18 +- .../gregtech/api/network/PacketDataList.java | 4 +- .../gregtech/api/pattern/BlockPattern.java | 158 +- .../gregtech/api/pattern/BlockWorldState.java | 8 +- .../api/pattern/FactoryBlockPattern.java | 23 +- .../api/pattern/MultiblockShapeInfo.java | 9 +- .../api/pattern/PatternStringError.java | 3 +- .../api/pattern/TraceabilityPredicate.java | 40 +- .../api/pipenet/IBlockAppearance.java | 6 +- .../java/gregtech/api/pipenet/IRoutePath.java | 3 +- .../java/gregtech/api/pipenet/PipeNet.java | 116 +- .../gregtech/api/pipenet/PipeNetWalker.java | 42 +- .../gregtech/api/pipenet/WorldPipeNet.java | 3 +- .../gregtech/api/pipenet/block/BlockPipe.java | 141 +- .../gregtech/api/pipenet/block/IPipeType.java | 1 - .../api/pipenet/block/ItemBlockPipe.java | 14 +- .../block/material/BlockMaterialPipe.java | 14 +- .../block/material/IMaterialPipeTile.java | 3 +- .../block/material/ItemBlockMaterialPipe.java | 4 +- .../material/TileEntityMaterialPipeBase.java | 5 +- .../pipenet/block/simple/BlockSimplePipe.java | 5 +- .../pipenet/block/simple/EmptyNodeData.java | 3 +- .../longdist/BlockLongDistancePipe.java | 19 +- .../api/pipenet/longdist/ILDEndpoint.java | 6 +- .../api/pipenet/longdist/ILDNetworkPart.java | 1 + .../pipenet/longdist/LongDistanceNetwork.java | 23 +- .../longdist/LongDistancePipeType.java | 7 +- .../api/pipenet/longdist/NetworkBuilder.java | 13 +- .../tickable/TickableWorldPipeNet.java | 7 +- .../TickableWorldPipeNetEventHandler.java | 1 + .../gregtech/api/pipenet/tile/IPipeTile.java | 6 +- .../tile/PipeCoverableImplementation.java | 15 +- .../api/pipenet/tile/TileEntityPipeBase.java | 29 +- .../gregtech/api/recipes/FluidCellInput.java | 13 +- .../java/gregtech/api/recipes/FluidKey.java | 3 +- .../gregtech/api/recipes/GTRecipeHandler.java | 33 +- .../api/recipes/GTRecipeInputCache.java | 3 +- .../java/gregtech/api/recipes/ModHandler.java | 151 +- .../java/gregtech/api/recipes/Recipe.java | 65 +- .../gregtech/api/recipes/RecipeBuilder.java | 54 +- .../java/gregtech/api/recipes/RecipeMap.java | 248 ++- .../java/gregtech/api/recipes/RecipeMaps.java | 1432 +++++++++-------- .../api/recipes/RecyclingHandler.java | 11 +- .../builders/AssemblyLineRecipeBuilder.java | 27 +- .../recipes/builders/BlastRecipeBuilder.java | 7 +- .../CircuitAssemblerRecipeBuilder.java | 4 +- .../builders/ComputationRecipeBuilder.java | 1 + .../recipes/builders/FuelRecipeBuilder.java | 5 +- .../recipes/builders/FusionRecipeBuilder.java | 4 +- .../builders/GasCollectorRecipeBuilder.java | 38 +- .../builders/ImplosionRecipeBuilder.java | 9 +- .../builders/PrimitiveRecipeBuilder.java | 3 +- .../builders/ResearchRecipeBuilder.java | 9 +- .../recipes/builders/SimpleRecipeBuilder.java | 4 +- .../UniversalDistillationRecipeBuilder.java | 25 +- .../recipes/category/GTRecipeCategory.java | 13 +- .../recipes/category/RecipeCategories.java | 18 +- .../api/recipes/chance/ChanceEntry.java | 6 +- .../chance/boost/ChanceBoostFunction.java | 1 + .../chance/output/BoostableChanceOutput.java | 1 + .../recipes/chance/output/ChancedOutput.java | 3 +- .../chance/output/ChancedOutputList.java | 4 +- .../chance/output/ChancedOutputLogic.java | 45 +- .../output/impl/ChancedFluidOutput.java | 2 + .../chance/output/impl/ChancedItemOutput.java | 2 + .../ingredients/GTRecipeFluidInput.java | 3 +- .../recipes/ingredients/GTRecipeInput.java | 25 +- .../ingredients/GTRecipeItemInput.java | 11 +- .../recipes/ingredients/GTRecipeOreInput.java | 11 +- .../ingredients/IntCircuitIngredient.java | 6 +- .../nbtmatch/ListNBTCondition.java | 4 +- .../ingredients/nbtmatch/NBTCondition.java | 3 +- .../ingredients/nbtmatch/NBTMatcher.java | 16 +- .../ingredients/nbtmatch/NBTTagType.java | 8 +- .../logic/IParallelableRecipeLogic.java | 32 +- .../api/recipes/logic/OverclockingLogic.java | 20 +- .../api/recipes/logic/ParallelLogic.java | 177 +- .../recipes/machines/IResearchRecipeMap.java | 7 +- .../recipes/machines/IScannerRecipeMap.java | 5 +- .../machines/RecipeMapAssemblyLine.java | 33 +- .../recipes/machines/RecipeMapCokeOven.java | 16 +- .../machines/RecipeMapCrackerUnit.java | 32 +- .../machines/RecipeMapDistillationTower.java | 32 +- .../machines/RecipeMapFluidCanner.java | 21 +- .../machines/RecipeMapFormingPress.java | 16 +- .../recipes/machines/RecipeMapFurnace.java | 7 +- .../machines/RecipeMapResearchStation.java | 14 +- .../recipes/machines/RecipeMapScanner.java | 8 +- .../java/gregtech/api/recipes/map/Branch.java | 14 +- .../java/gregtech/api/recipes/map/Either.java | 15 +- .../api/recipes/map/MapFluidIngredient.java | 7 +- .../recipes/map/MapItemStackIngredient.java | 11 +- .../map/MapItemStackNBTIngredient.java | 8 +- .../api/recipes/map/MapOreDictIngredient.java | 1 - .../recipes/map/MapOreDictNBTIngredient.java | 3 +- .../recipeproperties/CleanroomProperty.java | 1 + .../recipeproperties/ComputationProperty.java | 3 +- .../recipeproperties/DefaultProperty.java | 1 - .../EmptyRecipePropertyStorage.java | 8 +- .../FusionEUToStartProperty.java | 6 +- .../GasCollectorDimensionProperty.java | 9 +- .../IRecipePropertyStorage.java | 1 - .../ImplosionExplosiveProperty.java | 1 - .../recipeproperties/PrimitiveProperty.java | 3 +- .../recipeproperties/RecipeProperty.java | 4 +- .../RecipePropertyStorage.java | 2 +- .../ResearchPropertyData.java | 5 +- .../recipeproperties/TemperatureProperty.java | 7 +- .../TotalComputationProperty.java | 3 +- .../api/storage/ICraftingStorage.java | 2 + .../api/terminal/TerminalRegistry.java | 20 +- .../api/terminal/app/ARApplication.java | 34 +- .../api/terminal/app/AbstractApplication.java | 19 +- .../terminal/gui/CustomTabListRenderer.java | 15 +- .../gregtech/api/terminal/gui/IDraggable.java | 8 +- .../gui/widgets/AnimaWidgetGroup.java | 16 +- .../gui/widgets/CircleButtonWidget.java | 7 +- .../api/terminal/gui/widgets/ColorWidget.java | 86 +- .../gui/widgets/CustomPositionSizeWidget.java | 20 +- .../DraggableScrollableWidgetGroup.java | 77 +- .../gui/widgets/MachineSceneWidget.java | 31 +- .../gui/widgets/RectButtonWidget.java | 14 +- .../terminal/gui/widgets/ScrollBarWidget.java | 16 +- .../terminal/gui/widgets/SelectorWidget.java | 20 +- .../gui/widgets/TextEditorWidget.java | 136 +- .../terminal/gui/widgets/TreeListWidget.java | 36 +- .../api/terminal/hardware/Hardware.java | 10 +- .../terminal/hardware/HardwareProvider.java | 21 +- .../hardware/IHardwareCapability.java | 1 + .../gregtech/api/terminal/os/SystemCall.java | 19 +- .../terminal/os/TerminalDesktopWidget.java | 6 +- .../api/terminal/os/TerminalDialogWidget.java | 109 +- .../terminal/os/TerminalHomeButtonWidget.java | 12 +- .../api/terminal/os/TerminalOSWidget.java | 73 +- .../api/terminal/os/TerminalTheme.java | 62 +- .../api/terminal/os/menu/IMenuComponent.java | 3 +- .../terminal/os/menu/TerminalMenuWidget.java | 61 +- .../gregtech/api/terminal/util/FileTree.java | 2 +- .../gregtech/api/terminal/util/ISearch.java | 6 +- .../api/terminal/util/SearchEngine.java | 11 +- .../gregtech/api/terminal/util/TreeNode.java | 12 +- .../gregtech/api/unification/Element.java | 6 +- .../gregtech/api/unification/Elements.java | 9 +- .../api/unification/FluidUnifier.java | 28 +- .../api/unification/OreDictUnifier.java | 57 +- .../unification/material/MarkerMaterial.java | 10 +- .../unification/material/MarkerMaterials.java | 11 +- .../api/unification/material/Material.java | 101 +- .../api/unification/material/Materials.java | 19 +- .../material/event/MaterialEvent.java | 1 + .../material/event/MaterialRegistryEvent.java | 3 +- .../material/event/PostMaterialEvent.java | 1 + .../material/info/MaterialFlag.java | 4 +- .../material/info/MaterialFlags.java | 61 +- .../material/info/MaterialIconSet.java | 9 +- .../material/info/MaterialIconType.java | 25 +- .../material/materials/ElementMaterials.java | 29 +- .../materials/FirstDegreeMaterials.java | 75 +- .../materials/HigherDegreeMaterials.java | 7 +- .../materials/MaterialFlagAddition.java | 22 +- .../materials/OrganicChemistryMaterials.java | 3 +- .../materials/SecondDegreeMaterials.java | 14 +- .../UnknownCompositionMaterials.java | 6 +- .../material/properties/BlastProperty.java | 17 +- .../properties/FluidPipeProperties.java | 13 +- .../material/properties/FluidProperty.java | 1 + .../properties/MaterialProperties.java | 6 +- .../material/properties/OreProperty.java | 21 +- .../material/properties/PolymerProperty.java | 5 +- .../material/properties/PropertyKey.java | 6 +- .../material/properties/ToolProperty.java | 4 +- .../material/properties/WireProperties.java | 10 +- .../material/properties/package-info.java | 17 +- .../registry/IMaterialRegistryManager.java | 3 +- .../registry/MarkerMaterialRegistry.java | 1 + .../material/registry/MaterialRegistry.java | 3 +- .../ore/IOreRegistrationHandler.java | 1 - .../api/unification/ore/OrePrefix.java | 296 ++-- .../api/unification/ore/StoneType.java | 20 +- .../api/unification/ore/StoneTypes.java | 57 +- .../unification/stack/ItemAndMetadata.java | 1 + .../api/unification/stack/ItemVariantMap.java | 20 +- .../api/unification/stack/MaterialStack.java | 3 +- .../stack/MultiItemVariantMap.java | 1 + .../unification/stack/UnificationEntry.java | 4 +- .../stack/UnmodifiableSetViewVariantMap.java | 5 +- .../api/util/AssemblyLineManager.java | 20 +- .../gregtech/api/util/BaseCreativeTab.java | 3 +- .../java/gregtech/api/util/BlockInfo.java | 3 +- .../java/gregtech/api/util/BlockUtility.java | 1 - .../java/gregtech/api/util/CapesRegistry.java | 40 +- .../java/gregtech/api/util/ClipboardUtil.java | 1 + .../api/util/CustomModPriorityComparator.java | 11 +- .../gregtech/api/util/DummyContainer.java | 7 +- src/main/java/gregtech/api/util/DyeUtil.java | 51 +- .../gregtech/api/util/EntityDamageUtil.java | 7 +- .../java/gregtech/api/util/FileUtility.java | 32 +- .../gregtech/api/util/FluidTooltipUtil.java | 2 + .../api/util/GTControlledRegistry.java | 6 +- .../java/gregtech/api/util/GTHashMaps.java | 31 +- src/main/java/gregtech/api/util/GTLog.java | 3 +- .../java/gregtech/api/util/GTStringUtils.java | 16 +- .../java/gregtech/api/util/GTTeleporter.java | 1 + .../gregtech/api/util/GTTransferUtils.java | 37 +- .../java/gregtech/api/util/GTUtility.java | 106 +- .../java/gregtech/api/util/GradientUtil.java | 9 +- .../gregtech/api/util/GregFakePlayer.java | 20 +- .../java/gregtech/api/util/IBlockOre.java | 2 +- .../gregtech/api/util/IDirtyNotifiable.java | 1 + .../IFluidTankPropertiesHashStrategy.java | 8 +- .../api/util/ItemStackHashStrategy.java | 12 +- .../util/LargeStackSizeItemStackHandler.java | 4 +- .../gregtech/api/util/LocalizationUtils.java | 28 +- .../java/gregtech/api/util/MCGuiUtil.java | 15 +- .../gregtech/api/util/ModCompatibility.java | 5 +- .../api/util/OverlayedFluidHandler.java | 6 +- .../api/util/OverlayedItemHandler.java | 17 +- .../api/util/ParticleHandlerUtil.java | 47 +- .../gregtech/api/util/PerTickIntCounter.java | 6 +- .../gregtech/api/util/PositionedRect.java | 1 + .../gregtech/api/util/RandomPotionEffect.java | 1 - .../java/gregtech/api/util/RedstoneUtil.java | 6 +- .../gregtech/api/util/RelativeDirection.java | 9 +- .../java/gregtech/api/util/TaskScheduler.java | 4 +- .../gregtech/api/util/TeleportHandler.java | 13 +- .../gregtech/api/util/TextFormattingUtil.java | 8 +- .../gregtech/api/util/ValidationResult.java | 1 + .../api/util/VirtualTankRegistry.java | 57 +- src/main/java/gregtech/api/util/XSTR.java | 39 +- .../api/util/function/FloatConsumer.java | 1 - .../java/gregtech/api/util/function/Task.java | 1 - .../api/util/function/TriConsumer.java | 1 + .../java/gregtech/api/util/input/KeyBind.java | 6 +- .../gregtech/api/util/interpolate/Eases.java | 5 + .../gregtech/api/util/interpolate/IEase.java | 5 +- .../api/util/interpolate/Interpolator.java | 6 +- .../api/util/interpolate/RGBInterpolator.java | 5 +- .../gregtech/api/util/oreglob/OreGlob.java | 7 +- .../api/util/oreglob/OreGlobTextBuilder.java | 4 +- .../api/util/world/DummyChunkProvider.java | 5 +- .../api/util/world/DummySaveHandler.java | 29 +- .../gregtech/api/util/world/DummyWorld.java | 30 +- .../BedrockFluidVeinHandler.java | 21 +- .../BedrockFluidVeinSaveData.java | 14 +- .../bedrockFluids/ChunkPosDimension.java | 1 + .../config/BedrockFluidDepositDefinition.java | 31 +- .../worldgen/config/FillerConfigUtils.java | 37 +- .../worldgen/config/IWorldgenDefinition.java | 2 +- .../api/worldgen/config/OreConfigUtils.java | 17 +- .../worldgen/config/OreDepositDefinition.java | 36 +- .../worldgen/config/PredicateConfigUtils.java | 22 +- .../api/worldgen/config/WorldConfigUtils.java | 26 +- .../api/worldgen/config/WorldGenRegistry.java | 122 +- .../filler/BlacklistedBlockFiller.java | 7 +- .../api/worldgen/filler/BlockFiller.java | 7 +- .../api/worldgen/filler/FillerEntry.java | 4 +- .../worldgen/filler/LayeredBlockFiller.java | 10 +- .../worldgen/filler/SimpleBlockFiller.java | 10 +- .../worldgen/generator/CachedGridEntry.java | 64 +- .../generator/GTWorldGenCapability.java | 11 +- .../api/worldgen/generator/GridEntryInfo.java | 2 +- .../generator/WorldGeneratorImpl.java | 24 +- .../populator/FluidSpringPopulator.java | 13 +- .../populator/IBlockModifierAccess.java | 1 - .../worldgen/populator/IVeinPopulator.java | 4 +- .../populator/SurfaceBlockPopulator.java | 38 +- .../populator/SurfaceRockPopulator.java | 40 +- .../populator/VeinBufferPopulator.java | 4 +- .../populator/VeinChunkPopulator.java | 4 +- .../worldgen/shape/EllipsoidGenerator.java | 7 +- .../api/worldgen/shape/LayeredGenerator.java | 6 +- .../api/worldgen/shape/PlateGenerator.java | 7 +- .../api/worldgen/shape/ShapeGenerator.java | 3 +- .../worldgen/shape/SingleBlockGenerator.java | 10 +- .../api/worldgen/shape/SphereGenerator.java | 7 +- .../gregtech/asm/GregTechLoadingPlugin.java | 9 +- .../gregtech/asm/GregTechTransformer.java | 58 +- .../java/gregtech/asm/hooks/ArmorHooks.java | 4 +- .../gregtech/asm/hooks/ArmorRenderHooks.java | 17 +- .../java/gregtech/asm/hooks/BlockHooks.java | 5 +- .../java/gregtech/asm/hooks/CTMHooks.java | 9 +- .../java/gregtech/asm/hooks/CTMModHooks.java | 4 +- .../gregtech/asm/hooks/EnchantmentHooks.java | 1 + .../java/gregtech/asm/hooks/JEIHooks.java | 1 + .../gregtech/asm/hooks/LittleTilesHooks.java | 10 +- .../gregtech/asm/hooks/MinecraftHooks.java | 1 + .../asm/hooks/RecipeRepairItemHooks.java | 7 +- .../gregtech/asm/hooks/RenderChunkHooks.java | 5 +- .../gregtech/asm/hooks/RenderItemHooks.java | 1 + .../java/gregtech/asm/hooks/SoundHooks.java | 7 +- .../gregtech/asm/hooks/TheOneProbeHooks.java | 1 + .../java/gregtech/asm/util/ObfMapping.java | 34 +- .../gregtech/asm/util/TargetClassVisitor.java | 7 +- .../AbstractCTMBakedModelVisitor.java | 3 +- .../gregtech/asm/visitors/BlockVisitor.java | 16 +- .../gregtech/asm/visitors/CCLVisitor.java | 1 + .../asm/visitors/ConcretePowderVisitor.java | 1 + .../asm/visitors/DamageSourceVisitor.java | 7 +- .../visitors/EnchantmentCanApplyVisitor.java | 8 +- .../asm/visitors/EntityRendererVisitor.java | 5 +- .../gregtech/asm/visitors/JEIVisitor.java | 13 +- .../asm/visitors/LayerArmorBaseVisitor.java | 16 +- .../asm/visitors/LayerCustomHeadVisitor.java | 18 +- .../asm/visitors/LittleTilesVisitor.java | 5 +- .../asm/visitors/MinecraftVisitor.java | 1 + .../asm/visitors/ModelCTMVisitor.java | 2 +- .../visitors/ModelLoaderRegistryVisitor.java | 1 + .../NuclearCraftRecipeHelperVisitor.java | 11 +- .../asm/visitors/RecipeRepairItemVisitor.java | 10 +- .../RegionRenderCacheBuilderVisitor.java | 5 +- .../asm/visitors/RenderChunkVisitor.java | 10 +- .../asm/visitors/RenderItemVisitor.java | 11 +- .../visitors/SpecialArmorApplyVisitor.java | 33 +- .../visitors/SpecialArmorClassVisitor.java | 4 +- .../asm/visitors/TheOneProbeVisitor.java | 21 +- .../gregtech/asm/visitors/WorldVisitor.java | 4 +- .../java/gregtech/client/ClientProxy.java | 59 +- .../client/event/ClientEventHandler.java | 9 +- .../client/event/FluidVisualHandler.java | 16 +- .../model/ActiveVariantBlockBakedModel.java | 25 +- .../model/BorderlessLampBakedModel.java | 4 +- .../client/model/EmissiveOreBakedModel.java | 4 +- .../client/model/MaterialStateMapper.java | 1 + .../gregtech/client/model/ModelFactory.java | 45 +- .../gregtech/client/model/OreBakedModel.java | 10 +- .../client/model/SimpleStateMapper.java | 9 +- .../model/customtexture/CustomTexture.java | 32 +- .../CustomTextureBakedModel.java | 51 +- .../customtexture/CustomTextureModel.java | 29 +- .../CustomTextureModelHandler.java | 20 +- .../customtexture/MetadataSectionCTM.java | 20 +- .../client/model/lamp/LampBakedModel.java | 12 +- .../client/model/lamp/LampModelType.java | 1 + .../modelfactories/BakedModelHandler.java | 23 +- .../MaterialBlockModelLoader.java | 17 +- .../pipeline/VertexLighterFlatSpecial.java | 32 +- .../VertexLighterSmoothAoSpecial.java | 6 +- .../client/particle/GTLaserBeamParticle.java | 17 +- .../client/particle/GTNameTagParticle.java | 17 +- .../client/particle/GTOverheatParticle.java | 10 +- .../gregtech/client/particle/GTParticle.java | 14 +- .../client/particle/GTParticleManager.java | 10 +- .../client/renderer/CubeRendererState.java | 4 +- .../client/renderer/ICCLBlockRenderer.java | 1 + .../client/renderer/ICubeRenderer.java | 30 +- .../renderer/cclop/ColourOperation.java | 6 +- .../renderer/cclop/LightMapOperation.java | 6 +- .../client/renderer/cclop/UVMirror.java | 7 +- .../client/renderer/fx/LaserBeamRenderer.java | 65 +- .../handler/BlockPosHighlightRenderer.java | 6 +- .../renderer/handler/CCLBlockRenderer.java | 39 +- .../renderer/handler/DynamiteRenderer.java | 1 + .../renderer/handler/FacadeRenderer.java | 85 +- .../renderer/handler/GTBoatRenderer.java | 7 +- .../handler/LampItemOverlayRenderer.java | 2 + .../handler/MetaTileEntityRenderer.java | 44 +- .../renderer/handler/MetaTileEntityTESR.java | 25 +- .../handler/MultiblockPreviewRenderer.java | 23 +- .../client/renderer/handler/PortalModel.java | 36 +- .../renderer/handler/PortalRenderer.java | 38 +- .../renderer/handler/TerminalARRenderer.java | 10 +- .../client/renderer/pipe/CableRenderer.java | 22 +- .../renderer/pipe/FluidPipeRenderer.java | 12 +- .../renderer/pipe/ItemPipeRenderer.java | 10 +- .../renderer/pipe/LaserPipeRenderer.java | 30 +- .../renderer/pipe/OpticalPipeRenderer.java | 10 +- .../client/renderer/pipe/PipeRenderer.java | 144 +- .../renderer/scene/FBOWorldSceneRenderer.java | 25 +- .../renderer/scene/ISceneRenderHook.java | 4 +- .../scene/ImmediateWorldSceneRenderer.java | 13 +- .../renderer/scene/WorldSceneRenderer.java | 102 +- .../client/renderer/texture/Textures.java | 609 ++++--- .../cube/AlignedOrientedOverlayRenderer.java | 3 +- .../texture/cube/LDPipeOverlayRenderer.java | 8 +- .../texture/cube/OrientedOverlayRenderer.java | 45 +- .../texture/cube/SidedCubeRenderer.java | 26 +- .../texture/cube/SimpleCubeRenderer.java | 18 +- .../cube/SimpleOrientedCubeRenderer.java | 69 +- .../texture/cube/SimpleOverlayRenderer.java | 24 +- .../texture/cube/SimpleSidedCubeRenderer.java | 31 +- .../texture/custom/ClipboardRenderer.java | 38 +- .../texture/custom/CrateRenderer.java | 19 +- .../renderer/texture/custom/DrumRenderer.java | 24 +- .../texture/custom/FireboxActiveRenderer.java | 29 +- .../texture/custom/LargeTurbineRenderer.java | 43 +- .../custom/QuantumStorageRenderer.java | 50 +- .../renderer/texture/custom/SafeRenderer.java | 40 +- .../client/shader/PingPongBuffer.java | 2 + .../java/gregtech/client/shader/Shaders.java | 29 +- .../shader/postprocessing/BloomEffect.java | 10 +- .../shader/postprocessing/BloomType.java | 1 + .../shader/postprocessing/BlurEffect.java | 23 +- .../client/utils/AdvCCRSConsumer.java | 16 +- .../client/utils/BloomEffectUtil.java | 58 +- .../client/utils/DepthTextureUtil.java | 27 +- .../client/utils/EffectRenderContext.java | 12 +- .../client/utils/FacadeBlockAccess.java | 8 +- .../gregtech/client/utils/IBloomEffect.java | 3 +- .../gregtech/client/utils/PipelineUtil.java | 7 +- .../client/utils/RenderBufferHelper.java | 43 +- .../gregtech/client/utils/RenderUtil.java | 113 +- .../client/utils/ToolChargeBarRenderer.java | 63 +- .../gregtech/client/utils/TooltipHelper.java | 5 +- .../client/utils/TrackedDummyWorld.java | 13 +- .../java/gregtech/common/CommonProxy.java | 44 +- .../java/gregtech/common/ConfigHolder.java | 397 +++-- .../java/gregtech/common/EventHandlers.java | 55 +- .../java/gregtech/common/MetaEntities.java | 13 +- .../gregtech/common/ToolEventHandlers.java | 92 +- .../gregtech/common/blocks/BlockAsphalt.java | 4 +- .../common/blocks/BlockBatteryPart.java | 9 +- .../common/blocks/BlockBoilerCasing.java | 5 +- .../common/blocks/BlockBrittleCharcoal.java | 10 +- .../common/blocks/BlockCleanroomCasing.java | 16 +- .../gregtech/common/blocks/BlockColored.java | 12 +- .../common/blocks/BlockCompressed.java | 8 +- .../common/blocks/BlockComputerCasing.java | 2 + .../common/blocks/BlockFireboxCasing.java | 5 +- .../gregtech/common/blocks/BlockFrame.java | 35 +- .../common/blocks/BlockFusionCasing.java | 4 +- .../common/blocks/BlockGlassCasing.java | 8 +- .../common/blocks/BlockGregStairs.java | 4 +- .../common/blocks/BlockHermeticCasing.java | 4 +- .../gregtech/common/blocks/BlockLamp.java | 14 +- .../common/blocks/BlockLampBorderless.java | 4 +- .../common/blocks/BlockMachineCasing.java | 6 +- .../common/blocks/BlockMaterialBase.java | 1 + .../common/blocks/BlockMetalCasing.java | 8 +- .../common/blocks/BlockMultiblockCasing.java | 6 +- .../java/gregtech/common/blocks/BlockOre.java | 18 +- .../common/blocks/BlockSteamCasing.java | 7 +- .../common/blocks/BlockSurfaceRock.java | 33 +- .../common/blocks/BlockTurbineCasing.java | 2 +- .../common/blocks/BlockWarningSign.java | 3 +- .../common/blocks/BlockWarningSign1.java | 1 + .../gregtech/common/blocks/BlockWireCoil.java | 17 +- .../common/blocks/MaterialItemBlock.java | 1 + .../gregtech/common/blocks/MetaBlocks.java | 121 +- .../gregtech/common/blocks/OreItemBlock.java | 1 + .../common/blocks/StoneVariantBlock.java | 37 +- .../common/blocks/foam/BlockFoam.java | 15 +- .../blocks/foam/BlockPetrifiedFoam.java | 4 +- .../blocks/properties/PropertyMaterial.java | 9 +- .../blocks/properties/PropertyStoneType.java | 10 +- .../common/blocks/wood/BlockGregFence.java | 1 + .../blocks/wood/BlockGregFenceGate.java | 1 + .../common/blocks/wood/BlockGregPlanks.java | 1 + .../common/blocks/wood/BlockGregWoodSlab.java | 10 +- .../common/blocks/wood/BlockRubberDoor.java | 1 + .../common/blocks/wood/BlockRubberLeaves.java | 13 +- .../common/blocks/wood/BlockRubberLog.java | 7 +- .../blocks/wood/BlockRubberSapling.java | 16 +- .../common/blocks/wood/BlockWoodenDoor.java | 4 +- .../gregtech/common/command/CommandHand.java | 45 +- .../common/command/CommandRecipeCheck.java | 52 +- .../common/command/CommandShaders.java | 4 +- .../worldgen/CommandWorldgenReload.java | 4 +- .../common/covers/CoverBehaviors.java | 240 ++- .../gregtech/common/covers/CoverConveyor.java | 113 +- .../common/covers/CoverCraftingTable.java | 16 +- .../common/covers/CoverDigitalInterface.java | 260 +-- .../covers/CoverDigitalInterfaceWireless.java | 33 +- .../common/covers/CoverEnderFluidLink.java | 38 +- .../gregtech/common/covers/CoverFacade.java | 23 +- .../common/covers/CoverFluidFilter.java | 21 +- .../common/covers/CoverFluidRegulator.java | 81 +- .../common/covers/CoverFluidVoiding.java | 28 +- .../covers/CoverFluidVoidingAdvanced.java | 62 +- .../common/covers/CoverInfiniteWater.java | 20 +- .../common/covers/CoverItemFilter.java | 18 +- .../common/covers/CoverItemVoiding.java | 31 +- .../covers/CoverItemVoidingAdvanced.java | 68 +- .../common/covers/CoverMachineController.java | 42 +- .../gregtech/common/covers/CoverPump.java | 78 +- .../common/covers/CoverRoboticArm.java | 61 +- .../gregtech/common/covers/CoverScreen.java | 16 +- .../gregtech/common/covers/CoverShutter.java | 24 +- .../common/covers/CoverSolarPanel.java | 22 +- .../gregtech/common/covers/CoverStorage.java | 29 +- .../common/covers/DistributionMode.java | 1 + .../gregtech/common/covers/TransferMode.java | 3 +- .../gregtech/common/covers/VoidingMode.java | 2 +- .../detector/CoverDetectorActivity.java | 16 +- .../CoverDetectorActivityAdvanced.java | 24 +- .../covers/detector/CoverDetectorBase.java | 15 +- .../covers/detector/CoverDetectorEnergy.java | 23 +- .../detector/CoverDetectorEnergyAdvanced.java | 62 +- .../covers/detector/CoverDetectorFluid.java | 19 +- .../detector/CoverDetectorFluidAdvanced.java | 60 +- .../covers/detector/CoverDetectorItem.java | 19 +- .../detector/CoverDetectorItemAdvanced.java | 59 +- .../detector/CoverDetectorMaintenance.java | 21 +- .../common/covers/facade/FacadeHelper.java | 10 +- .../covers/filter/FilterTypeRegistry.java | 8 +- .../common/covers/filter/FluidFilter.java | 1 + .../covers/filter/FluidFilterContainer.java | 13 +- .../covers/filter/FluidFilterWrapper.java | 4 +- .../common/covers/filter/ItemFilter.java | 4 +- .../covers/filter/ItemFilterContainer.java | 12 +- .../covers/filter/ItemFilterWrapper.java | 4 +- .../filter/OreDictionaryItemFilter.java | 7 +- .../covers/filter/SimpleFluidFilter.java | 8 +- .../covers/filter/SimpleItemFilter.java | 12 +- .../common/covers/filter/SmartItemFilter.java | 16 +- .../covers/filter/WidgetGroupFluidFilter.java | 4 +- .../covers/filter/WidgetGroupItemFilter.java | 1 + .../filter/oreglob/impl/NodeInterpreter.java | 7 +- .../filter/oreglob/impl/NodeOreGlob.java | 3 +- .../oreglob/impl/NodeVisualXMLHandler.java | 7 +- .../filter/oreglob/impl/NodeVisualizer.java | 19 +- .../filter/oreglob/impl/OreGlobParser.java | 21 +- .../filter/oreglob/node/BranchNode.java | 41 +- .../filter/oreglob/node/BranchType.java | 4 +- .../filter/oreglob/node/MatchDescription.java | 51 +- .../filter/oreglob/node/OreGlobNode.java | 4 +- .../filter/oreglob/node/OreGlobNodes.java | 3 +- .../common/crafting/FacadeRecipe.java | 6 +- .../common/crafting/FluidReplaceRecipe.java | 15 +- .../crafting/GTFluidCraftingIngredient.java | 1 + .../common/crafting/GTShapedOreRecipe.java | 33 +- .../common/crafting/GTShapelessOreRecipe.java | 25 +- .../ShapedOreEnergyTransferRecipe.java | 21 +- .../crafting/ToolHeadReplaceRecipe.java | 4 +- .../common/entities/DynamiteEntity.java | 14 +- .../common/entities/GTBoatEntity.java | 13 +- .../common/entities/PortalEntity.java | 33 +- .../impl/FakeModularUIContainerClipboard.java | 9 +- .../impl/FakeModularUIPluginContainer.java | 4 +- .../gui/widget/HighlightedTextField.java | 10 +- .../common/gui/widget/WidgetARGB.java | 61 +- .../common/gui/widget/WidgetScrollBar.java | 25 +- .../widget/among_us/FixWiringTaskWidget.java | 40 +- .../gui/widget/appeng/AEConfigWidget.java | 9 +- .../widget/appeng/AEFluidConfigWidget.java | 8 +- .../gui/widget/appeng/AEFluidGridWidget.java | 16 +- .../gui/widget/appeng/AEItemConfigWidget.java | 9 +- .../gui/widget/appeng/AEItemGridWidget.java | 18 +- .../gui/widget/appeng/AEListGridWidget.java | 7 +- .../gui/widget/appeng/slot/AEConfigSlot.java | 7 +- .../widget/appeng/slot/AEFluidConfigSlot.java | 21 +- .../appeng/slot/AEFluidDisplayWidget.java | 5 +- .../widget/appeng/slot/AEItemConfigSlot.java | 18 +- .../appeng/slot/AEItemDisplayWidget.java | 5 +- .../gui/widget/appeng/slot/AmountSetSlot.java | 8 +- .../craftingstation/CraftingSlotWidget.java | 50 +- .../craftingstation/ItemListGridWidget.java | 19 +- .../craftingstation/ItemListSlotWidget.java | 19 +- .../MemorizedRecipeWidget.java | 5 +- .../gui/widget/monitor/WidgetCoverList.java | 53 +- .../widget/monitor/WidgetMonitorScreen.java | 12 +- .../widget/monitor/WidgetPluginConfig.java | 27 +- .../gui/widget/monitor/WidgetScreenGrid.java | 37 +- .../orefilter/ItemOreFilterTestSlot.java | 18 +- .../widget/orefilter/OreFilterTestSlot.java | 15 +- .../orefilter/OreGlobCompileStatusWidget.java | 4 +- .../gregtech/common/inventory/IItemList.java | 3 +- .../common/inventory/SimpleItemInfo.java | 1 + .../appeng/SerializableFluidList.java | 22 +- .../appeng/SerializableItemList.java | 13 +- .../handlers/CycleItemStackHandler.java | 4 +- .../handlers/TapeItemStackHandler.java | 1 + .../handlers/ToolItemStackHandler.java | 4 +- .../inventory/itemsource/ItemSource.java | 3 +- .../inventory/itemsource/ItemSources.java | 12 +- .../inventory/itemsource/NetworkItemInfo.java | 8 +- .../sources/InventoryItemSource.java | 18 +- .../itemsource/sources/TileItemSource.java | 20 +- .../common/items/EnchantmentTableTweaks.java | 6 +- .../java/gregtech/common/items/MetaItem1.java | 454 ++++-- .../java/gregtech/common/items/MetaItems.java | 24 +- .../java/gregtech/common/items/ToolItems.java | 13 +- .../common/items/armor/AdvancedJetpack.java | 5 +- .../items/armor/AdvancedNanoMuscleSuite.java | 26 +- .../items/armor/AdvancedQuarkTechSuite.java | 32 +- .../gregtech/common/items/armor/IJetpack.java | 17 +- .../common/items/armor/IStepAssist.java | 3 +- .../gregtech/common/items/armor/Jetpack.java | 12 +- .../common/items/armor/MetaArmor.java | 60 +- .../common/items/armor/NanoMuscleSuite.java | 24 +- .../items/armor/NightvisionGoggles.java | 13 +- .../common/items/armor/PowerlessJetpack.java | 46 +- .../common/items/armor/QuarkTechSuite.java | 75 +- .../AbstractMaterialPartBehavior.java | 7 +- .../behaviors/AbstractUsableBehaviour.java | 6 +- .../items/behaviors/ClipboardBehavior.java | 32 +- .../items/behaviors/ColorSprayBehaviour.java | 18 +- ...igitalInterfaceWirelessPlaceBehaviour.java | 8 +- .../items/behaviors/DataItemBehavior.java | 10 +- .../common/items/behaviors/DoorBehavior.java | 10 +- .../items/behaviors/DynamiteBehaviour.java | 1 + .../common/items/behaviors/FacadeItem.java | 7 +- .../items/behaviors/FertilizerBehavior.java | 4 +- .../items/behaviors/FoamSprayerBehavior.java | 39 +- .../items/behaviors/GTBoatBehavior.java | 7 +- .../items/behaviors/IntCircuitBehaviour.java | 20 +- .../items/behaviors/ItemMagnetBehavior.java | 36 +- .../items/behaviors/LighterBehaviour.java | 37 +- .../items/behaviors/ModeSwitchBehavior.java | 9 +- .../behaviors/MultiblockBuilderBehavior.java | 10 +- .../items/behaviors/NanoSaberBehavior.java | 12 +- .../behaviors/ProspectorScannerBehavior.java | 15 +- .../items/behaviors/TerminalBehaviour.java | 10 +- .../ToggleEnergyConsumerBehavior.java | 4 +- .../items/behaviors/TooltipBehavior.java | 4 +- .../items/behaviors/TricorderBehavior.java | 165 +- .../items/behaviors/TurbineRotorBehavior.java | 6 +- .../AdvancedMonitorPluginBehavior.java | 104 +- .../monitorplugin/FakeGuiPluginBehavior.java | 44 +- .../OnlinePicPluginBehavior.java | 54 +- .../monitorplugin/TextPluginBehavior.java | 19 +- .../items/tool/BlockRotatingBehavior.java | 14 +- .../items/tool/DisableShieldBehavior.java | 10 +- .../items/tool/EntityDamageBehavior.java | 23 +- .../common/items/tool/GrassPathBehavior.java | 28 +- .../items/tool/HarvestCropsBehavior.java | 34 +- .../common/items/tool/HarvestIceBehavior.java | 7 +- .../common/items/tool/HoeGroundBehavior.java | 39 +- .../common/items/tool/PlungerBehavior.java | 12 +- .../common/items/tool/RotateRailBehavior.java | 11 +- .../common/items/tool/TorchPlaceBehavior.java | 26 +- .../items/tool/TreeFellingBehavior.java | 10 +- .../tool/rotation/CustomBlockRotations.java | 7 +- .../rotation/ICustomRotationBehavior.java | 5 +- .../metatileentities/MetaTileEntities.java | 806 +++++++--- .../MetaTileEntityClipboard.java | 95 +- .../converter/ConverterTrait.java | 4 +- .../converter/MetaTileEntityConverter.java | 33 +- .../electric/MetaTileEntityAlarm.java | 40 +- .../electric/MetaTileEntityBatteryBuffer.java | 31 +- .../electric/MetaTileEntityBlockBreaker.java | 40 +- .../electric/MetaTileEntityCharger.java | 11 +- .../electric/MetaTileEntityDiode.java | 34 +- .../electric/MetaTileEntityFisher.java | 25 +- .../electric/MetaTileEntityGasCollector.java | 13 +- .../electric/MetaTileEntityHull.java | 26 +- .../electric/MetaTileEntityItemCollector.java | 29 +- .../MetaTileEntityMagicEnergyAbsorber.java | 51 +- .../electric/MetaTileEntityMiner.java | 62 +- .../electric/MetaTileEntityPump.java | 45 +- .../electric/MetaTileEntityRockBreaker.java | 12 +- .../MetaTileEntitySingleCombustion.java | 18 +- .../electric/MetaTileEntitySingleTurbine.java | 21 +- .../electric/MetaTileEntityTransformer.java | 49 +- .../MetaTileEntityWorldAccelerator.java | 45 +- .../SimpleMachineMetaTileEntityResizable.java | 16 +- .../metatileentities/multi/BoilerType.java | 16 +- .../multi/MetaTileEntityCokeOven.java | 27 +- .../multi/MetaTileEntityCokeOvenHatch.java | 25 +- .../multi/MetaTileEntityLargeBoiler.java | 40 +- .../multi/MetaTileEntityMultiblockTank.java | 19 +- .../MetaTileEntityPrimitiveBlastFurnace.java | 34 +- .../MetaTileEntityPrimitiveWaterPump.java | 34 +- .../multi/MetaTileEntityPumpHatch.java | 20 +- .../multi/MetaTileEntityTankValve.java | 29 +- .../MetaTileEntityActiveTransformer.java | 21 +- .../electric/MetaTileEntityAssemblyLine.java | 43 +- .../electric/MetaTileEntityCleanroom.java | 79 +- .../electric/MetaTileEntityCrackingUnit.java | 10 +- .../electric/MetaTileEntityDataBank.java | 28 +- .../MetaTileEntityDistillationTower.java | 14 +- .../MetaTileEntityElectricBlastFurnace.java | 20 +- .../electric/MetaTileEntityFluidDrill.java | 58 +- .../electric/MetaTileEntityFusionReactor.java | 97 +- .../multi/electric/MetaTileEntityHPCA.java | 100 +- .../MetaTileEntityImplosionCompressor.java | 1 + .../MetaTileEntityLargeChemicalReactor.java | 32 +- .../electric/MetaTileEntityLargeMiner.java | 126 +- .../electric/MetaTileEntityMultiSmelter.java | 11 +- .../electric/MetaTileEntityNetworkSwitch.java | 19 +- .../MetaTileEntityPowerSubstation.java | 91 +- .../MetaTileEntityProcessingArray.java | 81 +- .../electric/MetaTileEntityPyrolyseOven.java | 8 +- .../MetaTileEntityResearchStation.java | 18 +- .../electric/MetaTileEntityVacuumFreezer.java | 2 + .../MetaTileEntityCentralMonitor.java | 87 +- .../MetaTileEntityMonitorScreen.java | 180 ++- .../LargeTurbineWorkableHandler.java | 16 +- .../MetaTileEntityLargeCombustionEngine.java | 96 +- .../generator/MetaTileEntityLargeTurbine.java | 47 +- .../MetaTileEntityAutoMaintenanceHatch.java | 20 +- ...etaTileEntityCleaningMaintenanceHatch.java | 22 +- .../MetaTileEntityComputationHatch.java | 24 +- .../MetaTileEntityDataAccessHatch.java | 39 +- .../MetaTileEntityEnergyHatch.java | 38 +- .../MetaTileEntityFluidHatch.java | 37 +- .../multiblockpart/MetaTileEntityItemBus.java | 49 +- .../MetaTileEntityLaserHatch.java | 26 +- .../MetaTileEntityMachineHatch.java | 44 +- .../MetaTileEntityMaintenanceHatch.java | 60 +- .../MetaTileEntityMufflerHatch.java | 22 +- .../MetaTileEntityMultiFluidHatch.java | 31 +- ...etaTileEntityMultiblockNotifiablePart.java | 2 + .../MetaTileEntityMultiblockPart.java | 26 +- .../MetaTileEntityObjectHolder.java | 15 +- .../MetaTileEntityOpticalDataHatch.java | 20 +- .../MetaTileEntityPassthroughHatchFluid.java | 26 +- .../MetaTileEntityPassthroughHatchItem.java | 19 +- .../MetaTileEntityReservoirHatch.java | 23 +- .../MetaTileEntityRotorHolder.java | 36 +- .../MetaTileEntitySubstationEnergyHatch.java | 8 +- .../appeng/ExportOnlyAESlot.java | 8 +- .../appeng/IConfigurableSlot.java | 1 - .../appeng/MetaTileEntityAEHostablePart.java | 47 +- .../appeng/MetaTileEntityMEInputBus.java | 58 +- .../appeng/MetaTileEntityMEInputHatch.java | 55 +- .../appeng/MetaTileEntityMEOutputBus.java | 49 +- .../appeng/MetaTileEntityMEOutputHatch.java | 49 +- .../appeng/stack/WrappedFluidStack.java | 19 +- .../appeng/stack/WrappedItemStack.java | 12 +- .../hpca/MetaTileEntityHPCABridge.java | 1 + .../hpca/MetaTileEntityHPCAComponent.java | 28 +- .../hpca/MetaTileEntityHPCAComputation.java | 10 +- .../hpca/MetaTileEntityHPCACooler.java | 1 + .../hpca/MetaTileEntityHPCAEmpty.java | 1 + .../steam/MetaTileEntitySteamGrinder.java | 4 +- .../multi/steam/MetaTileEntitySteamOven.java | 7 +- .../MetaTileEntityCharcoalPileIgniter.java | 61 +- .../steam/SteamAlloySmelter.java | 10 +- .../steam/SteamCompressor.java | 7 +- .../steam/SteamExtractor.java | 7 +- .../metatileentities/steam/SteamFurnace.java | 7 +- .../metatileentities/steam/SteamHammer.java | 7 +- .../steam/SteamMacerator.java | 16 +- .../metatileentities/steam/SteamMiner.java | 59 +- .../steam/SteamRockBreaker.java | 22 +- .../steam/boiler/SteamBoiler.java | 40 +- .../steam/boiler/SteamCoalBoiler.java | 6 +- .../steam/boiler/SteamLavaBoiler.java | 15 +- .../steam/boiler/SteamSolarBoiler.java | 1 + .../MetaTileEntitySteamHatch.java | 26 +- .../MetaTileEntitySteamItemBus.java | 17 +- .../storage/CachedRecipeData.java | 48 +- .../storage/CraftingRecipeLogic.java | 34 +- .../storage/CraftingRecipeMemory.java | 6 +- .../storage/MetaTileEntityBuffer.java | 19 +- .../storage/MetaTileEntityCrate.java | 49 +- .../storage/MetaTileEntityCreativeChest.java | 32 +- .../storage/MetaTileEntityCreativeEnergy.java | 30 +- .../storage/MetaTileEntityCreativeTank.java | 40 +- .../storage/MetaTileEntityDrum.java | 51 +- .../storage/MetaTileEntityLockedSafe.java | 52 +- .../MetaTileEntityLongDistanceEndpoint.java | 24 +- .../storage/MetaTileEntityQuantumChest.java | 76 +- .../storage/MetaTileEntityQuantumTank.java | 104 +- .../storage/MetaTileEntityWorkbench.java | 50 +- .../common/pipelike/cable/BlockCable.java | 25 +- .../common/pipelike/cable/Insulation.java | 4 +- .../common/pipelike/cable/ItemBlockCable.java | 11 +- .../common/pipelike/cable/net/EnergyNet.java | 7 +- .../pipelike/cable/net/EnergyNetHandler.java | 5 +- .../pipelike/cable/net/EnergyNetWalker.java | 17 +- .../pipelike/cable/net/EnergyRoutePath.java | 2 + .../common/pipelike/cable/net/WorldENet.java | 2 +- .../cable/tile/PerTickLongCounter.java | 6 +- .../pipelike/cable/tile/TileEntityCable.java | 23 +- .../cable/tile/TileEntityCableTickable.java | 3 +- .../pipelike/fluidpipe/BlockFluidPipe.java | 36 +- .../pipelike/fluidpipe/FluidPipeType.java | 3 +- .../fluidpipe/ItemBlockFluidPipe.java | 11 +- .../MetaTileEntityLDFluidEndpoint.java | 17 +- .../pipelike/fluidpipe/net/FluidPipeNet.java | 4 +- .../pipelike/fluidpipe/net/PipeTankList.java | 9 +- .../fluidpipe/net/WorldFluidPipeNet.java | 2 +- .../fluidpipe/tile/TileEntityFluidPipe.java | 6 +- .../tile/TileEntityFluidPipeTickable.java | 65 +- .../pipelike/itempipe/BlockItemPipe.java | 21 +- .../pipelike/itempipe/ItemBlockItemPipe.java | 14 +- .../pipelike/itempipe/ItemPipeType.java | 6 +- .../MetaTileEntityLDItemEndpoint.java | 20 +- .../pipelike/itempipe/net/ItemNetHandler.java | 59 +- .../pipelike/itempipe/net/ItemNetWalker.java | 41 +- .../pipelike/itempipe/net/ItemPipeNet.java | 4 +- .../pipelike/itempipe/net/ItemRoutePath.java | 7 +- .../itempipe/net/WorldItemPipeNet.java | 1 + .../itempipe/tile/TileEntityItemPipe.java | 13 +- .../common/pipelike/laser/BlockLaserPipe.java | 14 +- .../pipelike/laser/ItemBlockLaserPipe.java | 5 +- .../common/pipelike/laser/LaserPipeType.java | 1 + .../pipelike/laser/net/LaserNetHandler.java | 1 + .../pipelike/laser/net/LaserNetWalker.java | 23 +- .../pipelike/laser/net/LaserPipeNet.java | 13 +- .../pipelike/laser/net/LaserRoutePath.java | 3 +- .../pipelike/laser/net/WorldLaserPipeNet.java | 3 + .../laser/tile/TileEntityLaserPipe.java | 5 +- .../pipelike/optical/BlockOpticalPipe.java | 11 +- .../optical/ItemBlockOpticalPipe.java | 5 +- .../pipelike/optical/OpticalPipeType.java | 1 + .../optical/net/OpticalNetHandler.java | 4 +- .../optical/net/OpticalNetWalker.java | 22 +- .../pipelike/optical/net/OpticalPipeNet.java | 15 +- .../optical/net/OpticalRoutePath.java | 6 +- .../optical/net/WorldOpticalPipeNet.java | 1 + .../optical/tile/TileEntityOpticalPipe.java | 14 +- .../common/terminal/app/VirtualTankApp.java | 15 +- .../terminal/app/appstore/AppCardWidget.java | 45 +- .../terminal/app/appstore/AppPageWidget.java | 75 +- .../terminal/app/appstore/AppStoreApp.java | 19 +- .../app/batterymanager/BatteryManagerApp.java | 25 +- .../app/batterymanager/BatteryWidget.java | 17 +- .../app/capeselector/CapeSelectorApp.java | 5 +- .../capeselector/widget/CapeListWidget.java | 19 +- .../terminal/app/console/ConsoleApp.java | 6 +- .../app/console/MachineConsoleWidget.java | 116 +- .../terminal/app/game/maze/MazeApp.java | 43 +- .../app/game/maze/widget/EnemyWidget.java | 1 - .../app/game/maze/widget/MazeWidget.java | 22 +- .../app/game/maze/widget/PlayerWidget.java | 3 +- .../app/game/minesweeper/MinesweeperApp.java | 27 +- .../minesweeper/widget/MineMapWidget.java | 25 +- .../terminal/app/game/pong/PongApp.java | 32 +- .../game/pong/TwoDimensionalRayTracer.java | 9 +- .../app/game/pong/widget/BallWidget.java | 8 +- .../app/game/pong/widget/PaddleWidget.java | 11 +- .../common/terminal/app/guide/GuideApp.java | 41 +- .../terminal/app/guide/ItemGuideApp.java | 13 +- .../app/guide/MultiBlockGuideApp.java | 7 +- .../app/guide/SimpleMachineGuideApp.java | 7 +- .../terminal/app/guide/TutorialGuideApp.java | 4 +- .../terminal/app/guide/widget/CardWidget.java | 11 +- .../app/guide/widget/GuidePageWidget.java | 20 +- .../app/guide/widget/GuideWidget.java | 22 +- .../app/guide/widget/GuideWidgetGroup.java | 17 +- .../app/guide/widget/IGuideWidget.java | 19 +- .../app/guide/widget/ImageWidget.java | 23 +- .../app/guide/widget/SlotListWidget.java | 20 +- .../app/guide/widget/TankListWidget.java | 23 +- .../app/guide/widget/TextBoxWidget.java | 17 +- .../app/guideeditor/GuideEditorApp.java | 34 +- .../guideeditor/widget/GuideConfigEditor.java | 200 +-- .../widget/GuidePageEditorWidget.java | 41 +- .../configurator/BooleanConfigurator.java | 16 +- .../configurator/ColorConfigurator.java | 15 +- .../configurator/ConfiguratorWidget.java | 24 +- .../configurator/FluidStackConfigurator.java | 27 +- .../configurator/ItemStackConfigurator.java | 26 +- .../configurator/NumberConfigurator.java | 9 +- .../configurator/SelectorConfigurator.java | 19 +- .../configurator/StringConfigurator.java | 11 +- .../configurator/TextListConfigurator.java | 12 +- .../hardwaremanager/HardwareManagerApp.java | 21 +- .../hardwaremanager/HardwareSlotWidget.java | 45 +- .../MachineBuilderWidget.java | 57 +- .../MultiBlockPreviewARApp.java | 38 +- .../app/prospector/ProspectingTexture.java | 23 +- .../app/prospector/ProspectorApp.java | 56 +- .../app/prospector/ProspectorMode.java | 1 + .../app/prospector/widget/WidgetOreList.java | 28 +- .../widget/WidgetProspectingMap.java | 49 +- .../app/recipechart/FluidStackHelper.java | 4 +- .../app/recipechart/IngredientHelper.java | 1 + .../app/recipechart/ItemStackHelper.java | 1 + .../app/recipechart/RecipeChartApp.java | 159 +- .../app/recipechart/widget/PhantomWidget.java | 35 +- .../app/recipechart/widget/RGContainer.java | 15 +- .../app/recipechart/widget/RGLine.java | 45 +- .../app/recipechart/widget/RGNode.java | 124 +- .../terminal/app/settings/SettingsApp.java | 11 +- .../settings/widgets/HomeButtonSettings.java | 86 +- .../app/settings/widgets/OsSettings.java | 11 +- .../app/settings/widgets/ThemeSettings.java | 60 +- .../terminal/app/teleport/TeleportApp.java | 19 +- .../worldprospector/WorldProspectorARApp.java | 73 +- .../matcher/BlockStateMatcher.java | 9 +- .../app/worldprospector/matcher/IMatcher.java | 2 + .../terminal/component/ClickComponent.java | 1 + .../terminal/component/SearchComponent.java | 14 +- .../component/setting/GuiTextureSetter.java | 3 +- .../terminal/component/setting/ISetting.java | 3 + .../component/setting/IWidgetSettings.java | 1 + .../component/setting/SettingComponent.java | 2 +- .../terminal/hardware/BatteryHardware.java | 19 +- .../terminal/hardware/DeviceHardware.java | 14 +- .../worldgen/AbstractItemLootEntry.java | 11 +- .../common/worldgen/LootEntryMetaItem.java | 12 +- .../common/worldgen/LootEntryOreDict.java | 13 +- .../common/worldgen/LootTableHelper.java | 31 +- .../common/worldgen/WorldGenRubberTree.java | 13 +- src/main/java/gregtech/core/CoreModule.java | 31 +- .../criterion/AbstractCriterion.java | 1 + .../internal/AdvancementListeners.java | 6 +- .../internal/AdvancementManager.java | 7 +- .../internal/AdvancementTrigger.java | 11 +- .../core/command/internal/CommandManager.java | 1 + .../command/internal/GregTechCommand.java | 16 +- .../gregtech/core/network/NetworkUtils.java | 8 +- .../core/network/internal/NetworkHandler.java | 19 +- .../core/network/internal/PacketHandler.java | 2 +- .../network/packets/PacketBlockParticle.java | 7 +- .../core/network/packets/PacketClipboard.java | 1 + .../packets/PacketClipboardNBTUpdate.java | 11 +- .../PacketClipboardUIWidgetUpdate.java | 7 +- .../network/packets/PacketFluidVeinList.java | 4 +- .../network/packets/PacketKeysPressed.java | 2 + .../packets/PacketNotifyCapeChange.java | 2 +- .../network/packets/PacketPluginSynced.java | 7 +- .../network/packets/PacketProspecting.java | 20 +- .../network/packets/PacketRecoverMTE.java | 4 +- .../network/packets/PacketReloadShaders.java | 7 +- .../network/packets/PacketUIClientAction.java | 1 + .../core/network/packets/PacketUIOpen.java | 4 +- .../network/packets/PacketUIWidgetUpdate.java | 1 + .../core/sound/internal/SoundManager.java | 6 +- .../internal/MaterialRegistryImpl.java | 7 +- .../internal/MaterialRegistryManager.java | 8 +- .../integration/IntegrationModule.java | 20 +- .../integration/IntegrationSubmodule.java | 5 +- .../gregtech/integration/IntegrationUtil.java | 10 +- .../integration/RecipeCompatUtil.java | 6 +- .../integration/baubles/BaubleBehavior.java | 8 +- .../integration/baubles/BaublesModule.java | 19 +- .../baubles/BaublesWrappedInventory.java | 18 +- .../crafttweaker/CTRecipeHelper.java | 5 +- .../crafttweaker/CraftTweakerModule.java | 18 +- .../block/CTHeatingCoilBlockStats.java | 16 +- .../crafttweaker/item/CTItemRegistry.java | 10 +- .../material/CTMaterialBuilder.java | 27 +- .../material/CTMaterialHelpers.java | 16 +- .../material/CTMaterialRegistry.java | 3 +- .../material/MaterialBracketHandler.java | 6 +- .../material/MaterialExpansion.java | 27 +- .../material/MaterialPropertyExpansion.java | 48 +- .../crafttweaker/recipe/CTNBTMatcher.java | 6 +- .../recipe/CTNBTMultiItemMatcher.java | 12 +- .../crafttweaker/recipe/CTRecipe.java | 8 +- .../crafttweaker/recipe/CTRecipeBuilder.java | 37 +- .../crafttweaker/recipe/CTRecipeUtils.java | 13 +- .../crafttweaker/recipe/InputIngredient.java | 3 +- .../recipe/MetaItemBracketHandler.java | 23 +- .../recipe/MetaTileEntityBracketHandler.java | 21 +- .../recipe/RecipeMapBracketHandler.java | 3 +- .../terminal/CTTerminalRegistry.java | 21 +- .../integration/ctm/IFacadeWrapper.java | 5 +- .../integration/forestry/ForestryConfig.java | 5 +- .../integration/forestry/ForestryModule.java | 22 +- .../integration/forestry/ForestryUtil.java | 18 +- .../forestry/bees/BeeRemovals.java | 5 +- .../forestry/bees/ForestryScannerLogic.java | 28 +- .../forestry/bees/GTAlleleBeeSpecies.java | 29 +- .../forestry/bees/GTBeeDefinition.java | 301 ++-- .../forestry/bees/GTBranchDefinition.java | 2 +- .../integration/forestry/bees/GTCombItem.java | 15 +- .../integration/forestry/bees/GTCombType.java | 3 +- .../integration/forestry/bees/GTDropItem.java | 12 +- .../integration/forestry/bees/GTDropType.java | 2 +- .../forestry/frames/GTFrameType.java | 3 +- .../forestry/frames/GTItemFrame.java | 19 +- .../forestry/recipes/CombRecipes.java | 304 ++-- .../recipes/ForestryElectrodeRecipes.java | 21 +- .../recipes/ForestryExtractorRecipes.java | 224 ++- .../recipes/ForestryFrameRecipes.java | 13 +- .../forestry/recipes/ForestryMiscRecipes.java | 29 +- .../forestry/recipes/ForestryToolRecipes.java | 1 + .../forestry/tools/ScoopBehavior.java | 20 +- .../integration/groovy/GrSRecipeHelper.java | 7 +- .../integration/groovy/GroovyHandCommand.java | 28 +- .../GroovyMaterialBuilderExpansion.java | 22 +- .../groovy/GroovyRecipeBuilderExpansion.java | 6 +- .../groovy/GroovyScriptModule.java | 54 +- .../groovy/VirtualizedRecipeMap.java | 10 +- .../integration/hwyla/HWYLAClient.java | 6 +- .../integration/hwyla/HWYLAModule.java | 15 +- .../hwyla/provider/BlockOreDataProvider.java | 10 +- .../provider/CapabilityDataProvider.java | 8 +- .../provider/ControllableDataProvider.java | 11 +- .../hwyla/provider/ConverterDataProvider.java | 23 +- .../hwyla/provider/DiodeDataProvider.java | 16 +- .../ElectricContainerDataProvider.java | 11 +- .../hwyla/provider/LampDataProvider.java | 11 +- .../provider/MaintenanceDataProvider.java | 14 +- .../provider/MultiRecipeMapDataProvider.java | 11 +- .../provider/MultiblockDataProvider.java | 8 +- .../provider/PrimitivePumpDataProvider.java | 25 +- .../provider/RecipeLogicDataProvider.java | 20 +- .../provider/SteamBoilerDataProvider.java | 25 +- .../provider/TransformerDataProvider.java | 23 +- .../hwyla/provider/WorkableDataProvider.java | 14 +- .../hwyla/renderer/RendererOffsetString.java | 3 +- .../gregtech/integration/jei/JEIOptional.java | 9 +- .../jei/JustEnoughItemsModule.java | 75 +- .../jei/basic/BasicRecipeCategory.java | 17 +- .../jei/basic/GTFluidVeinCategory.java | 55 +- .../jei/basic/GTFluidVeinInfo.java | 13 +- .../integration/jei/basic/GTOreCategory.java | 51 +- .../integration/jei/basic/GTOreInfo.java | 51 +- .../integration/jei/basic/MaterialTree.java | 12 +- .../jei/basic/MaterialTreeCategory.java | 57 +- .../integration/jei/basic/OreByProduct.java | 33 +- .../jei/basic/OreByProductCategory.java | 44 +- .../multiblock/MultiblockInfoCategory.java | 16 +- .../MultiblockInfoRecipeWrapper.java | 141 +- .../jei/recipe/FacadeRecipeWrapper.java | 8 +- .../jei/recipe/FacadeRegistryPlugin.java | 20 +- .../jei/recipe/GTRecipeWrapper.java | 65 +- .../jei/recipe/IntCircuitCategory.java | 93 +- .../jei/recipe/IntCircuitRecipeWrapper.java | 12 +- .../jei/recipe/RecipeMapCategory.java | 58 +- .../jei/utils/AdvancedRecipeWrapper.java | 12 +- .../JEIResourceDepositCategoryUtils.java | 22 +- .../integration/jei/utils/JeiButton.java | 5 +- .../jei/utils/MachineSubtypeHandler.java | 5 +- .../jei/utils/MetaItemSubtypeHandler.java | 5 +- .../jei/utils/ModularUIGuiHandler.java | 26 +- .../MultiblockInfoRecipeFocusShower.java | 3 +- .../jei/utils/render/CompositeDrawable.java | 9 +- .../jei/utils/render/CompositeRenderer.java | 15 +- .../jei/utils/render/DrawableRegistry.java | 11 +- .../utils/render/FluidStackTextRenderer.java | 28 +- .../utils/render/ItemStackTextRenderer.java | 14 +- .../opencomputers/InputValidator.java | 6 +- .../opencomputers/OpenComputersModule.java | 17 +- .../drivers/DriverAbstractRecipeLogic.java | 21 +- .../drivers/DriverCoverHolder.java | 28 +- .../drivers/DriverEnergyContainer.java | 33 +- .../DriverRecipeMapMultiblockController.java | 44 +- .../drivers/DriverSimpleMachine.java | 42 +- .../opencomputers/drivers/DriverWorkable.java | 27 +- .../drivers/EnvironmentMetaTileEntity.java | 1 + .../drivers/specific/DriverConverter.java | 17 +- .../drivers/specific/DriverFusionReactor.java | 17 +- .../specific/DriverPowerSubstation.java | 24 +- .../specific/DriverWorldAccelerator.java | 31 +- .../values/ValueCoverBehavior.java | 20 +- .../values/ValueCoverConveyor.java | 14 +- .../values/ValueCoverEnderFluidLink.java | 12 +- .../values/ValueCoverFluidFilter.java | 8 +- .../values/ValueCoverFluidRegulator.java | 8 +- .../values/ValueCoverItemFilter.java | 8 +- .../opencomputers/values/ValueCoverPump.java | 14 +- .../values/ValueCoverRoboticArm.java | 8 +- .../theoneprobe/TheOneProbeModule.java | 15 +- .../provider/BlockOreInfoProvider.java | 10 +- .../provider/CapabilityInfoProvider.java | 15 +- .../provider/ControllableInfoProvider.java | 14 +- .../provider/ConverterInfoProvider.java | 26 +- .../provider/CoverInfoProvider.java | 68 +- .../provider/DiodeInfoProvider.java | 21 +- .../ElectricContainerInfoProvider.java | 10 +- .../theoneprobe/provider/LDPipeProvider.java | 4 +- .../provider/LampInfoProvider.java | 11 +- .../provider/LaserContainerInfoProvider.java | 10 +- .../provider/MaintenanceInfoProvider.java | 24 +- .../provider/MultiRecipeMapInfoProvider.java | 15 +- .../provider/MultiblockInfoProvider.java | 12 +- .../provider/PrimitivePumpInfoProvider.java | 11 +- .../provider/RecipeLogicInfoProvider.java | 24 +- .../provider/SteamBoilerInfoProvider.java | 18 +- .../provider/TransformerInfoProvider.java | 28 +- .../provider/WorkableInfoProvider.java | 10 +- .../debug/DebugPipeNetInfoProvider.java | 27 +- .../provider/debug/DebugTickTimeProvider.java | 17 +- .../integration/xaero/ColorUtility.java | 34 +- .../gregtech/loaders/MaterialInfoLoader.java | 529 +++--- .../gregtech/loaders/OreDictionaryLoader.java | 17 +- .../java/gregtech/loaders/WoodTypeEntry.java | 7 +- .../loaders/dungeon/ChestGenHooks.java | 27 +- .../loaders/dungeon/DungeonLootLoader.java | 191 ++- .../loaders/recipe/AssemblyLineLoader.java | 1 - .../loaders/recipe/BatteryRecipes.java | 54 +- .../loaders/recipe/CircuitRecipes.java | 228 ++- .../loaders/recipe/ComponentRecipes.java | 244 ++- .../loaders/recipe/ComputerRecipes.java | 49 +- .../loaders/recipe/CraftingComponent.java | 1070 ++++++------ .../loaders/recipe/CraftingRecipeLoader.java | 360 +++-- .../loaders/recipe/DecorationRecipes.java | 11 +- .../gregtech/loaders/recipe/FuelRecipes.java | 10 +- .../gregtech/loaders/recipe/FusionLoader.java | 2 - .../loaders/recipe/GTRecipeManager.java | 1 + .../loaders/recipe/MachineRecipeLoader.java | 732 ++++++--- .../loaders/recipe/MetaTileEntityLoader.java | 1379 ++++++++++++---- .../MetaTileEntityMachineRecipeLoader.java | 42 +- .../loaders/recipe/MiscRecipeLoader.java | 115 +- .../loaders/recipe/RecyclingRecipes.java | 112 +- .../recipe/VanillaOverrideRecipes.java | 272 ++-- .../recipe/VanillaStandardRecipes.java | 347 ++-- .../loaders/recipe/WoodRecipeLoader.java | 43 +- .../loaders/recipe/chemistry/AcidRecipes.java | 7 +- .../chemistry/AssemblerRecipeLoader.java | 5 +- .../recipe/chemistry/BrewingRecipes.java | 31 +- .../recipe/chemistry/ChemicalBathRecipes.java | 8 +- .../recipe/chemistry/ChemistryRecipes.java | 3 +- .../recipe/chemistry/FuelRecipeChains.java | 1 - .../recipe/chemistry/GemSlurryRecipes.java | 1 - .../recipe/chemistry/GrowthMediumRecipes.java | 2 +- .../loaders/recipe/chemistry/LCRCombined.java | 1 - .../recipe/chemistry/NaquadahRecipes.java | 6 - .../recipe/chemistry/NuclearRecipes.java | 2 - .../recipe/chemistry/PetrochemRecipes.java | 2 - .../chemistry/PlatGroupMetalsRecipes.java | 15 +- .../recipe/chemistry/PolymerRecipes.java | 6 - .../recipe/chemistry/ReactorRecipes.java | 4 +- .../recipe/chemistry/SeparationRecipes.java | 6 +- .../handlers/DecompositionRecipeHandler.java | 22 +- .../handlers/MaterialRecipeHandler.java | 28 +- .../recipe/handlers/OreRecipeHandler.java | 38 +- .../recipe/handlers/PartsRecipeHandler.java | 10 +- .../recipe/handlers/PipeRecipeHandler.java | 35 +- .../handlers/PolarizingRecipeHandler.java | 15 +- .../handlers/RecyclingRecipeHandler.java | 18 +- .../recipe/handlers/ToolRecipeHandler.java | 68 +- .../recipe/handlers/WireCombiningHandler.java | 9 +- .../recipe/handlers/WireRecipeHandler.java | 23 +- .../gregtech/modules/BaseGregTechModule.java | 4 +- .../gregtech/modules/GregTechModules.java | 4 +- .../java/gregtech/modules/ModuleManager.java | 24 +- src/main/java/gregtech/tools/ToolsModule.java | 14 +- .../enchants/EnchantmentEnderDamage.java | 13 +- .../tools/enchants/EnchantmentHardHammer.java | 10 +- src/test/java/gregtech/Bootstrap.java | 7 +- .../impl/AbstractRecipeLogicTest.java | 17 +- .../impl/EnergyContainerListTest.java | 6 +- .../capability/impl/FluidTankListTest.java | 391 ++--- .../impl/MultiblockRecipeLogicTest.java | 183 ++- .../gregtech/api/recipes/RecipeMapTest.java | 52 +- .../recipes/chance/boost/ChanceBoostTest.java | 7 +- .../chance/output/ChancedOutputLogicTest.java | 22 +- .../logic/IParallelableRecipeLogicTest.java | 183 ++- .../api/recipes/logic/OverclockingTest.java | 19 +- .../api/recipes/logic/ParallelLogicTest.java | 150 +- .../RecipePropertyStorageTest.java | 33 +- .../java/gregtech/api/util/OreGlobTest.java | 58 +- .../gregtech/api/util/SmallDigitsTest.java | 3 +- .../gregtech/api/util/TierByVoltageTest.java | 1 - src/test/java/gregtech/client/I18nTest.java | 2 + .../covers/CoverFluidRegulatorTest.java | 110 +- .../converter/ConverterTraitTest.java | 29 +- .../multiblock/PowerSubstationTest.java | 1 + .../multiblock/hpca/HPCATest.java | 3 +- .../multiblock/hpca/helper/HPCAHelper.java | 3 +- .../storage/QuantumChestTest.java | 36 +- .../storage/QuantumTankTest.java | 27 +- 1401 files changed, 25629 insertions(+), 15666 deletions(-) create mode 100644 spotless.importorder diff --git a/.editorconfig b/.editorconfig index 30f209b0f6e..8df9e318396 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,44 +9,47 @@ tab_width = 4 ij_continuation_indent_size = 8 ij_formatter_off_tag = @formatter:off ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = false +ij_formatter_tags_enabled = true ij_smart_tabs = false ij_visual_guides = none ij_wrap_on_typing = false [*.java] +ij_smart_tabs = true ij_java_align_consecutive_assignments = false ij_java_align_consecutive_variable_declarations = false ij_java_align_group_field_declarations = false -ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_annotation_parameters = true ij_java_align_multiline_array_initializer_expression = false ij_java_align_multiline_assignment = false ij_java_align_multiline_binary_operation = false ij_java_align_multiline_chained_methods = false -ij_java_align_multiline_extends_list = false -ij_java_align_multiline_for = true +ij_java_align_multiline_deconstruction_list_components = true +ij_java_align_multiline_extends_list = true +ij_java_align_multiline_for = false ij_java_align_multiline_method_parentheses = false ij_java_align_multiline_parameters = true ij_java_align_multiline_parameters_in_calls = false ij_java_align_multiline_parenthesized_expression = false ij_java_align_multiline_records = true -ij_java_align_multiline_resources = true +ij_java_align_multiline_resources = false ij_java_align_multiline_ternary_operation = false ij_java_align_multiline_text_blocks = false -ij_java_align_multiline_throws_list = false +ij_java_align_multiline_throws_list = true ij_java_align_subsequent_simple_methods = false ij_java_align_throws_keyword = false -ij_java_annotation_parameter_wrap = off +ij_java_align_types_in_multi_catch = true +ij_java_annotation_parameter_wrap = on_every_item ij_java_array_initializer_new_line_after_left_brace = false ij_java_array_initializer_right_brace_on_new_line = false -ij_java_array_initializer_wrap = off -ij_java_assert_statement_colon_on_next_line = false +ij_java_array_initializer_wrap = normal +ij_java_assert_statement_colon_on_next_line = true ij_java_assert_statement_wrap = off ij_java_assignment_wrap = off ij_java_binary_operation_sign_on_next_line = false -ij_java_binary_operation_wrap = off -ij_java_blank_lines_after_anonymous_class_header = 0 -ij_java_blank_lines_after_class_header = 0 +ij_java_binary_operation_wrap = normal +ij_java_blank_lines_after_anonymous_class_header = 1 +ij_java_blank_lines_after_class_header = 1 ij_java_blank_lines_after_imports = 1 ij_java_blank_lines_after_package = 1 ij_java_blank_lines_around_class = 1 @@ -55,32 +58,35 @@ ij_java_blank_lines_around_field_in_interface = 0 ij_java_blank_lines_around_initializer = 1 ij_java_blank_lines_around_method = 1 ij_java_blank_lines_around_method_in_interface = 1 -ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_class_end = 1 ij_java_blank_lines_before_imports = 1 -ij_java_blank_lines_before_method_body = 0 -ij_java_blank_lines_before_package = 0 +ij_java_blank_lines_before_method_body = 1 +ij_java_blank_lines_before_package = 1 ij_java_block_brace_style = end_of_line +ij_java_block_comment_add_space = false ij_java_block_comment_at_first_column = true ij_java_builder_methods = none ij_java_call_parameters_new_line_after_left_paren = false ij_java_call_parameters_right_paren_on_new_line = false -ij_java_call_parameters_wrap = off -ij_java_case_statement_on_separate_line = false +ij_java_call_parameters_wrap = normal +ij_java_case_statement_on_separate_line = true ij_java_catch_on_new_line = false ij_java_class_annotation_wrap = split_into_lines ij_java_class_brace_style = end_of_line ij_java_class_count_to_use_import_on_demand = 5 ij_java_class_names_in_javadoc = 1 +ij_java_deconstruction_list_wrap = normal ij_java_do_not_indent_top_level_class_members = false ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_not_wrap_after_single_annotation_in_parameter = false ij_java_do_while_brace_force = never ij_java_doc_add_blank_line_after_description = true ij_java_doc_add_blank_line_after_param_comments = false ij_java_doc_add_blank_line_after_return = false -ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_add_p_tag_on_empty_lines = false ij_java_doc_align_exception_comments = true ij_java_doc_align_param_comments = true -ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_do_not_wrap_if_one_line = true ij_java_doc_enable_formatting = true ij_java_doc_enable_leading_asterisks = true ij_java_doc_indent_on_continuation = false @@ -93,9 +99,9 @@ ij_java_doc_param_description_on_new_line = false ij_java_doc_preserve_line_breaks = false ij_java_doc_use_throws_not_exception_tag = true ij_java_else_on_new_line = false -ij_java_enum_constants_wrap = off -ij_java_extends_keyword_wrap = off -ij_java_extends_list_wrap = off +ij_java_enum_constants_wrap = split_into_lines +ij_java_extends_keyword_wrap = normal +ij_java_extends_list_wrap = normal ij_java_field_annotation_wrap = split_into_lines ij_java_finally_on_new_line = false ij_java_for_brace_force = never @@ -105,21 +111,21 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = *, |, javax.**, java.**, |, $* +ij_java_imports_layout = *,|,javax.**,java.**,|,$* ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true -ij_java_keep_blank_lines_before_right_brace = 2 -ij_java_keep_blank_lines_between_package_declaration_and_header = 2 -ij_java_keep_blank_lines_in_code = 2 -ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_blank_lines_before_right_brace = 1 +ij_java_keep_blank_lines_between_package_declaration_and_header = 1 +ij_java_keep_blank_lines_in_code = 1 +ij_java_keep_blank_lines_in_declarations = 1 ij_java_keep_builder_methods_indents = false ij_java_keep_control_statement_in_one_line = true -ij_java_keep_first_column_comment = true +ij_java_keep_first_column_comment = false ij_java_keep_indents_on_empty_lines = false ij_java_keep_line_breaks = true ij_java_keep_multiple_expressions_in_one_line = false -ij_java_keep_simple_blocks_in_one_line = true +ij_java_keep_simple_blocks_in_one_line = false ij_java_keep_simple_classes_in_one_line = true ij_java_keep_simple_lambdas_in_one_line = true ij_java_keep_simple_methods_in_one_line = true @@ -128,17 +134,21 @@ ij_java_label_indent_size = 0 ij_java_lambda_brace_style = end_of_line ij_java_layout_static_imports_separately = true ij_java_line_comment_add_space = false +ij_java_line_comment_add_space_on_reformat = false ij_java_line_comment_at_first_column = true ij_java_method_annotation_wrap = split_into_lines ij_java_method_brace_style = end_of_line -ij_java_method_call_chain_wrap = off +ij_java_method_call_chain_wrap = normal ij_java_method_parameters_new_line_after_left_paren = false ij_java_method_parameters_right_paren_on_new_line = false -ij_java_method_parameters_wrap = off +ij_java_method_parameters_wrap = normal ij_java_modifier_list_wrap = false +ij_java_multi_catch_types_wrap = normal ij_java_names_count_to_use_import_on_demand = 3 +ij_java_new_line_after_lparen_in_annotation = false +ij_java_new_line_after_lparen_in_deconstruction_pattern = true ij_java_new_line_after_lparen_in_record_header = false -ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.* +ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* ij_java_parameter_annotation_wrap = off ij_java_parentheses_expression_new_line_after_left_paren = false ij_java_parentheses_expression_right_paren_on_new_line = false @@ -152,7 +162,9 @@ ij_java_replace_null_check = true ij_java_replace_sum_lambda_with_method_ref = true ij_java_resource_list_new_line_after_left_paren = false ij_java_resource_list_right_paren_on_new_line = false -ij_java_resource_list_wrap = off +ij_java_resource_list_wrap = on_every_item +ij_java_rparen_on_new_line_in_annotation = false +ij_java_rparen_on_new_line_in_deconstruction_pattern = true ij_java_rparen_on_new_line_in_record_header = false ij_java_space_after_closing_angle_bracket_in_type_argument = false ij_java_space_after_colon = true @@ -163,7 +175,7 @@ ij_java_space_after_quest = true ij_java_space_after_type_cast = true ij_java_space_before_annotation_array_initializer_left_brace = false ij_java_space_before_annotation_parameter_list = false -ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_array_initializer_left_brace = true ij_java_space_before_catch_keyword = true ij_java_space_before_catch_left_brace = true ij_java_space_before_catch_parentheses = true @@ -171,6 +183,7 @@ ij_java_space_before_class_left_brace = true ij_java_space_before_colon = true ij_java_space_before_colon_in_foreach = true ij_java_space_before_comma = false +ij_java_space_before_deconstruction_list = false ij_java_space_before_do_left_brace = true ij_java_space_before_else_keyword = true ij_java_space_before_else_left_brace = true @@ -201,6 +214,7 @@ ij_java_space_within_empty_array_initializer_braces = false ij_java_space_within_empty_method_call_parentheses = false ij_java_space_within_empty_method_parentheses = false ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_annotation_eq = true ij_java_spaces_around_assignment_operators = true ij_java_spaces_around_bitwise_operators = true ij_java_spaces_around_equality_operators = true @@ -214,11 +228,12 @@ ij_java_spaces_around_type_bounds_in_type_parameters = true ij_java_spaces_around_unary_operator = false ij_java_spaces_within_angle_brackets = false ij_java_spaces_within_annotation_parentheses = false -ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_array_initializer_braces = true ij_java_spaces_within_braces = false ij_java_spaces_within_brackets = false ij_java_spaces_within_cast_parentheses = false ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_deconstruction_list = false ij_java_spaces_within_for_parentheses = false ij_java_spaces_within_if_parentheses = false ij_java_spaces_within_method_call_parentheses = false @@ -232,22 +247,40 @@ ij_java_spaces_within_while_parentheses = false ij_java_special_else_if_treatment = true ij_java_subclass_name_suffix = Impl ij_java_ternary_operation_signs_on_next_line = false -ij_java_ternary_operation_wrap = off +ij_java_ternary_operation_wrap = normal ij_java_test_name_suffix = Test -ij_java_throws_keyword_wrap = off -ij_java_throws_list_wrap = off +ij_java_throws_keyword_wrap = normal +ij_java_throws_list_wrap = normal ij_java_use_external_annotations = false ij_java_use_fq_class_names = false ij_java_use_relative_indents = false ij_java_use_single_class_imports = true -ij_java_variable_annotation_wrap = off +ij_java_variable_annotation_wrap = split_into_lines ij_java_visibility = public ij_java_while_brace_force = never ij_java_while_on_new_line = false -ij_java_wrap_comments = false +ij_java_wrap_comments = true ij_java_wrap_first_method_in_call_chain = false ij_java_wrap_long_lines = false +[*.nbtt] +indent_style = tab +max_line_length = 150 +ij_continuation_indent_size = 4 +ij_nbtt_keep_indents_on_empty_lines = false +ij_nbtt_space_after_colon = true +ij_nbtt_space_after_comma = true +ij_nbtt_space_before_colon = true +ij_nbtt_space_before_comma = false +ij_nbtt_spaces_within_brackets = false +ij_nbtt_spaces_within_parentheses = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + [.editorconfig] ij_editorconfig_align_group_field_declarations = false ij_editorconfig_space_after_colon = false @@ -256,31 +289,375 @@ ij_editorconfig_space_before_colon = false ij_editorconfig_space_before_comma = false ij_editorconfig_spaces_around_assignment_operators = true -[{*.har,*.ire-wood,*.json,mcmod.info,*.mcmeta}] +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.jspx,*.pom,*.rng,*.tagx,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal + +[{*.bash,*.sh,*.zsh}] indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.gant,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_add_space = false +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enable_groovydoc_formatting = true +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_ginq_general_clause_wrap_policy = 2 +ij_groovy_ginq_having_wrap_policy = 1 +ij_groovy_ginq_indent_having_clause = true +ij_groovy_ginq_indent_on_clause = true +ij_groovy_ginq_on_wrap_policy = 1 +ij_groovy_ginq_space_after_keyword = true +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_add_space_on_reformat = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_record_parentheses = false +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_chain_calls_after_dot = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts,*.kt,*.kts,*.main.kts}] +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = off +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_add_space = false +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = false +ij_kotlin_call_parameters_right_paren_on_new_line = false +ij_kotlin_call_parameters_wrap = off +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_continuation_indent_for_chained_calls = true +ij_kotlin_continuation_indent_for_expression_bodies = true +ij_kotlin_continuation_indent_in_argument_lists = true +ij_kotlin_continuation_indent_in_elvis = true +ij_kotlin_continuation_indent_in_if_conditions = true +ij_kotlin_continuation_indent_in_parameter_lists = true +ij_kotlin_continuation_indent_in_supertype_lists = true +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = off +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = false +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_add_space_on_reformat = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = off +ij_kotlin_method_parameters_new_line_after_left_paren = false +ij_kotlin_method_parameters_right_paren_on_new_line = false +ij_kotlin_method_parameters_wrap = off +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 0 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json,mcmod.info,pack.mcmeta}] +indent_size = 2 +ij_json_array_wrapping = split_into_lines ij_json_keep_blank_lines_in_code = 0 ij_json_keep_indents_on_empty_lines = false ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align ij_json_space_after_colon = true ij_json_space_after_comma = true -ij_json_space_before_colon = true +ij_json_space_before_colon = false ij_json_space_before_comma = false ij_json_spaces_within_braces = false ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true ij_markdown_force_one_space_after_header_symbol = true ij_markdown_force_one_space_after_list_bullet = true ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true ij_markdown_max_lines_around_block_elements = 1 ij_markdown_max_lines_around_header = 1 ij_markdown_max_lines_between_paragraphs = 1 ij_markdown_min_lines_around_block_elements = 1 ij_markdown_min_lines_around_header = 1 ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +ij_toml_keep_indents_on_empty_lines = false [{*.yaml,*.yml}] indent_size = 2 diff --git a/.github/workflows/pr_testing.yml b/.github/workflows/pr_testing.yml index feb93b4f317..7761d2a8555 100644 --- a/.github/workflows/pr_testing.yml +++ b/.github/workflows/pr_testing.yml @@ -35,3 +35,26 @@ jobs: jdks notifications wrapper + + Formatting: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Run Spotless + uses: gradle/gradle-build-action@v2 + with: + arguments: 'spotlessCheck --build-cache' + gradle-home-cache-includes: | + caches + jdks + notifications + wrapper diff --git a/gradle.properties b/gradle.properties index f8e10a2589d..ab47d3bdb1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -135,7 +135,7 @@ noPublishedSources = false # By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless # to format your code. However, you can create your own version of these files and place them in your project's # root directory to apply your own formatting options instead. -enableSpotless = false +enableSpotless = true # Enable JUnit testing platform used for testing your code. # Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/ diff --git a/spotless.importorder b/spotless.importorder new file mode 100644 index 00000000000..b85a5670f76 --- /dev/null +++ b/spotless.importorder @@ -0,0 +1,9 @@ +#Organize Import Order +#Sat May 27 02:13:47 CDT 2023 +0=gregtech +1=net +2=codechickenlib +2= +3=java +4=javax +5=\# diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index b481b0618a3..1cb973f18ee 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -8,6 +8,7 @@ import gregtech.common.covers.filter.oreglob.impl.OreGlobParser; import gregtech.modules.GregTechModules; import gregtech.modules.ModuleManager; + import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -17,22 +18,13 @@ import net.minecraftforge.fml.common.event.*; @Mod(modid = GTValues.MODID, - name = "GregTech", - acceptedMinecraftVersions = "[1.12.2,1.13)", - version = GTInternalTags.VERSION, - dependencies = "required:forge@[14.23.5.2847,);" - + "required-after:codechickenlib@[3.2.3,);" - + "after:appliedenergistics2;" - + "after:forestry;" - + "after:extrabees;" - + "after:extratrees;" - + "after:genetics;" - + "after:magicbees;" - + "after:jei@[4.15.0,);" - + "after:crafttweaker@[4.1.20,);" - + "after:groovyscript@[0.6.0,);" - + "after:theoneprobe;" - + "after:hwyla;") + name = "GregTech", + acceptedMinecraftVersions = "[1.12.2,1.13)", + version = GTInternalTags.VERSION, + dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + + "after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + + "after:genetics;" + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + + "after:groovyscript@[0.6.0,);" + "after:theoneprobe;" + "after:hwyla;") public class GregTechMod { // Hold this so that we can reference non-interface methods without diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index e19c0044128..fa0f424854a 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -2,6 +2,7 @@ import gregtech.api.util.XSTR; import gregtech.common.ConfigHolder; + import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.oredict.OreDictionary; @@ -50,22 +51,26 @@ public class GTValues { /** * The Voltage Tiers. Use this Array instead of the old named Voltage Variables */ - public static final long[] V = {8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, Integer.MAX_VALUE}; + public static final long[] V = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, + 134217728, 536870912, Integer.MAX_VALUE }; /** * The Voltage Tiers divided by 2. */ - public static final int[] VH = {4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824}; + public static final int[] VH = { 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, + 67108864, 268435456, 1073741824 }; /** * The Voltage Tiers adjusted for cable loss. Use this for recipe EU/t to avoid full-amp recipes */ - public static final int[] VA = {7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, 125829120, 503316480, 2013265920}; + public static final int[] VA = { 7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, + 125829120, 503316480, 2013265920 }; /** * The Voltage Tiers adjusted for cable loss, divided by 2. */ - public static final int[] VHA = {7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, 62914560, 251658240, 1006632960}; + public static final int[] VHA = { 7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, + 62914560, 251658240, 1006632960 }; public static final int ULV = 0; public static final int LV = 1; @@ -87,28 +92,32 @@ public class GTValues { /** * The short names for the voltages, used for registration primarily */ - public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UXV", "OpV", "MAX"}; + public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", + "UEV", "UIV", "UXV", "OpV", "MAX" }; /** * The short names for the voltages, formatted for text */ - public static final String[] VNF = new String[]{ + public static final String[] VNF = new String[] { DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV", GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV", LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV", DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV", - YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX"}; + YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX" }; /** * Color values for the voltages */ - public static final int[] VC = new int[]{0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5}; + public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, + 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 }; /** * The long names for the voltages */ - public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", - "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", "Overpowered Voltage", "Maximum Voltage"}; + public static final String[] VOLTAGE_NAMES = new String[] { "Ultra Low Voltage", "Low Voltage", "Medium Voltage", + "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", + "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", + "Overpowered Voltage", "Maximum Voltage" }; /** * ModID strings, since they are quite common parameters @@ -175,6 +184,7 @@ public static boolean isDeobfEnvironment() { public static Supplier XMAS = () -> { String[] yearMonthDay = LocalDate.now().toString().split("-"); - return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") && (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25")); + return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") && + (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25")); }; } diff --git a/src/main/java/gregtech/api/GregTechAPI.java b/src/main/java/gregtech/api/GregTechAPI.java index 3c1f5a200dd..14188ff6bfa 100644 --- a/src/main/java/gregtech/api/GregTechAPI.java +++ b/src/main/java/gregtech/api/GregTechAPI.java @@ -29,14 +29,16 @@ import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.GenericEvent; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.HashMap; import java.util.Map; @@ -63,31 +65,34 @@ public class GregTechAPI { private static boolean highTier; private static boolean highTierInitialized; - public static final GTControlledRegistry MTE_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE); - public static final GTControlledRegistry UI_FACTORY_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE); - public static final GTControlledRegistry COVER_REGISTRY = new GTControlledRegistry<>(Integer.MAX_VALUE); + public static final GTControlledRegistry MTE_REGISTRY = new GTControlledRegistry<>( + Short.MAX_VALUE); + public static final GTControlledRegistry UI_FACTORY_REGISTRY = new GTControlledRegistry<>( + Short.MAX_VALUE); + public static final GTControlledRegistry COVER_REGISTRY = new GTControlledRegistry<>( + Integer.MAX_VALUE); public static BlockMachine MACHINE; public static final Map> oreBlockTable = new HashMap<>(); public static final Object2ObjectMap HEATING_COILS = new Object2ObjectOpenHashMap<>(); public static final Object2ObjectMap PSS_BATTERIES = new Object2ObjectOpenHashMap<>(); - public static final BaseCreativeTab TAB_GREGTECH = - new BaseCreativeTab(GTValues.MODID + ".main", () -> MetaItems.LOGO.getStackForm(), true); - public static final BaseCreativeTab TAB_GREGTECH_MACHINES = - new BaseCreativeTab(GTValues.MODID + ".machines", () -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true); - public static final BaseCreativeTab TAB_GREGTECH_CABLES = - new BaseCreativeTab(GTValues.MODID + ".cables", () -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_PIPES = - new BaseCreativeTab(GTValues.MODID + ".pipes", () -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_TOOLS = - new BaseCreativeTab(GTValues.MODID + ".tools", () -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_MATERIALS = - new BaseCreativeTab(GTValues.MODID + ".materials", () -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_ORES = - new BaseCreativeTab(GTValues.MODID + ".ores", () -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true); - public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS = - new BaseCreativeTab(GTValues.MODID + ".decorations", () -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true); + public static final BaseCreativeTab TAB_GREGTECH = new BaseCreativeTab(GTValues.MODID + ".main", + () -> MetaItems.LOGO.getStackForm(), true); + public static final BaseCreativeTab TAB_GREGTECH_MACHINES = new BaseCreativeTab(GTValues.MODID + ".machines", + () -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true); + public static final BaseCreativeTab TAB_GREGTECH_CABLES = new BaseCreativeTab(GTValues.MODID + ".cables", + () -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_PIPES = new BaseCreativeTab(GTValues.MODID + ".pipes", + () -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_TOOLS = new BaseCreativeTab(GTValues.MODID + ".tools", + () -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_MATERIALS = new BaseCreativeTab(GTValues.MODID + ".materials", + () -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_ORES = new BaseCreativeTab(GTValues.MODID + ".ores", + () -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true); + public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS = new BaseCreativeTab(GTValues.MODID + ".decorations", + () -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true); /** Will be available at the Pre-Initialization stage */ public static boolean isHighTier() { @@ -123,8 +128,8 @@ public void register(int id, ResourceLocation key, V value) { } public void register(int id, String key, V value) { - if (registry != null) registry.register(id, new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value); + if (registry != null) registry.register(id, + new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value); } } - } diff --git a/src/main/java/gregtech/api/GregTechAPIInternal.java b/src/main/java/gregtech/api/GregTechAPIInternal.java index cb653b259fe..7e7ae395de8 100644 --- a/src/main/java/gregtech/api/GregTechAPIInternal.java +++ b/src/main/java/gregtech/api/GregTechAPIInternal.java @@ -2,6 +2,7 @@ /** * If you're an addon looking in here, you're probably in the wrong place. + * * @see GregTechAPI */ public final class GregTechAPIInternal { diff --git a/src/main/java/gregtech/api/block/BlockCustomParticle.java b/src/main/java/gregtech/api/block/BlockCustomParticle.java index 8a7522dc1b4..a1f7d937be7 100644 --- a/src/main/java/gregtech/api/block/BlockCustomParticle.java +++ b/src/main/java/gregtech/api/block/BlockCustomParticle.java @@ -1,10 +1,10 @@ package gregtech.api.block; -import codechicken.lib.vec.Vector3; import gregtech.api.GregTechAPI; +import gregtech.api.util.ParticleHandlerUtil; import gregtech.core.network.NetworkUtils; import gregtech.core.network.packets.PacketBlockParticle; -import gregtech.api.util.ParticleHandlerUtil; + import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -19,6 +19,8 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Vector3; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -38,9 +40,11 @@ public BlockCustomParticle(Material materialIn) { @Override @SideOnly(Side.CLIENT) - public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, @Nonnull ParticleManager manager) { + public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, + @Nonnull ParticleManager manager) { Pair atlasSprite = getParticleTexture(worldObj, target.getBlockPos()); - ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), manager); + ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), + manager); return true; } @@ -48,19 +52,23 @@ public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj @SideOnly(Side.CLIENT) public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager manager) { Pair atlasSprite = getParticleTexture(world, pos); - ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), atlasSprite.getRight(), manager); + ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), + atlasSprite.getRight(), manager); return true; } @Override @SideOnly(Side.CLIENT) - public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles) { + public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, + Vector3 entityPos, int numberOfParticles) { Pair atlasSprite = getParticleTexture(worldObj, blockPos); - ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(), particleManager, numberOfParticles); + ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(), + particleManager, numberOfParticles); } @Override - public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull Entity entity) { + public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, + @Nonnull Entity entity) { if (world.isRemote) { Pair atlasSprite = getParticleTexture(world, pos); ParticleHandlerUtil.addBlockRunningEffects(world, entity, atlasSprite.getLeft(), atlasSprite.getRight()); @@ -69,9 +77,11 @@ public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnu } @Override - public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) { - PacketBlockParticle - packet = new PacketBlockParticle(blockPosition, new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles); + public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, + @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, + EntityLivingBase entity, int numberOfParticles) { + PacketBlockParticle packet = new PacketBlockParticle(blockPosition, + new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles); GregTechAPI.networkHandler.sendToAllTracking(packet, NetworkUtils.blockPoint(worldObj, blockPosition)); return true; } diff --git a/src/main/java/gregtech/api/block/BlockStateTileEntity.java b/src/main/java/gregtech/api/block/BlockStateTileEntity.java index bcd6152bbfa..f0729eddd8e 100644 --- a/src/main/java/gregtech/api/block/BlockStateTileEntity.java +++ b/src/main/java/gregtech/api/block/BlockStateTileEntity.java @@ -8,5 +8,4 @@ public class BlockStateTileEntity extends TileEntity { public IBlockState getBlockState() { return getBlockType().getStateFromMeta(getBlockMetadata()); } - } diff --git a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java index 7113989e1b4..b20f59f7759 100644 --- a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java +++ b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java @@ -29,5 +29,4 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { public boolean isFullCube(@Nonnull IBlockState state) { return false; } - } diff --git a/src/main/java/gregtech/api/block/ICustomParticleBlock.java b/src/main/java/gregtech/api/block/ICustomParticleBlock.java index bad3858e73f..8024b0b07b9 100644 --- a/src/main/java/gregtech/api/block/ICustomParticleBlock.java +++ b/src/main/java/gregtech/api/block/ICustomParticleBlock.java @@ -1,11 +1,13 @@ package gregtech.api.block; -import codechicken.lib.vec.Vector3; import net.minecraft.client.particle.ParticleManager; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.vec.Vector3; + public interface ICustomParticleBlock { - void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles); + void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, + int numberOfParticles); } diff --git a/src/main/java/gregtech/api/block/IStateHarvestLevel.java b/src/main/java/gregtech/api/block/IStateHarvestLevel.java index 421cadc3385..b2e64adefe7 100644 --- a/src/main/java/gregtech/api/block/IStateHarvestLevel.java +++ b/src/main/java/gregtech/api/block/IStateHarvestLevel.java @@ -1,6 +1,7 @@ package gregtech.api.block; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.state.IBlockState; public interface IStateHarvestLevel { diff --git a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java index ba6b30dd6d1..bfe40475459 100644 --- a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java +++ b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public class UnlistedBooleanProperty implements IUnlistedProperty { + private final String name; public UnlistedBooleanProperty(@Nonnull String name) { diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index 439d6302329..7e3a4172716 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -4,10 +4,7 @@ import gregtech.client.model.ActiveVariantBlockBakedModel; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSet; + import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; @@ -28,9 +25,13 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import it.unimi.dsi.fastutil.objects.ObjectSet; import team.chisel.ctm.client.state.CTMExtendedState; -import javax.annotation.Nonnull; import java.util.EnumMap; import java.util.Map; import java.util.Objects; @@ -38,6 +39,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class VariantActiveBlock & IStringSerializable> extends VariantBlock { private static final Int2ObjectMap> ACTIVE_BLOCKS = new Int2ObjectOpenHashMap<>(); @@ -121,19 +124,21 @@ protected BlockStateContainer createBlockState() { Class enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class, 0); this.VARIANT = PropertyEnum.create("variant", enumClass); this.VALUES = enumClass.getEnumConstants(); - return new ExtendedBlockState(this, new IProperty[]{VARIANT, ACTIVE_DEPRECATED}, new IUnlistedProperty[]{ACTIVE}); + return new ExtendedBlockState(this, new IProperty[] { VARIANT, ACTIVE_DEPRECATED }, + new IUnlistedProperty[] { ACTIVE }); } @Nonnull @Override - public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos) { IExtendedBlockState ext = ((IExtendedBlockState) state) .withProperty(ACTIVE, Minecraft.getMinecraft().world != null && isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos)); if (Loader.isModLoaded(GTValues.MODID_CTM)) { - //if the Connected Textures Mod is loaded we wrap our IExtendedBlockState with their wrapper, - //so that the CTM renderer can render the block properly. + // if the Connected Textures Mod is loaded we wrap our IExtendedBlockState with their wrapper, + // so that the CTM renderer can render the block properly. return new CTMExtendedState(ext, world, pos); } return ext; @@ -146,17 +151,18 @@ public void onModelRegister() { ModelResourceLocation inactiveModel = model(false, value); ModelResourceLocation activeModel = model(true, value); - ActiveVariantBlockBakedModel model = new ActiveVariantBlockBakedModel(inactiveModel, activeModel, () -> isBloomEnabled(value)); + ActiveVariantBlockBakedModel model = new ActiveVariantBlockBakedModel(inactiveModel, activeModel, + () -> isBloomEnabled(value)); models.put(value, model.getModelLocation()); Item item = Item.getItemFromBlock(this); ModelLoader.setCustomModelResourceLocation(item, value.ordinal(), inactiveModel); ModelLoader.registerItemVariants(item, activeModel); } - ModelLoader.setCustomStateMapper(this, b -> b.getBlockState().getValidStates().stream().collect(Collectors.toMap( - s -> s, - s -> models.get(s.getValue(VARIANT)) - ))); + ModelLoader.setCustomStateMapper(this, + b -> b.getBlockState().getValidStates().stream().collect(Collectors.toMap( + s -> s, + s -> models.get(s.getValue(VARIANT))))); } private ModelResourceLocation model(boolean active, T variant) { diff --git a/src/main/java/gregtech/api/block/VariantBlock.java b/src/main/java/gregtech/api/block/VariantBlock.java index 01200b1f51f..94eb2270b06 100644 --- a/src/main/java/gregtech/api/block/VariantBlock.java +++ b/src/main/java/gregtech/api/block/VariantBlock.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; @@ -19,13 +20,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class VariantBlock & IStringSerializable> extends Block implements IWalkingSpeedBonus { protected PropertyEnum VARIANT; @@ -37,7 +39,8 @@ public VariantBlock(Material materialIn) { for (T t : VALUES) { IStateHarvestLevel stateHarvestLevel = (IStateHarvestLevel) t; IBlockState state = getState(t); - setHarvestLevel(stateHarvestLevel.getHarvestTool(state), stateHarvestLevel.getHarvestLevel(state), state); + setHarvestLevel(stateHarvestLevel.getHarvestTool(state), stateHarvestLevel.getHarvestLevel(state), + state); } } setCreativeTab(GregTechAPI.TAB_GREGTECH); @@ -82,12 +85,13 @@ protected BlockStateContainer createBlockState() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List tooltip, @Nonnull ITooltipFlag advanced) { - //tier less tooltip like: tile.turbine_casing.tooltip + public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List tooltip, + @Nonnull ITooltipFlag advanced) { + // tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; if (I18n.hasKey(unlocalizedVariantTooltip)) Collections.addAll(tooltip, LocalizationUtils.formatLines(unlocalizedVariantTooltip)); - //item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip + // item specific tooltip: tile.turbine_casing.bronze_gearbox.tooltip String unlocalizedTooltip = stack.getTranslationKey() + ".tooltip"; if (I18n.hasKey(unlocalizedTooltip)) Collections.addAll(tooltip, LocalizationUtils.formatLines(unlocalizedTooltip)); @@ -117,7 +121,8 @@ public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull return; } - IBlockState below = entityIn.getEntityWorld().getBlockState(new BlockPos(entityIn.posX, entityIn.posY - (1 / 16D), entityIn.posZ)); + IBlockState below = entityIn.getEntityWorld() + .getBlockState(new BlockPos(entityIn.posX, entityIn.posY - (1 / 16D), entityIn.posZ)); if (checkApplicableBlocks(below)) { if (bonusSpeedCondition(entityIn)) { entityIn.motionX *= getWalkingSpeedBonus(); @@ -126,9 +131,10 @@ public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull } } - //magic is here + // magic is here @SuppressWarnings("unchecked") - protected static Class getActualTypeParameter(Class thisClass, Class declaringClass, int index) { + protected static Class getActualTypeParameter(Class thisClass, Class declaringClass, + int index) { Type type = thisClass.getGenericSuperclass(); while (!(type instanceof ParameterizedType) || ((ParameterizedType) type).getRawType() != declaringClass) { diff --git a/src/main/java/gregtech/api/block/VariantItemBlock.java b/src/main/java/gregtech/api/block/VariantItemBlock.java index 2490785f7fb..3aa02bdfc28 100644 --- a/src/main/java/gregtech/api/block/VariantItemBlock.java +++ b/src/main/java/gregtech/api/block/VariantItemBlock.java @@ -32,5 +32,4 @@ public IBlockState getBlockState(ItemStack stack) { public String getTranslationKey(@Nonnull ItemStack stack) { return super.getTranslationKey(stack) + '.' + genericBlock.getState(getBlockState(stack)).getName(); } - } diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index 71a4b8fdab3..5f0caaad155 100644 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -1,9 +1,5 @@ package gregtech.api.block.machines; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.BlockCustomParticle; @@ -22,6 +18,7 @@ import gregtech.client.renderer.handler.MetaTileEntityRenderer; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; @@ -57,12 +54,18 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.raytracer.RayTracer; +import codechicken.lib.vec.Cuboid6; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; import static gregtech.api.util.GTUtility.getMetaTileEntity; @@ -70,7 +73,7 @@ public class BlockMachine extends BlockCustomParticle implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { private static final List EMPTY_COLLISION_BOX = Collections.emptyList(); - //used for rendering purposes of non-opaque machines like chests and tanks + // used for rendering purposes of non-opaque machines like chests and tanks public static final PropertyBool OPAQUE = PropertyBool.create("opaque"); // Vanilla MC's getHarvestTool() and getHarvestLevel() only pass the state, which is @@ -110,7 +113,8 @@ public boolean causesSuffocation(IBlockState state) { @Nonnull @Override - public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity == null) return state; @@ -122,11 +126,13 @@ public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAcc @Nonnull @Override protected BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[]{OPAQUE}, new IUnlistedProperty[]{HARVEST_TOOL, HARVEST_LEVEL}); + return new ExtendedBlockState(this, new IProperty[] { OPAQUE }, + new IUnlistedProperty[] { HARVEST_TOOL, HARVEST_LEVEL }); } @Override - public float getPlayerRelativeBlockHardness(@Nonnull IBlockState state, @Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos) { + public float getPlayerRelativeBlockHardness(@Nonnull IBlockState state, @Nonnull EntityPlayer player, + @Nonnull World worldIn, @Nonnull BlockPos pos) { // make sure our extended block state info is here for callers (since forge does not do it for us in this case) state = state.getBlock().getActualState(state, worldIn, pos); return super.getPlayerRelativeBlockHardness(state, player, worldIn, pos); @@ -144,7 +150,8 @@ public int getMetaFromState(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -155,7 +162,8 @@ public float getBlockHardness(@Nonnull IBlockState blockState, @Nonnull World wo } @Override - public float getExplosionResistance(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity exploder, @Nonnull Explosion explosion) { + public float getExplosionResistance(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity exploder, + @Nonnull Explosion explosion) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity == null ? 1.0f : metaTileEntity.getBlockResistance(); } @@ -170,13 +178,15 @@ private static List getCollisionBox(IBlockAccess blockAccess, Bl } @Override - public boolean doesSideBlockRendering(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public boolean doesSideBlockRendering(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return state.isOpaqueCube() && getMetaTileEntity(world, pos) != null; } @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) return ItemStack.EMPTY; @@ -187,7 +197,9 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { + public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + @Nullable Entity entityIn, boolean isActualState) { for (Cuboid6 axisAlignedBB : getCollisionBox(worldIn, pos)) { AxisAlignedBB offsetBox = axisAlignedBB.aabb().offset(pos); if (offsetBox.intersects(entityBox)) collidingBoxes.add(offsetBox); @@ -196,7 +208,8 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, @Nonnull World worldIn, + @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos)); } @@ -222,7 +235,8 @@ public EnumFacing[] getValidRotations(@Nonnull World world, @Nonnull BlockPos po } @Override - public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumDyeColor color) { + public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, + @Nonnull EnumDyeColor color) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null || metaTileEntity.getPaintingColor() == color.colorValue) return false; @@ -231,7 +245,8 @@ public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnul } @Override - public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, ItemStack stack) { + public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, ItemStack stack) { IGregTechTileEntity holder = (IGregTechTileEntity) worldIn.getTileEntity(pos); MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); if (holder != null && sampleMetaTileEntity != null) { @@ -241,7 +256,7 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc } MetaTileEntity metaTileEntity = holder.setMetaTileEntity(sampleMetaTileEntity); if (stack.hasTagCompound()) { - //noinspection ConstantConditions + // noinspection ConstantConditions metaTileEntity.initFromItemStackData(stack.getTagCompound()); } if (metaTileEntity.isValidFrontFacing(EnumFacing.UP)) { @@ -270,7 +285,8 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc ItemStack offhand = placer.getHeldItemOffhand(); for (int i = 0; i < EnumDyeColor.values().length; i++) { if (offhand.isItemEqual(MetaItems.SPRAY_CAN_DYES[i].getStackForm())) { - MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); + MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, + pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); break; } } @@ -300,14 +316,15 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { MetaTileEntity metaTileEntity = tileEntities.get() == null ? getMetaTileEntity(world, pos) : tileEntities.get(); if (metaTileEntity == null) return; if (!metaTileEntity.shouldDropWhenDestroyed()) return; ItemStack itemStack = metaTileEntity.getStackForm(); NBTTagCompound tagCompound = new NBTTagCompound(); metaTileEntity.writeItemStackData(tagCompound); - //only set item tag if it's not empty, so newly created items will stack with dismantled + // only set item tag if it's not empty, so newly created items will stack with dismantled if (!tagCompound.isEmpty()) itemStack.setTagCompound(tagCompound); // TODO Clean this up @@ -322,7 +339,9 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = (CuboidRayTraceResult) RayTracer.retraceBlock(worldIn, playerIn, pos); ItemStack itemStack = playerIn.getHeldItem(hand); @@ -353,26 +372,31 @@ public void onBlockClicked(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnu } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { + public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nullable EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity != null && metaTileEntity.canConnectRedstone(side == null ? null : side.getOpposite()); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(blockAccess, pos); - return metaTileEntity == null ? 0 : metaTileEntity.getOutputRedstoneSignal(side == null ? null : side.getOpposite()); + return metaTileEntity == null ? 0 : + metaTileEntity.getOutputRedstoneSignal(side == null ? null : side.getOpposite()); } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { TileEntity holder = worldIn.getTileEntity(pos); if (holder instanceof IGregTechTileEntity gregTechTile) { EnumFacing facing = GTUtility.getFacingToNeighbor(pos, fromPos); @@ -397,7 +421,8 @@ public void onNeighborChange(IBlockAccess world, @NotNull BlockPos pos, @NotNull protected final ThreadLocal tileEntities = new ThreadLocal<>(); @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, + @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : ((IGregTechTileEntity) te).getMetaTileEntity()); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); @@ -433,7 +458,8 @@ public boolean isFullCube(IBlockState state) { @Nonnull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); return metaTileEntity == null ? BlockFaceShape.SOLID : metaTileEntity.getCoverFaceShape(face); } @@ -463,7 +489,8 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList getParticleTexture(World world, Bloc } @Override - public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull Entity entity) { + public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull Entity entity) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) { return super.canEntityDestroy(state, world, pos, entity); } - return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && metaTileEntity.getWitherProof()); + return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && + metaTileEntity.getWitherProof()); } @SideOnly(Side.CLIENT) @Override - public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Random rand) { + public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Random rand) { super.randomDisplayTick(stateIn, worldIn, pos, rand); MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity != null) metaTileEntity.randomDisplayTick(); diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index 42febdc36b5..8d7263b0068 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -1,6 +1,5 @@ package gregtech.api.block.machines; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.metatileentity.ITieredMetaTileEntity; @@ -11,14 +10,13 @@ import gregtech.api.util.LocalizationUtils; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -34,12 +32,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MachineItemBlock extends ItemBlock { private static final Set ADDITIONAL_CREATIVE_TABS = new ObjectArraySet<>(); @@ -51,17 +53,21 @@ public class MachineItemBlock extends ItemBlock { * Note that, for machines to be properly registered on the creative tab, a matching implementation of * {@link MetaTileEntity#isInCreativeTab(CreativeTabs)} should be provided as well. * - * @param creativeTab Creative tab to be checked during {@link net.minecraft.item.Item#getSubItems(CreativeTabs, NonNullList)} + * @param creativeTab Creative tab to be checked during + * {@link net.minecraft.item.Item#getSubItems(CreativeTabs, NonNullList)} * @throws NullPointerException If {@code creativeTab == null} - * @throws IllegalArgumentException If {@code creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES || creativeTab == CreativeTabs.SEARCH} + * @throws IllegalArgumentException If + * {@code creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES || creativeTab == CreativeTabs.SEARCH} * @see MetaTileEntity#isInCreativeTab(CreativeTabs) */ public static void addCreativeTab(CreativeTabs creativeTab) { Preconditions.checkNotNull(creativeTab, "creativeTab"); if (creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES) { - throw new IllegalArgumentException("Adding " + GregTechAPI.TAB_GREGTECH_MACHINES.tabLabel + " as additional creative tab is redundant."); + throw new IllegalArgumentException("Adding " + GregTechAPI.TAB_GREGTECH_MACHINES.tabLabel + + " as additional creative tab is redundant."); } else if (creativeTab == CreativeTabs.SEARCH) { - throw new IllegalArgumentException("Adding " + CreativeTabs.SEARCH.tabLabel + " as additional creative tab is redundant."); + throw new IllegalArgumentException( + "Adding " + CreativeTabs.SEARCH.tabLabel + " as additional creative tab is redundant."); } ADDITIONAL_CREATIVE_TABS.add(creativeTab); } @@ -79,10 +85,12 @@ public String getTranslationKey(@Nonnull ItemStack stack) { } @Override - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { + public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + IBlockState newState) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); - //prevent rendering glitch before meta tile entity sync to client, but after block placement - //set opaque property on the placing on block, instead during set of meta tile entity + // prevent rendering glitch before meta tile entity sync to client, but after block placement + // set opaque property on the placing on block, instead during set of meta tile entity boolean superVal = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState.withProperty(BlockMachine.OPAQUE, metaTileEntity != null && metaTileEntity.isOpaqueCube())); if (superVal && !world.isRemote) { @@ -90,7 +98,8 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play Block block = world.getBlockState(possiblePipe).getBlock(); if (block instanceof BlockPipe) { IPipeTile pipeTile = ((BlockPipe) block).getPipeTileEntity(world, possiblePipe); - if (pipeTile != null && ((BlockPipe) block).canPipeConnectToBlock(pipeTile, side.getOpposite(), world.getTileEntity(pos))) { + if (pipeTile != null && ((BlockPipe) block).canPipeConnectToBlock(pipeTile, side.getOpposite(), + world.getTileEntity(pos))) { pipeTile.setConnection(side, true, false); } } @@ -128,7 +137,8 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { return ItemStack.EMPTY; } if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(1000, true); if (drained == null || drained.amount != 1000) { @@ -142,21 +152,23 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); if (metaTileEntity == null) return; - //item specific tooltip like: gregtech.machine.lathe.lv.tooltip + // item specific tooltip like: gregtech.machine.lathe.lv.tooltip String tooltipLocale = metaTileEntity.getMetaName() + ".tooltip"; if (I18n.hasKey(tooltipLocale)) { Collections.addAll(tooltip, LocalizationUtils.formatLines(tooltipLocale)); } - //tier less tooltip for a electric machine like: gregtech.machine.lathe.tooltip + // tier less tooltip for a electric machine like: gregtech.machine.lathe.tooltip if (metaTileEntity instanceof ITieredMetaTileEntity) { String tierlessTooltipLocale = ((ITieredMetaTileEntity) metaTileEntity).getTierlessTooltipKey(); - //only add tierless tooltip if it's key is not equal to normal tooltip key (i.e if machine name has dot in it's name) - //case when it's not true would be any machine extending from TieredMetaTileEntity but having only one tier + // only add tierless tooltip if it's key is not equal to normal tooltip key (i.e if machine name has dot in + // it's name) + // case when it's not true would be any machine extending from TieredMetaTileEntity but having only one tier if (!tooltipLocale.equals(tierlessTooltipLocale) && I18n.hasKey(tierlessTooltipLocale)) { Collections.addAll(tooltip, LocalizationUtils.formatLines(tierlessTooltipLocale)); } diff --git a/src/main/java/gregtech/api/capability/FeCompat.java b/src/main/java/gregtech/api/capability/FeCompat.java index aadf8c1c0d9..c5768a1816e 100644 --- a/src/main/java/gregtech/api/capability/FeCompat.java +++ b/src/main/java/gregtech/api/capability/FeCompat.java @@ -1,6 +1,7 @@ package gregtech.api.capability; import gregtech.common.ConfigHolder; + import net.minecraftforge.energy.IEnergyStorage; public class FeCompat { @@ -14,6 +15,7 @@ public static int ratio(boolean feToEu) { /** * Converts eu to fe, using specified ratio + * * @return fe */ public static int toFe(long eu, int ratio) { @@ -23,6 +25,7 @@ public static int toFe(long eu, int ratio) { /** * Converts eu to fe, using specified ratio, and returns as a long. * Can be used for overflow protection. + * * @return fe */ public static long toFeLong(long eu, int ratio) { @@ -32,6 +35,7 @@ public static long toFeLong(long eu, int ratio) { /** * Converts eu to fe, using a specified ratio, and with a specified upper bound. * This can be useful for dealing with int-overflows when converting from a long to an int. + * * @return fe */ public static int toFeBounded(long eu, int ratio, int max) { @@ -40,17 +44,19 @@ public static int toFeBounded(long eu, int ratio, int max) { /** * Converts fe to eu, using specified ratio + * * @return eu */ - public static long toEu(long fe, int ratio){ + public static long toEu(long fe, int ratio) { return fe / ratio; } /** * Inserts energy to the storage. EU -> FE conversion is performed. + * * @return amount of EU inserted */ - public static long insertEu(IEnergyStorage storage, long amountEU){ + public static long insertEu(IEnergyStorage storage, long amountEU) { int euToFeRatio = ratio(false); int feSent = storage.receiveEnergy(toFe(amountEU, euToFeRatio), true); return toEu(storage.receiveEnergy(feSent - (feSent % euToFeRatio), false), euToFeRatio); @@ -58,9 +64,10 @@ public static long insertEu(IEnergyStorage storage, long amountEU){ /** * Extracts energy from the storage. EU -> FE conversion is performed. + * * @return amount of EU extracted */ - public static long extractEu(IEnergyStorage storage, long amountEU){ + public static long extractEu(IEnergyStorage storage, long amountEU) { int euToFeRatio = ratio(false); int extract = storage.extractEnergy(toFe(amountEU, euToFeRatio), true); return toEu(storage.extractEnergy(extract - (extract % euToFeRatio), false), euToFeRatio); diff --git a/src/main/java/gregtech/api/capability/GregtechCapabilities.java b/src/main/java/gregtech/api/capability/GregtechCapabilities.java index 5414f54d03f..985d6c5a7fe 100644 --- a/src/main/java/gregtech/api/capability/GregtechCapabilities.java +++ b/src/main/java/gregtech/api/capability/GregtechCapabilities.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; diff --git a/src/main/java/gregtech/api/capability/GregtechDataCodes.java b/src/main/java/gregtech/api/capability/GregtechDataCodes.java index eb1df93f037..b8720654da1 100644 --- a/src/main/java/gregtech/api/capability/GregtechDataCodes.java +++ b/src/main/java/gregtech/api/capability/GregtechDataCodes.java @@ -159,7 +159,6 @@ public static int assignId() { public static final String TAG_KEY_FRAGILE = "Fragile"; public static final String TAG_KEY_MUFFLED = "Muffled"; - // MTE Trait Names public static final String ABSTRACT_WORKABLE_TRAIT = "RecipeMapWorkable"; diff --git a/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java b/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java index d6681895937..0d7a53cc813 100644 --- a/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java +++ b/src/main/java/gregtech/api/capability/GregtechTileCapabilities.java @@ -3,6 +3,7 @@ import gregtech.api.capability.impl.AbstractRecipeLogic; import gregtech.api.cover.CoverHolder; import gregtech.api.metatileentity.multiblock.IMaintenance; + import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; diff --git a/src/main/java/gregtech/api/capability/IControllable.java b/src/main/java/gregtech/api/capability/IControllable.java index 1ba7dfd0f01..631900461e5 100644 --- a/src/main/java/gregtech/api/capability/IControllable.java +++ b/src/main/java/gregtech/api/capability/IControllable.java @@ -13,5 +13,4 @@ public interface IControllable { * @param isWorkingAllowed true if the workable can work, otherwise false */ void setWorkingEnabled(boolean isWorkingAllowed); - } diff --git a/src/main/java/gregtech/api/capability/IDataAccessHatch.java b/src/main/java/gregtech/api/capability/IDataAccessHatch.java index 014a6b9c7ce..d8d42eb0681 100644 --- a/src/main/java/gregtech/api/capability/IDataAccessHatch.java +++ b/src/main/java/gregtech/api/capability/IDataAccessHatch.java @@ -2,10 +2,11 @@ import gregtech.api.recipes.Recipe; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; + public interface IDataAccessHatch { /** diff --git a/src/main/java/gregtech/api/capability/IElectricItem.java b/src/main/java/gregtech/api/capability/IElectricItem.java index 9069088e1ab..34dc08b235d 100644 --- a/src/main/java/gregtech/api/capability/IElectricItem.java +++ b/src/main/java/gregtech/api/capability/IElectricItem.java @@ -90,5 +90,4 @@ default boolean canUse(long amount) { * @return The tier of the item. */ int getTier(); - } diff --git a/src/main/java/gregtech/api/capability/IEnergyContainer.java b/src/main/java/gregtech/api/capability/IEnergyContainer.java index 72df6268142..14e9c7f158d 100644 --- a/src/main/java/gregtech/api/capability/IEnergyContainer.java +++ b/src/main/java/gregtech/api/capability/IEnergyContainer.java @@ -94,29 +94,34 @@ default long getOutputVoltage() { /** * @return output energy packet size - * Overflowing this value will explode machine. + * Overflowing this value will explode machine. */ long getInputVoltage(); /** * @return input eu/s */ - default long getInputPerSec() {return 0L;} + default long getInputPerSec() { + return 0L; + } /** * @return output eu/s */ - default long getOutputPerSec() {return 0L;} + default long getOutputPerSec() { + return 0L; + } /** * @return true if information like energy capacity should be hidden from TOP. - * Useful for cables + * Useful for cables */ default boolean isOneProbeHidden() { return false; } IEnergyContainer DEFAULT = new IEnergyContainer() { + @Override public long acceptEnergyFromNetwork(EnumFacing enumFacing, long l, long l1) { return 0; diff --git a/src/main/java/gregtech/api/capability/IFilter.java b/src/main/java/gregtech/api/capability/IFilter.java index 9d7463b9a3a..d677dbb42d0 100644 --- a/src/main/java/gregtech/api/capability/IFilter.java +++ b/src/main/java/gregtech/api/capability/IFilter.java @@ -1,9 +1,10 @@ package gregtech.api.capability; -import javax.annotation.Nonnull; import java.util.Comparator; import java.util.function.Predicate; +import javax.annotation.Nonnull; + /** * Base type for generic filters. In addition to the predicate method, this interface provides priority primarily used * in insertion logic. @@ -38,20 +39,20 @@ public interface IFilter extends Predicate { * certain filters from others. The priority system uses reverse ordering; higher priority values have * precedence over lower ones. *
    - *
  • Whitelist filters have {@code Integer.MAX_VALUE - whitelistSize} as their default priority. The highest - * possible number for whitelist priority is {@code Integer.MAX_VALUE - 1}, where only one entry is - * whitelisted. The priority can be computed using {@link #whitelistPriority(int)}.
  • - *
  • Blacklist filters have {@code Integer.MIN_VALUE + 1 + blacklistSize} as their default priority. The - * lowest possible number for blacklist priority is {@code Integer.MIN_VALUE + 2}, where only one entry is - * blacklisted. The priority can be computed using {@link #blacklistPriority(int)}.
  • - *
  • Filters with unspecified priority have {@code 0} as their priority.
  • - *
  • Two values, {@link #firstPriority()}, and {@link #lastPriority()}, can be used to create filter - * with highest/lowest possible priority respectively.
  • - *
  • For custom filter implementations, it is expected to have at least positive priority for whitelist-like - * filters, and negative priority for blacklist-like filters. Methods {@link #whitelistLikePriority()} and - * {@link #blacklistLikePriority()} are available as standard priority.
  • - *
  • {@link #noPriority()} is reserved for 'no-priority' filters; it's applicable to no-op filters and - * its reverse (everything filter).
  • + *
  • Whitelist filters have {@code Integer.MAX_VALUE - whitelistSize} as their default priority. The highest + * possible number for whitelist priority is {@code Integer.MAX_VALUE - 1}, where only one entry is + * whitelisted. The priority can be computed using {@link #whitelistPriority(int)}.
  • + *
  • Blacklist filters have {@code Integer.MIN_VALUE + 1 + blacklistSize} as their default priority. The + * lowest possible number for blacklist priority is {@code Integer.MIN_VALUE + 2}, where only one entry is + * blacklisted. The priority can be computed using {@link #blacklistPriority(int)}.
  • + *
  • Filters with unspecified priority have {@code 0} as their priority.
  • + *
  • Two values, {@link #firstPriority()}, and {@link #lastPriority()}, can be used to create filter + * with highest/lowest possible priority respectively.
  • + *
  • For custom filter implementations, it is expected to have at least positive priority for whitelist-like + * filters, and negative priority for blacklist-like filters. Methods {@link #whitelistLikePriority()} and + * {@link #blacklistLikePriority()} are available as standard priority.
  • + *
  • {@link #noPriority()} is reserved for 'no-priority' filters; it's applicable to no-op filters and + * its reverse (everything filter).
  • *
* Although the priority is not a strict requirement, it is strongly encouraged to specify priority according to * these criteria. @@ -72,6 +73,7 @@ default int getPriority() { @Nonnull default IFilter negate() { return new IFilter<>() { + @Override public boolean test(@Nonnull T t) { return !IFilter.this.test(t); diff --git a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java index ca35dc0b32b..524ad54eee8 100644 --- a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java +++ b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java @@ -2,9 +2,10 @@ import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.Comparator; +import javax.annotation.Nullable; + /** * Interface for fluid containers ({@link net.minecraftforge.fluids.IFluidTank IFluidTank} or * {@link net.minecraftforge.fluids.capability.IFluidHandler IFluidHandler}) associated with {@link IFilter}. @@ -15,12 +16,11 @@ public interface IFilteredFluidContainer { * Compare logic for filtered instances. */ Comparator COMPARATOR = Comparator.nullsLast( - Comparator.comparing(IFilteredFluidContainer::getFilter, IFilter.FILTER_COMPARATOR) - ); + Comparator.comparing(IFilteredFluidContainer::getFilter, IFilter.FILTER_COMPARATOR)); /** * @return instance of {@link IFilter} associated to this object, or {@code null} if there's no filter - * associated. + * associated. */ @Nullable IFilter getFilter(); diff --git a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java index 617c3e74ea2..fbd9915ebdb 100644 --- a/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java +++ b/src/main/java/gregtech/api/capability/IHPCAComponentHatch.java @@ -36,8 +36,7 @@ default boolean isDamaged() { /** * Set this component as damaged (or undamaged). */ - default void setDamaged(boolean damaged) { - } + default void setDamaged(boolean damaged) {} /** * If this component allows for bridging HPCAs to Network Switches. diff --git a/src/main/java/gregtech/api/capability/ILaserContainer.java b/src/main/java/gregtech/api/capability/ILaserContainer.java index c91ac9bafb6..4f051cd8a8e 100644 --- a/src/main/java/gregtech/api/capability/ILaserContainer.java +++ b/src/main/java/gregtech/api/capability/ILaserContainer.java @@ -3,5 +3,4 @@ /** * It is its own separate interface to make piping work easier */ -public interface ILaserContainer extends IEnergyContainer { -} +public interface ILaserContainer extends IEnergyContainer {} diff --git a/src/main/java/gregtech/api/capability/IMaintenanceHatch.java b/src/main/java/gregtech/api/capability/IMaintenanceHatch.java index f15c0bbcc20..07c148bb3ab 100644 --- a/src/main/java/gregtech/api/capability/IMaintenanceHatch.java +++ b/src/main/java/gregtech/api/capability/IMaintenanceHatch.java @@ -11,14 +11,16 @@ public interface IMaintenanceHatch { /** * Sets this Maintenance Hatch as being duct taped + * * @param isTaped is the state of the hatch being taped or not */ void setTaped(boolean isTaped); /** * Stores maintenance data to this MetaTileEntity + * * @param maintenanceProblems is the byte value representing the problems - * @param timeActive is the int value representing the total time the parent multiblock has been active + * @param timeActive is the int value representing the total time the parent multiblock has been active */ void storeMaintenanceData(byte maintenanceProblems, int timeActive); @@ -30,6 +32,7 @@ public interface IMaintenanceHatch { /** * reads this MetaTileEntity's maintenance data + * * @return Tuple of Byte, Integer corresponding to the maintenance problems, and total time active */ Tuple readMaintenanceData(); diff --git a/src/main/java/gregtech/api/capability/IMiner.java b/src/main/java/gregtech/api/capability/IMiner.java index 5ac4607a31b..4b82046f399 100644 --- a/src/main/java/gregtech/api/capability/IMiner.java +++ b/src/main/java/gregtech/api/capability/IMiner.java @@ -1,6 +1,5 @@ package gregtech.api.capability; - import codechicken.lib.vec.Cuboid6; public interface IMiner { diff --git a/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java b/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java index 6e9d353e2ca..2a6259791cf 100644 --- a/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java +++ b/src/main/java/gregtech/api/capability/IMultipleRecipeMaps.java @@ -6,6 +6,7 @@ public interface IMultipleRecipeMaps { /** * Used to get all possible RecipeMaps a Multiblock can run + * * @return array of RecipeMaps */ RecipeMap[] getAvailableRecipeMaps(); diff --git a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java index eaf5ae04cf4..bc779c0597b 100644 --- a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java +++ b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java @@ -1,6 +1,5 @@ package gregtech.api.capability; - import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.fluids.FluidStack; @@ -10,12 +9,13 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Base class for multi-tank fluid handlers. Handles insertion logic, along with other standard * {@link IFluidHandler} functionalities. @@ -43,7 +43,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFluidTanks(); @@ -58,7 +58,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFilter() { public IFluidTankProperties[] getTankProperties() { return delegate instanceof IFluidHandler fluidHandler ? fluidHandler.getTankProperties() : - new IFluidTankProperties[]{new FallbackTankProperty()}; + new IFluidTankProperties[] { new FallbackTankProperty() }; } public NBTTagCompound trySerialize() { @@ -137,7 +137,7 @@ public NBTTagCompound trySerialize() { return new NBTTagCompound(); } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings({ "unchecked" }) public void tryDeserialize(NBTTagCompound tag) { if (delegate instanceof FluidTank fluidTank) { fluidTank.readFromNBT(tag); diff --git a/src/main/java/gregtech/api/capability/INotifiableHandler.java b/src/main/java/gregtech/api/capability/INotifiableHandler.java index b0ba2988d1b..8dddb60482d 100644 --- a/src/main/java/gregtech/api/capability/INotifiableHandler.java +++ b/src/main/java/gregtech/api/capability/INotifiableHandler.java @@ -30,5 +30,4 @@ default void addToNotifiedList(MetaTileEntity metaTileEntity, T handler, boo void addNotifiableMetaTileEntity(MetaTileEntity metaTileEntity); void removeNotifiableMetaTileEntity(MetaTileEntity metaTileEntity); - } diff --git a/src/main/java/gregtech/api/capability/IObjectHolder.java b/src/main/java/gregtech/api/capability/IObjectHolder.java index 9c599222aef..1a7dca27503 100644 --- a/src/main/java/gregtech/api/capability/IObjectHolder.java +++ b/src/main/java/gregtech/api/capability/IObjectHolder.java @@ -3,15 +3,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.items.IItemHandler; + import org.jetbrains.annotations.NotNull; public interface IObjectHolder { /** * Get the item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ - @NotNull ItemStack getHeldItem(boolean remove); + @NotNull + ItemStack getHeldItem(boolean remove); /** * Set the item held in the object holder. Overwrites the currently held item. @@ -20,9 +23,11 @@ public interface IObjectHolder { /** * Get the data item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ - @NotNull ItemStack getDataItem(boolean remove); + @NotNull + ItemStack getDataItem(boolean remove); /** * Set the data item held in the object holder. Overwrites the currently held data item. @@ -39,5 +44,6 @@ public interface IObjectHolder { /** * @return the object holder's contents represented as an IItemHandler */ - @NotNull IItemHandler getAsHandler(); + @NotNull + IItemHandler getAsHandler(); } diff --git a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java index 82d32887cd8..ff3c94655a6 100644 --- a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java +++ b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java @@ -1,9 +1,10 @@ package gregtech.api.capability; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; + /** * MUST be implemented on any multiblock which uses * Transmitter Computation Hatches in its structure. diff --git a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java index ff5c26b3010..bf5aa13605c 100644 --- a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java @@ -4,16 +4,19 @@ import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.UnmodifiableView; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.fluids.FluidConstants.CRYOGENIC_FLUID_THRESHOLD; /** @@ -75,12 +78,14 @@ default int getPriority() { /** * Set the container as able to contain an attribute * - * @param attribute the attribute to change containment status for + * @param attribute the attribute to change containment status for * @param canContain whether the attribute can be contained */ void setCanContain(@NotNull FluidAttribute attribute, boolean canContain); - @NotNull @UnmodifiableView Collection<@NotNull FluidAttribute> getContainedAttributes(); + @NotNull + @UnmodifiableView + Collection<@NotNull FluidAttribute> getContainedAttributes(); /** * Append tooltips about containment info @@ -91,7 +96,8 @@ default int getPriority() { */ default void appendTooltips(@NotNull List tooltip, boolean showToolsInfo, boolean showTemperatureInfo) { if (TooltipHelper.isShiftDown()) { - if (showTemperatureInfo) tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); + if (showTemperatureInfo) + tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", getMaxFluidTemperature())); if (isGasProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.gas_proof")); else tooltip.add(I18n.format("gregtech.fluid_pipe.not_gas_proof")); if (isPlasmaProof()) tooltip.add(I18n.format("gregtech.fluid_pipe.plasma_proof")); diff --git a/src/main/java/gregtech/api/capability/IWorkable.java b/src/main/java/gregtech/api/capability/IWorkable.java index d7218b065fc..300574630e4 100644 --- a/src/main/java/gregtech/api/capability/IWorkable.java +++ b/src/main/java/gregtech/api/capability/IWorkable.java @@ -19,5 +19,4 @@ public interface IWorkable extends IControllable { * @return true is machine is active */ boolean isActive(); - -} \ No newline at end of file +} diff --git a/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java b/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java index 287892ca8f7..8aad39dc29c 100644 --- a/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java +++ b/src/main/java/gregtech/api/capability/SimpleCapabilityManager.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.worldgen.generator.GTWorldGenCapability; import gregtech.common.metatileentities.converter.ConverterTrait; + import net.minecraft.nbt.NBTBase; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -19,6 +20,7 @@ public class SimpleCapabilityManager { */ public static void registerCapabilityWithNoDefault(Class capabilityClass) { CapabilityManager.INSTANCE.register(capabilityClass, new Capability.IStorage() { + @Override public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { throw new UnsupportedOperationException("Not supported"); @@ -50,7 +52,8 @@ public static void init() { registerCapabilityWithNoDefault(ConverterTrait.class); registerCapabilityWithNoDefault(ILaserContainer.class); - //internal capabilities - CapabilityManager.INSTANCE.register(GTWorldGenCapability.class, GTWorldGenCapability.STORAGE, GTWorldGenCapability.FACTORY); + // internal capabilities + CapabilityManager.INSTANCE.register(GTWorldGenCapability.class, GTWorldGenCapability.STORAGE, + GTWorldGenCapability.FACTORY); } } diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 9f222dce3be..898314816c7 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -16,6 +16,7 @@ import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -28,11 +29,12 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.ULV; import static gregtech.api.recipes.logic.OverclockingLogic.*; @@ -185,7 +187,7 @@ public void update() { if (progressTime > 0) { updateRecipeProgress(); } - //check everything that would make a recipe never start here. + // check everything that would make a recipe never start here. if (progressTime == 0 && shouldSearchForRecipes()) { trySearchNewRecipe(); } @@ -266,8 +268,9 @@ protected boolean canWorkWithInputs() { // if the inputs were bad last time, check if they've changed before trying to find a new recipe. if (this.invalidInputsForRecipes && !hasNotifiedInputs()) return false; - //the change in inputs (especially by removal of ingredient by the player) might change the current valid recipe. - //and if the previous recipe produced fluids and the new recipe doesn't, then outputs are not full. + // the change in inputs (especially by removal of ingredient by the player) might change the current valid + // recipe. + // and if the previous recipe produced fluids and the new recipe doesn't, then outputs are not full. this.isOutputsFull = false; this.invalidInputsForRecipes = false; this.metaTileEntity.getNotifiedItemInputList().clear(); @@ -310,7 +313,7 @@ public void setParallelRecipesPerformed(int amount) { protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -318,8 +321,8 @@ protected void updateRecipeProgress() { this.hasNotEnoughEnergy = false; } } else if (recipeEUt > 0) { - //only set hasNotEnoughEnergy if this recipe is consuming recipe - //generators always have enough energy + // only set hasNotEnoughEnergy if this recipe is consuming recipe + // generators always have enough energy this.hasNotEnoughEnergy = true; decreaseProgress(); } @@ -329,7 +332,7 @@ protected void updateRecipeProgress() { * Decrease the recipe progress time in the case that some state was not right, like available EU to drain. */ protected void decreaseProgress() { - //if current progress value is greater than 2, decrement it by 2 + // if current progress value is greater than 2, decrement it by 2 if (progressTime >= 2) { if (ConfigHolder.machines.recipeProgressLowEnergy) { this.progressTime = 1; @@ -437,7 +440,8 @@ protected boolean checkCleanroomRequirement(@Nonnull Recipe recipe) { * @return true if the recipe was successfully prepared, else false */ protected boolean prepareRecipe(Recipe recipe) { - recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), metaTileEntity.getFluidOutputLimit()); + recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), + metaTileEntity.getFluidOutputLimit()); // Pass in the trimmed recipe to the parallel logic recipe = findParallelRecipe( @@ -467,6 +471,7 @@ public int getParallelLimit() { /** * Set the parallel limit + * * @param amount the amount to set */ public void setParallelLimit(int amount) { @@ -499,8 +504,9 @@ protected static int getMinTankCapacity(@Nonnull IMultipleTankHandler tanks) { /** * Find a recipe using inputs - * @param maxVoltage the maximum voltage the recipe can have - * @param inputs the item inputs used to search for the recipe + * + * @param maxVoltage the maximum voltage the recipe can have + * @param inputs the item inputs used to search for the recipe * @param fluidInputs the fluid inputs used to search for the recipe * @return the recipe if found, otherwise null */ @@ -534,7 +540,8 @@ protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull } /** - * Determines if the provided recipe is possible to run from the provided inventory, or if there is anything preventing + * Determines if the provided recipe is possible to run from the provided inventory, or if there is anything + * preventing * the Recipe from being completed. *

* Will consume the inputs of the Recipe if it is possible to run. @@ -545,7 +552,8 @@ protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull * a specific bus * @return - true if the recipe is successful, false if the recipe is not successful */ - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, + @Nonnull IItemHandlerModifiable importInventory) { this.overclockResults = calculateOverclock(recipe); modifyOverclockPost(overclockResults, recipe.getRecipePropertyStorage()); @@ -560,13 +568,15 @@ protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull I // We have already trimmed outputs and chanced outputs at this time // Attempt to merge all outputs + chanced outputs into the output bus, to prevent voiding chanced outputs - if (!metaTileEntity.canVoidRecipeItemOutputs() && !GTTransferUtils.addItemsToItemHandler(exportInventory, true, recipe.getAllItemOutputs())) { + if (!metaTileEntity.canVoidRecipeItemOutputs() && + !GTTransferUtils.addItemsToItemHandler(exportInventory, true, recipe.getAllItemOutputs())) { this.isOutputsFull = true; return false; } // We have already trimmed fluid outputs at this time - if (!metaTileEntity.canVoidRecipeFluidOutputs() && !GTTransferUtils.addFluidsToFluidHandler(exportFluids, true, recipe.getAllFluidOutputs())) { + if (!metaTileEntity.canVoidRecipeFluidOutputs() && + !GTTransferUtils.addFluidsToFluidHandler(exportFluids, true, recipe.getAllFluidOutputs())) { this.isOutputsFull = true; return false; } @@ -587,7 +597,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { // Format of resultOverclock: EU/t, duration int totalEUt = resultOverclock[0] * resultOverclock[1]; - //RIP Ternary + // RIP Ternary // Power Consumption case if (totalEUt >= 0) { int capacity; @@ -618,7 +628,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { * Is always called, even if no overclocks are performed. * * @param overclockResults The overclocked recipe EUt and duration, in format [EUt, duration] - * @param storage the RecipePropertyStorage of the recipe being processed + * @param storage the RecipePropertyStorage of the recipe being processed */ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) {} @@ -643,15 +653,16 @@ protected int[] calculateOverclock(@Nonnull Recipe recipe) { */ @Nonnull protected int[] performOverclocking(@Nonnull Recipe recipe) { - int[] values = {recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt())}; + int[] values = { recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt()) }; modifyOverclockPre(values, recipe.getRecipePropertyStorage()); if (values[2] <= 0) { // number of OCs is <= 0, so do not overclock - return new int[]{values[0], values[1]}; + return new int[] { values[0], values[1] }; } - return runOverclockingLogic(recipe.getRecipePropertyStorage(), values[0], getMaximumOverclockVoltage(), values[1], values[2]); + return runOverclockingLogic(recipe.getRecipePropertyStorage(), values[0], getMaximumOverclockVoltage(), + values[1], values[2]); } /** @@ -695,15 +706,15 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert * @return an int array of {OverclockedEUt, OverclockedDuration} */ @Nonnull - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int duration, int amountOC) { return standardOverclockingLogic( Math.abs(recipeEUt), maxVoltage, duration, amountOC, getOverclockingDurationDivisor(), - getOverclockingVoltageMultiplier() - ); + getOverclockingVoltageMultiplier()); } /** @@ -721,7 +732,8 @@ protected double getOverclockingVoltageMultiplier() { } /** - * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock to. + * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock + * to. * * @param voltage The maximum voltage the recipe is allowed to overclock to. * @return the highest voltage tier the machine should use to overclock with @@ -732,7 +744,8 @@ protected int getOverclockForTier(long voltage) { /** * Creates an array of Voltage Names that the machine/multiblock can overclock to. - * Since this is for use with the customizable overclock button, all tiers up to {@link AbstractRecipeLogic#getMaxVoltage()} + * Since this is for use with the customizable overclock button, all tiers up to + * {@link AbstractRecipeLogic#getMaxVoltage()} * are allowed, since the button is initialized to this value. * * @return a String array of the voltage names allowed to be used for overclocking @@ -756,8 +769,10 @@ protected void setupRecipe(Recipe recipe) { this.recipeEUt = overclockResults[0]; int recipeTier = GTUtility.getTierByVoltage(recipe.getEUt()); int machineTier = getOverclockForTier(getMaximumOverclockVoltage()); - this.fluidOutputs = GTUtility.copyFluidList(recipe.getResultFluidOutputs(recipeTier, machineTier, getRecipeMap())); - this.itemOutputs = GTUtility.copyStackList(recipe.getResultItemOutputs(recipeTier, machineTier, getRecipeMap())); + this.fluidOutputs = GTUtility + .copyFluidList(recipe.getResultFluidOutputs(recipeTier, machineTier, getRecipeMap())); + this.itemOutputs = GTUtility + .copyStackList(recipe.getResultItemOutputs(recipeTier, machineTier, getRecipeMap())); if (this.wasActiveAndNeedsUpdate) { this.wasActiveAndNeedsUpdate = false; @@ -779,7 +794,7 @@ protected void completeRecipe() { this.hasNotEnoughEnergy = false; this.wasActiveAndNeedsUpdate = true; this.parallelRecipesPerformed = 0; - this.overclockResults = new int[]{0, 0}; + this.overclockResults = new int[] { 0, 0 }; } /** @@ -1026,5 +1041,4 @@ public void deserializeNBT(@Nonnull NBTTagCompound compound) { } } } - } diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index d16ecba4bbd..f7cd06dda87 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -9,6 +9,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -18,11 +19,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.BOILER_HEAT; import static gregtech.api.capability.GregtechDataCodes.BOILER_LAST_TICK_STEAM; @@ -54,13 +56,15 @@ public void update() { @Override protected boolean canProgressRecipe() { - return super.canProgressRecipe() && !(metaTileEntity instanceof IMultiblockController && ((IMultiblockController) metaTileEntity).isStructureObstructed()); + return super.canProgressRecipe() && !(metaTileEntity instanceof IMultiblockController && + ((IMultiblockController) metaTileEntity).isStructureObstructed()); } @Override protected void trySearchNewRecipe() { MetaTileEntityLargeBoiler boiler = (MetaTileEntityLargeBoiler) metaTileEntity; - if (ConfigHolder.machines.enableMaintenance && boiler.hasMaintenanceMechanics() && boiler.getNumMaintenanceProblems() > 5) { + if (ConfigHolder.machines.enableMaintenance && boiler.hasMaintenanceMechanics() && + boiler.getNumMaintenanceProblems() > 5) { return; } @@ -77,10 +81,12 @@ protected void trySearchNewRecipe() { Recipe dieselRecipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.findRecipe( GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division - if (dieselRecipe != null && fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { + if (dieselRecipe != null && + fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); // divide by 2, as it is half burntime for combustion - setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(dieselRecipe.getEUt()) * dieselRecipe.getDuration()) / FLUID_BURNTIME_TO_EU / 2)))); + setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost( + (Math.abs(dieselRecipe.getEUt()) * dieselRecipe.getDuration()) / FLUID_BURNTIME_TO_EU / 2)))); didStartRecipe = true; break; } @@ -88,10 +94,13 @@ protected void trySearchNewRecipe() { Recipe denseFuelRecipe = RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.findRecipe( GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division - if (denseFuelRecipe != null && fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { + if (denseFuelRecipe != null && + fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); // multiply by 2, as it is 2x burntime for semi-fluid - setMaxProgress(adjustBurnTimeForThrottle(Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(denseFuelRecipe.getEUt()) * denseFuelRecipe.getDuration() / FLUID_BURNTIME_TO_EU * 2))))); + setMaxProgress(adjustBurnTimeForThrottle( + Math.max(1, boiler.boilerType.runtimeBoost((Math.abs(denseFuelRecipe.getEUt()) * + denseFuelRecipe.getDuration() / FLUID_BURNTIME_TO_EU * 2))))); didStartRecipe = true; break; } @@ -107,7 +116,8 @@ protected void trySearchNewRecipe() { this.excessFuel += fuelBurnTime % 80; int excessProgress = this.excessFuel / 80; this.excessFuel %= 80; - setMaxProgress(excessProgress + adjustBurnTimeForThrottle(boiler.boilerType.runtimeBoost(fuelBurnTime / 80))); + setMaxProgress(excessProgress + + adjustBurnTimeForThrottle(boiler.boilerType.runtimeBoost(fuelBurnTime / 80))); stack.shrink(1); didStartRecipe = true; break; @@ -157,7 +167,8 @@ protected void updateRecipeProgress() { private int getMaximumHeatFromMaintenance() { if (ConfigHolder.machines.enableMaintenance) { - return (int) Math.min(currentHeat, (1 - 0.1 * getMetaTileEntity().getNumMaintenanceProblems()) * getMaximumHeat()); + return (int) Math.min(currentHeat, + (1 - 0.1 * getMetaTileEntity().getNumMaintenanceProblems()) * getMaximumHeat()); } else return currentHeat; } diff --git a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java index 1d8044d93a6..42e4a24ae0f 100644 --- a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java +++ b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.multiblock.ICleanroomProvider; import gregtech.api.metatileentity.multiblock.IMaintenance; import gregtech.common.ConfigHolder; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.world.World; @@ -32,7 +33,8 @@ public class CleanroomLogic { public CleanroomLogic(MetaTileEntity metaTileEntity, int minEnergyTier) { this.metaTileEntity = metaTileEntity; this.minEnergyTier = minEnergyTier; - this.hasMaintenance = ConfigHolder.machines.enableMaintenance && ((IMaintenance) metaTileEntity).hasMaintenanceMechanics(); + this.hasMaintenance = ConfigHolder.machines.enableMaintenance && + ((IMaintenance) metaTileEntity).hasMaintenanceMechanics(); } /** @@ -121,7 +123,8 @@ public void setWorkingEnabled(boolean workingEnabled) { this.metaTileEntity.markDirty(); World world = this.metaTileEntity.getWorld(); if (world != null && !world.isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(workingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(workingEnabled)); } } @@ -177,7 +180,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); @@ -189,7 +193,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeBoolean(this.isActive); @@ -201,7 +206,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { setActive(buf.readBoolean()); @@ -213,7 +219,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.IS_WORKING) { diff --git a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java index 837aac7bcfc..1b02128f099 100644 --- a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java +++ b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java @@ -4,9 +4,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class CombinedCapabilityProvider implements ICapabilityProvider { diff --git a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java index 8a2b633df16..6b76b5adc35 100644 --- a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java +++ b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java @@ -4,6 +4,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.common.ConfigHolder; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -14,7 +15,9 @@ * Common fluid filter implementations. */ public enum CommonFluidFilters implements IFilter { + ALLOW_ALL { + @Override public boolean test(@Nonnull FluidStack fluid) { return true; @@ -31,6 +34,7 @@ public IFilter negate() { } }, DISALLOW_ALL { + @Override public boolean test(@Nonnull FluidStack fluid) { return false; @@ -47,6 +51,7 @@ public IFilter negate() { } }, BOILER_FLUID { + @Override public boolean test(@Nonnull FluidStack fluid) { if (matchesFluid(fluid, FluidRegistry.WATER) || matchesFluid(fluid, Materials.DistilledWater)) { @@ -68,6 +73,7 @@ public int getPriority() { } }, STEAM { + @Override public boolean test(@Nonnull FluidStack fluid) { return matchesFluid(fluid, Materials.Steam); @@ -79,6 +85,7 @@ public int getPriority() { } }, LIGHTER_FUEL { + @Override public boolean test(@Nonnull FluidStack fluidStack) { return matchesFluid(fluidStack, Materials.Butane) || matchesFluid(fluidStack, Materials.Propane); diff --git a/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java index 515a0159b15..ffd91c5d3ff 100644 --- a/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/ComputationRecipeLogic.java @@ -6,7 +6,9 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.recipeproperties.ComputationProperty; import gregtech.api.recipes.recipeproperties.TotalComputationProperty; + import net.minecraft.nbt.NBTTagCompound; + import org.jetbrains.annotations.NotNull; /** @@ -147,7 +149,6 @@ public void deserializeNBT(@NotNull NBTTagCompound compound) { } } - /** * @return Whether TOP / WAILA should show the recipe progress as duration or as total computation. */ diff --git a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java index 327e04545de..beeba3c3d8f 100644 --- a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java +++ b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java @@ -6,6 +6,7 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -55,7 +56,6 @@ public GTEnergyWrapper(IEnergyStorage energyStorage) { @Override public long acceptEnergyFromNetwork(EnumFacing facing, long voltage, long amperage) { - int receive = 0; // Try to use the internal buffer before consuming a new packet @@ -162,9 +162,12 @@ public long getEnergyStored() { } /** - * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving IEnergyStorage should handle it. - * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the cable attempt to insert energy. - * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any changes to our internal rf buffer. + * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving + * IEnergyStorage should handle it. + * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the + * cable attempt to insert energy. + * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any + * changes to our internal rf buffer. */ @Override public long getEnergyCanBeInserted() { diff --git a/src/main/java/gregtech/api/capability/impl/ElectricItem.java b/src/main/java/gregtech/api/capability/impl/ElectricItem.java index 05fab8d05da..9300b8bed9d 100644 --- a/src/main/java/gregtech/api/capability/impl/ElectricItem.java +++ b/src/main/java/gregtech/api/capability/impl/ElectricItem.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; @@ -10,12 +11,13 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ElectricItem implements IElectricItem, ICapabilityProvider { protected final ItemStack itemStack; @@ -28,7 +30,8 @@ public class ElectricItem implements IElectricItem, ICapabilityProvider { protected final List> listeners = new ArrayList<>(); - public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, boolean canProvideEnergyExternally) { + public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, + boolean canProvideEnergyExternally) { this.itemStack = itemStack; this.maxCharge = maxCharge; this.tier = tier; @@ -45,7 +48,7 @@ public void setCharge(long change) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setLong("Charge", change); listeners.forEach(l -> l.accept(itemStack, change)); } @@ -54,7 +57,7 @@ public void setMaxChargeOverride(long maxCharge) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setLong("MaxCharge", maxCharge); } @@ -86,7 +89,7 @@ public void setInfiniteCharge(boolean infiniteCharge) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions itemStack.getTagCompound().setBoolean("Infinite", infiniteCharge); listeners.forEach(l -> l.accept(itemStack, getMaxCharge())); } @@ -121,11 +124,13 @@ public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, bo } @Override - public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, + boolean simulate) { if (itemStack.getCount() != 1) { return 0L; } - if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && amount > 0L) { + if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && + amount > 0L) { if (!ignoreTransferLimit) { amount = Math.min(amount, getTransferLimit()); } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java index bfe8fb75dbc..b1e61ce109f 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -12,10 +13,11 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class EnergyContainerBatteryBuffer extends EnergyContainerHandler { public static final long AMPS_PER_BATTERY = 2L; @@ -23,7 +25,8 @@ public class EnergyContainerBatteryBuffer extends EnergyContainerHandler { private final int tier; public EnergyContainerBatteryBuffer(MetaTileEntity metaTileEntity, int tier, int inventorySize) { - super(metaTileEntity, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); + super(metaTileEntity, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], + inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); this.tier = tier; } @@ -44,7 +47,7 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage return usedAmps; } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, maxAmps - internalAmps); @@ -57,14 +60,17 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage for (Object item : batteries) { if (item instanceof IElectricItem) { IElectricItem electricItem = (IElectricItem) item; - energy -= electricItem.charge(Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), true, false); + energy -= electricItem.charge( + Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), + true, false); } else if (item instanceof IEnergyStorage) { IEnergyStorage energyStorage = (IEnergyStorage) item; - energy -= FeCompat.insertEu(energyStorage, Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); + energy -= FeCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); } } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } @@ -89,7 +95,8 @@ public void update() { if (tileEntity == null) { return; } - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, outFacing.getOpposite()); + IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + outFacing.getOpposite()); if (energyContainer == null) { return; } @@ -97,7 +104,7 @@ public void update() { long voltage = getOutputVoltage(); List batteries = getNonEmptyBatteries(); if (batteries.size() > 0) { - //Prioritize as many packets as available of energy created + // Prioritize as many packets as available of energy created long internalAmps = Math.abs(Math.min(0, getInternalStorage() / voltage)); long genAmps = Math.max(0, batteries.size() - internalAmps); long outAmps = 0L; @@ -116,7 +123,7 @@ public void update() { energy -= electricItem.discharge(distributed, getTier(), false, true, false); } - //Subtract energy created out of thin air from the buffer + // Subtract energy created out of thin air from the buffer setEnergyStored(getInternalStorage() + internalAmps * voltage - energy); } } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java index 29cfb4bc150..c335e09ddca 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryCharger.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.CapabilityEnergy; @@ -43,7 +44,7 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage metaTileEntity.doExplosion(GTUtility.getExplosionPower(voltage)); } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, maxAmps - internalAmps); @@ -56,14 +57,17 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage for (Object item : batteries) { if (item instanceof IElectricItem) { IElectricItem electricItem = (IElectricItem) item; - energy -= electricItem.charge(Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), true, false); + energy -= electricItem.charge( + Math.min(distributed, GTValues.V[electricItem.getTier()] * AMPS_PER_BATTERY), getTier(), + true, false); } else if (item instanceof IEnergyStorage) { IEnergyStorage energyStorage = (IEnergyStorage) item; - energy -= FeCompat.insertEu(energyStorage, Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); + energy -= FeCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_BATTERY)); } } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java index 51b10e197ca..9d3ad8b26b6 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -15,9 +16,10 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class EnergyContainerHandler extends MTETrait implements IEnergyContainer { protected final long maxCapacity; @@ -39,7 +41,8 @@ public class EnergyContainerHandler extends MTETrait implements IEnergyContainer protected long amps = 0; - public EnergyContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + public EnergyContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, + long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { super(tileEntity); this.maxCapacity = maxCapacity; this.maxInputVoltage = maxInputVoltage; @@ -56,11 +59,13 @@ public void setSideOutputCondition(Predicate sideOutputCondition) { this.sideOutputCondition = sideOutputCondition; } - public static EnergyContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, long maxOutputVoltage, long maxOutputAmperage) { + public static EnergyContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxOutputVoltage, long maxOutputAmperage) { return new EnergyContainerHandler(tileEntity, maxCapacity, 0L, 0L, maxOutputVoltage, maxOutputAmperage); } - public static EnergyContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage) { + public static EnergyContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxInputVoltage, long maxInputAmperage) { return new EnergyContainerHandler(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, 0L, 0L); } @@ -201,10 +206,13 @@ public void update() { if (!outputsEnergy(side)) continue; TileEntity tileEntity = metaTileEntity.getNeighbor(side); EnumFacing oppositeSide = side.getOpposite(); - if (tileEntity != null && tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide)) { - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide); + if (tileEntity != null && + tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide)) { + IEnergyContainer energyContainer = tileEntity + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, oppositeSide); if (energyContainer == null || !energyContainer.inputsEnergy(oppositeSide)) continue; - amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, outputAmperes - amperesUsed); + amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, + outputAmperes - amperesUsed); if (amperesUsed == outputAmperes) break; } } @@ -242,7 +250,8 @@ public long getEnergyCapacity() { @Override public boolean inputsEnergy(EnumFacing side) { - return !outputsEnergy(side) && getInputVoltage() > 0 && (sideInputCondition == null || sideInputCondition.test(side)); + return !outputsEnergy(side) && getInputVoltage() > 0 && + (sideInputCondition == null || sideInputCondition.test(side)); } @Override @@ -253,7 +262,8 @@ public boolean outputsEnergy(EnumFacing side) { @Override public long changeEnergy(long energyToAdd) { long oldEnergyStored = getEnergyStored(); - long newEnergyStored = (maxCapacity - oldEnergyStored < energyToAdd) ? maxCapacity : (oldEnergyStored + energyToAdd); + long newEnergyStored = (maxCapacity - oldEnergyStored < energyToAdd) ? maxCapacity : + (oldEnergyStored + energyToAdd); if (newEnergyStored < 0) newEnergyStored = 0; setEnergyStored(newEnergyStored); @@ -281,6 +291,7 @@ public long getInputVoltage() { } public interface IEnergyChangeListener { + void onEnergyChanged(IEnergyContainer container, boolean isInitialChange); } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java index 4d296a86e78..da175b75639 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java @@ -1,11 +1,13 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IEnergyContainer; + import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class EnergyContainerList implements IEnergyContainer { private final List energyContainerList; @@ -55,7 +57,7 @@ public EnergyContainerList(@Nonnull List energyContainerList) /** * Computes the correct max voltage and amperage values * - * @param voltage the sum of voltage * amperage for each hatch + * @param voltage the sum of voltage * amperage for each hatch * @param amperage the total amperage of all hatches * * @return [newVoltage, newAmperage] @@ -89,7 +91,7 @@ private static long[] calculateVoltageAmperage(long voltage, long amperage) { amperage = 1; } } - return new long[]{voltage, amperage}; + return new long[] { voltage, amperage }; } private static boolean hasPrimeFactorGreaterThanTwo(long l) { @@ -185,7 +187,9 @@ public long getHighestInputVoltage() { return highestInputVoltage; } - /** The number of parts with voltage specified in {@link EnergyContainerList#getHighestInputVoltage()} in this list. */ + /** + * The number of parts with voltage specified in {@link EnergyContainerList#getHighestInputVoltage()} in this list. + */ public int getNumHighestInputContainers() { return numHighestInputContainers; } diff --git a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java index 79fcffa9029..ad8765c5ed5 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java @@ -2,6 +2,7 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; diff --git a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java index 38f9d0966cf..2ed16f744af 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java @@ -2,13 +2,15 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class FilteredItemHandler extends GTItemStackHandler { public static Predicate getCapabilityFilter(Capability cap) { @@ -18,7 +20,7 @@ public static Predicate getCapabilityFilter(Capability cap) { private Predicate fillPredicate; public FilteredItemHandler(MetaTileEntity metaTileEntity) { - super(metaTileEntity,1); + super(metaTileEntity, 1); } public FilteredItemHandler(MetaTileEntity metaTileEntity, int size) { diff --git a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java index 5f1a92a70b6..20f762df005 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java @@ -6,6 +6,7 @@ import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityFluidDrill; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fluids.Fluid; @@ -48,7 +49,6 @@ public void performDrilling() { if (!acquireNewFluid()) return; // stop if we still have no fluid - // drills that cannot work do nothing if (!this.isWorkingEnabled) return; @@ -113,11 +113,14 @@ protected void depleteVein() { } public int getFluidToProduce() { - int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); + int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), + getChunkZ()); int regularYield = BedrockFluidVeinHandler.getFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); - int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), getChunkZ()); + int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), + getChunkZ()); - int produced = Math.max(depletedYield, regularYield * remainingOperations / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS); + int produced = Math.max(depletedYield, + regularYield * remainingOperations / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS); produced *= metaTileEntity.getRigMultiplier(); // Overclocks produce 50% more fluid @@ -144,7 +147,8 @@ protected boolean checkCanDrain() { return false; } - if (this.hasNotEnoughEnergy && metaTileEntity.getEnergyInputPerSecond() > 19L * GTValues.VA[metaTileEntity.getEnergyTier()]) { + if (this.hasNotEnoughEnergy && + metaTileEntity.getEnergyInputPerSecond() > 19L * GTValues.VA[metaTileEntity.getEnergyTier()]) { this.hasNotEnoughEnergy = false; } @@ -200,7 +204,8 @@ public void setWorkingEnabled(boolean isWorkingEnabled) { this.isWorkingEnabled = isWorkingEnabled; metaTileEntity.markDirty(); if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(isWorkingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(isWorkingEnabled)); } } } @@ -261,7 +266,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); @@ -274,7 +280,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeBoolean(this.isActive); @@ -286,7 +293,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { setActive(buf.readBoolean()); @@ -298,7 +306,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.WORKABLE_ACTIVE) { diff --git a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java index a0cd2b982b8..a4bf50ed9b8 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java @@ -1,14 +1,16 @@ package gregtech.api.capability.impl; -import com.google.common.collect.Lists; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nullable; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + public class FluidHandlerProxy implements IFluidHandler { public IFluidHandler input; diff --git a/src/main/java/gregtech/api/capability/impl/FluidTankList.java b/src/main/java/gregtech/api/capability/impl/FluidTankList.java index 848652265a8..41b9de569b6 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidTankList.java +++ b/src/main/java/gregtech/api/capability/impl/FluidTankList.java @@ -1,6 +1,7 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IMultipleTankHandler; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants; @@ -9,13 +10,14 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class FluidTankList implements IMultipleTankHandler, INBTSerializable { private final MultiFluidTankEntry[] fluidTanks; @@ -35,7 +37,8 @@ public FluidTankList(boolean allowSameFluidFill, @Nonnull List list = new ArrayList<>(parent.getFluidTanks()); for (IFluidTank tank : additionalTanks) list.add(wrapIntoEntry(tank)); this.fluidTanks = list.toArray(new MultiFluidTankEntry[0]); diff --git a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java index ce7eaa6c468..f126e354753 100644 --- a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java @@ -6,19 +6,21 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; -import javax.annotation.Nonnull; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class FuelRecipeLogic extends RecipeLogicEnergy { - public FuelRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public FuelRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(tileEntity, recipeMap, energyContainer); } @Nonnull @Override public ParallelLogicType getParallelLogicType() { - return ParallelLogicType.MULTIPLY; //TODO APPEND_FLUIDS + return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS } @Override diff --git a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java index dabb85647cb..d55f0477dfc 100644 --- a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java @@ -2,6 +2,7 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; @@ -62,7 +63,7 @@ public GTFluidHandlerItemStack setCanDrain(boolean canDrain) { @Override public IFluidTankProperties[] getTankProperties() { if (properties == null) { - return properties = new IFluidTankProperties[]{new TankProperties()}; + return properties = new IFluidTankProperties[] { new TankProperties() }; } return properties; } diff --git a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java index 86bb0457652..6eda40fbc36 100644 --- a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java @@ -2,9 +2,9 @@ import gregtech.api.capability.IFilter; import gregtech.api.capability.IFilteredFluidContainer; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.FluidTankProperties; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple; @@ -63,7 +63,7 @@ public GTSimpleFluidHandlerItemStack setCanDrain(boolean canDrain) { @Override public IFluidTankProperties[] getTankProperties() { if (properties == null) { - return properties = new IFluidTankProperties[]{new GTSimpleFluidHandlerItemStack.TankProperties()}; + return properties = new IFluidTankProperties[] { new GTSimpleFluidHandlerItemStack.TankProperties() }; } return properties; } diff --git a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java index 8619510ff57..27854110540 100644 --- a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java +++ b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java @@ -4,17 +4,20 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ingredients.IntCircuitIngredient; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.util.Constants; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -public class GhostCircuitItemStackHandler extends GTItemStackHandler implements IItemHandlerModifiable, INotifiableHandler { +import javax.annotation.Nonnull; + +public class GhostCircuitItemStackHandler extends GTItemStackHandler + implements IItemHandlerModifiable, INotifiableHandler { /** * Special circuit value indicating no circuit value is set. @@ -166,7 +169,8 @@ public void write(@Nonnull NBTTagCompound tag) { } public void read(@Nonnull NBTTagCompound tag) { - int circuitValue = tag.hasKey("GhostCircuit", Constants.NBT.TAG_ANY_NUMERIC) ? tag.getInteger("GhostCircuit") : NO_CONFIG; + int circuitValue = tag.hasKey("GhostCircuit", Constants.NBT.TAG_ANY_NUMERIC) ? tag.getInteger("GhostCircuit") : + NO_CONFIG; if (circuitValue < IntCircuitIngredient.CIRCUIT_MIN || circuitValue > IntCircuitIngredient.CIRCUIT_MAX) circuitValue = NO_CONFIG; setCircuitValue(circuitValue); diff --git a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java index 0403a3559a7..2ddd1e750cf 100644 --- a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java @@ -34,14 +34,14 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert @Nonnull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int duration, int amountOC) { return heatingCoilOverclockingLogic( Math.abs(recipeEUt), maxVoltage, duration, amountOC, ((IHeatingCoil) metaTileEntity).getCurrentTemperature(), - propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0) - ); + propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0)); } } diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java index b5ce1d118cb..6fcbe6379a9 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java @@ -1,14 +1,16 @@ package gregtech.api.capability.impl; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import java.util.*; +import javax.annotation.Nonnull; + /** * Efficiently delegates calls into multiple item handlers */ diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java index 80fd93aff6f..28a5ad86edc 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java @@ -23,7 +23,8 @@ public int getSlots() { @Nonnull @Override public ItemStack getStackInSlot(int slot) { - return slot < insertHandler.getSlots() ? insertHandler.getStackInSlot(slot) : extractHandler.getStackInSlot(slot - insertHandler.getSlots()); + return slot < insertHandler.getSlots() ? insertHandler.getStackInSlot(slot) : + extractHandler.getStackInSlot(slot - insertHandler.getSlots()); } @Nonnull @@ -35,11 +36,13 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate @Nonnull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { - return slot >= insertHandler.getSlots() ? extractHandler.extractItem(slot - insertHandler.getSlots(), amount, simulate) : ItemStack.EMPTY; + return slot >= insertHandler.getSlots() ? + extractHandler.extractItem(slot - insertHandler.getSlots(), amount, simulate) : ItemStack.EMPTY; } @Override public int getSlotLimit(int slot) { - return slot < insertHandler.getSlots() ? insertHandler.getSlotLimit(slot) : extractHandler.getSlotLimit(slot - insertHandler.getSlots()); + return slot < insertHandler.getSlots() ? insertHandler.getSlotLimit(slot) : + extractHandler.getSlotLimit(slot - insertHandler.getSlots()); } } diff --git a/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java b/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java index aa5dd739ee5..1665374a43d 100644 --- a/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/LaserContainerHandler.java @@ -4,21 +4,25 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.ILaserContainer; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; public class LaserContainerHandler extends EnergyContainerHandler implements ILaserContainer { - public LaserContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + public LaserContainerHandler(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, + long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { super(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, maxOutputVoltage, maxOutputAmperage); } - public static LaserContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, long maxOutputVoltage, long maxOutputAmperage) { + public static LaserContainerHandler emitterContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxOutputVoltage, long maxOutputAmperage) { return new LaserContainerHandler(tileEntity, maxCapacity, 0L, 0L, maxOutputVoltage, maxOutputAmperage); } - public static LaserContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, long maxInputVoltage, long maxInputAmperage) { + public static LaserContainerHandler receiverContainer(MetaTileEntity tileEntity, long maxCapacity, + long maxInputVoltage, long maxInputAmperage) { return new LaserContainerHandler(tileEntity, maxCapacity, maxInputVoltage, maxInputAmperage, 0L, 0L); } @@ -50,10 +54,13 @@ public void update() { if (!outputsEnergy(side)) continue; TileEntity tileEntity = metaTileEntity.getWorld().getTileEntity(metaTileEntity.getPos().offset(side)); EnumFacing oppositeSide = side.getOpposite(); - if (tileEntity != null && tileEntity.hasCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide)) { - IEnergyContainer energyContainer = tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide); + if (tileEntity != null && + tileEntity.hasCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide)) { + IEnergyContainer energyContainer = tileEntity + .getCapability(GregtechTileCapabilities.CAPABILITY_LASER, oppositeSide); if (energyContainer == null || !energyContainer.inputsEnergy(oppositeSide)) continue; - amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, outputAmperes - amperesUsed); + amperesUsed += energyContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, + outputAmperes - amperesUsed); if (amperesUsed == outputAmperes) break; } } @@ -75,5 +82,4 @@ public String toString() { ", amps=" + amps + '}'; } - } diff --git a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java index 0e0c4d599e0..1e88a0d5b02 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java @@ -1,14 +1,17 @@ package gregtech.api.capability.impl; -import com.google.common.collect.Iterables; import gregtech.api.capability.IFilter; + import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; +import com.google.common.collect.Iterables; + import java.util.Arrays; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + /** * Basic filter with multiple fluid templates. Can be either whitelist or blacklist. */ diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java index 5aea4463085..93cd0ebd095 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java @@ -8,13 +8,15 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; import gregtech.api.util.TextFormattingUtil; + import net.minecraft.util.Tuple; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MultiblockFuelRecipeLogic extends MultiblockRecipeLogic { protected long totalContinuousRunningTime; @@ -51,7 +53,7 @@ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePrope @Nonnull @Override public ParallelLogicType getParallelLogicType() { - return ParallelLogicType.MULTIPLY; //TODO APPEND_FLUIDS + return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS } @Override @@ -64,7 +66,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { public void update() { super.update(); if (workingEnabled && isActive && progressTime > 0) { - totalContinuousRunningTime ++; + totalContinuousRunningTime++; } else { totalContinuousRunningTime = 0; } @@ -146,7 +148,9 @@ public FluidStack getInputFluidStack() { if (previousRecipe == null) { Recipe recipe = findRecipe(Integer.MAX_VALUE, getInputInventory(), getInputTank()); - return recipe == null ? null : getInputTank().drain(new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), false); + return recipe == null ? null : getInputTank().drain( + new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), + false); } FluidStack fuelStack = previousRecipe.getFluidInputs().get(0).getInputFluidStack(); return getInputTank().drain(new FluidStack(fuelStack.getFluid(), Integer.MAX_VALUE), false); diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java index f46d95abaa1..b6073d037bc 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java @@ -13,16 +13,18 @@ import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.util.Tuple; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MultiblockRecipeLogic extends AbstractRecipeLogic { // Used for distinct mode @@ -39,8 +41,7 @@ public MultiblockRecipeLogic(RecipeMapMultiblockController tileEntity, boolean h } @Override - public void update() { - } + public void update() {} public void updateWorkable() { super.update(); @@ -114,7 +115,8 @@ protected boolean canWorkWithInputs() { if (controller instanceof RecipeMapMultiblockController) { RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { boolean canWork = false; if (invalidatedInputList.isEmpty()) { return true; @@ -125,7 +127,8 @@ protected boolean canWorkWithInputs() { metaTileEntity.getNotifiedFluidInputList().clear(); metaTileEntity.getNotifiedItemInputList().clear(); } else { - Iterator notifiedIter = metaTileEntity.getNotifiedItemInputList().iterator(); + Iterator notifiedIter = metaTileEntity.getNotifiedItemInputList() + .iterator(); while (notifiedIter.hasNext()) { IItemHandlerModifiable bus = notifiedIter.next(); Iterator invalidatedIter = invalidatedInputList.iterator(); @@ -169,7 +172,8 @@ protected void trySearchNewRecipe() { // do not run recipes when there are more than 5 maintenance problems // Maintenance can apply to all multiblocks, so cast to a base multiblock class MultiblockWithDisplayBase controller = (MultiblockWithDisplayBase) metaTileEntity; - if (ConfigHolder.machines.enableMaintenance && controller.hasMaintenanceMechanics() && controller.getNumMaintenanceProblems() > 5) { + if (ConfigHolder.machines.enableMaintenance && controller.hasMaintenanceMechanics() && + controller.getNumMaintenanceProblems() > 5) { return; } @@ -177,7 +181,8 @@ protected void trySearchNewRecipe() { if (controller instanceof RecipeMapMultiblockController) { RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { trySearchNewRecipeDistinct(); return; } @@ -187,7 +192,8 @@ protected void trySearchNewRecipe() { } /** - * Put into place so multiblocks can override {@link AbstractRecipeLogic#trySearchNewRecipe()} without having to deal with + * Put into place so multiblocks can override {@link AbstractRecipeLogic#trySearchNewRecipe()} without having to + * deal with * the maintenance and distinct logic in {@link MultiblockRecipeLogic#trySearchNewRecipe()} */ protected void trySearchNewRecipeCombined() { @@ -232,7 +238,7 @@ protected void trySearchNewRecipeDistinct() { } } if (currentRecipe == null) { - //no valid recipe found, invalidate this bus + // no valid recipe found, invalidate this bus invalidatedInputList.add(bus); } } @@ -242,7 +248,8 @@ protected void trySearchNewRecipeDistinct() { public void invalidateInputs() { MultiblockWithDisplayBase controller = (MultiblockWithDisplayBase) metaTileEntity; RecipeMapMultiblockController distinctController = (RecipeMapMultiblockController) controller; - if (distinctController.canBeDistinct() && distinctController.isDistinct() && getInputInventory().getSlots() > 0) { + if (distinctController.canBeDistinct() && distinctController.isDistinct() && + getInputInventory().getSlots() > 0) { invalidatedInputList.add(currentDistinctInputBus); } else { super.invalidateInputs(); @@ -254,8 +261,8 @@ protected boolean checkPreviousRecipeDistinct(IItemHandlerModifiable previousBus } protected boolean prepareRecipeDistinct(Recipe recipe) { - - recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), metaTileEntity.getFluidOutputLimit()); + recipe = Recipe.trimRecipeOutputs(recipe, getRecipeMap(), metaTileEntity.getItemOutputLimit(), + metaTileEntity.getFluidOutputLimit()); recipe = findParallelRecipe( recipe, @@ -331,8 +338,10 @@ public long getMaximumOverclockVoltage() { @Nonnull protected Tuple getMaintenanceValues() { - MultiblockWithDisplayBase displayBase = this.metaTileEntity instanceof MultiblockWithDisplayBase ? (MultiblockWithDisplayBase) metaTileEntity : null; - int numMaintenanceProblems = displayBase == null || !displayBase.hasMaintenanceMechanics() || !ConfigHolder.machines.enableMaintenance ? 0 : displayBase.getNumMaintenanceProblems(); + MultiblockWithDisplayBase displayBase = this.metaTileEntity instanceof MultiblockWithDisplayBase ? + (MultiblockWithDisplayBase) metaTileEntity : null; + int numMaintenanceProblems = displayBase == null || !displayBase.hasMaintenanceMechanics() || + !ConfigHolder.machines.enableMaintenance ? 0 : displayBase.getNumMaintenanceProblems(); double durationMultiplier = 1.0D; if (displayBase != null && displayBase.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { durationMultiplier = displayBase.getMaintenanceDurationMultiplier(); diff --git a/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java b/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java index b6b785e58d8..2669fa35097 100644 --- a/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java +++ b/src/main/java/gregtech/api/capability/impl/NotifiableFluidTank.java @@ -2,6 +2,7 @@ import gregtech.api.capability.INotifiableHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraftforge.fluids.FluidTank; import java.util.ArrayList; diff --git a/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java b/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java index 847fc2a1847..472c29e033f 100644 --- a/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java +++ b/src/main/java/gregtech/api/capability/impl/NotifiableItemStackHandler.java @@ -3,17 +3,20 @@ import gregtech.api.capability.INotifiableHandler; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; + import net.minecraftforge.items.IItemHandlerModifiable; import java.util.ArrayList; import java.util.List; -public class NotifiableItemStackHandler extends GTItemStackHandler implements IItemHandlerModifiable, INotifiableHandler { +public class NotifiableItemStackHandler extends GTItemStackHandler + implements IItemHandlerModifiable, INotifiableHandler { List notifiableEntities = new ArrayList<>(); private final boolean isExport; - public NotifiableItemStackHandler(MetaTileEntity metaTileEntity, int slots, MetaTileEntity entityToNotify, boolean isExport) { + public NotifiableItemStackHandler(MetaTileEntity metaTileEntity, int slots, MetaTileEntity entityToNotify, + boolean isExport) { super(metaTileEntity, slots); if (entityToNotify != null) { this.notifiableEntities.add(entityToNotify); diff --git a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java index 683b51ffda9..72e7c8fd332 100644 --- a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java @@ -45,7 +45,8 @@ public long getMaxVoltage() { @Nonnull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int recipeDuration, int amountOC) { + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + long maxVoltage, int recipeDuration, int amountOC) { return standardOverclockingLogic( 1, getMaxVoltage(), diff --git a/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java b/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java index c0dcd53b46f..deb8e12d8d3 100644 --- a/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/PropertyFluidFilter.java @@ -4,6 +4,7 @@ import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.attribute.FluidAttributes; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java index c618fa377b0..f618b37e2be 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicEnergy.java @@ -10,7 +10,8 @@ public class RecipeLogicEnergy extends AbstractRecipeLogic { protected final Supplier energyContainer; - public RecipeLogicEnergy(MetaTileEntity tileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public RecipeLogicEnergy(MetaTileEntity tileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(tileEntity, recipeMap); this.energyContainer = energyContainer; setMaximumOverclockVoltage(getMaxVoltage()); diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java index c2944e24a0b..c32af96f849 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java @@ -10,6 +10,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; @@ -32,13 +33,14 @@ public class RecipeLogicSteam extends AbstractRecipeLogic implements IVentable { private final IFluidTank steamFluidTank; private final boolean isHighPressure; - private final double conversionRate; //energy units per millibucket + private final double conversionRate; // energy units per millibucket private boolean needsVenting; private boolean ventingStuck; private EnumFacing ventingSide; - public RecipeLogicSteam(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, IFluidTank steamFluidTank, double conversionRate) { + public RecipeLogicSteam(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, + IFluidTank steamFluidTank, double conversionRate) { super(tileEntity, recipeMap); this.steamFluidTank = steamFluidTank; this.conversionRate = conversionRate; @@ -139,7 +141,8 @@ public void tryDoVenting() { private void performVentingAnimation(BlockPos ventingBlockPos, BlockPos machinePos) { metaTileEntity.getWorld() - .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET) + .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), + EntitySelectors.CAN_AI_TARGET) .forEach(entity -> { entity.attackEntityFrom(DamageSources.getHeatDamage(), this.isHighPressure ? 12.0f : 6.0f); if (entity instanceof EntityPlayerMP) { @@ -156,11 +159,11 @@ private void performVentingAnimation(BlockPos ventingBlockPos, BlockPos machineP ventingSide.getXOffset() / 2.0, ventingSide.getYOffset() / 2.0, ventingSide.getZOffset() / 2.0, 0.1); - if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()){ - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()) { + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } setNeedsVenting(false); - } @Override @@ -188,8 +191,7 @@ protected void completeRecipe() { @Nonnull @Override protected int[] calculateOverclock(@Nonnull Recipe recipe) { - - //EUt, Duration + // EUt, Duration int[] result = new int[2]; result[0] = isHighPressure ? recipe.getEUt() * 2 : recipe.getEUt(); diff --git a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java index f1d3a4622f8..db4178ba433 100644 --- a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java @@ -1,6 +1,7 @@ package gregtech.api.capability.impl; import gregtech.api.capability.IFilter; + import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java index 6c4aa7a4d70..cb293fe9bbe 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java @@ -6,7 +6,6 @@ import javax.annotation.Nonnull; - /** * General Recipe Handler for Steam Multiblocks. * Will do up to the passed value of items in one process. diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java index 70cee480210..6cb6e3ed9ef 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java @@ -6,6 +6,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.BlockSnow; import net.minecraft.block.state.IBlockState; @@ -30,7 +31,8 @@ public class SteamMultiblockRecipeLogic extends AbstractRecipeLogic { // EU per mB private final double conversionRate; - public SteamMultiblockRecipeLogic(RecipeMapSteamMultiblockController tileEntity, RecipeMap recipeMap, IMultipleTankHandler steamFluidTank, double conversionRate) { + public SteamMultiblockRecipeLogic(RecipeMapSteamMultiblockController tileEntity, RecipeMap recipeMap, + IMultipleTankHandler steamFluidTank, double conversionRate) { super(tileEntity, recipeMap); this.steamFluidTank = steamFluidTank; this.conversionRate = conversionRate; @@ -73,7 +75,6 @@ private void combineSteamTanks() { @Override public void update() { - // Fixes an annoying GTCE bug in AbstractRecipeLogic RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity; if (isActive && !controller.isStructureFormed()) { @@ -121,7 +122,8 @@ public boolean isAllowOverclocking() { } @Override - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, + @Nonnull IItemHandlerModifiable importInventory) { RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity; if (controller.checkRecipe(recipe, false) && super.setupAndConsumeRecipeInputs(recipe, importInventory)) { @@ -143,8 +145,7 @@ private void ventSteam() { IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) { performVentingAnimation(machinePos, ventingSide); - } - else if(blockOnPos.getBlock() == Blocks.SNOW_LAYER && blockOnPos.getValue(BlockSnow.LAYERS) == 1) { + } else if (blockOnPos.getBlock() == Blocks.SNOW_LAYER && blockOnPos.getValue(BlockSnow.LAYERS) == 1) { performVentingAnimation(machinePos, ventingSide); metaTileEntity.getWorld().destroyBlock(ventingBlockPos, false); } @@ -161,8 +162,9 @@ private void performVentingAnimation(BlockPos machinePos, EnumFacing ventingSide ventingSide.getXOffset() / 2.0, ventingSide.getYOffset() / 2.0, ventingSide.getZOffset() / 2.0, 0.1); - if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()){ - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + if (ConfigHolder.machines.machineSounds && !metaTileEntity.isMuffled()) { + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } } } diff --git a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java index 2ded13ae1a4..98faab4159d 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java @@ -1,8 +1,5 @@ package gregtech.api.capability.impl.miner; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IMiner; import gregtech.api.metatileentity.MetaTileEntity; @@ -16,6 +13,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -30,15 +28,20 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.StringUtils; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import javax.annotation.Nonnull; + public class MinerLogic { private static final short MAX_SPEED = Short.MAX_VALUE; @@ -85,7 +88,8 @@ public class MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public MinerLogic(@Nonnull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, ICubeRenderer pipeTexture) { + public MinerLogic(@Nonnull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + ICubeRenderer pipeTexture) { this.metaTileEntity = metaTileEntity; this.miner = (IMiner) metaTileEntity; this.fortune = fortune; @@ -112,7 +116,8 @@ private static IBlockState findMiningReplacementBlock() { // check for meta if (blockDescription.length > 2 && !blockDescription[2].isEmpty()) { - return replacementBlock.getDefaultState().getBlock().getStateFromMeta(Integer.parseInt(blockDescription[2])); + return replacementBlock.getDefaultState().getBlock() + .getStateFromMeta(Integer.parseInt(blockDescription[2])); } return replacementBlock.getDefaultState(); @@ -153,7 +158,8 @@ public void performMining() { // drill a hole beneath the miner and extend the pipe downwards by one WorldServer world = (WorldServer) metaTileEntity.getWorld(); if (mineY.get() < pipeY.get()) { - world.destroyBlock(new BlockPos(metaTileEntity.getPos().getX(), pipeY.get(), metaTileEntity.getPos().getZ()), false); + world.destroyBlock( + new BlockPos(metaTileEntity.getPos().getX(), pipeY.get(), metaTileEntity.getPos().getZ()), false); pipeY.decrementAndGet(); incrementPipeLength(); } @@ -223,9 +229,7 @@ protected boolean checkShouldStop() { /** * Called after each block is mined, used to perform additional actions afterwards */ - protected void onMineOperation() { - - } + protected void onMineOperation() {} /** * called in order to drain anything the miner needs to drain in order to run @@ -243,13 +247,15 @@ protected boolean drainStorages(boolean simulate) { * @param blockToMine the {@link BlockPos} of the block being mined * @param blockState the {@link IBlockState} of the block being mined */ - protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, IBlockState blockState) { - /*small ores - if orePrefix of block in blockPos is small - applyTieredHammerNoRandomDrops... - else - current code... - */ + protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + IBlockState blockState) { + /* + * small ores + * if orePrefix of block in blockPos is small + * applyTieredHammerNoRandomDrops... + * else + * current code... + */ } /** @@ -260,8 +266,10 @@ protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldSer * @param blockToMine the {@link BlockPos} of the block being mined * @param blockState the {@link IBlockState} of the block being mined */ - protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, @Nonnull IBlockState blockState) { - blockState.getBlock().getDrops(blockDrops, world, blockToMine, blockState, 0); // regular ores do not get fortune applied + protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + @Nonnull IBlockState blockState) { + blockState.getBlock().getDrops(blockDrops, world, blockToMine, blockState, 0); // regular ores do not get + // fortune applied } /** @@ -320,7 +328,8 @@ public void initPos(@Nonnull BlockPos pos, int currentRadius) { * @param z the z coordinate * @return {@code true} if the coordinates are invalid, else false */ - private static boolean checkCoordinatesInvalid(@Nonnull AtomicInteger x, @Nonnull AtomicInteger y, @Nonnull AtomicInteger z) { + private static boolean checkCoordinatesInvalid(@Nonnull AtomicInteger x, @Nonnull AtomicInteger y, + @Nonnull AtomicInteger z) { return x.get() == Integer.MAX_VALUE && y.get() == Integer.MAX_VALUE && z.get() == Integer.MAX_VALUE; } @@ -367,7 +376,9 @@ private LinkedList getBlocksToMine() { if (x.get() <= startX.get() + currentRadius * 2) { BlockPos blockPos = new BlockPos(x.get(), y.get(), z.get()); IBlockState state = metaTileEntity.getWorld().getBlockState(blockPos); - if (state.getBlock().blockHardness >= 0 && metaTileEntity.getWorld().getTileEntity(blockPos) == null && GTUtility.isOre(GTUtility.toItem(state))) { + if (state.getBlock().blockHardness >= 0 && + metaTileEntity.getWorld().getTileEntity(blockPos) == null && + GTUtility.isOre(GTUtility.toItem(state))) { blocks.addLast(blockPos); } // move to the next x position @@ -433,12 +444,14 @@ private static double getQuotient(double base) { * @param map the recipemap from which to get the drops * @param tier the tier at which the operation is performed, used for calculating the chanced output boost */ - protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, int fortuneLevel, @Nonnull RecipeMap map, int tier) { + protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, + int fortuneLevel, @Nonnull RecipeMap map, int tier) { ItemStack itemStack = GTUtility.toItem(blockState); Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList()); if (recipe != null && !recipe.getOutputs().isEmpty()) { drops.clear(); - for (ItemStack outputStack : recipe.getResultItemOutputs(GTUtility.getTierByVoltage(recipe.getEUt()), tier, map)) { + for (ItemStack outputStack : recipe.getResultItemOutputs(GTUtility.getTierByVoltage(recipe.getEUt()), tier, + map)) { outputStack = outputStack.copy(); if (OreDictUnifier.getPrefix(outputStack) == OrePrefix.crushed) { if (fortuneLevel > 0) { @@ -511,7 +524,8 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { /** * reads all needed values from NBT - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} method + * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} + * method */ public void readFromNBT(@Nonnull NBTTagCompound data) { x.set(data.getInteger("xPos")); @@ -534,7 +548,8 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { /** * writes all needed values to InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { buf.writeInt(pipeLength); @@ -545,7 +560,8 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from InitialSyncData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { this.pipeLength = buf.readInt(); @@ -556,7 +572,8 @@ public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { /** * reads all needed values from CustomData - * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method + * This MUST be called and returned in the MetaTileEntity's + * {@link MetaTileEntity#receiveCustomData(int, PacketBuffer)} method */ public void receiveCustomData(int dataId, PacketBuffer buf) { if (dataId == GregtechDataCodes.PUMP_HEAD_LEVEL) { @@ -684,7 +701,8 @@ public void setActive(boolean isActive) { this.isActive = isActive; this.metaTileEntity.markDirty(); if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKABLE_ACTIVE, buf -> buf.writeBoolean(isActive)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKABLE_ACTIVE, + buf -> buf.writeBoolean(isActive)); } } } @@ -699,7 +717,8 @@ public void setWorkingEnabled(boolean isWorkingEnabled) { if (metaTileEntity.getWorld() != null && !metaTileEntity.getWorld().isRemote) { if (!isWorkingEnabled) resetArea(); - this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, buf -> buf.writeBoolean(isWorkingEnabled)); + this.metaTileEntity.writeCustomData(GregtechDataCodes.WORKING_ENABLED, + buf -> buf.writeBoolean(isWorkingEnabled)); } } } diff --git a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java index 5b30ee22606..99faf2b318f 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java @@ -4,6 +4,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -38,7 +39,8 @@ public class MultiblockMinerLogic extends MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public MultiblockMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, RecipeMap blockDropRecipeMap) { + public MultiblockMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + RecipeMap blockDropRecipeMap) { super(metaTileEntity, fortune, speed, maximumRadius, null); this.blockDropRecipeMap = blockDropRecipeMap; } @@ -49,13 +51,16 @@ protected boolean drainStorages(boolean simulate) { } @Override - protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, IBlockState blockState) { - // Small ores: use (fortune bonus + overclockAmount) value here for fortune, since every overclock increases the yield for small ores + protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + IBlockState blockState) { + // Small ores: use (fortune bonus + overclockAmount) value here for fortune, since every overclock increases the + // yield for small ores super.getSmallOreBlockDrops(blockDrops, world, blockToMine, blockState); } @Override - protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, @Nonnull IBlockState blockState) { + protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, + @Nonnull IBlockState blockState) { if (!isSilkTouchMode) // 3X the ore compared to the single blocks applyTieredHammerNoRandomDrops(blockState, blockDrops, 3, this.blockDropRecipeMap, this.voltageTier); else @@ -69,7 +74,8 @@ public void initPos(@Nonnull BlockPos pos, int currentRadius) { } else { WorldServer world = (WorldServer) this.metaTileEntity.getWorld(); Chunk origin = world.getChunk(this.metaTileEntity.getPos()); - ChunkPos startPos = (world.getChunk(origin.x - currentRadius / CHUNK_LENGTH, origin.z - currentRadius / CHUNK_LENGTH)).getPos(); + ChunkPos startPos = (world.getChunk(origin.x - currentRadius / CHUNK_LENGTH, + origin.z - currentRadius / CHUNK_LENGTH)).getPos(); getX().set(startPos.getXStart()); getY().set(this.metaTileEntity.getPos().getY() - 1); getZ().set(startPos.getZStart()); diff --git a/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java index 7557f1fbf63..3d20620db2a 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java @@ -14,7 +14,8 @@ public class SteamMinerLogic extends MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public SteamMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, ICubeRenderer pipeTexture) { + public SteamMinerLogic(MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + ICubeRenderer pipeTexture) { super(metaTileEntity, fortune, speed, maximumRadius, pipeTexture); } diff --git a/src/main/java/gregtech/api/cover/Cover.java b/src/main/java/gregtech/api/cover/Cover.java index b6f9c4c0a7a..a5fc207812e 100644 --- a/src/main/java/gregtech/api/cover/Cover.java +++ b/src/main/java/gregtech/api/cover/Cover.java @@ -1,11 +1,7 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -17,6 +13,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -31,9 +33,11 @@ public interface Cover { /** * @return the CoverableView containing this cover */ - @NotNull CoverableView getCoverableView(); + @NotNull + CoverableView getCoverableView(); - @NotNull CoverDefinition getDefinition(); + @NotNull + CoverDefinition getDefinition(); /** * @return the World containing this cover @@ -97,14 +101,15 @@ default long getOffsetTimer() { default void update() {} default boolean isTickable() { - //noinspection InstanceofThis + // noinspection InstanceofThis return this instanceof ITickable; } /** * @return the side the cover is attached to */ - @NotNull EnumFacing getAttachedSide(); + @NotNull + EnumFacing getAttachedSide(); /** * @param coverable the CoverableView to attach to @@ -122,7 +127,8 @@ default boolean isTickable() { * @param player the player attaching the cover * @param itemStack the item used to place the cover */ - default void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) {} + default void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) {} /** * Called when the cover is removed @@ -165,7 +171,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -175,7 +182,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -185,7 +193,8 @@ default boolean onLeftClick(@NotNull EntityPlayer player, @NotNull CuboidRayTrac * @param hitResult the HitResult of the click * @return the action's result */ - default @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + default @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.PASS; } @@ -229,7 +238,8 @@ default int getRedstoneSignalOutput() { * It will be automatically translated to prevent Z-fighting with machine faces */ @SideOnly(Side.CLIENT) - void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, + void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer); @SideOnly(Side.CLIENT) @@ -238,7 +248,8 @@ default boolean canRenderInLayer(@NotNull BlockRenderLayer renderLayer) { } @SideOnly(Side.CLIENT) - void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, + void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer); default boolean canRenderBackside() { diff --git a/src/main/java/gregtech/api/cover/CoverBase.java b/src/main/java/gregtech/api/cover/CoverBase.java index a493cedd0b2..49a3429f842 100644 --- a/src/main/java/gregtech/api/cover/CoverBase.java +++ b/src/main/java/gregtech/api/cover/CoverBase.java @@ -1,13 +1,10 @@ package gregtech.api.cover; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public abstract class CoverBase implements Cover { @@ -62,13 +64,15 @@ protected void dropInventoryContents(@NotNull IItemHandlerModifiable inventory) @SideOnly(Side.CLIENT) @Override - public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull IVertexOperation[] pipeline, - @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull IVertexOperation[] pipeline, + @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { TextureAtlasSprite casingSide = getPlateSprite(); for (EnumFacing coverPlateSide : EnumFacing.VALUES) { boolean isAttachedSide = getAttachedSide().getAxis() == coverPlateSide.getAxis(); if (isAttachedSide || !getCoverableView().hasCover(coverPlateSide)) { - Textures.renderFace(renderState, translation, pipeline, coverPlateSide, plateBox, casingSide, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, coverPlateSide, plateBox, casingSide, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/api/cover/CoverDefinition.java b/src/main/java/gregtech/api/cover/CoverDefinition.java index 4ac8c983c50..51d5ed655f8 100644 --- a/src/main/java/gregtech/api/cover/CoverDefinition.java +++ b/src/main/java/gregtech/api/cover/CoverDefinition.java @@ -1,9 +1,11 @@ package gregtech.api.cover; import gregtech.api.GregTechAPI; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -61,7 +63,8 @@ public static int getNetworkIdForCover(@NotNull CoverDefinition definition) { @FunctionalInterface public interface CoverCreator { - @NotNull Cover create(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, - @NotNull EnumFacing attachedSide); + @NotNull + Cover create(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide); } } diff --git a/src/main/java/gregtech/api/cover/CoverHolder.java b/src/main/java/gregtech/api/cover/CoverHolder.java index e1fee34ec24..06ab0791ce7 100644 --- a/src/main/java/gregtech/api/cover/CoverHolder.java +++ b/src/main/java/gregtech/api/cover/CoverHolder.java @@ -1,12 +1,8 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.*; import gregtech.api.util.GTUtility; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -15,6 +11,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -95,6 +97,7 @@ default void updateCovers() { * Also used to check whether cover placement is possible on a side, because a cover cannot be placed if the * collision boxes of the Holder and its plate overlap. * If zero, it is expected that machine is full block and plate doesn't need to be rendered. + * * @return the cover plate thickness. */ double getCoverPlateThickness(); @@ -111,11 +114,13 @@ default void updateCovers() { int getPaintingColorForRendering(); @SideOnly(Side.CLIENT) - default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, @NotNull BlockRenderLayer layer) { + default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + @NotNull BlockRenderLayer layer) { renderState.lightMatrix.locate(getWorld(), getPos()); double coverPlateThickness = getCoverPlateThickness(); - IVertexOperation[] platePipeline = {renderState.lightMatrix, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))}; - IVertexOperation[] coverPipeline = {renderState.lightMatrix}; + IVertexOperation[] platePipeline = { renderState.lightMatrix, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())) }; + IVertexOperation[] coverPipeline = { renderState.lightMatrix }; for (EnumFacing sideFacing : EnumFacing.values()) { Cover cover = getCoverAtSide(sideFacing); @@ -128,17 +133,22 @@ default void renderCovers(@NotNull CCRenderState renderState, @NotNull Matrix4 t } if (cover.canRenderInLayer(layer)) { - cover.renderCover(renderState, RenderUtil.adjustTrans(translation, sideFacing, 2), coverPipeline, plateBox, layer); + cover.renderCover(renderState, RenderUtil.adjustTrans(translation, sideFacing, 2), coverPipeline, + plateBox, layer); if (coverPlateThickness == 0.0 && shouldRenderCoverBackSides() && cover.canRenderBackside()) { - //machine is full block, but still not opaque - render cover on the back side too + // machine is full block, but still not opaque - render cover on the back side too Matrix4 backTranslation = translation.copy(); if (sideFacing.getAxis().isVertical()) { REVERSE_VERTICAL_ROTATION.apply(backTranslation); } else { REVERSE_HORIZONTAL_ROTATION.apply(backTranslation); } - backTranslation.translate(-sideFacing.getXOffset(), -sideFacing.getYOffset(), -sideFacing.getZOffset()); - cover.renderCover(renderState, backTranslation, coverPipeline, plateBox, layer); // may need to translate the layer here as well + backTranslation.translate(-sideFacing.getXOffset(), -sideFacing.getYOffset(), + -sideFacing.getZOffset()); + cover.renderCover(renderState, backTranslation, coverPipeline, plateBox, layer); // may need to + // translate the + // layer here as + // well } } } diff --git a/src/main/java/gregtech/api/cover/CoverRayTracer.java b/src/main/java/gregtech/api/cover/CoverRayTracer.java index bc5f0623701..e44588d4dc3 100644 --- a/src/main/java/gregtech/api/cover/CoverRayTracer.java +++ b/src/main/java/gregtech/api/cover/CoverRayTracer.java @@ -1,12 +1,14 @@ package gregtech.api.cover; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.util.GTUtility; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.RayTraceResult; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.RayTracer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,12 +16,13 @@ public final class CoverRayTracer { private CoverRayTracer() {} - public static @Nullable EnumFacing rayTraceCoverableSide(@NotNull CoverableView coverableView, @NotNull EntityPlayer player) { - + public static @Nullable EnumFacing rayTraceCoverableSide(@NotNull CoverableView coverableView, + @NotNull EntityPlayer player) { // if the coverable view is from a blockpipe, use the proper raytrace method - RayTraceResult result = coverableView.getWorld().getBlockState(coverableView.getPos()).getBlock() instanceof BlockPipe pipe ? - pipe.getServerCollisionRayTrace(player, coverableView.getPos(), coverableView.getWorld()) : - RayTracer.retraceBlock(coverableView.getWorld(), player, coverableView.getPos()); + RayTraceResult result = coverableView.getWorld().getBlockState(coverableView.getPos()) + .getBlock() instanceof BlockPipepipe ? + pipe.getServerCollisionRayTrace(player, coverableView.getPos(), coverableView.getWorld()) : + RayTracer.retraceBlock(coverableView.getWorld(), player, coverableView.getPos()); if (result == null || result.typeOfHit != RayTraceResult.Type.BLOCK) { return null; } @@ -37,9 +40,9 @@ private CoverRayTracer() {} return pipeConnectionData.side; } else if (rayTraceResult.cuboid6.data instanceof PrimaryBoxData primaryBoxData) { return primaryBoxData.usePlacementGrid ? determineGridSideHit(result) : result.sideHit; - } //unknown hit type, fall through + } // unknown hit type, fall through } - //normal collision ray trace, return side hit + // normal collision ray trace, return side hit return determineGridSideHit(result); } @@ -47,8 +50,7 @@ private CoverRayTracer() {} return GTUtility.determineWrenchingSide(result.sideHit, (float) (result.hitVec.x - result.getBlockPos().getX()), (float) (result.hitVec.y - result.getBlockPos().getY()), - (float) (result.hitVec.z - result.getBlockPos().getZ()) - ); + (float) (result.hitVec.z - result.getBlockPos().getZ())); } public static class PrimaryBoxData { diff --git a/src/main/java/gregtech/api/cover/CoverSaveHandler.java b/src/main/java/gregtech/api/cover/CoverSaveHandler.java index 5b956024261..fe62aa782a9 100644 --- a/src/main/java/gregtech/api/cover/CoverSaveHandler.java +++ b/src/main/java/gregtech/api/cover/CoverSaveHandler.java @@ -1,12 +1,14 @@ package gregtech.api.cover; import gregtech.api.util.GTLog; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.Constants; + import org.jetbrains.annotations.NotNull; import java.util.function.BiConsumer; @@ -59,7 +61,8 @@ public static void receiveInitialSyncData(@NotNull PacketBuffer buf, @NotNull Co CoverDefinition definition = CoverDefinition.getCoverByNetworkId(id); if (definition == null) { - GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, coverHolder.getPos()); + GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, + coverHolder.getPos()); } else { Cover cover = definition.createCover(coverHolder, facing); cover.readInitialSyncData(buf); @@ -92,12 +95,13 @@ public static void writeCoverPlacement(@NotNull CoverHolder coverHolder, int dis * @param coverHolder the CoverHolder the cover is placed on */ public static void readCoverPlacement(@NotNull PacketBuffer buf, @NotNull CoverHolder coverHolder) { - //cover placement event + // cover placement event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; int id = buf.readVarInt(); CoverDefinition coverDefinition = CoverDefinition.getCoverByNetworkId(id); if (coverDefinition == null) { - GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, coverHolder.getPos()); + GTLog.logger.warn("Unable to find CoverDefinition for Network ID {} at position {}", id, + coverHolder.getPos()); } else { Cover cover = coverDefinition.createCover(coverHolder, placementSide); coverHolder.addCover(placementSide, cover); diff --git a/src/main/java/gregtech/api/cover/CoverUIFactory.java b/src/main/java/gregtech/api/cover/CoverUIFactory.java index c937bcadeb1..a21cd057d44 100644 --- a/src/main/java/gregtech/api/cover/CoverUIFactory.java +++ b/src/main/java/gregtech/api/cover/CoverUIFactory.java @@ -5,6 +5,7 @@ import gregtech.api.gui.ModularUI; import gregtech.api.gui.UIFactory; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; @@ -16,8 +17,7 @@ public final class CoverUIFactory extends UIFactory { public static final CoverUIFactory INSTANCE = new CoverUIFactory(); - private CoverUIFactory() { - } + private CoverUIFactory() {} public void init() { GregTechAPI.UI_FACTORY_REGISTRY.register(2, GTUtility.gregtechId("cover_behavior_factory"), this); @@ -33,7 +33,8 @@ protected CoverWithUI readHolderFromSyncData(PacketBuffer syncData) { BlockPos blockPos = syncData.readBlockPos(); EnumFacing attachedSide = EnumFacing.VALUES[syncData.readByte()]; TileEntity tileEntity = Minecraft.getMinecraft().world.getTileEntity(blockPos); - CoverableView coverable = tileEntity == null ? null : tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, attachedSide); + CoverableView coverable = tileEntity == null ? null : + tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, attachedSide); if (coverable != null) { Cover cover = coverable.getCoverAtSide(attachedSide); if (cover instanceof CoverWithUI coverWithUI) { diff --git a/src/main/java/gregtech/api/cover/CoverUtil.java b/src/main/java/gregtech/api/cover/CoverUtil.java index 2e78461090b..cd18b64b5a9 100644 --- a/src/main/java/gregtech/api/cover/CoverUtil.java +++ b/src/main/java/gregtech/api/cover/CoverUtil.java @@ -1,8 +1,9 @@ package gregtech.api.cover; +import net.minecraft.util.EnumFacing; + import codechicken.lib.raytracer.IndexedCuboid6; import codechicken.lib.vec.Cuboid6; -import net.minecraft.util.EnumFacing; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/gregtech/api/cover/CoverWithUI.java b/src/main/java/gregtech/api/cover/CoverWithUI.java index ad1dfe41d7b..eb7dfcad582 100644 --- a/src/main/java/gregtech/api/cover/CoverWithUI.java +++ b/src/main/java/gregtech/api/cover/CoverWithUI.java @@ -2,6 +2,7 @@ import gregtech.api.gui.IUIHolder; import gregtech.api.gui.ModularUI; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; diff --git a/src/main/java/gregtech/api/cover/CoverableView.java b/src/main/java/gregtech/api/cover/CoverableView.java index 9f19aaa853c..0b7d6f33c68 100644 --- a/src/main/java/gregtech/api/cover/CoverableView.java +++ b/src/main/java/gregtech/api/cover/CoverableView.java @@ -6,6 +6,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -17,18 +18,21 @@ public interface CoverableView extends ICapabilityProvider { /** * @return the world containing the CoverableView */ - @UnknownNullability World getWorld(); + @UnknownNullability + World getWorld(); /** * @return the pos of the block containing the CoverableView */ - @UnknownNullability BlockPos getPos(); + @UnknownNullability + BlockPos getPos(); /** * @param facing the side to get the neighbor at * @return the neighbor tile entity at the side */ - @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing); + @Nullable + TileEntity getNeighbor(@NotNull EnumFacing facing); /** * Mark the CoverableView as needing to be saved to the chunk @@ -59,7 +63,8 @@ public interface CoverableView extends ICapabilityProvider { * @param side the side to retrieve a cover from * @return the cover at the side */ - @Nullable Cover getCoverAtSide(@NotNull EnumFacing side); + @Nullable + Cover getCoverAtSide(@NotNull EnumFacing side); /** * @param side the side to check @@ -75,7 +80,7 @@ default boolean hasCover(@NotNull EnumFacing side) { boolean hasAnyCover(); /** - * @param side the side to get the redstone from + * @param side the side to get the redstone from * @param ignoreCover if the cover is being ignored * @return the redstone signal being input at the side */ diff --git a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java index 005f1a9d2b3..d0d046d8924 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java +++ b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java @@ -21,7 +21,8 @@ public DamageSourceTool(String type, EntityLivingBase player, String deathMessag @Override @SuppressWarnings("deprecation") public ITextComponent getDeathMessage(@Nonnull EntityLivingBase target) { - if (deathMessage == null || damageSourceEntity == null || !I18n.canTranslate(deathMessage)) return super.getDeathMessage(target); + if (deathMessage == null || damageSourceEntity == null || !I18n.canTranslate(deathMessage)) + return super.getDeathMessage(target); return new TextComponentTranslation(deathMessage, target.getDisplayName(), damageSourceEntity.getDisplayName()); } } diff --git a/src/main/java/gregtech/api/damagesources/DamageSources.java b/src/main/java/gregtech/api/damagesources/DamageSources.java index 98efc8cd049..c4ad36b5127 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSources.java +++ b/src/main/java/gregtech/api/damagesources/DamageSources.java @@ -1,6 +1,7 @@ package gregtech.api.damagesources; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; diff --git a/src/main/java/gregtech/api/event/MaterialInfoEvent.java b/src/main/java/gregtech/api/event/MaterialInfoEvent.java index f495de9acfa..868d339b18c 100644 --- a/src/main/java/gregtech/api/event/MaterialInfoEvent.java +++ b/src/main/java/gregtech/api/event/MaterialInfoEvent.java @@ -5,5 +5,4 @@ /** * Fired right before processing handlers for autogenerated recipes are run for items with MaterialInfo. */ -public final class MaterialInfoEvent extends Event { -} +public final class MaterialInfoEvent extends Event {} diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index b7cccf6dbee..31eb9e358fe 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -1,6 +1,5 @@ package gregtech.api.fluids; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.store.FluidStorageKey; @@ -11,11 +10,14 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; -import io.github.drmanganese.topaddons.reference.Colors; + import net.minecraft.block.material.MaterialLiquid; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.Loader; + +import com.google.common.base.Preconditions; +import io.github.drmanganese.topaddons.reference.Colors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -137,6 +139,7 @@ public FluidBuilder() {} /** * Converts a density value in g/cm^3 to an MC fluid density by comparison to air's density. + * * @param density the density to convert * @return the MC integer density */ @@ -180,6 +183,7 @@ private static int convertToMCDensity(double density) { /** * Converts viscosity in Poise to MC viscosity + * * @param viscosity the viscosity to convert * @return the converted value */ @@ -200,13 +204,14 @@ private static int convertViscosity(double viscosity) { * @param attributes the attributes to add * @return this */ - public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull ... attributes) { + public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull... attributes) { Collections.addAll(this.attributes, attributes); return this; } /** * Mark this fluid as having a custom still texture + * * @return this */ public @NotNull FluidBuilder customStill() { @@ -217,6 +222,7 @@ private static int convertViscosity(double viscosity) { /** * Mark this fluid as having a custom flowing texture + * * @return this */ public @NotNull FluidBuilder customFlow() { @@ -226,7 +232,7 @@ private static int convertViscosity(double viscosity) { } /** - * @param hasCustomStill if the fluid has a custom still texture + * @param hasCustomStill if the fluid has a custom still texture * @param hasCustomFlowing if the fluid has a custom flowing texture * @return this */ @@ -310,7 +316,8 @@ private static int convertViscosity(double viscosity) { MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), false); block = new GTFluidBlock(fluid, materialLiquid, false, false, false); } else { - MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), material.hasFlag(MaterialFlags.STICKY)); + MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), + material.hasFlag(MaterialFlags.STICKY)); block = new GTFluidBlock(fluid, materialLiquid, material); } block.setRegistryName(modid, "fluid." + name); diff --git a/src/main/java/gregtech/api/fluids/FluidState.java b/src/main/java/gregtech/api/fluids/FluidState.java index a8b5fb7055b..02cad14303c 100644 --- a/src/main/java/gregtech/api/fluids/FluidState.java +++ b/src/main/java/gregtech/api/fluids/FluidState.java @@ -3,6 +3,7 @@ import org.jetbrains.annotations.NotNull; public enum FluidState { + LIQUID("gregtech.fluid.state_liquid"), GAS("gregtech.fluid.state_gas"), PLASMA("gregtech.fluid.state_plasma"); diff --git a/src/main/java/gregtech/api/fluids/GTFluid.java b/src/main/java/gregtech/api/fluids/GTFluid.java index 193623efa11..5b808f034f8 100644 --- a/src/main/java/gregtech/api/fluids/GTFluid.java +++ b/src/main/java/gregtech/api/fluids/GTFluid.java @@ -3,7 +3,7 @@ import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.unification.material.Material; -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentTranslation; @@ -11,6 +11,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -22,7 +24,8 @@ public class GTFluid extends Fluid implements AttributedFluid { private final Collection attributes = new ObjectLinkedOpenHashSet<>(); private final FluidState state; - public GTFluid(@NotNull String fluidName, ResourceLocation still, ResourceLocation flowing, @NotNull FluidState state) { + public GTFluid(@NotNull String fluidName, ResourceLocation still, ResourceLocation flowing, + @NotNull FluidState state) { super(fluidName, still, flowing); setGaseous(state != FluidState.LIQUID); this.state = state; @@ -43,7 +46,6 @@ public void addAttribute(@NotNull FluidAttribute attribute) { attributes.add(attribute); } - public static class GTMaterialFluid extends GTFluid { private final Material material; diff --git a/src/main/java/gregtech/api/fluids/GTFluidBlock.java b/src/main/java/gregtech/api/fluids/GTFluidBlock.java index d1cc60045f1..73089981f2e 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidBlock.java +++ b/src/main/java/gregtech/api/fluids/GTFluidBlock.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialFlags; + import net.minecraft.block.Block; import net.minecraft.block.BlockFire; import net.minecraft.block.material.MaterialLiquid; @@ -16,6 +17,7 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,7 +67,10 @@ public boolean isSticky() { @Nullable @Override - public Boolean isEntityInsideMaterial(@NotNull IBlockAccess world, @NotNull BlockPos blockpos, @NotNull IBlockState iblockstate, @NotNull Entity entity, double yToTest, @NotNull net.minecraft.block.material.Material materialIn, boolean testingHead) { + public Boolean isEntityInsideMaterial(@NotNull IBlockAccess world, @NotNull BlockPos blockpos, + @NotNull IBlockState iblockstate, @NotNull Entity entity, double yToTest, + @NotNull net.minecraft.block.material.Material materialIn, + boolean testingHead) { return materialIn == net.minecraft.block.material.Material.WATER ? true : null; } @@ -85,16 +90,19 @@ public int getFlammability(@NotNull IBlockAccess world, @NotNull BlockPos pos, @ } @Override - public void neighborChanged(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, @NotNull Block neighborBlock, @NotNull BlockPos neighbourPos) { + public void neighborChanged(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, + @NotNull Block neighborBlock, @NotNull BlockPos neighbourPos) { super.neighborChanged(state, world, pos, neighborBlock, neighbourPos); - if (this.isExplosive && this.isFlammable && neighborBlock instanceof BlockFire && GTValues.RNG.nextInt(5) == 0) { + if (this.isExplosive && this.isFlammable && neighborBlock instanceof BlockFire && + GTValues.RNG.nextInt(5) == 0) { world.setBlockToAir(pos); world.createExplosion(null, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, 1.5F, true); } } @Override - public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, @NotNull Entity entityIn) { + public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull Entity entityIn) { if (this.isSticky) { if (entityIn instanceof EntityPlayer && ((EntityPlayer) entityIn).isCreative()) { return; diff --git a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java index 9145279fef1..dcfb0bc7d4a 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java +++ b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java @@ -1,18 +1,20 @@ package gregtech.api.fluids; -import com.google.common.collect.BiMap; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.FluidProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; + +import com.google.common.collect.BiMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,7 +43,7 @@ private static void fixFluidRegistryName(@NotNull Fluid fluid, @NotNull String m try { Field field = FluidRegistry.class.getDeclaredField("masterFluidReference"); field.setAccessible(true); - //noinspection unchecked + // noinspection unchecked MASTER_FLUID_REFERENCE = (BiMap) field.get(null); } catch (NoSuchFieldException | IllegalAccessException e) { throw new IllegalStateException("Could not reflect the Forge Master Fluid Registry", e); diff --git a/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java b/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java index dd679dbd5f5..d35a99be991 100644 --- a/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java +++ b/src/main/java/gregtech/api/fluids/attribute/AttributedFluid.java @@ -1,6 +1,7 @@ package gregtech.api.fluids.attribute; import gregtech.api.fluids.FluidState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Unmodifiable; @@ -11,12 +12,15 @@ public interface AttributedFluid { /** * @return the attributes on the fluid */ - @NotNull @Unmodifiable Collection getAttributes(); + @NotNull + @Unmodifiable + Collection getAttributes(); /** * @param attribute the attribute to add */ void addAttribute(@NotNull FluidAttribute attribute); - @NotNull FluidState getState(); + @NotNull + FluidState getState(); } diff --git a/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java b/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java index 3842bd55160..ad99e07821b 100644 --- a/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java +++ b/src/main/java/gregtech/api/fluids/attribute/FluidAttribute.java @@ -1,6 +1,7 @@ package gregtech.api.fluids.attribute; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -13,7 +14,8 @@ public final class FluidAttribute { private final Consumer> containerTooltip; private final int hashCode; - public FluidAttribute(@NotNull ResourceLocation resourceLocation, @NotNull Consumer> fluidTooltip, + public FluidAttribute(@NotNull ResourceLocation resourceLocation, + @NotNull Consumer> fluidTooltip, @NotNull Consumer> containerTooltip) { this.resourceLocation = resourceLocation; this.fluidTooltip = fluidTooltip; diff --git a/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java b/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java index ba051d27798..b683d21c4fc 100644 --- a/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java +++ b/src/main/java/gregtech/api/fluids/attribute/FluidAttributes.java @@ -11,8 +11,7 @@ public final class FluidAttributes { */ public static final FluidAttribute ACID = new FluidAttribute(gregtechId("acid"), list -> list.add(I18n.format("gregtech.fluid.type_acid.tooltip")), - list -> list.add(I18n.format("gregtech.fluid_pipe.acid_proof")) - ); + list -> list.add(I18n.format("gregtech.fluid_pipe.acid_proof"))); private FluidAttributes() {} } diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorage.java b/src/main/java/gregtech/api/fluids/store/FluidStorage.java index 2188697bd90..ea21d756480 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorage.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorage.java @@ -3,8 +3,10 @@ import gregtech.api.fluids.FluidBuilder; import gregtech.api.unification.material.Material; import gregtech.api.util.GTLog; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraftforge.fluids.Fluid; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,7 +25,7 @@ public FluidStorage() {} /** * Enqueue a fluid for registration * - * @param key the key corresponding with the fluid + * @param key the key corresponding with the fluid * @param builder the FluidBuilder to build */ public void enqueueRegistration(@NotNull FluidStorageKey key, @NotNull FluidBuilder builder) { @@ -80,7 +82,7 @@ public void registerFluids(@NotNull Material material) { /** * Will do nothing if an existing fluid association would be overwritten. * - * @param key the key to associate with the fluid + * @param key the key to associate with the fluid * @param fluid the fluid to associate with the key * @return if the associations were successfully updated */ @@ -95,7 +97,7 @@ public boolean storeNoOverwrites(@NotNull FluidStorageKey key, @NotNull Fluid fl /** * Will overwrite existing fluid associations. * - * @param key the key to associate with the fluid + * @param key the key to associate with the fluid * @param fluid the fluid to associate with the key */ public void store(@NotNull FluidStorageKey key, @NotNull Fluid fluid) { diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java index 79090fc1d8e..dae9a0c02e6 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java @@ -2,8 +2,10 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialIconType; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.util.ResourceLocation; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/gui/BlankUIHolder.java b/src/main/java/gregtech/api/gui/BlankUIHolder.java index 66efbb74208..5eb4bcff7e5 100644 --- a/src/main/java/gregtech/api/gui/BlankUIHolder.java +++ b/src/main/java/gregtech/api/gui/BlankUIHolder.java @@ -13,6 +13,5 @@ public boolean isRemote() { } @Override - public void markAsDirty() { - } -} \ No newline at end of file + public void markAsDirty() {} +} diff --git a/src/main/java/gregtech/api/gui/GuiTextures.java b/src/main/java/gregtech/api/gui/GuiTextures.java index e0b11726854..20936a052b2 100644 --- a/src/main/java/gregtech/api/gui/GuiTextures.java +++ b/src/main/java/gregtech/api/gui/GuiTextures.java @@ -7,264 +7,449 @@ public class GuiTextures { - //GREGTECH + // GREGTECH public static final TextureArea GREGTECH_LOGO = TextureArea.fullImage("textures/gui/icon/gregtech_logo.png"); - public static final TextureArea GREGTECH_LOGO_XMAS = TextureArea.fullImage("textures/gui/icon/gregtech_logo_xmas.png"); - public static final TextureArea GREGTECH_LOGO_DARK = TextureArea.fullImage("textures/gui/icon/gregtech_logo_dark.png"); - public static final TextureArea GREGTECH_LOGO_BLINKING_YELLOW = TextureArea.fullImage("textures/gui/icon/gregtech_logo_blinking_yellow.png"); - public static final TextureArea GREGTECH_LOGO_BLINKING_RED = TextureArea.fullImage("textures/gui/icon/gregtech_logo_blinking_red.png"); + public static final TextureArea GREGTECH_LOGO_XMAS = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_xmas.png"); + public static final TextureArea GREGTECH_LOGO_DARK = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_dark.png"); + public static final TextureArea GREGTECH_LOGO_BLINKING_YELLOW = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_blinking_yellow.png"); + public static final TextureArea GREGTECH_LOGO_BLINKING_RED = TextureArea + .fullImage("textures/gui/icon/gregtech_logo_blinking_red.png"); - //BASE TEXTURES - public static final TextureArea BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/background.png", 176, 166, 3, 3); - public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4); - public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11); - public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("textures/gui/base/background_%s.png", 176, 166, 3, 3); - public static final TextureArea CLIPBOARD_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_background.png"); - public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_paper_background.png"); + // BASE TEXTURES + public static final TextureArea BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/background.png", 176, + 166, 3, 3); + public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4); + public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("textures/gui/base/background_%s.png", + 176, 166, 3, 3); + public static final TextureArea CLIPBOARD_BACKGROUND = TextureArea + .fullImage("textures/gui/base/clipboard_background.png"); + public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea + .fullImage("textures/gui/base/clipboard_paper_background.png"); public static final TextureArea BLANK = AdoptableTextureArea.fullImage("textures/gui/base/blank.png", 1, 1, 0, 0); - public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea.fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0); - public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, 2, 2); - public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, 2, 2); - public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, 18, 1, 1); - public static final TextureArea FLUID_TANK_BACKGROUND = TextureArea.fullImage("textures/gui/base/fluid_tank_background.png"); - public static final TextureArea FLUID_TANK_OVERLAY = TextureArea.fullImage("textures/gui/base/fluid_tank_overlay.png"); + public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea + .fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0); + public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, + 2, 2); + public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, + 2, 2); + public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, + 18, 1, 1); + public static final TextureArea FLUID_TANK_BACKGROUND = TextureArea + .fullImage("textures/gui/base/fluid_tank_background.png"); + public static final TextureArea FLUID_TANK_OVERLAY = TextureArea + .fullImage("textures/gui/base/fluid_tank_overlay.png"); public static final TextureArea SLOT = AdoptableTextureArea.fullImage("textures/gui/base/slot.png", 18, 18, 1, 1); public static final TextureArea SLOT_DARKENED = TextureArea.fullImage("textures/gui/base/darkened_slot.png"); public static final SteamTexture SLOT_STEAM = SteamTexture.fullImage("textures/gui/base/slot_%s.png"); - public static final TextureArea TOGGLE_BUTTON_BACK = TextureArea.fullImage("textures/gui/widget/toggle_button_background.png"); + public static final TextureArea TOGGLE_BUTTON_BACK = TextureArea + .fullImage("textures/gui/widget/toggle_button_background.png"); - //FLUID & ITEM OUTPUT BUTTONS + // FLUID & ITEM OUTPUT BUTTONS public static final TextureArea BLOCKS_INPUT = TextureArea.fullImage("textures/gui/widget/button_blocks_input.png"); public static final TextureArea BUTTON = TextureArea.fullImage("textures/gui/widget/button.png"); - public static final TextureArea BUTTON_ALLOW_IMPORT_EXPORT = TextureArea.fullImage("textures/gui/widget/button_allow_import_export.png"); - public static final TextureArea BUTTON_BLACKLIST = TextureArea.fullImage("textures/gui/widget/button_blacklist.png"); - public static final TextureArea BUTTON_CLEAR_GRID = TextureArea.fullImage("textures/gui/widget/button_clear_grid.png"); - public static final TextureArea BUTTON_FILTER_DAMAGE = TextureArea.fullImage("textures/gui/widget/button_filter_damage.png"); - public static final TextureArea BUTTON_FILTER_NBT = TextureArea.fullImage("textures/gui/widget/button_filter_nbt.png"); - public static final TextureArea BUTTON_FLUID_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_fluid_output_overlay.png"); - public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_item_output_overlay.png"); + public static final TextureArea BUTTON_ALLOW_IMPORT_EXPORT = TextureArea + .fullImage("textures/gui/widget/button_allow_import_export.png"); + public static final TextureArea BUTTON_BLACKLIST = TextureArea + .fullImage("textures/gui/widget/button_blacklist.png"); + public static final TextureArea BUTTON_CLEAR_GRID = TextureArea + .fullImage("textures/gui/widget/button_clear_grid.png"); + public static final TextureArea BUTTON_FILTER_DAMAGE = TextureArea + .fullImage("textures/gui/widget/button_filter_damage.png"); + public static final TextureArea BUTTON_FILTER_NBT = TextureArea + .fullImage("textures/gui/widget/button_filter_nbt.png"); + public static final TextureArea BUTTON_FLUID_OUTPUT = TextureArea + .fullImage("textures/gui/widget/button_fluid_output_overlay.png"); + public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea + .fullImage("textures/gui/widget/button_item_output_overlay.png"); public static final TextureArea BUTTON_LOCK = TextureArea.fullImage("textures/gui/widget/button_lock.png"); - public static final TextureArea BUTTON_FLUID_VOID = TextureArea.fullImage("textures/gui/widget/button_fluid_void.png"); - public static final TextureArea BUTTON_ITEM_VOID = TextureArea.fullImage("textures/gui/widget/button_item_void.png"); - public static final TextureArea BUTTON_VOID_NONE = TextureArea.fullImage("textures/gui/widget/button_void_none.png"); - public static final TextureArea BUTTON_VOID_MULTIBLOCK = TextureArea.fullImage("textures/gui/widget/button_void_multiblock.png"); + public static final TextureArea BUTTON_FLUID_VOID = TextureArea + .fullImage("textures/gui/widget/button_fluid_void.png"); + public static final TextureArea BUTTON_ITEM_VOID = TextureArea + .fullImage("textures/gui/widget/button_item_void.png"); + public static final TextureArea BUTTON_VOID_NONE = TextureArea + .fullImage("textures/gui/widget/button_void_none.png"); + public static final TextureArea BUTTON_VOID_MULTIBLOCK = TextureArea + .fullImage("textures/gui/widget/button_void_multiblock.png"); public static final TextureArea BUTTON_LEFT = TextureArea.fullImage("textures/gui/widget/left.png"); - public static final TextureArea BUTTON_OVERCLOCK = TextureArea.fullImage("textures/gui/widget/button_overclock.png"); - public static final TextureArea BUTTON_PUBLIC_PRIVATE = TextureArea.fullImage("textures/gui/widget/button_public_private.png"); + public static final TextureArea BUTTON_OVERCLOCK = TextureArea + .fullImage("textures/gui/widget/button_overclock.png"); + public static final TextureArea BUTTON_PUBLIC_PRIVATE = TextureArea + .fullImage("textures/gui/widget/button_public_private.png"); public static final TextureArea BUTTON_RIGHT = TextureArea.fullImage("textures/gui/widget/right.png"); - public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea.fullImage("textures/gui/widget/button_switch_view.png"); - public static final TextureArea BUTTON_WORKING_ENABLE = TextureArea.fullImage("textures/gui/widget/button_working_enable.png"); - public static final TextureArea BUTTON_INT_CIRCUIT_PLUS = TextureArea.fullImage("textures/gui/widget/button_circuit_plus.png"); - public static final TextureArea BUTTON_INT_CIRCUIT_MINUS = TextureArea.fullImage("textures/gui/widget/button_circuit_minus.png"); - public static final TextureArea CLIPBOARD_BUTTON = TextureArea.fullImage("textures/gui/widget/clipboard_button.png"); - public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea.fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); - public static final TextureArea DISTRIBUTION_MODE = TextureArea.fullImage("textures/gui/widget/button_distribution_mode.png"); + public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea + .fullImage("textures/gui/widget/button_switch_view.png"); + public static final TextureArea BUTTON_WORKING_ENABLE = TextureArea + .fullImage("textures/gui/widget/button_working_enable.png"); + public static final TextureArea BUTTON_INT_CIRCUIT_PLUS = TextureArea + .fullImage("textures/gui/widget/button_circuit_plus.png"); + public static final TextureArea BUTTON_INT_CIRCUIT_MINUS = TextureArea + .fullImage("textures/gui/widget/button_circuit_minus.png"); + public static final TextureArea CLIPBOARD_BUTTON = TextureArea + .fullImage("textures/gui/widget/clipboard_button.png"); + public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea + .fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); + public static final TextureArea DISTRIBUTION_MODE = TextureArea + .fullImage("textures/gui/widget/button_distribution_mode.png"); public static final TextureArea LOCK = TextureArea.fullImage("textures/gui/widget/lock.png"); public static final TextureArea LOCK_WHITE = TextureArea.fullImage("textures/gui/widget/lock_white.png"); public static final TextureArea SWITCH = TextureArea.fullImage("textures/gui/widget/switch.png"); - public static final TextureArea SWITCH_HORIZONTAL = TextureArea.fullImage("textures/gui/widget/switch_horizontal.png"); - public static final SizedTextureArea VANILLA_BUTTON = SizedTextureArea.fullImage("textures/gui/widget/vanilla_button.png", 200, 40); + public static final TextureArea SWITCH_HORIZONTAL = TextureArea + .fullImage("textures/gui/widget/switch_horizontal.png"); + public static final SizedTextureArea VANILLA_BUTTON = SizedTextureArea + .fullImage("textures/gui/widget/vanilla_button.png", 200, 40); public static final TextureArea BUTTON_POWER = TextureArea.fullImage("textures/gui/widget/button_power.png"); - public static final TextureArea BUTTON_POWER_DETAIL = TextureArea.fullImage("textures/gui/widget/button_power_detail.png"); - public static final TextureArea BUTTON_DISTINCT_BUSES = TextureArea.fullImage("textures/gui/widget/button_distinct_buses.png"); - public static final TextureArea BUTTON_NO_DISTINCT_BUSES = TextureArea.fullImage("textures/gui/widget/button_no_distinct_buses.png"); + public static final TextureArea BUTTON_POWER_DETAIL = TextureArea + .fullImage("textures/gui/widget/button_power_detail.png"); + public static final TextureArea BUTTON_DISTINCT_BUSES = TextureArea + .fullImage("textures/gui/widget/button_distinct_buses.png"); + public static final TextureArea BUTTON_NO_DISTINCT_BUSES = TextureArea + .fullImage("textures/gui/widget/button_no_distinct_buses.png"); public static final TextureArea BUTTON_NO_FLEX = TextureArea.fullImage("textures/gui/widget/button_no_flex.png"); - public static final TextureArea BUTTON_MULTI_MAP = TextureArea.fullImage("textures/gui/widget/button_multi_map.png"); - public static final TextureArea BUTTON_MINER_MODES = TextureArea.fullImage("textures/gui/widget/button_miner_modes.png"); - public static final TextureArea BUTTON_THROTTLE_MINUS = TextureArea.fullImage("textures/gui/widget/button_throttle_minus.png"); - public static final TextureArea BUTTON_THROTTLE_PLUS = TextureArea.fullImage("textures/gui/widget/button_throttle_plus.png"); + public static final TextureArea BUTTON_MULTI_MAP = TextureArea + .fullImage("textures/gui/widget/button_multi_map.png"); + public static final TextureArea BUTTON_MINER_MODES = TextureArea + .fullImage("textures/gui/widget/button_miner_modes.png"); + public static final TextureArea BUTTON_THROTTLE_MINUS = TextureArea + .fullImage("textures/gui/widget/button_throttle_minus.png"); + public static final TextureArea BUTTON_THROTTLE_PLUS = TextureArea + .fullImage("textures/gui/widget/button_throttle_plus.png"); - //INDICATORS & ICONS - public static final TextureArea INDICATOR_NO_ENERGY = TextureArea.fullImage("textures/gui/base/indicator_no_energy.png"); - public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture.fullImage("textures/gui/base/indicator_no_steam_%s.png"); + // INDICATORS & ICONS + public static final TextureArea INDICATOR_NO_ENERGY = TextureArea + .fullImage("textures/gui/base/indicator_no_energy.png"); + public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture + .fullImage("textures/gui/base/indicator_no_steam_%s.png"); public static final TextureArea TANK_ICON = TextureArea.fullImage("textures/gui/base/tank_icon.png"); - //WIDGET UI RELATED - public static final TextureArea SLIDER_BACKGROUND = TextureArea.fullImage("textures/gui/widget/slider_background.png"); - public static final TextureArea SLIDER_BACKGROUND_VERTICAL = TextureArea.fullImage("textures/gui/widget/slider_background_vertical.png"); + // WIDGET UI RELATED + public static final TextureArea SLIDER_BACKGROUND = TextureArea + .fullImage("textures/gui/widget/slider_background.png"); + public static final TextureArea SLIDER_BACKGROUND_VERTICAL = TextureArea + .fullImage("textures/gui/widget/slider_background_vertical.png"); public static final TextureArea SLIDER_ICON = TextureArea.fullImage("textures/gui/widget/slider.png"); - public static final TextureArea MAINTENANCE_ICON = TextureArea.fullImage("textures/gui/widget/button_maintenance.png"); + public static final TextureArea MAINTENANCE_ICON = TextureArea + .fullImage("textures/gui/widget/button_maintenance.png"); - //PRIMITIVE - public static final TextureArea PRIMITIVE_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); - public static final TextureArea PRIMITIVE_SLOT = AdoptableTextureArea.fullImage("textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); - public static final TextureArea PRIMITIVE_FURNACE_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_furnace.png"); - public static final TextureArea PRIMITIVE_DUST_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_dust.png"); - public static final TextureArea PRIMITIVE_INGOT_OVERLAY = TextureArea.fullImage("textures/gui/primitive/overlay_primitive_ingot.png"); - public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK = TextureArea.fullImage("textures/gui/primitive/primitive_large_fluid_tank.png"); - public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = TextureArea.fullImage("textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); - public static final TextureArea PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = TextureArea.fullImage("textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); + // PRIMITIVE + public static final TextureArea PRIMITIVE_BACKGROUND = AdoptableTextureArea + .fullImage("textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); + public static final TextureArea PRIMITIVE_SLOT = AdoptableTextureArea + .fullImage("textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); + public static final TextureArea PRIMITIVE_FURNACE_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_furnace.png"); + public static final TextureArea PRIMITIVE_DUST_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_dust.png"); + public static final TextureArea PRIMITIVE_INGOT_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/overlay_primitive_ingot.png"); + public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK = TextureArea + .fullImage("textures/gui/primitive/primitive_large_fluid_tank.png"); + public static final TextureArea PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = TextureArea + .fullImage("textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); + public static final TextureArea PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = TextureArea + .fullImage("textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); - //SLOT OVERLAYS - public static final TextureArea ATOMIC_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/atomic_overlay_1.png"); - public static final TextureArea ATOMIC_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/atomic_overlay_2.png"); - public static final TextureArea ARROW_INPUT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/arrow_input_overlay.png"); - public static final TextureArea ARROW_OUTPUT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/arrow_output_overlay.png"); + // SLOT OVERLAYS + public static final TextureArea ATOMIC_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/atomic_overlay_1.png"); + public static final TextureArea ATOMIC_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/atomic_overlay_2.png"); + public static final TextureArea ARROW_INPUT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/arrow_input_overlay.png"); + public static final TextureArea ARROW_OUTPUT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/arrow_output_overlay.png"); public static final TextureArea BATTERY_OVERLAY = TextureArea.fullImage("textures/gui/overlay/battery_overlay.png"); - public static final TextureArea BEAKER_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_1.png"); - public static final TextureArea BEAKER_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_2.png"); - public static final TextureArea BEAKER_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_3.png"); - public static final TextureArea BEAKER_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/beaker_overlay_4.png"); + public static final TextureArea BEAKER_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_1.png"); + public static final TextureArea BEAKER_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_2.png"); + public static final TextureArea BEAKER_OVERLAY_3 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_3.png"); + public static final TextureArea BEAKER_OVERLAY_4 = TextureArea + .fullImage("textures/gui/overlay/beaker_overlay_4.png"); public static final TextureArea BENDER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/bender_overlay.png"); public static final TextureArea BOX_OVERLAY = TextureArea.fullImage("textures/gui/overlay/box_overlay.png"); public static final TextureArea BOXED_OVERLAY = TextureArea.fullImage("textures/gui/overlay/boxed_overlay.png"); public static final TextureArea BREWER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/brewer_overlay.png"); public static final TextureArea CANNER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/canner_overlay.png"); - public static final TextureArea CHARGER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/charger_slot_overlay.png"); - public static final TextureArea CANISTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/canister_overlay.png"); - public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/canister_overlay_%s.png"); - public static final TextureArea CENTRIFUGE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/centrifuge_overlay.png"); + public static final TextureArea CHARGER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/charger_slot_overlay.png"); + public static final TextureArea CANISTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/canister_overlay.png"); + public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/canister_overlay_%s.png"); + public static final TextureArea CENTRIFUGE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/centrifuge_overlay.png"); public static final TextureArea CIRCUIT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/circuit_overlay.png"); - public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/coal_overlay_%s.png"); - public static final TextureArea COMPRESSOR_OVERLAY = TextureArea.fullImage("textures/gui/overlay/compressor_overlay.png"); - public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/compressor_overlay_%s.png"); - public static final TextureArea CRACKING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/cracking_overlay_1.png"); - public static final TextureArea CRACKING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/cracking_overlay_2.png"); - public static final TextureArea CRUSHED_ORE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/crushed_ore_overlay.png"); - public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/crushed_ore_overlay_%s.png"); + public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/coal_overlay_%s.png"); + public static final TextureArea COMPRESSOR_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/compressor_overlay.png"); + public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/compressor_overlay_%s.png"); + public static final TextureArea CRACKING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/cracking_overlay_1.png"); + public static final TextureArea CRACKING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/cracking_overlay_2.png"); + public static final TextureArea CRUSHED_ORE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/crushed_ore_overlay.png"); + public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/crushed_ore_overlay_%s.png"); public static final TextureArea CRYSTAL_OVERLAY = TextureArea.fullImage("textures/gui/overlay/crystal_overlay.png"); public static final TextureArea CUTTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/cutter_overlay.png"); - public static final TextureArea DARK_CANISTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/dark_canister_overlay.png"); + public static final TextureArea DARK_CANISTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/dark_canister_overlay.png"); public static final TextureArea DUST_OVERLAY = TextureArea.fullImage("textures/gui/overlay/dust_overlay.png"); - public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/dust_overlay_%s.png"); - public static final TextureArea EXTRACTOR_OVERLAY = TextureArea.fullImage("textures/gui/overlay/extractor_overlay.png"); - public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/extractor_overlay_%s.png"); - public static final TextureArea FILTER_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/filter_slot_overlay.png"); - public static final TextureArea FURNACE_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/furnace_overlay_1.png"); - public static final TextureArea FURNACE_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/furnace_overlay_2.png"); - public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/furnace_overlay_%s.png"); + public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/dust_overlay_%s.png"); + public static final TextureArea EXTRACTOR_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/extractor_overlay.png"); + public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/extractor_overlay_%s.png"); + public static final TextureArea FILTER_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/filter_slot_overlay.png"); + public static final TextureArea FURNACE_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/furnace_overlay_1.png"); + public static final TextureArea FURNACE_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/furnace_overlay_2.png"); + public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/furnace_overlay_%s.png"); public static final TextureArea HAMMER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/hammer_overlay.png"); - public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/hammer_overlay_%s.png"); - public static final TextureArea HEATING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/heating_overlay_1.png"); - public static final TextureArea HEATING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/heating_overlay_2.png"); - public static final TextureArea IMPLOSION_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/implosion_overlay_1.png"); - public static final TextureArea IMPLOSION_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/implosion_overlay_2.png"); + public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/hammer_overlay_%s.png"); + public static final TextureArea HEATING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/heating_overlay_1.png"); + public static final TextureArea HEATING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/heating_overlay_2.png"); + public static final TextureArea IMPLOSION_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/implosion_overlay_1.png"); + public static final TextureArea IMPLOSION_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/implosion_overlay_2.png"); public static final TextureArea IN_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/in_slot_overlay.png"); - public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/in_slot_overlay_%s.png"); + public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/in_slot_overlay_%s.png"); public static final TextureArea INGOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/ingot_overlay.png"); - public static final TextureArea INT_CIRCUIT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/int_circuit_overlay.png"); + public static final TextureArea INT_CIRCUIT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/int_circuit_overlay.png"); public static final TextureArea LENS_OVERLAY = TextureArea.fullImage("textures/gui/overlay/lens_overlay.png"); - public static final TextureArea LIGHTNING_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/lightning_overlay_1.png"); - public static final TextureArea LIGHTNING_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/lightning_overlay_2.png"); + public static final TextureArea LIGHTNING_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/lightning_overlay_1.png"); + public static final TextureArea LIGHTNING_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/lightning_overlay_2.png"); public static final TextureArea MOLD_OVERLAY = TextureArea.fullImage("textures/gui/overlay/mold_overlay.png"); - public static final TextureArea MOLECULAR_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_1.png"); - public static final TextureArea MOLECULAR_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_2.png"); - public static final TextureArea MOLECULAR_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_3.png"); - public static final TextureArea MOLECULAR_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/molecular_overlay_4.png"); - public static final TextureArea OUT_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/out_slot_overlay.png"); - public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("textures/gui/overlay/out_slot_overlay_%s.png"); + public static final TextureArea MOLECULAR_OVERLAY_1 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_1.png"); + public static final TextureArea MOLECULAR_OVERLAY_2 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_2.png"); + public static final TextureArea MOLECULAR_OVERLAY_3 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_3.png"); + public static final TextureArea MOLECULAR_OVERLAY_4 = TextureArea + .fullImage("textures/gui/overlay/molecular_overlay_4.png"); + public static final TextureArea OUT_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/out_slot_overlay.png"); + public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("textures/gui/overlay/out_slot_overlay_%s.png"); public static final TextureArea PAPER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/paper_overlay.png"); - public static final TextureArea PRINTED_PAPER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/printed_paper_overlay.png"); + public static final TextureArea PRINTED_PAPER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/printed_paper_overlay.png"); public static final TextureArea PIPE_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/pipe_overlay_2.png"); public static final TextureArea PIPE_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/pipe_overlay_1.png"); public static final TextureArea PRESS_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/press_overlay_1.png"); public static final TextureArea PRESS_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/press_overlay_2.png"); public static final TextureArea PRESS_OVERLAY_3 = TextureArea.fullImage("textures/gui/overlay/press_overlay_3.png"); public static final TextureArea PRESS_OVERLAY_4 = TextureArea.fullImage("textures/gui/overlay/press_overlay_4.png"); - public static final TextureArea SAWBLADE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/sawblade_overlay.png"); - public static final TextureArea SOLIDIFIER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/solidifier_overlay.png"); - public static final TextureArea STRING_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/string_slot_overlay.png"); - public static final TextureArea TOOL_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/overlay/tool_slot_overlay.png"); + public static final TextureArea SAWBLADE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/sawblade_overlay.png"); + public static final TextureArea SOLIDIFIER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/solidifier_overlay.png"); + public static final TextureArea STRING_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/string_slot_overlay.png"); + public static final TextureArea TOOL_SLOT_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/tool_slot_overlay.png"); public static final TextureArea TURBINE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/turbine_overlay.png"); public static final TextureArea VIAL_OVERLAY_1 = TextureArea.fullImage("textures/gui/overlay/vial_overlay_1.png"); public static final TextureArea VIAL_OVERLAY_2 = TextureArea.fullImage("textures/gui/overlay/vial_overlay_2.png"); - public static final TextureArea WIREMILL_OVERLAY = TextureArea.fullImage("textures/gui/overlay/wiremill_overlay.png"); - public static final TextureArea POSITIVE_MATTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/positive_matter_overlay.png"); - public static final TextureArea NEUTRAL_MATTER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/neutral_matter_overlay.png"); - public static final TextureArea DATA_ORB_OVERLAY = TextureArea.fullImage("textures/gui/overlay/data_orb_overlay.png"); + public static final TextureArea WIREMILL_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/wiremill_overlay.png"); + public static final TextureArea POSITIVE_MATTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/positive_matter_overlay.png"); + public static final TextureArea NEUTRAL_MATTER_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/neutral_matter_overlay.png"); + public static final TextureArea DATA_ORB_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/data_orb_overlay.png"); public static final TextureArea SCANNER_OVERLAY = TextureArea.fullImage("textures/gui/overlay/scanner_overlay.png"); - public static final TextureArea DUCT_TAPE_OVERLAY = TextureArea.fullImage("textures/gui/overlay/duct_tape_overlay.png"); - public static final TextureArea RESEARCH_STATION_OVERLAY = TextureArea.fullImage("textures/gui/overlay/research_station_overlay.png"); + public static final TextureArea DUCT_TAPE_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/duct_tape_overlay.png"); + public static final TextureArea RESEARCH_STATION_OVERLAY = TextureArea + .fullImage("textures/gui/overlay/research_station_overlay.png"); - //PROGRESS BARS - public static final TextureArea PROGRESS_BAR_ARC_FURNACE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arc_furnace.png"); - public static final TextureArea PROGRESS_BAR_ARROW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arrow.png"); - public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_arrow_%s.png"); - public static final TextureArea PROGRESS_BAR_ARROW_MULTIPLE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_arrow_multiple.png"); - public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_assembly_line.png"); - public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE_ARROW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); - public static final TextureArea PROGRESS_BAR_BATH = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_bath.png"); - public static final TextureArea PROGRESS_BAR_BENDING = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_bending.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); - public static final TextureArea PROGRESS_BAR_BOILER_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_boiler_heat.png"); - public static final TextureArea PROGRESS_BAR_CANNER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_canner.png"); - public static final TextureArea PROGRESS_BAR_CIRCUIT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_circuit.png"); - public static final TextureArea PROGRESS_BAR_CIRCUIT_ASSEMBLER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_circuit_assembler.png"); - public static final TextureArea PROGRESS_BAR_COKE_OVEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_coke_oven.png"); - public static final TextureArea PROGRESS_BAR_COMPRESS = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_compress.png"); - public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_compress_%s.png"); - public static final TextureArea PROGRESS_BAR_CRACKING = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_cracking.png"); - public static final TextureArea PROGRESS_BAR_CRACKING_INPUT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_cracking_2.png"); - public static final TextureArea PROGRESS_BAR_CRYSTALLIZATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_crystallization.png"); - public static final TextureArea PROGRESS_BAR_DISTILLATION_TOWER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_distillation_tower.png"); - public static final TextureArea PROGRESS_BAR_EXTRACT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_extract.png"); - public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_extract_%s.png"); - public static final TextureArea PROGRESS_BAR_EXTRUDER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_extruder.png"); - public static final TextureArea PROGRESS_BAR_FUSION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion.png"); - public static final TextureArea PROGRESS_BAR_GAS_COLLECTOR = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_gas_collector.png"); - public static final TextureArea PROGRESS_BAR_HAMMER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hammer.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_hammer_%s.png"); - public static final TextureArea PROGRESS_BAR_HAMMER_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hammer_base.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); - public static final TextureArea PROGRESS_BAR_LATHE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lathe.png"); - public static final TextureArea PROGRESS_BAR_LATHE_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lathe_base.png"); - public static final TextureArea PROGRESS_BAR_MACERATE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_macerate.png"); - public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_macerate_%s.png"); - public static final TextureArea PROGRESS_BAR_MAGNET = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_magnet.png"); - public static final TextureArea PROGRESS_BAR_MASS_FAB = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_mass_fab.png"); - public static final TextureArea PROGRESS_BAR_MIXER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_mixer.png"); - public static final TextureArea PROGRESS_BAR_PACKER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_packer.png"); - public static final TextureArea PROGRESS_BAR_RECYCLER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_recycler.png"); - public static final TextureArea PROGRESS_BAR_REPLICATOR = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_replicator.png"); - public static final TextureArea PROGRESS_BAR_SIFT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_sift.png"); - public static final TextureArea PROGRESS_BAR_SLICE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_slice.png"); - public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture.fullImage("textures/gui/progress_bar/progress_bar_solar_%s.png"); - public static final TextureArea PROGRESS_BAR_UNLOCK = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_unlock.png"); - public static final TextureArea PROGRESS_BAR_UNPACKER = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_unpacker.png"); - public static final TextureArea PROGRESS_BAR_WIREMILL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_wiremill.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png"); - public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png"); - public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png"); - public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png"); - public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png"); - public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png"); - public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png"); - public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png"); - public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png"); - public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png"); - public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png"); - public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png"); + // PROGRESS BARS + public static final TextureArea PROGRESS_BAR_ARC_FURNACE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arc_furnace.png"); + public static final TextureArea PROGRESS_BAR_ARROW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arrow.png"); + public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_arrow_%s.png"); + public static final TextureArea PROGRESS_BAR_ARROW_MULTIPLE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_arrow_multiple.png"); + public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_assembly_line.png"); + public static final TextureArea PROGRESS_BAR_ASSEMBLY_LINE_ARROW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); + public static final TextureArea PROGRESS_BAR_BATH = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_bath.png"); + public static final TextureArea PROGRESS_BAR_BENDING = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_bending.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); + public static final TextureArea PROGRESS_BAR_BOILER_HEAT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_boiler_heat.png"); + public static final TextureArea PROGRESS_BAR_CANNER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_canner.png"); + public static final TextureArea PROGRESS_BAR_CIRCUIT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_circuit.png"); + public static final TextureArea PROGRESS_BAR_CIRCUIT_ASSEMBLER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_circuit_assembler.png"); + public static final TextureArea PROGRESS_BAR_COKE_OVEN = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_coke_oven.png"); + public static final TextureArea PROGRESS_BAR_COMPRESS = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_compress.png"); + public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_compress_%s.png"); + public static final TextureArea PROGRESS_BAR_CRACKING = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_cracking.png"); + public static final TextureArea PROGRESS_BAR_CRACKING_INPUT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_cracking_2.png"); + public static final TextureArea PROGRESS_BAR_CRYSTALLIZATION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_crystallization.png"); + public static final TextureArea PROGRESS_BAR_DISTILLATION_TOWER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_distillation_tower.png"); + public static final TextureArea PROGRESS_BAR_EXTRACT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_extract.png"); + public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_extract_%s.png"); + public static final TextureArea PROGRESS_BAR_EXTRUDER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_extruder.png"); + public static final TextureArea PROGRESS_BAR_FUSION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion.png"); + public static final TextureArea PROGRESS_BAR_GAS_COLLECTOR = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_gas_collector.png"); + public static final TextureArea PROGRESS_BAR_HAMMER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hammer.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_hammer_%s.png"); + public static final TextureArea PROGRESS_BAR_HAMMER_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hammer_base.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); + public static final TextureArea PROGRESS_BAR_LATHE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lathe.png"); + public static final TextureArea PROGRESS_BAR_LATHE_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lathe_base.png"); + public static final TextureArea PROGRESS_BAR_MACERATE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_macerate.png"); + public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_macerate_%s.png"); + public static final TextureArea PROGRESS_BAR_MAGNET = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_magnet.png"); + public static final TextureArea PROGRESS_BAR_MASS_FAB = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_mass_fab.png"); + public static final TextureArea PROGRESS_BAR_MIXER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_mixer.png"); + public static final TextureArea PROGRESS_BAR_PACKER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_packer.png"); + public static final TextureArea PROGRESS_BAR_RECYCLER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_recycler.png"); + public static final TextureArea PROGRESS_BAR_REPLICATOR = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_replicator.png"); + public static final TextureArea PROGRESS_BAR_SIFT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_sift.png"); + public static final TextureArea PROGRESS_BAR_SLICE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_slice.png"); + public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture + .fullImage("textures/gui/progress_bar/progress_bar_solar_%s.png"); + public static final TextureArea PROGRESS_BAR_UNLOCK = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_unlock.png"); + public static final TextureArea PROGRESS_BAR_UNPACKER = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_unpacker.png"); + public static final TextureArea PROGRESS_BAR_WIREMILL = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_wiremill.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png"); + public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png"); + public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png"); + public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png"); + public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png"); + public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png"); + public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png"); + public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png"); + public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png"); + public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png"); + public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea + .fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png"); // Fusion reactor diagram progress bar parts - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png"); - public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png"); + public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea + .fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png"); - //JEI + // JEI public static final TextureArea INFO_ICON = TextureArea.fullImage("textures/gui/widget/information.png"); - public static final TextureArea MULTIBLOCK_CATEGORY = TextureArea.fullImage("textures/gui/icon/multiblock_category.png"); - public static final TextureArea ARC_FURNACE_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/arc_furnace_recycling.png"); - public static final TextureArea MACERATOR_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/macerator_recycling.png"); - public static final TextureArea EXTRACTOR_RECYLCING_CATEGORY = TextureArea.fullImage("textures/gui/icon/extractor_recycling.png"); + public static final TextureArea MULTIBLOCK_CATEGORY = TextureArea + .fullImage("textures/gui/icon/multiblock_category.png"); + public static final TextureArea ARC_FURNACE_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/arc_furnace_recycling.png"); + public static final TextureArea MACERATOR_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/macerator_recycling.png"); + public static final TextureArea EXTRACTOR_RECYLCING_CATEGORY = TextureArea + .fullImage("textures/gui/icon/extractor_recycling.png"); // Covers - public static final TextureArea COVER_MACHINE_CONTROLLER = TextureArea.fullImage("textures/items/metaitems/cover.controller.png"); + public static final TextureArea COVER_MACHINE_CONTROLLER = TextureArea + .fullImage("textures/items/metaitems/cover.controller.png"); // Ore Filter public static final TextureArea ORE_FILTER_INFO = TextureArea.fullImage("textures/gui/widget/ore_filter/info.png"); - public static final TextureArea ORE_FILTER_SUCCESS = TextureArea.fullImage("textures/gui/widget/ore_filter/success.png"); - public static final TextureArea ORE_FILTER_ERROR = TextureArea.fullImage("textures/gui/widget/ore_filter/error.png"); + public static final TextureArea ORE_FILTER_SUCCESS = TextureArea + .fullImage("textures/gui/widget/ore_filter/success.png"); + public static final TextureArea ORE_FILTER_ERROR = TextureArea + .fullImage("textures/gui/widget/ore_filter/error.png"); public static final TextureArea ORE_FILTER_WARN = TextureArea.fullImage("textures/gui/widget/ore_filter/warn.png"); - public static final TextureArea ORE_FILTER_WAITING = TextureArea.fullImage("textures/gui/widget/ore_filter/waiting.png"); + public static final TextureArea ORE_FILTER_WAITING = TextureArea + .fullImage("textures/gui/widget/ore_filter/waiting.png"); - public static final TextureArea ORE_FILTER_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/match.png"); - public static final TextureArea ORE_FILTER_NO_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/no_match.png"); + public static final TextureArea ORE_FILTER_MATCH = TextureArea + .fullImage("textures/gui/widget/ore_filter/match.png"); + public static final TextureArea ORE_FILTER_NO_MATCH = TextureArea + .fullImage("textures/gui/widget/ore_filter/no_match.png"); - //Terminal + // Terminal public static final TextureArea ICON_REMOVE = TextureArea.fullImage("textures/gui/terminal/icon/remove_hover.png"); public static final TextureArea ICON_UP = TextureArea.fullImage("textures/gui/terminal/icon/up_hover.png"); public static final TextureArea ICON_DOWN = TextureArea.fullImage("textures/gui/terminal/icon/down_hover.png"); @@ -272,49 +457,79 @@ public class GuiTextures { public static final TextureArea ICON_LEFT = TextureArea.fullImage("textures/gui/terminal/icon/left_hover.png"); public static final TextureArea ICON_ADD = TextureArea.fullImage("textures/gui/terminal/icon/add_hover.png"); - public final static TextureArea ICON_NEW_PAGE = TextureArea.fullImage("textures/gui/terminal/icon/system/memory_card_hover.png"); + public final static TextureArea ICON_NEW_PAGE = TextureArea + .fullImage("textures/gui/terminal/icon/system/memory_card_hover.png"); public final static TextureArea ICON_LOAD = TextureArea.fullImage("textures/gui/terminal/icon/folder_hover.png"); - public final static TextureArea ICON_SAVE = TextureArea.fullImage("textures/gui/terminal/icon/system/save_hover.png"); + public final static TextureArea ICON_SAVE = TextureArea + .fullImage("textures/gui/terminal/icon/system/save_hover.png"); public final static TextureArea ICON_LOCATION = TextureArea.fullImage("textures/gui/terminal/icon/guide_hover.png"); - public final static TextureArea ICON_VISIBLE = TextureArea.fullImage("textures/gui/terminal/icon/appearance_hover.png"); - public final static TextureArea ICON_CALCULATOR = TextureArea.fullImage("textures/gui/terminal/icon/calculator_hover.png"); + public final static TextureArea ICON_VISIBLE = TextureArea + .fullImage("textures/gui/terminal/icon/appearance_hover.png"); + public final static TextureArea ICON_CALCULATOR = TextureArea + .fullImage("textures/gui/terminal/icon/calculator_hover.png"); public final static TextureArea UI_FRAME_SIDE_UP = TextureArea.fullImage("textures/gui/terminal/frame_side_up.png"); - public final static TextureArea UI_FRAME_SIDE_DOWN = TextureArea.fullImage("textures/gui/terminal/frame_side_down.png"); + public final static TextureArea UI_FRAME_SIDE_DOWN = TextureArea + .fullImage("textures/gui/terminal/frame_side_down.png"); // Texture Areas - public static final TextureArea BUTTON_FLUID = TextureArea.fullImage("textures/blocks/cover/cover_interface_fluid_button.png"); - public static final TextureArea BUTTON_ITEM = TextureArea.fullImage("textures/blocks/cover/cover_interface_item_button.png"); - public static final TextureArea BUTTON_ENERGY = TextureArea.fullImage("textures/blocks/cover/cover_interface_energy_button.png"); - public static final TextureArea BUTTON_MACHINE = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_button.png"); - public static final TextureArea BUTTON_INTERFACE = TextureArea.fullImage("textures/blocks/cover/cover_interface_computer_button.png"); - public static final TextureArea COVER_INTERFACE_MACHINE_ON_PROXY = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_on_proxy.png"); - public static final TextureArea COVER_INTERFACE_MACHINE_OFF_PROXY = TextureArea.fullImage("textures/blocks/cover/cover_interface_machine_off_proxy.png"); + public static final TextureArea BUTTON_FLUID = TextureArea + .fullImage("textures/blocks/cover/cover_interface_fluid_button.png"); + public static final TextureArea BUTTON_ITEM = TextureArea + .fullImage("textures/blocks/cover/cover_interface_item_button.png"); + public static final TextureArea BUTTON_ENERGY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_energy_button.png"); + public static final TextureArea BUTTON_MACHINE = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_button.png"); + public static final TextureArea BUTTON_INTERFACE = TextureArea + .fullImage("textures/blocks/cover/cover_interface_computer_button.png"); + public static final TextureArea COVER_INTERFACE_MACHINE_ON_PROXY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_on_proxy.png"); + public static final TextureArea COVER_INTERFACE_MACHINE_OFF_PROXY = TextureArea + .fullImage("textures/blocks/cover/cover_interface_machine_off_proxy.png"); // Lamp item overlay - public static final TextureArea LAMP_NO_BLOOM = TextureArea.fullImage("textures/gui/item_overlay/lamp_no_bloom.png"); - public static final TextureArea LAMP_NO_LIGHT = TextureArea.fullImage("textures/gui/item_overlay/lamp_no_light.png"); + public static final TextureArea LAMP_NO_BLOOM = TextureArea + .fullImage("textures/gui/item_overlay/lamp_no_bloom.png"); + public static final TextureArea LAMP_NO_LIGHT = TextureArea + .fullImage("textures/gui/item_overlay/lamp_no_light.png"); // ME hatch/bus - public static final TextureArea NUMBER_BACKGROUND = TextureArea.fullImage("textures/gui/widget/number_background.png"); + public static final TextureArea NUMBER_BACKGROUND = TextureArea + .fullImage("textures/gui/widget/number_background.png"); public static final TextureArea CONFIG_ARROW = TextureArea.fullImage("textures/gui/widget/config_arrow.png"); - public static final TextureArea CONFIG_ARROW_DARK = TextureArea.fullImage("textures/gui/widget/config_arrow_dark.png"); + public static final TextureArea CONFIG_ARROW_DARK = TextureArea + .fullImage("textures/gui/widget/config_arrow_dark.png"); public static final TextureArea SELECT_BOX = TextureArea.fullImage("textures/gui/widget/select_box.png"); // Fusion Reactor custom images - public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk1_title.png"); - public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk2_title.png"); - public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk3_title.png"); - public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea.fullImage("textures/gui/widget/fusion_reactor_diagram.png"); - public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea.fullImage("textures/gui/widget/fusion_reactor_legend.png"); + public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk1_title.png"); + public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk2_title.png"); + public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_mk3_title.png"); + public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_diagram.png"); + public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea + .fullImage("textures/gui/widget/fusion_reactor_legend.png"); // HPCA Component icons - public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea.fullImage("textures/gui/widget/hpca/component_outline.png"); - public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/empty_component.png"); - public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/advanced_computation_component.png"); - public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/bridge_component.png"); - public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/computation_component.png"); - public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/active_cooler_component.png"); - public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/heat_sink_component.png"); - public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png"); - public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_computation_component.png"); + public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea + .fullImage("textures/gui/widget/hpca/component_outline.png"); + public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/empty_component.png"); + public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/bridge_component.png"); + public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/computation_component.png"); + public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/active_cooler_component.png"); + public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/heat_sink_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png"); + public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea + .fullImage("textures/gui/widget/hpca/damaged_computation_component.png"); } diff --git a/src/main/java/gregtech/api/gui/INativeWidget.java b/src/main/java/gregtech/api/gui/INativeWidget.java index 937a3e976d5..3d2d2d76101 100644 --- a/src/main/java/gregtech/api/gui/INativeWidget.java +++ b/src/main/java/gregtech/api/gui/INativeWidget.java @@ -11,6 +11,7 @@ * Rendering is still handled by widget via helpers in {@link gregtech.api.gui.IRenderContext} */ public interface INativeWidget { + /** * You should return MC slot handle instance you created earlier * @@ -44,6 +45,7 @@ default ItemStack onItemTake(EntityPlayer player, ItemStack stack, boolean simul ItemStack slotClick(int dragType, ClickType clickTypeIn, EntityPlayer player); class SlotLocationInfo { + public final boolean isPlayerInventory; public final boolean isHotbarSlot; diff --git a/src/main/java/gregtech/api/gui/ISizeProvider.java b/src/main/java/gregtech/api/gui/ISizeProvider.java index bb2b4791a22..05186421288 100644 --- a/src/main/java/gregtech/api/gui/ISizeProvider.java +++ b/src/main/java/gregtech/api/gui/ISizeProvider.java @@ -20,15 +20,15 @@ public interface ISizeProvider { /** * @return width of the GUI the widget is located in - * if the widget is located in the sub interface, then width - * and height will be the sub interface's holder dimensions + * if the widget is located in the sub interface, then width + * and height will be the sub interface's holder dimensions */ int getWidth(); /** * @return height of the GUI the widget is located in - * if the widget is located in the sub interface, then height - * and width will be the sub interface's holder dimensions + * if the widget is located in the sub interface, then height + * and width will be the sub interface's holder dimensions */ int getHeight(); @@ -41,6 +41,7 @@ default int getGuiTop() { } default Rectangle toScreenCoords(Rectangle widgetRect) { - return new Rectangle(getGuiLeft() + widgetRect.x, getGuiTop() + widgetRect.y, widgetRect.width, widgetRect.height); + return new Rectangle(getGuiLeft() + widgetRect.x, getGuiTop() + widgetRect.y, widgetRect.width, + widgetRect.height); } } diff --git a/src/main/java/gregtech/api/gui/ModularUI.java b/src/main/java/gregtech/api/gui/ModularUI.java index 96874665a1d..e437790302f 100644 --- a/src/main/java/gregtech/api/gui/ModularUI.java +++ b/src/main/java/gregtech/api/gui/ModularUI.java @@ -1,8 +1,5 @@ package gregtech.api.gui; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import gregtech.api.gui.impl.ModularUIGui; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.TextureArea; @@ -11,12 +8,17 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.util.Position; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableList; + import java.util.ArrayList; import java.util.List; import java.util.function.DoubleSupplier; @@ -51,7 +53,9 @@ public final class ModularUI implements ISizeProvider { public final IUIHolder holder; public final EntityPlayer entityPlayer; - public ModularUI(ImmutableBiMap guiWidgets, ImmutableList openListeners, ImmutableList closeListeners, IGuiTexture backgroundPath, int width, int height, IUIHolder holder, EntityPlayer entityPlayer) { + public ModularUI(ImmutableBiMap guiWidgets, ImmutableList openListeners, + ImmutableList closeListeners, IGuiTexture backgroundPath, int width, int height, + IUIHolder holder, EntityPlayer entityPlayer) { this.guiWidgets = guiWidgets; this.uiOpenCallback = openListeners; this.uiCloseCallback = closeListeners; @@ -94,7 +98,7 @@ public void setSize(int width, int height) { getModularUIGui().initGui(); } } - + public void updateScreenSize(int screenWidth, int screenHeight) { this.screenWidth = screenWidth; this.screenHeight = screenHeight; @@ -223,17 +227,22 @@ public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, in return widget(new SlotWidget(itemHandler, slotIndex, x, y).setBackgroundTexture(overlays)); } - public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, int y, boolean canTakeItems, boolean canPutItems, IGuiTexture... overlays) { - return widget(new SlotWidget(itemHandler, slotIndex, x, y, canTakeItems, canPutItems).setBackgroundTexture(overlays)); + public Builder slot(IItemHandlerModifiable itemHandler, int slotIndex, int x, int y, boolean canTakeItems, + boolean canPutItems, IGuiTexture... overlays) { + return widget(new SlotWidget(itemHandler, slotIndex, x, y, canTakeItems, canPutItems) + .setBackgroundTexture(overlays)); } // todo this shouldn't exist, only RecipeProgressWidget should directly take a DoubleSupplier - public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea texture, MoveType moveType) { + public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, + TextureArea texture, MoveType moveType) { return widget(new ProgressWidget(progressSupplier, x, y, width, height, texture, moveType)); } - public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea texture, MoveType moveType, RecipeMap recipeMap) { - return widget(new RecipeProgressWidget(progressSupplier, x, y, width, height, texture, moveType, recipeMap)); + public Builder progressBar(DoubleSupplier progressSupplier, int x, int y, int width, int height, + TextureArea texture, MoveType moveType, RecipeMap recipeMap) { + return widget( + new RecipeProgressWidget(progressSupplier, x, y, width, height, texture, moveType, recipeMap)); } public Builder bindPlayerInventory(InventoryPlayer inventoryPlayer) { @@ -286,7 +295,8 @@ public Builder shouldColor(boolean color) { } public ModularUI build(IUIHolder holder, EntityPlayer player) { - ModularUI ui = new ModularUI(widgets.build(), openListeners.build(), closeListeners.build(), background, width, height, holder, player); + ModularUI ui = new ModularUI(widgets.build(), openListeners.build(), closeListeners.build(), background, + width, height, holder, player); ui.shouldColor = this.shouldColor; return ui; } diff --git a/src/main/java/gregtech/api/gui/UIFactory.java b/src/main/java/gregtech/api/gui/UIFactory.java index 300d6b022a1..163f08f2342 100644 --- a/src/main/java/gregtech/api/gui/UIFactory.java +++ b/src/main/java/gregtech/api/gui/UIFactory.java @@ -5,7 +5,7 @@ import gregtech.api.gui.impl.ModularUIGui; import gregtech.core.network.packets.PacketUIOpen; import gregtech.core.network.packets.PacketUIWidgetUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; @@ -17,11 +17,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import io.netty.buffer.Unpooled; + import java.util.ArrayList; import java.util.List; /** - * Implement and register on the {@link GregTechAPI.RegisterEvent} event to be able to create and open ModularUI's + * Implement and register on the {@link GregTechAPI.RegisterEvent} event to be able to create and open + * ModularUI's * createUITemplate should return equal gui both on server and client side, or sync will break! * * @param UI holder type @@ -50,7 +53,7 @@ public final void openUI(E holder, EntityPlayerMP player) { ModularUIContainer container = new ModularUIContainer(uiTemplate); container.windowId = currentWindowId; - //accumulate all initial updates of widgets in open packet + // accumulate all initial updates of widgets in open packet container.accumulateWidgetUpdateData = true; uiTemplate.guiWidgets.values().forEach(Widget::detectAndSendChanges); container.accumulateWidgetUpdateData = false; @@ -63,12 +66,13 @@ public final void openUI(E holder, EntityPlayerMP player) { container.addListener(player); player.openContainer = container; - //and fire forge event only in the end + // and fire forge event only in the end MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, container)); } @SideOnly(Side.CLIENT) - public final void initClientUI(PacketBuffer serializedHolder, int windowId, List initialWidgetUpdates) { + public final void initClientUI(PacketBuffer serializedHolder, int windowId, + List initialWidgetUpdates) { E holder = readHolderFromSyncData(serializedHolder); Minecraft minecraft = Minecraft.getMinecraft(); EntityPlayerSP entityPlayer = minecraft.player; @@ -92,5 +96,4 @@ public final void initClientUI(PacketBuffer serializedHolder, int windowId, List protected abstract E readHolderFromSyncData(PacketBuffer syncData); protected abstract void writeHolderToSyncData(PacketBuffer syncData, E holder); - } diff --git a/src/main/java/gregtech/api/gui/Widget.java b/src/main/java/gregtech/api/gui/Widget.java index e7fff37b8e2..be7a34b2ebb 100644 --- a/src/main/java/gregtech/api/gui/Widget.java +++ b/src/main/java/gregtech/api/gui/Widget.java @@ -1,10 +1,10 @@ package gregtech.api.gui; -import com.google.common.base.Preconditions; import gregtech.api.gui.widgets.WidgetUIAccess; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; @@ -21,15 +21,18 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.awt.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nullable; + /** * Widget is functional element of ModularUI * It can draw, perform actions, react to key press and mouse @@ -136,11 +139,9 @@ protected void recomputePosition() { onPositionUpdate(); } - protected void onPositionUpdate() { - } + protected void onPositionUpdate() {} - protected void onSizeUpdate() { - } + protected void onSizeUpdate() {} public boolean isMouseOverElement(int mouseX, int mouseY) { Position position = getPosition(); @@ -155,40 +156,34 @@ public static boolean isMouseOver(int x, int y, int width, int height, int mouse /** * Called on both sides to initialize widget data */ - public void initWidget() { - } + public void initWidget() {} /** * Called on serverside to detect changes and synchronize them with clients */ - public void detectAndSendChanges() { - } + public void detectAndSendChanges() {} /** * Called clientside every tick with this modular UI open */ - public void updateScreen() { - } + public void updateScreen() {} /** * Called clientside approximately every 1/60th of a second with this modular UI open */ - public void updateScreenOnFrame() { - } + public void updateScreenOnFrame() {} /** * Called each draw tick to draw this widget in GUI */ @SideOnly(Side.CLIENT) - public void drawInForeground(int mouseX, int mouseY) { - } + public void drawInForeground(int mouseX, int mouseY) {} /** * Called each draw tick to draw this widget in GUI */ @SideOnly(Side.CLIENT) - public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - } + public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {} /** * Called when mouse wheel is moved in GUI @@ -235,11 +230,9 @@ public boolean keyTyped(char charTyped, int keyCode) { * Read data received from server's {@link #writeUpdateInfo} */ @SideOnly(Side.CLIENT) - public void readUpdateInfo(int id, PacketBuffer buffer) { - } + public void readUpdateInfo(int id, PacketBuffer buffer) {} - public void handleClientAction(int id, PacketBuffer buffer) { - } + public void handleClientAction(int id, PacketBuffer buffer) {} public List getNativeWidgets() { if (this instanceof INativeWidget) { @@ -282,7 +275,8 @@ public void drawHoveringText(ItemStack itemStack, List tooltip, int maxT } @SideOnly(Side.CLIENT) - public static void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) { + public static void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, + boolean center) { GlStateManager.pushMatrix(); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; double scaledTextWidth = center ? fontRenderer.getStringWidth(text) * scale : 0.0; @@ -293,7 +287,8 @@ public static void drawStringSized(String text, double x, double y, int color, b } @SideOnly(Side.CLIENT) - public static void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) { + public static void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, + float scale) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; double scaledWidth = fontRenderer.getStringWidth(text) * scale; double scaledHeight = fontRenderer.FONT_HEIGHT * scale; @@ -342,7 +337,8 @@ public static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable St @SideOnly(Side.CLIENT) public static List getItemToolTip(ItemStack itemStack) { Minecraft mc = Minecraft.getMinecraft(); - ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; + ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : + ITooltipFlag.TooltipFlags.NORMAL; List tooltip = itemStack.getTooltip(mc.player, flag); for (int i = 0; i < tooltip.size(); ++i) { if (i == 0) { @@ -380,7 +376,9 @@ public static void drawRectShadow(int x, int y, int width, int height, int dista 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.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -406,7 +404,8 @@ public static void drawGradientRect(int x, int y, int width, int height, int sta } @SideOnly(Side.CLIENT) - public static void drawGradientRect(float x, float y, float width, float height, int startColor, int endColor, boolean horizontal) { + public static void drawGradientRect(float x, float y, float width, float height, int startColor, int endColor, + boolean horizontal) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; @@ -418,7 +417,9 @@ public static void drawGradientRect(float x, float y, float width, float height, 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.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -454,11 +455,14 @@ public static void drawCircle(float x, float y, float r, int color, int segments BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION); for (int i = 0; i < segments; i++) { - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), + y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); } tessellator.draw(); GlStateManager.enableTexture2D(); @@ -473,12 +477,16 @@ public static void drawSector(float x, float y, float r, int color, int segments BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION); for (int i = from; i < to; i++) { - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); - bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * (i + 1) / segments), y + r * Math.sin(-2 * Math.PI * (i + 1) / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * i / segments), + y + r * Math.sin(-2 * Math.PI * i / segments), 0.0D).endVertex(); + bufferbuilder.pos(x + r * Math.cos(-2 * Math.PI * (i + 1) / segments), + y + r * Math.sin(-2 * Math.PI * (i + 1) / segments), 0.0D).endVertex(); bufferbuilder.pos(x, y, 0.0D).endVertex(); } tessellator.draw(); @@ -486,12 +494,15 @@ public static void drawSector(float x, float y, float r, int color, int segments GlStateManager.color(1, 1, 1, 1); } - public static void drawTorus(float x, float y, float outer, float inner, int color, int segments, int from, int to) { + public static void drawTorus(float x, float y, float outer, float inner, int color, int segments, int from, + int to) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); setColor(color); bufferbuilder.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION); for (int i = from; i <= to; i++) { @@ -510,7 +521,9 @@ public static void drawLines(List points, int startColor, int endColor, f BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(width); if (startColor == endColor) { setColor(startColor); @@ -568,7 +581,7 @@ public static List genBezierPoints(Vec2f from, Vec2f to, boolean horizont c1 = new Vec2f(from.x, (from.y + to.y) / 2); c2 = new Vec2f(to.x, (from.y + to.y) / 2); } - Vec2f[] controlPoint = new Vec2f[]{from, c1, c2, to}; + Vec2f[] controlPoint = new Vec2f[] { from, c1, c2, to }; int n = controlPoint.length - 1; int i, r; List bezierPoints = new ArrayList<>(); @@ -589,7 +602,8 @@ public static List genBezierPoints(Vec2f from, Vec2f to, boolean horizont @SideOnly(Side.CLIENT) protected static void playButtonClickSound() { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + Minecraft.getMinecraft().getSoundHandler() + .playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } @SideOnly(Side.CLIENT) @@ -611,6 +625,7 @@ protected static boolean isClientSide() { } public static final class ClickData { + public final int button; public final boolean isShiftClick; public final boolean isCtrlClick; @@ -647,6 +662,7 @@ public static ClickData readFromBuf(PacketBuffer buf) { } public static final class WheelData { + public final int wheelDelta; public final boolean isShiftClick; public final boolean isCtrlClick; @@ -681,5 +697,4 @@ public static WheelData readFromBuf(PacketBuffer buf) { return new WheelData(button, shiftClick, ctrlClick, isClient); } } - } diff --git a/src/main/java/gregtech/api/gui/impl/FakeModularGui.java b/src/main/java/gregtech/api/gui/impl/FakeModularGui.java index 22742ea1602..e244ff9c25a 100644 --- a/src/main/java/gregtech/api/gui/impl/FakeModularGui.java +++ b/src/main/java/gregtech/api/gui/impl/FakeModularGui.java @@ -4,6 +4,7 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -26,12 +27,13 @@ @SideOnly(Side.CLIENT) public class FakeModularGui implements IRenderContext { + public final ModularUI modularUI; public FakeModularGuiContainer container; protected Minecraft mc; protected FontRenderer fr; - public FakeModularGui(ModularUI modularUI, FakeModularGuiContainer fakeModularUIContainer){ + public FakeModularGui(ModularUI modularUI, FakeModularGuiContainer fakeModularUIContainer) { this.modularUI = modularUI; this.container = fakeModularUIContainer; this.modularUI.updateScreenSize(this.modularUI.getWidth(), this.modularUI.getHeight()); @@ -57,11 +59,12 @@ public void drawScreen(double x, double y, float partialTicks) { float halfW = modularUI.getWidth() / 2f; float halfH = modularUI.getHeight() / 2f; float scale = 0.5f / Math.max(halfW, halfH); - int mouseX = (int) ((x / scale) + (halfW > halfH? 0: (halfW - halfH))); - int mouseY = (int) ((y / scale) + (halfH > halfW? 0: (halfH - halfW))); + int mouseX = (int) ((x / scale) + (halfW > halfH ? 0 : (halfW - halfH))); + int mouseY = (int) ((y / scale) + (halfH > halfW ? 0 : (halfH - halfW))); GlStateManager.translate(-scale * halfW, -scale * halfH, 0); GlStateManager.scale(scale, scale, 1); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); modularUI.backgroundPath.draw(0, 0, modularUI.getWidth(), modularUI.getHeight()); GlStateManager.translate(0, 0, 0.001); GlStateManager.depthMask(false); @@ -77,7 +80,8 @@ public void drawScreen(double x, double y, float partialTicks) { for (int i = 0; i < this.container.inventorySlots.size(); ++i) { Slot slot = this.container.inventorySlots.get(i); - if (!slot.getStack().isEmpty() && slot.xPos < mouseX && mouseX < slot.xPos + 18 && slot.yPos < mouseY && mouseY < slot.yPos + 18) { + if (!slot.getStack().isEmpty() && slot.xPos < mouseX && mouseX < slot.xPos + 18 && slot.yPos < mouseY && + mouseY < slot.yPos + 18) { renderToolTip(slot.getStack(), slot.xPos, slot.yPos); } } @@ -98,22 +102,19 @@ public static void renderSlot(Slot slot, FontRenderer fr) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.renderItemAndEffectIntoGUI(stack, 0, 0); renderItem.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, stack, 0, 0, null); - String text = stack.getCount() > 1? Integer.toString(stack.getCount()) : null; + String text = stack.getCount() > 1 ? Integer.toString(stack.getCount()) : null; - if (!stack.isEmpty()) - { - if (stack.getCount() != 1) - { + if (!stack.isEmpty()) { + if (stack.getCount() != 1) { String s = text == null ? String.valueOf(stack.getCount()) : text; GlStateManager.disableLighting(); GlStateManager.disableBlend(); - fr.drawStringWithShadow(s, (float)(17 - fr.getStringWidth(s)), (float)9, 16777215); + fr.drawStringWithShadow(s, (float) (17 - fr.getStringWidth(s)), (float) 9, 16777215); GlStateManager.enableLighting(); GlStateManager.enableBlend(); } - if (stack.getItem().showDurabilityBar(stack)) - { + if (stack.getItem().showDurabilityBar(stack)) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.disableAlpha(); @@ -122,9 +123,10 @@ public static void renderSlot(Slot slot, FontRenderer fr) { BufferBuilder bufferbuilder = tessellator.getBuffer(); double health = stack.getItem().getDurabilityForDisplay(stack); int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack); - int i = Math.round(13.0F - (float)health * 13.0F); + int i = Math.round(13.0F - (float) health * 13.0F); draw(bufferbuilder, 2, 13, 13, 2, 0, 0, 0, 255); - draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, rgbfordisplay & 255, 255); + draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, + rgbfordisplay & 255, 255); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); @@ -132,15 +134,16 @@ public static void renderSlot(Slot slot, FontRenderer fr) { } EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player; - float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks()); + float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker() + .getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks()); - if (f3 > 0.0F) - { + if (f3 > 0.0F) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - draw(bufferBuilder, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127); + draw(bufferBuilder, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, + 255, 255, 127); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); } @@ -151,8 +154,8 @@ public static void renderSlot(Slot slot, FontRenderer fr) { } } - private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) - { + private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, + int alpha) { renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); renderer.pos(x, y, 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((x), y + height, 0.0D).color(red, green, blue, alpha).endVertex(); @@ -164,12 +167,14 @@ private static void draw(BufferBuilder renderer, int x, int y, int width, int he protected void renderToolTip(ItemStack stack, int x, int y) { FontRenderer font = stack.getItem().getFontRenderer(stack); GuiUtils.preItemToolTip(stack); - GuiUtils.drawHoveringText(this.getItemToolTip(stack), x, y, modularUI.getScreenWidth(), modularUI.getScreenHeight(), -1, (font == null ? fr : font)); + GuiUtils.drawHoveringText(this.getItemToolTip(stack), x, y, modularUI.getScreenWidth(), + modularUI.getScreenHeight(), -1, (font == null ? fr : font)); net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); } protected List getItemToolTip(ItemStack itemStack) { - List list = itemStack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); + List list = itemStack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? + ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); list.set(0, itemStack.getItem().getForgeRarity(itemStack).getColor() + list.get(0)); for (int i = 1; i < list.size(); ++i) { list.set(i, TextFormatting.GRAY + list.get(i)); @@ -178,10 +183,12 @@ protected List getItemToolTip(ItemStack itemStack) { } public void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); for (Widget widget : modularUI.guiWidgets.values()) { GlStateManager.pushMatrix(); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay()); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay()); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); widget.drawInBackground(mouseX, mouseY, partialTicks, this); @@ -202,7 +209,8 @@ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { public void mouseClicked(int mouseX, int mouseY, int mouseButton) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && !(widget instanceof INativeWidget) && widget.mouseClicked(mouseX, mouseY, mouseButton)) { + if (widget.isVisible() && widget.isActive() && !(widget instanceof INativeWidget) && + widget.mouseClicked(mouseX, mouseY, mouseButton)) { return; } } diff --git a/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java b/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java index b86ff057c92..150a28c245f 100644 --- a/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java +++ b/src/main/java/gregtech/api/gui/impl/FakeModularGuiContainer.java @@ -1,18 +1,21 @@ package gregtech.api.gui.impl; -import com.google.common.collect.Lists; import gregtech.api.gui.INativeWidget; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.WidgetUIAccess; + import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.NonNullList; +import com.google.common.collect.Lists; + import java.util.List; public abstract class FakeModularGuiContainer implements WidgetUIAccess { + protected final NonNullList inventoryItemStacks = NonNullList.create(); public final List inventorySlots = Lists.newArrayList(); public final ModularUI modularUI; @@ -22,7 +25,8 @@ public FakeModularGuiContainer(ModularUI modularUI) { this.modularUI = modularUI; modularUI.initWidgets(); modularUI.guiWidgets.values().forEach(widget -> widget.setUiAccess(this)); - modularUI.guiWidgets.values().stream().flatMap(widget -> widget.getNativeWidgets().stream()).forEach(nativeWidget -> addSlotToContainer(nativeWidget.getHandle())); + modularUI.guiWidgets.values().stream().flatMap(widget -> widget.getNativeWidgets().stream()) + .forEach(nativeWidget -> addSlotToContainer(nativeWidget.getHandle())); modularUI.triggerOpenListeners(); } @@ -38,7 +42,7 @@ public void handleSlotUpdate(PacketBuffer updateData) { for (int i = 0; i < size; i++) { inventorySlots.get(updateData.readVarInt()).putStack(updateData.readItemStack()); } - } catch (Exception ignored){ + } catch (Exception ignored) { } } @@ -58,14 +62,10 @@ public void handleClientAction(PacketBuffer buffer) { public abstract void detectAndSendChanges(); @Override - public void notifySizeChange() { - - } + public void notifySizeChange() {} @Override - public void notifyWidgetChange() { - - } + public void notifyWidgetChange() {} @Override public boolean attemptMergeStack(ItemStack itemStack, boolean b, boolean b1) { @@ -73,10 +73,8 @@ public boolean attemptMergeStack(ItemStack itemStack, boolean b, boolean b1) { } @Override - public void sendSlotUpdate(INativeWidget iNativeWidget) { - } + public void sendSlotUpdate(INativeWidget iNativeWidget) {} @Override - public void sendHeldItemUpdate() { - } + public void sendHeldItemUpdate() {} } diff --git a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java index d235f53d8fe..de6753738cd 100644 --- a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java +++ b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java @@ -10,7 +10,7 @@ import gregtech.api.util.PerTickIntCounter; import gregtech.core.network.packets.PacketUIClientAction; import gregtech.core.network.packets.PacketUIWidgetUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -19,11 +19,14 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketSetSlot; -import javax.annotation.Nonnull; +import io.netty.buffer.Unpooled; + import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class ModularUIContainer extends Container implements WidgetUIAccess { protected final HashMap slotMap = new HashMap<>(); @@ -46,11 +49,10 @@ public ModularUIContainer(ModularUI modularUI) { } @Override - public void notifySizeChange() { - } + public void notifySizeChange() {} - //WARNING! WIDGET CHANGES SHOULD BE *STRICTLY* SYNCHRONIZED BETWEEN SERVER AND CLIENT, - //OTHERWISE ID MISMATCH CAN HAPPEN BETWEEN ASSIGNED SLOTS! + // WARNING! WIDGET CHANGES SHOULD BE *STRICTLY* SYNCHRONIZED BETWEEN SERVER AND CLIENT, + // OTHERWISE ID MISMATCH CAN HAPPEN BETWEEN ASSIGNED SLOTS! @Override public void notifyWidgetChange() { List nativeWidgets = modularUI.guiWidgets.values().stream() @@ -63,7 +65,7 @@ public void notifyWidgetChange() { for (INativeWidget removedWidget : removedWidgets) { Slot slotHandle = removedWidget.getHandle(); this.slotMap.remove(slotHandle); - //replace removed slot with empty placeholder to avoid list index shift + // replace removed slot with empty placeholder to avoid list index shift EmptySlotPlaceholder emptySlotPlaceholder = new EmptySlotPlaceholder(); emptySlotPlaceholder.slotNumber = slotHandle.slotNumber; this.inventorySlots.set(slotHandle.slotNumber, emptySlotPlaceholder); @@ -80,7 +82,7 @@ public void notifyWidgetChange() { int currentIndex = 0; for (INativeWidget addedWidget : addedWidgets) { Slot slotHandle = addedWidget.getHandle(); - //add or replace empty slot in inventory + // add or replace empty slot in inventory this.slotMap.put(slotHandle, addedWidget); if (currentIndex < emptySlotIndexes.length) { int slotIndex = emptySlotIndexes[currentIndex++]; @@ -187,7 +189,7 @@ public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { return ItemStack.EMPTY; } if (!slot.getHasStack()) { - //return empty if we can't transfer it + // return empty if we can't transfer it return ItemStack.EMPTY; } ItemStack stackInSlot = slot.getStack(); @@ -200,17 +202,17 @@ public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { if (stackToMerge.isEmpty() || slotMap.get(slot).canMergeSlot(stackToMerge)) { itemsMerged = stackInSlot.getCount() - stackToMerge.getCount(); } else { - //if we can't have partial stack merge, we have to use all the stack + // if we can't have partial stack merge, we have to use all the stack itemsMerged = stackInSlot.getCount(); } int itemsToExtract = itemsMerged; itemsMerged += transferredPerTick.get(player.world); if (itemsMerged > stackInSlot.getMaxStackSize()) { - //we can merge at most one stack at a time + // we can merge at most one stack at a time return ItemStack.EMPTY; } transferredPerTick.increment(player.world, itemsToExtract); - //otherwise, perform extraction and merge + // otherwise, perform extraction and merge ItemStack extractedStack = stackInSlot.splitStack(itemsToExtract); if (stackInSlot.isEmpty()) { slot.putStack(ItemStack.EMPTY); @@ -281,8 +283,7 @@ public ItemStack getStack() { } @Override - public void putStack(@Nonnull ItemStack stack) { - } + public void putStack(@Nonnull ItemStack stack) {} @Override public boolean isItemValid(@Nonnull ItemStack stack) { diff --git a/src/main/java/gregtech/api/gui/impl/ModularUIGui.java b/src/main/java/gregtech/api/gui/impl/ModularUIGui.java index 7bedb941f0e..c1aeb1ac8f4 100644 --- a/src/main/java/gregtech/api/gui/impl/ModularUIGui.java +++ b/src/main/java/gregtech/api/gui/impl/ModularUIGui.java @@ -5,6 +5,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.core.network.packets.PacketUIWidgetUpdate; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; @@ -16,6 +17,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.event.GuiContainerEvent; import net.minecraftforge.common.MinecraftForge; + import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -26,7 +28,7 @@ public class ModularUIGui extends GuiContainer implements IRenderContext { private final ModularUI modularUI; - public static final float FRAMES_PER_TICK = 1/3f; + public static final float FRAMES_PER_TICK = 1 / 3f; private float lastUpdate; @@ -134,7 +136,6 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { renderHoveredToolTip(mouseX, mouseY); } - public void setHoveredSlot(Slot hoveredSlot) { this.hoveredSlot = hoveredSlot; } @@ -170,7 +171,7 @@ private void renderItemStackOnMouse(int mouseX, int mouseY) { itemStack.setCount(this.dragSplittingRemnant); } // This null is eventually nullable, 2 calls deep - //noinspection DataFlowIssue + // noinspection DataFlowIssue this.drawItemStack(itemStack, mouseX - guiLeft - 8, mouseY - guiTop - dragOffset, null); } } @@ -186,7 +187,7 @@ private void renderReturningItemStack() { int deltaY = this.returningStackDestSlot.yPos - this.touchUpY; int currentX = this.touchUpX + (int) ((float) deltaX * partialTicks); int currentY = this.touchUpY + (int) ((float) deltaY * partialTicks); - //noinspection ConstantConditions + // noinspection ConstantConditions this.drawItemStack(this.returningStack, currentX, currentY, null); } } @@ -205,7 +206,8 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.pushMatrix(); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); GlStateManager.enableBlend(); GlStateManager.popMatrix(); modularUI.backgroundPath.draw(guiLeft, guiTop, xSize, ySize); @@ -213,8 +215,9 @@ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, i if (!widget.isVisible()) return; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); - widget.drawInBackground(mouseX, mouseY, partialTicks,this); - GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), modularUI.getBColorForOverlay(), 1.0F); + widget.drawInBackground(mouseX, mouseY, partialTicks, this); + GlStateManager.color(modularUI.getRColorForOverlay(), modularUI.getGColorForOverlay(), + modularUI.getBColorForOverlay(), 1.0F); GlStateManager.popMatrix(); }); } @@ -233,7 +236,7 @@ public void handleMouseInput() throws IOException { protected void mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) { + if (widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) { return; } } @@ -251,7 +254,7 @@ public boolean getDragSplitting() { protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, mouseButton)) { + if (widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, mouseButton)) { return; } } @@ -260,14 +263,15 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { public void superMouseClicked(int mouseX, int mouseY, int mouseButton) { try { super.mouseClicked(mouseX, mouseY, mouseButton); - } catch (Exception ignored) { } + } catch (Exception ignored) {} } @Override protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)) { + if (widget.isVisible() && widget.isActive() && + widget.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)) { return; } } @@ -281,7 +285,7 @@ public void superMouseClickMove(int mouseX, int mouseY, int clickedMouseButton, protected void mouseReleased(int mouseX, int mouseY, int state) { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, state)) { + if (widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, state)) { return; } } @@ -295,7 +299,7 @@ public void superMouseReleased(int mouseX, int mouseY, int state) { protected void keyTyped(char typedChar, int keyCode) throws IOException { for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) { Widget widget = modularUI.guiWidgets.get(i); - if(widget.isVisible() && widget.isActive() && widget.keyTyped(typedChar, keyCode)) { + if (widget.isVisible() && widget.isActive() && widget.keyTyped(typedChar, keyCode)) { return; } } diff --git a/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java b/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java index 7ac592b8dd3..03c569c6d33 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java +++ b/src/main/java/gregtech/api/gui/ingredient/IGhostIngredientTarget.java @@ -7,5 +7,4 @@ public interface IGhostIngredientTarget { List> getPhantomTargets(Object ingredient); - } diff --git a/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java b/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java index cff05cbf6c2..0ac1ab8f4d6 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java +++ b/src/main/java/gregtech/api/gui/ingredient/IIngredientSlot.java @@ -3,5 +3,4 @@ public interface IIngredientSlot { Object getIngredientOverMouse(int mouseX, int mouseY); - } diff --git a/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java b/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java index aef53bf91e8..21d87be00cf 100644 --- a/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java +++ b/src/main/java/gregtech/api/gui/ingredient/IRecipeTransferHandlerWidget.java @@ -1,10 +1,13 @@ package gregtech.api.gui.ingredient; import gregtech.api.gui.impl.ModularUIContainer; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; +import mezz.jei.api.gui.IRecipeLayout; + public interface IRecipeTransferHandlerWidget { - String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer); + String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer); } diff --git a/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java b/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java index 01fbe3509a7..90bcd67f56e 100644 --- a/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/AdoptableTextureArea.java @@ -1,6 +1,7 @@ package gregtech.api.gui.resources; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public class AdoptableTextureArea extends SizedTextureArea { @@ -8,38 +9,48 @@ public class AdoptableTextureArea extends SizedTextureArea { private final int pixelCornerWidth; private final int pixelCornerHeight; - public AdoptableTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, double pixelImageWidth, double pixelImageHeight, int pixelCornerWidth, int pixelCornerHeight) { + public AdoptableTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, + double height, double pixelImageWidth, double pixelImageHeight, int pixelCornerWidth, + int pixelCornerHeight) { super(imageLocation, offsetX, offsetY, width, height, pixelImageWidth, pixelImageHeight); this.pixelCornerWidth = pixelCornerWidth; this.pixelCornerHeight = pixelCornerHeight; } - public static AdoptableTextureArea fullImage(String imageLocation, int imageWidth, int imageHeight, int cornerWidth, int cornerHeight) { - return new AdoptableTextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0, imageWidth, imageHeight, cornerWidth, cornerHeight); + public static AdoptableTextureArea fullImage(String imageLocation, int imageWidth, int imageHeight, int cornerWidth, + int cornerHeight) { + return new AdoptableTextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0, imageWidth, + imageHeight, cornerWidth, cornerHeight); } @Override - public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { - //compute relative sizes + public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, + double drawnWidth, double drawnHeight) { + // compute relative sizes double cornerWidth = pixelCornerWidth / pixelImageWidth; double cornerHeight = pixelCornerHeight / pixelImageHeight; - //draw up corners + // draw up corners super.drawSubArea(x, y, pixelCornerWidth, pixelCornerHeight, 0.0, 0.0, cornerWidth, cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 0.0, cornerWidth, cornerHeight); - //draw down corners - super.drawSubArea(x, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 0.0, 1.0 - cornerHeight, cornerWidth, cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 1.0 - cornerHeight, cornerWidth, cornerHeight); - //draw horizontal connections + super.drawSubArea(x + width - pixelCornerWidth, y, pixelCornerWidth, pixelCornerHeight, 1.0 - cornerWidth, 0.0, + cornerWidth, cornerHeight); + // draw down corners + super.drawSubArea(x, y + height - pixelCornerHeight, pixelCornerWidth, pixelCornerHeight, 0.0, + 1.0 - cornerHeight, cornerWidth, cornerHeight); + super.drawSubArea(x + width - pixelCornerWidth, y + height - pixelCornerHeight, pixelCornerWidth, + pixelCornerHeight, 1.0 - cornerWidth, 1.0 - cornerHeight, cornerWidth, cornerHeight); + // draw horizontal connections super.drawSubArea(x + pixelCornerWidth, y, width - 2 * pixelCornerWidth, pixelCornerHeight, cornerWidth, 0.0, 1.0 - 2 * cornerWidth, cornerHeight); - super.drawSubArea(x + pixelCornerWidth, y + height - pixelCornerHeight, width - 2 * pixelCornerWidth, pixelCornerHeight, + super.drawSubArea(x + pixelCornerWidth, y + height - pixelCornerHeight, width - 2 * pixelCornerWidth, + pixelCornerHeight, cornerWidth, 1.0 - cornerHeight, 1.0 - 2 * cornerWidth, cornerHeight); - //draw vertical connections + // draw vertical connections super.drawSubArea(x, y + pixelCornerHeight, pixelCornerWidth, height - 2 * pixelCornerHeight, 0.0, cornerHeight, cornerWidth, 1.0 - 2 * cornerHeight); - super.drawSubArea(x + width - pixelCornerWidth, y + pixelCornerHeight, pixelCornerWidth, height - 2 * pixelCornerHeight, + super.drawSubArea(x + width - pixelCornerWidth, y + pixelCornerHeight, pixelCornerWidth, + height - 2 * pixelCornerHeight, 1.0 - cornerWidth, cornerHeight, cornerWidth, 1.0 - 2 * cornerHeight); - //draw central body + // draw central body super.drawSubArea(x + pixelCornerWidth, y + pixelCornerHeight, width - 2 * pixelCornerWidth, height - 2 * pixelCornerHeight, cornerWidth, cornerHeight, 1.0 - 2 * cornerWidth, 1.0 - 2 * cornerHeight); diff --git a/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java b/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java index b1ae34250df..f27e41b2965 100644 --- a/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ColorRectTexture.java @@ -7,7 +7,8 @@ import java.awt.*; -public class ColorRectTexture implements IGuiTexture{ +public class ColorRectTexture implements IGuiTexture { + public int color; public ColorRectTexture(int color) { @@ -42,15 +43,17 @@ public void draw(double x, double y, int width, int height) { y = bottom; bottom = j; } - float f3 = (float)(color >> 24 & 255) / 255.0F; - float f = (float)(color >> 16 & 255) / 255.0F; - float f1 = (float)(color >> 8 & 255) / 255.0F; - float f2 = (float)(color & 255) / 255.0F; + float f3 = (float) (color >> 24 & 255) / 255.0F; + float f = (float) (color >> 16 & 255) / 255.0F; + float f1 = (float) (color >> 8 & 255) / 255.0F; + float f2 = (float) (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.color(f, f1, f2, f3); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); bufferbuilder.pos(x, bottom, 0.0D).endVertex(); diff --git a/src/main/java/gregtech/api/gui/resources/FileTexture.java b/src/main/java/gregtech/api/gui/resources/FileTexture.java index 94cac96e4f2..cd8a397a47b 100644 --- a/src/main/java/gregtech/api/gui/resources/FileTexture.java +++ b/src/main/java/gregtech/api/gui/resources/FileTexture.java @@ -7,19 +7,23 @@ import gregtech.api.gui.resources.utils.GifDecoder; import gregtech.api.gui.resources.utils.ImageUtils; import gregtech.api.gui.resources.utils.ProcessedImageData; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.compress.utils.IOUtils; -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -public class FileTexture implements IGuiTexture{ +import javax.imageio.ImageIO; + +public class FileTexture implements IGuiTexture { + public final File file; @SideOnly(Side.CLIENT) private PictureTexture texture; @@ -33,7 +37,7 @@ public FileTexture(File file) { } @SideOnly(Side.CLIENT) - public void loadFile(){ + public void loadFile() { if (imageData != null) { if (imageData.isAnimated()) { texture = new AnimatedPictureTexture(imageData); @@ -83,7 +87,7 @@ public void loadFile(){ @SideOnly(Side.CLIENT) @Override public void updateTick() { - if(this.texture != null) { + if (this.texture != null) { texture.tick(); // gif\video update } } @@ -91,17 +95,18 @@ public void updateTick() { @Override public void draw(double x, double y, int width, int height) { if (texture != null && texture.hasTexture()) { - texture.render((float)x, (float)y, width, height, 0, 1, 1, false, false); + texture.render((float) x, (float) y, width, height, 0, 1, 1, false, false); } else { if (failed || file == null) { - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int)x + 2, (int)(y + height / 2.0 - 4), 0xffff0000); + Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int) x + 2, + (int) (y + height / 2.0 - 4), 0xffff0000); } else { this.loadFile(); int s = (int) Math.floorMod(System.currentTimeMillis() / 200, 24); - Widget.drawSector((float)(x + width / 2.0), (float)(y + height / 2.0), (float)(Math.min(width, height) / 4.0), + Widget.drawSector((float) (x + width / 2.0), (float) (y + height / 2.0), + (float) (Math.min(width, height) / 4.0), 0xFF94E2C1, 24, s, s + 5); } } } - } diff --git a/src/main/java/gregtech/api/gui/resources/IGuiTexture.java b/src/main/java/gregtech/api/gui/resources/IGuiTexture.java index 4c0355e2780..cd9e81cd79a 100644 --- a/src/main/java/gregtech/api/gui/resources/IGuiTexture.java +++ b/src/main/java/gregtech/api/gui/resources/IGuiTexture.java @@ -1,7 +1,10 @@ package gregtech.api.gui.resources; public interface IGuiTexture { + void draw(double x, double y, int width, int height); - default void updateTick() { } + + default void updateTick() {} + IGuiTexture EMPTY = (x, y, width, height) -> {}; } diff --git a/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java b/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java index 5718ab90a77..901a1b1aad1 100644 --- a/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ItemStackTexture.java @@ -7,7 +7,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemStackTexture implements IGuiTexture{ +public class ItemStackTexture implements IGuiTexture { + private final ItemStack[] itemStack; private int index = 0; private int ticks = 0; @@ -21,15 +22,15 @@ public ItemStackTexture(ItemStack stack, ItemStack... itemStack) { public ItemStackTexture(Item item, Item... items) { this.itemStack = new ItemStack[items.length + 1]; this.itemStack[0] = new ItemStack(item); - for(int i = 0; i < items.length; i++) { - itemStack[i+1] = new ItemStack(items[i]); + for (int i = 0; i < items.length; i++) { + itemStack[i + 1] = new ItemStack(items[i]); } } @Override public void updateTick() { - if(itemStack.length > 1 && ++ticks % 20 == 0) - if(++index == itemStack.length) + if (itemStack.length > 1 && ++ticks % 20 == 0) + if (++index == itemStack.length) index = 0; } diff --git a/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java b/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java index bcd378396f7..302650df8f5 100644 --- a/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ModifyGuiTexture.java @@ -1,13 +1,15 @@ package gregtech.api.gui.resources; -import com.google.gson.JsonObject; import net.minecraft.util.ResourceLocation; +import com.google.gson.JsonObject; + import java.io.File; import java.util.Arrays; import java.util.List; -public class ModifyGuiTexture implements IGuiTexture{ +public class ModifyGuiTexture implements IGuiTexture { + public static List TYPES = Arrays.asList("resource", "url", "text", "color", "file"); private IGuiTexture texture; @@ -74,7 +76,7 @@ public JsonObject saveConfig() { if (((FileTexture) texture).file != null) { config.addProperty("file", ((FileTexture) texture).file.getPath()); } else { - config.addProperty("file", (String)null); + config.addProperty("file", (String) null); } } else { return null; @@ -86,7 +88,8 @@ public void loadConfig(JsonObject config) { try { switch (config.get("type").getAsString()) { case "resource": - setTexture(new TextureArea(new ResourceLocation(config.get("resource").getAsString()), 0.0, 0.0, 1.0, 1.0)); + setTexture(new TextureArea(new ResourceLocation(config.get("resource").getAsString()), 0.0, 0.0, + 1.0, 1.0)); case "url": setTexture(new URLTexture(config.get("url").getAsString())); case "text": @@ -96,7 +99,6 @@ public void loadConfig(JsonObject config) { case "file": setTexture(new FileTexture(new File(config.get("file").getAsString()))); } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } diff --git a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java index a93fe233937..7dd56f551f4 100644 --- a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java +++ b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java @@ -2,20 +2,23 @@ import gregtech.api.GTValues; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.io.IOUtils; -import javax.annotation.Nonnull; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + /** * Original copied from com.brandon3055.draconicevolution.helpers; *

@@ -69,7 +72,8 @@ public static boolean isResourceExist(String rs) { * @return if the resource exists */ @SideOnly(Side.CLIENT) - public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull String textureResource, boolean format) { + public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull String textureResource, + boolean format) { if (format) textureResource = String.format(DIR_FORMAT, textureResource); return doResourcepacksHaveResource(modid, textureResource); } diff --git a/src/main/java/gregtech/api/gui/resources/ShaderTexture.java b/src/main/java/gregtech/api/gui/resources/ShaderTexture.java index bb267a3b117..589dae4078a 100644 --- a/src/main/java/gregtech/api/gui/resources/ShaderTexture.java +++ b/src/main/java/gregtech/api/gui/resources/ShaderTexture.java @@ -1,35 +1,36 @@ package gregtech.api.gui.resources; -import codechicken.lib.render.shader.ShaderObject; -import codechicken.lib.render.shader.ShaderProgram; import gregtech.api.gui.Widget; import gregtech.client.shader.Shaders; import gregtech.common.ConfigHolder; + import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.shader.ShaderObject; +import codechicken.lib.render.shader.ShaderProgram; + import java.util.HashMap; import java.util.Map; import java.util.function.Consumer; -public class ShaderTexture implements IGuiTexture{ +public class ShaderTexture implements IGuiTexture { + @SideOnly(Side.CLIENT) private static final Map PROGRAMS = new HashMap<>(); @SideOnly(Side.CLIENT) private ShaderProgram program; @SideOnly(Side.CLIENT) private ShaderObject object; - private float resolution = (float)ConfigHolder.client.resolution; + private float resolution = (float) ConfigHolder.client.resolution; - public static void clear(){ + public static void clear() { PROGRAMS.values().forEach(ShaderTexture::dispose); PROGRAMS.clear(); } - private ShaderTexture() { - - } + private ShaderTexture() {} public void dispose() { if (object != null) { @@ -96,7 +97,7 @@ public void draw(double x, double y, int width, int height) { public void draw(double x, double y, int width, int height, Consumer uniformCache) { if (program != null) { - program.useShader(cache->{ + program.useShader(cache -> { cache.glUniform2F("u_resolution", width * resolution, height * resolution); if (uniformCache != null) { uniformCache.accept(cache); diff --git a/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java b/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java index 4ce47aac5e7..fb0a22b85b6 100644 --- a/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/SizedTextureArea.java @@ -1,6 +1,7 @@ package gregtech.api.gui.resources; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public class SizedTextureArea extends TextureArea { @@ -8,7 +9,8 @@ public class SizedTextureArea extends TextureArea { public final double pixelImageWidth; public final double pixelImageHeight; - public SizedTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, double pixelImageWidth, double pixelImageHeight) { + public SizedTextureArea(ResourceLocation imageLocation, double offsetX, double offsetY, double width, double height, + double pixelImageWidth, double pixelImageHeight) { super(imageLocation, offsetX, offsetY, width, height); this.pixelImageWidth = pixelImageWidth; this.pixelImageHeight = pixelImageHeight; diff --git a/src/main/java/gregtech/api/gui/resources/SteamTexture.java b/src/main/java/gregtech/api/gui/resources/SteamTexture.java index 6b50a93823a..df10c63603b 100644 --- a/src/main/java/gregtech/api/gui/resources/SteamTexture.java +++ b/src/main/java/gregtech/api/gui/resources/SteamTexture.java @@ -20,18 +20,19 @@ private SteamTexture(TextureArea bronzeTexture, TextureArea steelTexture) { public static SteamTexture fullImage(String path) { return new SteamTexture( TextureArea.fullImage(String.format(path, BRONZE)), - TextureArea.fullImage(String.format(path, STEEL)) - ); + TextureArea.fullImage(String.format(path, STEEL))); } - public static SteamTexture fullImage(String path, int imageWidth, int imageHeight, int cornerWidth, int cornerHeight) { + public static SteamTexture fullImage(String path, int imageWidth, int imageHeight, int cornerWidth, + int cornerHeight) { return new SteamTexture( - AdoptableTextureArea.fullImage(String.format(path, BRONZE), imageWidth, imageHeight, cornerWidth, cornerHeight), - AdoptableTextureArea.fullImage(String.format(path, STEEL), imageWidth, imageHeight, cornerWidth, cornerHeight) - ); + AdoptableTextureArea.fullImage(String.format(path, BRONZE), imageWidth, imageHeight, cornerWidth, + cornerHeight), + AdoptableTextureArea.fullImage(String.format(path, STEEL), imageWidth, imageHeight, cornerWidth, + cornerHeight)); } public TextureArea get(boolean isHighPressure) { - return isHighPressure ? steelTexture : bronzeTexture; + return isHighPressure ? steelTexture : bronzeTexture; } } diff --git a/src/main/java/gregtech/api/gui/resources/TextTexture.java b/src/main/java/gregtech/api/gui/resources/TextTexture.java index 507851d9a31..19928d07c8b 100644 --- a/src/main/java/gregtech/api/gui/resources/TextTexture.java +++ b/src/main/java/gregtech/api/gui/resources/TextTexture.java @@ -11,7 +11,8 @@ import java.util.Collections; import java.util.List; -public class TextTexture implements IGuiTexture{ +public class TextTexture implements IGuiTexture { + public String text; public int color; public int width; @@ -87,7 +88,7 @@ public void draw(double x, double y, int width, int height) { GlStateManager.color(1, 1, 1, 1); } - public enum TextType{ + public enum TextType { NORMAL, HIDE, ROLL diff --git a/src/main/java/gregtech/api/gui/resources/TextureArea.java b/src/main/java/gregtech/api/gui/resources/TextureArea.java index de56ae56591..1466759d646 100644 --- a/src/main/java/gregtech/api/gui/resources/TextureArea.java +++ b/src/main/java/gregtech/api/gui/resources/TextureArea.java @@ -1,13 +1,10 @@ package gregtech.api.gui.resources; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Translation; -import codechicken.lib.vec.Vector3; import gregtech.api.util.GTUtility; import gregtech.api.util.Position; import gregtech.api.util.PositionedRect; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Rotation; +import codechicken.lib.vec.Transformation; +import codechicken.lib.vec.Translation; +import codechicken.lib.vec.Vector3; + /** * Represents a texture area of image * This representation doesn't take image size in account, so all image variables are @@ -44,7 +46,8 @@ public static TextureArea fullImage(String imageLocation) { return new TextureArea(GTUtility.gregtechId(imageLocation), 0.0, 0.0, 1.0, 1.0); } - public static TextureArea areaOfImage(String imageLocation, int imageSizeX, int imageSizeY, int u, int v, int width, int height) { + public static TextureArea areaOfImage(String imageLocation, int imageSizeX, int imageSizeY, int u, int v, int width, + int height) { return new TextureArea(new ResourceLocation(imageLocation), u / (imageSizeX * 1.0), v / (imageSizeY * 1.0), @@ -66,7 +69,8 @@ public void drawRotated(int x, int y, Size areaSize, PositionedRect positionedRe GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 0.0f); transformation.glApply(); - draw(positionedRect.position.x, positionedRect.position.y, positionedRect.size.width, positionedRect.size.height); + draw(positionedRect.position.x, positionedRect.position.y, positionedRect.size.width, + positionedRect.size.height); GlStateManager.popMatrix(); } @@ -106,8 +110,9 @@ public void draw(double x, double y, int width, int height) { } @SideOnly(Side.CLIENT) - public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { - //sub area is just different width and height + public void drawSubArea(double x, double y, double width, double height, double drawnU, double drawnV, + double drawnWidth, double drawnHeight) { + // sub area is just different width and height double imageU = this.offsetX + (this.imageWidth * drawnU); double imageV = this.offsetY + (this.imageHeight * drawnV); double imageWidth = this.imageWidth * drawnWidth; diff --git a/src/main/java/gregtech/api/gui/resources/URLTexture.java b/src/main/java/gregtech/api/gui/resources/URLTexture.java index ef101d59b41..80a7a9630e1 100644 --- a/src/main/java/gregtech/api/gui/resources/URLTexture.java +++ b/src/main/java/gregtech/api/gui/resources/URLTexture.java @@ -3,12 +3,14 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.picturetexture.PictureTexture; import gregtech.api.gui.resources.utils.DownloadThread; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class URLTexture implements IGuiTexture{ +public class URLTexture implements IGuiTexture { + public final String url; @SideOnly(Side.CLIENT) private DownloadThread downloader; @@ -19,7 +21,6 @@ public class URLTexture implements IGuiTexture{ @SideOnly(Side.CLIENT) private String error; - public URLTexture(String url) { this.url = url; } @@ -27,7 +28,7 @@ public URLTexture(String url) { @SideOnly(Side.CLIENT) @Override public void updateTick() { - if(this.texture != null) { + if (this.texture != null) { texture.tick(); // gif\video update } } @@ -35,14 +36,16 @@ public void updateTick() { @Override public void draw(double x, double y, int width, int height) { if (texture != null && texture.hasTexture()) { - texture.render((float)x, (float)y, width, height, 0, 1, 1, false, false); + texture.render((float) x, (float) y, width, height, 0, 1, 1, false, false); } else { if (failed || url == null || this.url.isEmpty()) { - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int)x + 2, (int)(y + height / 2.0 - 4), 0xffff0000); + Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("texture.url_texture.fail"), (int) x + 2, + (int) (y + height / 2.0 - 4), 0xffff0000); } else { this.loadTexture(); int s = (int) Math.floorMod(System.currentTimeMillis() / 200, 24); - Widget.drawSector((float)(x + width / 2.0), (float)(y + height / 2.0), (float)(Math.min(width, height) / 4.0), + Widget.drawSector((float) (x + width / 2.0), (float) (y + height / 2.0), + (float) (Math.min(width, height) / 4.0), 0xFF94E2C1, 24, s, s + 5); } } diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java index a8b4526edef..3020f361f5e 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/AnimatedPictureTexture.java @@ -1,12 +1,13 @@ package gregtech.api.gui.resources.picturetexture; - import gregtech.api.gui.resources.utils.ProcessedImageData; + import net.minecraft.client.renderer.GlStateManager; import java.util.Arrays; public class AnimatedPictureTexture extends PictureTexture { + private final int[] textureIDs; private final long[] delay; private final long duration; @@ -28,7 +29,8 @@ public void tick() { if (imageData != null) { long startTime = System.currentTimeMillis(); int index = 0; - while (completedFrames < textureIDs.length && index < textureIDs.length && System.currentTimeMillis() - startTime < 10) { + while (completedFrames < textureIDs.length && index < textureIDs.length && + System.currentTimeMillis() - startTime < 10) { while (textureIDs[index] != -1 && index < textureIDs.length - 1) index++; if (textureIDs[index] == -1) diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java index 31d2e2a3983..deeff304937 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/OrdinaryTexture.java @@ -12,12 +12,10 @@ public OrdinaryTexture(ProcessedImageData image) { } @Override - public void tick() { - } + public void tick() {} @Override public int getTextureID() { return textureID; } } - diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java index 8d614fbecac..8ecd30be847 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/PictureTexture.java @@ -1,32 +1,33 @@ package gregtech.api.gui.resources.picturetexture; import gregtech.api.gui.resources.IGuiTexture; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; + import org.lwjgl.opengl.GL11; public abstract class PictureTexture implements IGuiTexture { + public int width; public int height; public PictureTexture(int width, int height) { this.width = width; this.height = height; - } - public void beforeRender() { - - } + public void beforeRender() {} @Override public void draw(double x, double y, int width, int height) { - render((float)x, (float)y, 1, 1, 0, width, height, false, false); + render((float) x, (float) y, 1, 1, 0, width, height, false, false); } - public void render(float x, float y, float width, float height, float rotation, float scaleX, float scaleY, boolean flippedX, boolean flippedY) { + public void render(float x, float y, float width, float height, float rotation, float scaleX, float scaleY, + boolean flippedX, boolean flippedY) { this.beforeRender(); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); GlStateManager.enableBlend(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GlStateManager.bindTexture(this.getTextureID()); diff --git a/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java b/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java index 70f1dc7aebf..ac1b631c03f 100644 --- a/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java +++ b/src/main/java/gregtech/api/gui/resources/picturetexture/VideoTexture.java @@ -1,17 +1,15 @@ package gregtech.api.gui.resources.picturetexture; public class VideoTexture extends PictureTexture { - //TODO implementations of it in the future + // TODO implementations of it in the future public VideoTexture(String url) { super(100, 100); } - + @Override - public void tick() { - - } - + public void tick() {} + @Override public int getTextureID() { return 0; diff --git a/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java b/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java index e9685bbf694..962c2639489 100644 --- a/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java +++ b/src/main/java/gregtech/api/gui/resources/utils/DownloadThread.java @@ -5,12 +5,13 @@ import gregtech.api.gui.resources.picturetexture.PictureTexture; import gregtech.api.gui.resources.picturetexture.VideoTexture; import gregtech.api.util.GTLog; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.compress.utils.IOUtils; import org.apache.logging.log4j.Logger; -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.*; import java.net.HttpURLConnection; @@ -24,8 +25,11 @@ import java.util.HashSet; import java.util.Set; +import javax.imageio.ImageIO; + @SideOnly(Side.CLIENT) public class DownloadThread extends Thread { + public static final Logger LOGGER = GTLog.logger; public static final TextureCache TEXTURE_CACHE = new TextureCache(); @@ -134,7 +138,8 @@ public static byte[] load(String url) throws IOException, FoundVideoException { TextureCache.CacheEntry entry = TEXTURE_CACHE.getEntry(url); long requestTime = System.currentTimeMillis(); URLConnection connection = new URL(url).openConnection(); - connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); + connection.addRequestProperty("User-Agent", + "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); int responseCode = -1; if (connection instanceof HttpURLConnection) { HttpURLConnection httpConnection = (HttpURLConnection) connection; diff --git a/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java b/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java index 2577edf7c8c..37ee5ee3b10 100644 --- a/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java +++ b/src/main/java/gregtech/api/gui/resources/utils/GifDecoder.java @@ -10,11 +10,13 @@ import java.net.URL; import java.util.ArrayList; -/** Class GifDecoder - Decodes a GIF file into one or more frames. +/** + * Class GifDecoder - Decodes a GIF file into one or more frames. * * Example: * *

+ * 
  * {
  *     @code
  *     GifDecoder d = new GifDecoder();
@@ -33,7 +35,8 @@
  * restrictions. Please forward any corrections to questions at fmsware.com.
  *
  * @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's ImageMagick.
- * @version 1.03 November 2003 */
+ * @version 1.03 November 2003
+ */
 
 public class GifDecoder {
 
@@ -97,6 +100,7 @@ public class GifDecoder {
     protected int frameCount;
 
     static class GifFrame {
+
         public GifFrame(BufferedImage im, int del) {
             image = im;
             delay = del;
@@ -106,11 +110,13 @@ public GifFrame(BufferedImage im, int del) {
         public int delay;
     }
 
-    /** Gets display duration for specified frame.
+    /**
+     * Gets display duration for specified frame.
      *
      * @param n
-     *            int index of frame
-     * @return delay in milliseconds */
+     *          int index of frame
+     * @return delay in milliseconds
+     */
     public int getDelay(int n) {
         //
         delay = -1;
@@ -120,30 +126,38 @@ public int getDelay(int n) {
         return delay;
     }
 
-    /** Gets the number of frames read from file.
+    /**
+     * Gets the number of frames read from file.
      *
-     * @return frame count */
+     * @return frame count
+     */
     public int getFrameCount() {
         return frameCount;
     }
 
-    /** Gets the first (or only) image read.
+    /**
+     * Gets the first (or only) image read.
      *
-     * @return BufferedImage containing first frame, or null if none. */
+     * @return BufferedImage containing first frame, or null if none.
+     */
     public BufferedImage getImage() {
         return getFrame(0);
     }
 
-    /** Gets the "Netscape" iteration count, if any.
+    /**
+     * Gets the "Netscape" iteration count, if any.
      * A count of 0 means repeat indefinitiely.
      *
-     * @return iteration count if one was specified, else 1. */
+     * @return iteration count if one was specified, else 1.
+     */
     public int getLoopCount() {
         return loopCount;
     }
 
-    /** Creates new frame image from current data (and previous
-     * frames as specified by their disposition codes). */
+    /**
+     * Creates new frame image from current data (and previous
+     * frames as specified by their disposition codes).
+     */
     protected void setPixels() {
         // expose destination image's pixels as int array
         int[] dest = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
@@ -229,9 +243,11 @@ protected void setPixels() {
         }
     }
 
-    /** Gets the image contents of frame n.
+    /**
+     * Gets the image contents of frame n.
      *
-     * @return BufferedImage representation of frame, or null if n is invalid. */
+     * @return BufferedImage representation of frame, or null if n is invalid.
+     */
     public BufferedImage getFrame(int n) {
         BufferedImage im = null;
         if ((n >= 0) && (n < frameCount)) {
@@ -240,18 +256,22 @@ public BufferedImage getFrame(int n) {
         return im;
     }
 
-    /** Gets image size.
+    /**
+     * Gets image size.
      *
-     * @return GIF image dimensions */
+     * @return GIF image dimensions
+     */
     public Dimension getFrameSize() {
         return new Dimension(width, height);
     }
 
-    /** Reads GIF image from stream
+    /**
+     * Reads GIF image from stream
      *
      * @param is
-     *            BufferedInputStream containing GIF file.
-     * @return read status code (0 = no errors) */
+     *           BufferedInputStream containing GIF file.
+     * @return read status code (0 = no errors)
+     */
     public int read(BufferedInputStream is) {
         init();
         if (is != null) {
@@ -268,16 +288,17 @@ public int read(BufferedInputStream is) {
         }
         try {
             is.close();
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         return status;
     }
 
-    /** Reads GIF image from stream
+    /**
+     * Reads GIF image from stream
      *
      * @param is
-     *            InputStream containing GIF file.
-     * @return read status code (0 = no errors) */
+     *           InputStream containing GIF file.
+     * @return read status code (0 = no errors)
+     */
     public int read(InputStream is) {
         init();
         if (is != null) {
@@ -296,17 +317,18 @@ public int read(InputStream is) {
         }
         try {
             is.close();
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         return status;
     }
 
-    /** Reads GIF file from specified file/URL source
+    /**
+     * Reads GIF file from specified file/URL source
      * (URL assumed if name contains ":/" or "file:")
      *
      * @param name
-     *            String containing source
-     * @return read status code (0 = no errors) */
+     *             String containing source
+     * @return read status code (0 = no errors)
+     */
     public int read(String name) {
         status = STATUS_OK;
         try {
@@ -325,8 +347,10 @@ public int read(String name) {
         return status;
     }
 
-    /** Decodes LZW image data into pixel array.
-     * Adapted from John Cristy's ImageMagick. */
+    /**
+     * Decodes LZW image data into pixel array.
+     * Adapted from John Cristy's ImageMagick.
+     */
     protected void decodeImageData() {
         int NullCode = -1;
         int npix = iw * ih;
@@ -343,7 +367,7 @@ protected void decodeImageData() {
         if (pixelStack == null)
             pixelStack = new byte[MaxStackSize + 1];
 
-        //  Initialize GIF data stream decoder.
+        // Initialize GIF data stream decoder.
 
         data_size = read();
         clear = 1 << data_size;
@@ -357,14 +381,14 @@ protected void decodeImageData() {
             suffix[code] = (byte) code;
         }
 
-        //  Decode GIF pixel stream.
+        // Decode GIF pixel stream.
 
         datum = bits = count = first = top = pi = bi = 0;
 
         for (i = 0; i < npix;) {
             if (top == 0) {
                 if (bits < code_size) {
-                    //  Load bytes until there are enough bits for a code.
+                    // Load bytes until there are enough bits for a code.
                     if (count == 0) {
                         // Read a new data block.
                         count = readBlock();
@@ -379,18 +403,18 @@ protected void decodeImageData() {
                     continue;
                 }
 
-                //  Get the next code.
+                // Get the next code.
 
                 code = datum & code_mask;
                 datum >>= code_size;
                 bits -= code_size;
 
-                //  Interpret the code
+                // Interpret the code
 
                 if ((code > available) || (code == end_of_information))
                     break;
                 if (code == clear) {
-                    //  Reset decoder.
+                    // Reset decoder.
                     code_size = data_size + 1;
                     code_mask = (1 << code_size) - 1;
                     available = clear + 2;
@@ -414,7 +438,7 @@ protected void decodeImageData() {
                 }
                 first = (suffix[code]) & 0xff;
 
-                //  Add a new string to the string table,
+                // Add a new string to the string table,
 
                 if (available >= MaxStackSize) {
                     pixelStack[top++] = (byte) first;
@@ -431,7 +455,7 @@ protected void decodeImageData() {
                 old_code = in_code;
             }
 
-            //  Pop a pixel off the pixel stack.
+            // Pop a pixel off the pixel stack.
 
             top--;
             pixels[pi++] = pixelStack[top];
@@ -441,7 +465,6 @@ protected void decodeImageData() {
         for (i = pi; i < npix; i++) {
             pixels[i] = 0; // clear missing pixels
         }
-
     }
 
     /** Returns true if an error was encountered during reading/decoding */
@@ -469,9 +492,11 @@ protected int read() {
         return curByte;
     }
 
-    /** Reads next variable length block from input.
+    /**
+     * Reads next variable length block from input.
      *
-     * @return number of bytes stored in "buffer" */
+     * @return number of bytes stored in "buffer"
+     */
     protected int readBlock() {
         blockSize = read();
         int n = 0;
@@ -484,8 +509,7 @@ protected int readBlock() {
                         break;
                     n += count;
                 }
-            } catch (IOException e) {
-            }
+            } catch (IOException e) {}
 
             if (n < blockSize) {
                 status = STATUS_FORMAT_ERROR;
@@ -494,11 +518,13 @@ protected int readBlock() {
         return n;
     }
 
-    /** Reads color table as 256 RGB integer values
+    /**
+     * Reads color table as 256 RGB integer values
      *
      * @param ncolors
-     *            int number of colors to read
-     * @return int array containing 256 colors (packed ARGB with full alpha) */
+     *                int number of colors to read
+     * @return int array containing 256 colors (packed ARGB with full alpha)
+     */
     protected int[] readColorTable(int ncolors) {
         int nbytes = 3 * ncolors;
         int[] tab = null;
@@ -506,8 +532,7 @@ protected int[] readColorTable(int ncolors) {
         int n = 0;
         try {
             n = in.read(c);
-        } catch (IOException e) {
-        }
+        } catch (IOException e) {}
         if (n < nbytes) {
             status = STATUS_FORMAT_ERROR;
         } else {
@@ -658,21 +683,19 @@ protected void readImage() {
             act[transIndex] = save;
         }
         resetFrame();
-
     }
 
     /** Reads Logical Screen Descriptor */
     protected void readLSD() {
-
         // logical screen size
         width = readShort();
         height = readShort();
 
         // packed fields
         int packed = read();
-        gctFlag = (packed & 0x80) != 0; // 1   : global color table flag
+        gctFlag = (packed & 0x80) != 0; // 1 : global color table flag
         // 2-4 : color resolution
-        // 5   : gct sort flag
+        // 5 : gct sort flag
         gctSize = 2 << (packed & 7); // 6-8 : gct size
 
         bgIndex = read(); // background color index
@@ -710,8 +733,10 @@ protected void resetFrame() {
         lct = null;
     }
 
-    /** Skips variable length blocks up to and including
-     * next zero length block. */
+    /**
+     * Skips variable length blocks up to and including
+     * next zero length block.
+     */
     protected void skip() {
         do {
             readBlock();
diff --git a/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java b/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
index af980ff8eaf..b48cf952fea 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/ImageUtils.java
@@ -1,21 +1,24 @@
 package gregtech.api.gui.resources.utils;
 
 import gregtech.GregTechMod;
+
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReadParam;
-import javax.imageio.ImageReader;
-import javax.imageio.stream.ImageInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Iterator;
 
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
 public class ImageUtils {
+
     public static final Logger LOGGER = LogManager.getLogger(GregTechMod.class);
 
     public static String readType(byte[] input) throws IOException {
diff --git a/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java b/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
index 81a354d91a2..1baf6296c32 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/ProcessedImageData.java
@@ -8,8 +8,8 @@
 import java.awt.image.BufferedImage;
 import java.nio.ByteBuffer;
 
-
 public class ProcessedImageData {
+
     private final int width;
     private final int height;
     private final Frame[] frames;
@@ -75,14 +75,14 @@ public int uploadFrame(int index) {
     }
 
     private static int uploadFrame(ByteBuffer buffer, boolean hasAlpha, int width, int height) {
-        int textureID = GL11.glGenTextures(); //Generate texture ID
-        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); //Bind texture ID
+        int textureID = GL11.glGenTextures(); // Generate texture ID
+        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); // Bind texture ID
 
-        //Setup wrap mode
+        // Setup wrap mode
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
 
-        //Setup texture scaling filtering
+        // Setup texture scaling filtering
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
 
@@ -90,10 +90,11 @@ private static int uploadFrame(ByteBuffer buffer, boolean hasAlpha, int width, i
             GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
         }
 
-        //Send texel data to OpenGL
-        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, hasAlpha ? GL11.GL_RGBA8 : GL11.GL_RGB8, width, height, 0, hasAlpha ? GL11.GL_RGBA : GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer);
+        // Send texel data to OpenGL
+        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, hasAlpha ? GL11.GL_RGBA8 : GL11.GL_RGB8, width, height, 0,
+                hasAlpha ? GL11.GL_RGBA : GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer);
 
-        //Return the texture ID so we can bind it later again
+        // Return the texture ID so we can bind it later again
         return textureID;
     }
 
@@ -126,6 +127,7 @@ private static Frame loadFrom(BufferedImage image) {
     }
 
     private static class Frame {
+
         private final ByteBuffer buffer;
         private final boolean hasAlpha;
 
diff --git a/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java b/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
index 39975f2448e..c7c45c1fc9c 100644
--- a/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
+++ b/src/main/java/gregtech/api/gui/resources/utils/TextureCache.java
@@ -1,6 +1,7 @@
 package gregtech.api.gui.resources.utils;
 
 import net.minecraft.client.Minecraft;
+
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 
@@ -12,6 +13,7 @@
 import java.util.zip.GZIPOutputStream;
 
 public class TextureCache {
+
     private File cacheDirectory = new File(Minecraft.getMinecraft().gameDir, "opframe_cache");
     private File index = new File(cacheDirectory, "index");
 
@@ -104,6 +106,7 @@ private static File getFile(String url) {
     }
 
     public static class CacheEntry {
+
         private String url;
         private String etag;
         private long time;
diff --git a/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
index 672714597c4..d765f7f7a39 100644
--- a/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/AbstractWidgetGroup.java
@@ -9,11 +9,13 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.common.ConfigHolder;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -27,7 +29,6 @@ public class AbstractWidgetGroup extends Widget implements IGhostIngredientTarge
     private transient boolean initialized = false;
     protected transient List waitToRemoved;
 
-
     public AbstractWidgetGroup(Position position) {
         super(position, Size.ZERO);
         this.isDynamicSized = true;
@@ -284,7 +285,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         for (Widget widget : widgets) {
             if (widget.isVisible()) {
                 widget.drawInBackground(mouseX, mouseY, partialTicks, context);
-                GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F);
+                GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(),
+                        1.0F);
             }
         }
     }
@@ -293,7 +295,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
     public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseWheelMove(mouseX, mouseY, wheelDelta)) {
                 return true;
             }
         }
@@ -304,7 +306,7 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, button)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, button)) {
                 return true;
             }
         }
@@ -315,7 +317,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
     public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, button, timeDragged)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, button, timeDragged)) {
                 return true;
             }
         }
@@ -326,7 +328,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged
     public boolean mouseReleased(int mouseX, int mouseY, int button) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, button)) {
+            if (widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, button)) {
                 return true;
             }
         }
@@ -337,7 +339,7 @@ public boolean mouseReleased(int mouseX, int mouseY, int button) {
     public boolean keyTyped(char charTyped, int keyCode) {
         for (int i = widgets.size() - 1; i >= 0; i--) {
             Widget widget = widgets.get(i);
-            if(widget.isVisible() && widget.isActive() && widget.keyTyped(charTyped, keyCode)) {
+            if (widget.isVisible() && widget.isActive() && widget.keyTyped(charTyped, keyCode)) {
                 return true;
             }
         }
@@ -426,6 +428,5 @@ public void writeUpdateInfo(Widget widget, int updateId, Consumer
                 dataWriter.accept(buffer);
             });
         }
-
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
index 27aff5dc44f..a6988624841 100644
--- a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiScreen;
@@ -19,20 +20,23 @@
 import net.minecraftforge.fml.client.config.GuiUtils;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
 import org.lwjgl.input.Mouse;
 
-import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
+import javax.annotation.Nonnull;
+
 /**
  * Represents a text-component based widget, which obtains
  * text from server and automatically synchronizes it with clients
  */
 public class AdvancedTextWidget extends Widget {
+
     protected int maxWidthLimit;
 
     @SideOnly(Side.CLIENT)
@@ -52,7 +56,7 @@ public AdvancedTextWidget(int xPosition, int yPosition, Consumer GuiUtilRenderComponents.splitText(c, maxTextWidthResult, fontRenderer, true, true).stream())
+                .flatMap(c -> GuiUtilRenderComponents.splitText(c, maxTextWidthResult, fontRenderer, true, true)
+                        .stream())
                 .collect(Collectors.toList());
     }
 
@@ -234,7 +240,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
         Position position = getPosition();
         for (int i = 0; i < displayText.size(); i++) {
-            fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x, position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
+            fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x,
+                    position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
         }
     }
 
@@ -254,6 +261,7 @@ public void drawInForeground(int mouseX, int mouseY) {
      */
     @SideOnly(Side.CLIENT)
     private static class WrapScreen extends GuiScreen {
+
         @Override
         public void handleComponentHover(@Nonnull ITextComponent component, int x, int y) {
             super.handleComponentHover(component, x, y);
diff --git a/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
index db4eb4ac043..ed876833814 100644
--- a/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/BlockableSlotWidget.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.inventory.IInventory;
 import net.minecraftforge.items.IItemHandler;
@@ -17,15 +18,18 @@ public class BlockableSlotWidget extends SlotWidget {
 
     private BooleanSupplier isBlocked = () -> false;
 
-    public BlockableSlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public BlockableSlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                               boolean canPutItems) {
         super(inventory, slotIndex, xPosition, yPosition, canTakeItems, canPutItems);
     }
 
-    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition,
+                               boolean canTakeItems, boolean canPutItems) {
         super(itemHandler, slotIndex, xPosition, yPosition, canTakeItems, canPutItems);
     }
 
-    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
+    public BlockableSlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition,
+                               boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
         super(itemHandler, slotIndex, xPosition, yPosition, canTakeItems, canPutItems, canShiftClickInto);
     }
 
diff --git a/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
index e3bf4cede24..a834867fd1e 100644
--- a/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ClickButtonWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -9,11 +8,14 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
+
+import com.google.common.base.Preconditions;
 import org.lwjgl.input.Mouse;
 
 import java.util.Arrays;
@@ -33,7 +35,8 @@ public class ClickButtonWidget extends Widget {
     private String tooltipText;
     private Object[] tooltipArgs;
 
-    public ClickButtonWidget(int xPosition, int yPosition, int width, int height, String displayText, Consumer onPressed) {
+    public ClickButtonWidget(int xPosition, int yPosition, int width, int height, String displayText,
+                             Consumer onPressed) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.displayText = displayText;
         this.onPressCallback = onPressed;
@@ -84,7 +87,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position position = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height,
+                    0.0, 1.0);
         } else {
             buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
index a53a3b9b441..0f95c5af62b 100644
--- a/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/CraftingStationInputWidgetGroup.java
@@ -5,21 +5,25 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.common.metatileentities.storage.CraftingRecipeLogic;
+
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.items.ItemStackHandler;
 
 public class CraftingStationInputWidgetGroup extends AbstractWidgetGroup {
+
     protected CraftingRecipeLogic recipeResolver;
     protected short tintLocations;
     public static final int LIGHT_RED = 0x66FF0000;
 
-    public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGrid, CraftingRecipeLogic recipeResolver) {
+    public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGrid,
+                                           CraftingRecipeLogic recipeResolver) {
         super(new Position(x, y));
 
-        //crafting grid
+        // crafting grid
         for (int i = 0; i < 3; ++i) {
             for (int j = 0; j < 3; ++j) {
-                this.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, x + j * 18, y + i * 18).setBackgroundTexture(GuiTextures.SLOT));
+                this.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, x + j * 18, y + i * 18)
+                        .setBackgroundTexture(GuiTextures.SLOT));
             }
         }
 
@@ -29,15 +33,17 @@ public CraftingStationInputWidgetGroup(int x, int y, ItemStackHandler craftingGr
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
-        if(this.widgets.size() == 9) { // In case someone added more...
+        if (this.widgets.size() == 9) { // In case someone added more...
             for (int i = 0; i < 9; i++) {
                 Widget widget = widgets.get(i);
-                if (widget instanceof PhantomSlotWidget && ((tintLocations >> i) & 1) == 0) { // In other words, is this slot usable?
+                if (widget instanceof PhantomSlotWidget && ((tintLocations >> i) & 1) == 0) { // In other words, is this
+                                                                                              // slot usable?
                     int color = LIGHT_RED;
 
                     PhantomSlotWidget phantomSlotWidget = (PhantomSlotWidget) widget;
                     drawSolidRect(phantomSlotWidget.getPosition().x + 1, phantomSlotWidget.getPosition().y + 1,
-                            phantomSlotWidget.getSize().getWidth() - 2, phantomSlotWidget.getSize().getWidth() - 2, color);
+                            phantomSlotWidget.getSize().getWidth() - 2, phantomSlotWidget.getSize().getWidth() - 2,
+                            color);
                 }
             }
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
index 2bc7d8a858e..9e4690c8f21 100644
--- a/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/CycleButtonWidget.java
@@ -10,6 +10,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -36,23 +37,27 @@ public class CycleButtonWidget extends Widget {
     protected int currentOption;
     protected String tooltipHoverString;
 
-    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, String[] optionNames, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
+    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, String[] optionNames,
+                             IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.optionNames = optionNames;
         this.currentOptionSupplier = currentOptionSupplier;
         this.setOptionExecutor = setOptionExecutor;
     }
 
-    public  & IStringSerializable> CycleButtonWidget(int xPosition, int yPosition, int width, int height, Class enumClass, Supplier supplier, Consumer updater) {
+    public  & IStringSerializable> CycleButtonWidget(int xPosition, int yPosition, int width,
+                                                                       int height, Class enumClass,
+                                                                       Supplier supplier, Consumer updater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         T[] enumConstantPool = enumClass.getEnumConstants();
-        //noinspection RedundantCast
+        // noinspection RedundantCast
         this.optionNames = GTUtility.mapToString(enumConstantPool, it -> ((IStringSerializable) it).getName());
         this.currentOptionSupplier = () -> supplier.get().ordinal();
         this.setOptionExecutor = (newIndex) -> updater.accept(enumConstantPool[newIndex]);
     }
 
-    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier supplier, BooleanConsumer updater, String... optionNames) {
+    public CycleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier supplier,
+                             BooleanConsumer updater, String... optionNames) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.optionNames = optionNames;
         this.currentOptionSupplier = () -> supplier.getAsBoolean() ? 1 : 0;
@@ -81,7 +86,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position pos = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                    1.0);
         } else {
             buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
@@ -122,9 +128,9 @@ public void readUpdateInfo(int id, PacketBuffer buffer) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         super.mouseClicked(mouseX, mouseY, button);
         if (isMouseOverElement(mouseX, mouseY)) {
-            //Allow only the RMB to reverse cycle
+            // Allow only the RMB to reverse cycle
             if (button == RIGHT_MOUSE) {
-                //Wrap from the first option to the last if needed
+                // Wrap from the first option to the last if needed
                 this.currentOption = currentOption == 0 ? optionNames.length - 1 : currentOption - 1;
             } else {
                 this.currentOption = (currentOption + 1) % optionNames.length;
@@ -137,7 +143,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
@@ -146,5 +151,4 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             setOptionExecutor.accept(currentOption);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java b/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
index 99bdc84b7b0..65f9eeb3aa2 100644
--- a/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/DrawableWidget.java
@@ -33,23 +33,25 @@ public DrawableWidget setForegroundDrawer(ForegroundDrawer foregroundDrawer) {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        if(backgroundDrawer != null)
+        if (backgroundDrawer != null)
             backgroundDrawer.draw(mouseX, mouseY, partialTicks, context, this);
     }
 
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
-        if(foregroundDrawer != null)
+        if (foregroundDrawer != null)
             foregroundDrawer.draw(mouseX, mouseY, this);
     }
 
     @FunctionalInterface
     public interface BackgroundDrawer {
+
         void draw(int mouseX, int mouseY, float partialTicks, IRenderContext context, Widget widget);
     }
 
     @FunctionalInterface
     public interface ForegroundDrawer {
+
         void draw(int mouseX, int mouseY, Widget widget);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java b/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
index 66fc169ba3e..8e5b1b5afdf 100644
--- a/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/DynamicLabelWidget.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraftforge.fml.relauncher.Side;
@@ -57,5 +58,4 @@ public void drawInForeground(int mouseX, int mouseY) {
             fontRenderer.drawString(split[i], position.x, position.y + (i * (fontRenderer.FONT_HEIGHT + 2)), color);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
index 252c02cbb45..6097076b1aa 100644
--- a/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/FluidContainerSlotWidget.java
@@ -9,7 +9,8 @@ public class FluidContainerSlotWidget extends SlotWidget {
 
     private final boolean requireFilledContainer;
 
-    public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotIndex, int xPosition, int yPosition, boolean requireFilledContainer) {
+    public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotIndex, int xPosition, int yPosition,
+                                    boolean requireFilledContainer) {
         super(itemHandler, slotIndex, xPosition, yPosition, true, true);
         this.requireFilledContainer = requireFilledContainer;
     }
@@ -17,6 +18,7 @@ public FluidContainerSlotWidget(IItemHandlerModifiable itemHandler, int slotInde
     @Override
     public boolean canPutStack(ItemStack stack) {
         IFluidHandlerItem fluidHandlerItem = FluidUtil.getFluidHandler(stack);
-        return fluidHandlerItem != null && (!requireFilledContainer || fluidHandlerItem.getTankProperties()[0].getContents() != null);
+        return fluidHandlerItem != null &&
+                (!requireFilledContainer || fluidHandlerItem.getTankProperties()[0].getContents() != null);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
index 2fe2887d0bd..c2dd6f114a7 100644
--- a/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/GhostCircuitSlotWidget.java
@@ -4,13 +4,13 @@
 import gregtech.api.recipes.ingredients.IntCircuitIngredient;
 import gregtech.api.util.LocalizationUtils;
 import gregtech.client.utils.TooltipHelper;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
 import java.util.Arrays;
 import java.util.List;
 
-
 /**
  * Used for setting a "ghost" IC for a machine
  */
@@ -22,7 +22,8 @@ public class GhostCircuitSlotWidget extends SlotWidget {
 
     private final GhostCircuitItemStackHandler circuitInventory;
 
-    public GhostCircuitSlotWidget(GhostCircuitItemStackHandler circuitInventory, int slotIndex, int xPosition, int yPosition) {
+    public GhostCircuitSlotWidget(GhostCircuitItemStackHandler circuitInventory, int slotIndex, int xPosition,
+                                  int yPosition) {
         super(circuitInventory, slotIndex, xPosition, yPosition, false, false, false);
         this.circuitInventory = circuitInventory;
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
index 2442b76a458..33deaf48b2a 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageCycleButtonWidget.java
@@ -9,6 +9,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -35,7 +36,8 @@ public class ImageCycleButtonWidget extends Widget {
     protected boolean shouldUseBaseBackground = false;
     protected boolean singleTexture = false;
 
-    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, int optionCount, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
+    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture,
+                                  int optionCount, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.buttonTexture = buttonTexture;
         this.currentOptionSupplier = currentOptionSupplier;
@@ -44,8 +46,8 @@ public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int heigh
         this.currentOption = currentOptionSupplier.getAsInt();
     }
 
-
-    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, BooleanSupplier supplier, BooleanConsumer updater) {
+    public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture,
+                                  BooleanSupplier supplier, BooleanConsumer updater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.buttonTexture = buttonTexture;
         this.currentOptionSupplier = () -> supplier.getAsBoolean() ? 1 : 0;
@@ -94,9 +96,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             buttonTexture.draw(pos.x, pos.y, size.width, size.height);
         } else {
             if (buttonTexture instanceof SizedTextureArea) {
-                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, (float) currentOption / optionCount, (float) 1 / optionCount);
+                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height,
+                        (float) currentOption / optionCount, (float) 1 / optionCount);
             } else {
-                buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, (float) currentOption / optionCount, 1.0, (float) 1 / optionCount);
+                buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                        (float) currentOption / optionCount, 1.0, (float) 1 / optionCount);
             }
         }
     }
@@ -104,7 +108,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
         if (isMouseOverElement(mouseX, mouseY) && tooltipHoverString != null) {
-            List hoverList = Arrays.asList(LocalizationUtils.formatLines(tooltipHoverString.apply(currentOption)));
+            List hoverList = Arrays
+                    .asList(LocalizationUtils.formatLines(tooltipHoverString.apply(currentOption)));
             drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
         }
     }
@@ -131,9 +136,9 @@ public void readUpdateInfo(int id, PacketBuffer buffer) {
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         super.mouseClicked(mouseX, mouseY, button);
         if (isMouseOverElement(mouseX, mouseY)) {
-            //Allow only the RMB to reverse cycle
+            // Allow only the RMB to reverse cycle
             if (button == RIGHT_MOUSE) {
-                //Wrap from the first option to the last if needed
+                // Wrap from the first option to the last if needed
                 this.currentOption = currentOption == 0 ? optionCount - 1 : currentOption - 1;
             } else {
                 this.currentOption = (currentOption + 1) % optionCount;
@@ -146,7 +151,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
index 4c3961b4d0a..674e4573829 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageTextFieldWidget.java
@@ -7,28 +7,33 @@
 import java.util.function.Supplier;
 
 public class ImageTextFieldWidget extends TextFieldWidget {
+
     SizedTextureArea textureArea;
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder) {
         super(xPosition, yPosition, width, height, false, textSupplier, textResponder);
         this.textureArea = textureArea;
     }
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder, int maxStringLength) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder, int maxStringLength) {
         super(xPosition, yPosition, width, height, false, textSupplier, textResponder, maxStringLength);
         this.textureArea = textureArea;
     }
 
-    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea, Supplier textSupplier, Consumer textResponder, int maxStringLength, int color) {
+    public ImageTextFieldWidget(int xPosition, int yPosition, int width, int height, SizedTextureArea textureArea,
+                                Supplier textSupplier, Consumer textResponder, int maxStringLength,
+                                int color) {
         this(xPosition, yPosition, width, height, textureArea, textSupplier, textResponder, maxStringLength);
-        if(isClientSide())
+        if (isClientSide())
             this.textField.setTextColor(color);
     }
 
-
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        this.textureArea.drawHorizontalCutArea(this.getPosition().x - 2, this.getPosition().y, this.getSize().width, this.getSize().height);
+        this.textureArea.drawHorizontalCutArea(this.getPosition().x - 2, this.getPosition().y, this.getSize().width,
+                this.getSize().height);
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
index 7950da9568c..c7d4cea16db 100644
--- a/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ImageWidget.java
@@ -7,6 +7,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -116,4 +117,3 @@ public void drawInForeground(int mouseX, int mouseY) {
         }
     }
 }
-
diff --git a/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
index 4e7f354c6ff..478fca6ef08 100644
--- a/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/IncrementButtonWidget.java
@@ -8,6 +8,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.item.ItemStack;
@@ -34,8 +35,8 @@ public class IncrementButtonWidget extends Widget {
     protected boolean isMouseHovered;
     protected float textScale = 1;
 
-
-    public IncrementButtonWidget(int x, int y, int width, int height, int increment, int incrementShift, int incrementCtrl, int incrementShiftCtrl, IntConsumer updater) {
+    public IncrementButtonWidget(int x, int y, int width, int height, int increment, int incrementShift,
+                                 int incrementCtrl, int incrementShiftCtrl, IntConsumer updater) {
         super(x, y, width, height);
         this.increment = increment;
         this.incrementShift = incrementShift;
@@ -81,7 +82,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position position = getPosition();
         Size size = getSize();
         if (buttonTexture instanceof SizedTextureArea) {
-            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
+            ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height,
+                    0.0, 1.0);
         } else {
             buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java b/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
index 445594b846a..af5f0820c05 100644
--- a/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/IndicatorImageWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.text.ITextComponent;
@@ -36,7 +37,8 @@ public IndicatorImageWidget(int xPosition, int yPosition, int width, int height,
     }
 
     /** Widget displays warning status if the supplied List is nonnull and not empty */
-    public IndicatorImageWidget setWarningStatus(TextureArea texture, Consumer> warningTextSupplier) {
+    public IndicatorImageWidget setWarningStatus(TextureArea texture,
+                                                 Consumer> warningTextSupplier) {
         this.warningTexture = texture;
         this.warningTextSupplier = warningTextSupplier;
         return this;
diff --git a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
index e5f4bc9070b..d694e936be5 100644
--- a/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/LabelWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -111,5 +112,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             fontRenderer.drawString(resultText, x, y, color, dropShadow);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
index a48160c138c..f7f90bd4767 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -10,7 +9,7 @@
 import gregtech.api.util.*;
 import gregtech.client.utils.RenderUtil;
 import gregtech.client.utils.TooltipHelper;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.renderer.GlStateManager;
@@ -23,7 +22,9 @@
 import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 
-import javax.annotation.Nonnull;
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -32,6 +33,8 @@
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 
+import javax.annotation.Nonnull;
+
 import static gregtech.api.util.GTUtility.getFluidFromContainer;
 
 public class PhantomFluidWidget extends Widget implements IIngredientSlot, IGhostIngredientTarget {
@@ -46,7 +49,8 @@ public class PhantomFluidWidget extends Widget implements IIngredientSlot, IGhos
     private boolean showTip;
     protected FluidStack lastFluidStack;
 
-    public PhantomFluidWidget(int xPosition, int yPosition, int width, int height, Supplier fluidStackSupplier, Consumer fluidStackUpdater) {
+    public PhantomFluidWidget(int xPosition, int yPosition, int width, int height,
+                              Supplier fluidStackSupplier, Consumer fluidStackUpdater) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         this.fluidStackSupplier = fluidStackSupplier;
         this.fluidStackUpdater = fluidStackUpdater;
@@ -89,6 +93,7 @@ public List> getPhantomTargets(Object ingredient) {
 
         Rectangle rectangle = toRectangleBox();
         return Lists.newArrayList(new Target() {
+
             @Nonnull
             @Override
             public Rectangle getArea() {
@@ -180,7 +185,8 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             ItemStack itemStack = gui.entityPlayer.inventory.getItemStack().copy();
             if (!itemStack.isEmpty()) {
                 itemStack.setCount(1);
-                IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+                IFluidHandlerItem fluidHandler = itemStack
+                        .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
                 if (fluidHandler != null) {
                     FluidStack resultFluid = fluidHandler.drain(Integer.MAX_VALUE, false);
                     fluidStackUpdater.accept(resultFluid);
@@ -271,13 +277,16 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         }
         if (lastFluidStack != null) {
             GlStateManager.disableBlend();
-            RenderUtil.drawFluidForGui(lastFluidStack, lastFluidStack.amount, pos.x + 1, pos.y + 1, size.width - 1, size.height - 1);
+            RenderUtil.drawFluidForGui(lastFluidStack, lastFluidStack.amount, pos.x + 1, pos.y + 1, size.width - 1,
+                    size.height - 1);
             if (showTip) {
                 GlStateManager.pushMatrix();
                 GlStateManager.scale(0.5, 0.5, 1);
                 String s = TextFormattingUtil.formatLongToCompactString(lastFluidStack.amount, 4) + "L";
                 FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-                fontRenderer.drawStringWithShadow(s, (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21, (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
+                fontRenderer.drawStringWithShadow(s,
+                        (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21,
+                        (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
                 GlStateManager.popMatrix();
             }
             GlStateManager.enableBlend();
@@ -293,7 +302,8 @@ public void drawInForeground(int mouseX, int mouseY) {
                 hoverStringList.add(fluidName);
                 if (showTip) {
                     hoverStringList.add(lastFluidStack.amount + " L");
-                    Collections.addAll(hoverStringList, LocalizationUtils.formatLines("cover.fluid_filter.config_amount"));
+                    Collections.addAll(hoverStringList,
+                            LocalizationUtils.formatLines("cover.fluid_filter.config_amount"));
                 }
                 drawHoveringText(ItemStack.EMPTY, hoverStringList, -1, mouseX, mouseY);
             }
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
index 214b4cc20e7..0490d7310b8 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java
@@ -1,22 +1,25 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.ingredient.IGhostIngredientTarget;
 import gregtech.client.utils.TooltipHelper;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.ClickType;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.items.IItemHandlerModifiable;
+
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
 import org.lwjgl.input.Mouse;
 
-import javax.annotation.Nonnull;
 import java.awt.*;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public class PhantomSlotWidget extends SlotWidget implements IGhostIngredientTarget {
 
     private boolean clearSlotOnRightClick;
@@ -35,8 +38,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         if (isMouseOverElement(mouseX, mouseY) && gui != null) {
             if (button == 1 && clearSlotOnRightClick && !slotReference.getStack().isEmpty()) {
                 slotReference.putStack(ItemStack.EMPTY);
-                writeClientAction(2, buf -> {
-                });
+                writeClientAction(2, buf -> {});
             } else {
                 gui.getModularUIGui().superMouseClicked(mouseX, mouseY, button);
             }
@@ -81,6 +83,7 @@ public List> getPhantomTargets(Object ingredient) {
         }
         Rectangle rectangle = toRectangleBox();
         return Lists.newArrayList(new Target() {
+
             @Nonnull
             @Override
             public Rectangle getArea() {
diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
index d4a910f3e71..53299b3d133 100644
--- a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java
@@ -1,13 +1,12 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.collect.Lists;
 import gregtech.api.fluids.GTFluid;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.ingredient.IGhostIngredientTarget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.client.utils.RenderUtil;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.NBTTagCompound;
@@ -18,8 +17,9 @@
 import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import com.google.common.collect.Lists;
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.io.IOException;
 import java.util.Collections;
@@ -27,6 +27,9 @@
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import static gregtech.api.capability.GregtechDataCodes.*;
 import static gregtech.api.util.GTUtility.getFluidFromContainer;
 
@@ -41,7 +44,8 @@ public class PhantomTankWidget extends TankWidget implements IGhostIngredientTar
     @Nullable
     protected FluidStack lastPhantomStack;
 
-    public PhantomTankWidget(IFluidTank fluidTank, int x, int y, int width, int height, Supplier phantomFluidGetter, Consumer phantomFluidSetter) {
+    public PhantomTankWidget(IFluidTank fluidTank, int x, int y, int width, int height,
+                             Supplier phantomFluidGetter, Consumer phantomFluidSetter) {
         super(fluidTank, x, y, width, height);
         this.phantomFluidGetter = phantomFluidGetter;
         this.phantomFluidSetter = phantomFluidSetter;
@@ -94,7 +98,8 @@ public void handleClientAction(int id, PacketBuffer buf) {
                 phantomFluidSetter.accept(null);
             } else {
                 stack.setCount(1);
-                IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+                IFluidHandlerItem fluidHandler = stack
+                        .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
                 if (fluidHandler != null) {
                     phantomFluidSetter.accept(fluidHandler.drain(Integer.MAX_VALUE, false));
                 }
@@ -121,8 +126,7 @@ public Object getIngredientOverMouse(int mouseX, int mouseY) {
     @Override
     public boolean mouseClicked(int mouseX, int mouseY, int button) {
         if (isMouseOverElement(mouseX, mouseY)) {
-            writeClientAction(SET_PHANTOM_FLUID, buf -> {
-            });
+            writeClientAction(SET_PHANTOM_FLUID, buf -> {});
             return true;
         }
         return false;
@@ -159,8 +163,7 @@ public void detectAndSendChanges() {
         if (stack == null) {
             if (lastPhantomStack != null) {
                 setLastPhantomStack(null);
-                writeUpdateInfo(REMOVE_PHANTOM_FLUID_TYPE, buf -> {
-                });
+                writeUpdateInfo(REMOVE_PHANTOM_FLUID_TYPE, buf -> {});
             }
         } else if (lastPhantomStack == null || !stack.isFluidEqual(lastPhantomStack)) {
             setLastPhantomStack(stack);
diff --git a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
index ec13e57dc44..b4699c241fd 100644
--- a/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.common.ConfigHolder;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
@@ -55,34 +56,35 @@ public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height) {
         this(new TimedProgressSupplier(ticksPerCycle, width, false), x, y, width, height);
     }
 
-    public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType) {
+    public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage,
+                          MoveType moveType) {
         super(new Position(x, y), new Size(width, height));
         this.progressSupplier = progressSupplier;
         this.emptyBarArea = fullImage.getSubArea(0.0, 0.0, 1.0, 0.5);
         this.moveType = moveType;
         if (moveType == MoveType.CIRCULAR) {
-            this.filledBarArea = new TextureArea[]{
+            this.filledBarArea = new TextureArea[] {
                     fullImage.getSubArea(0.0, 0.75, 0.5, 0.25), // UP
                     fullImage.getSubArea(0.0, 0.5, 0.5, 0.25), // LEFT
                     fullImage.getSubArea(0.5, 0.5, 0.5, 0.25), // DOWN
                     fullImage.getSubArea(0.5, 0.75, 0.5, 0.25), // RIGHT
             };
         } else {
-            this.filledBarArea = new TextureArea[]{fullImage.getSubArea(0.0, 0.5, 1.0, 0.5)};
+            this.filledBarArea = new TextureArea[] { fullImage.getSubArea(0.0, 0.5, 1.0, 0.5) };
         }
     }
 
-    public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType) {
+    public ProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage,
+                          MoveType moveType) {
         this(new TimedProgressSupplier(
                 ticksPerCycle,
                 moveType == MoveType.HORIZONTAL ? width : height,
-                false
-        ), x, y, width, height, fullImage, moveType);
+                false), x, y, width, height, fullImage, moveType);
     }
 
     public ProgressWidget setProgressBar(TextureArea emptyBarArea, TextureArea filledBarArea, MoveType moveType) {
         this.emptyBarArea = emptyBarArea;
-        this.filledBarArea = new TextureArea[]{filledBarArea};
+        this.filledBarArea = new TextureArea[] { filledBarArea };
         this.moveType = moveType;
         return this;
     }
@@ -183,8 +185,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         1.0 - progressScaledDrawnHeight,
                         1.0,
-                        progressScaledDrawnHeight
-                );
+                        progressScaledDrawnHeight);
 
                 // TL, draw RIGHT
                 progressScaled = subAreas[1] * halfWidth;
@@ -198,8 +199,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         0.0,
                         progressScaledDrawnWidth,
-                        1.0
-                );
+                        1.0);
 
                 // TR, draw DOWN
                 progressScaled = subAreas[2] * halfWidth;
@@ -213,8 +213,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         0.0,
                         0.0,
                         1.0,
-                        progressScaledDrawnHeight
-                );
+                        progressScaledDrawnHeight);
 
                 // BR, draw LEFT
                 progressScaled = subAreas[3] * halfWidth;
@@ -228,8 +227,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                         1.0 - progressScaledDrawnWidth,
                         0.0,
                         progressScaledDrawnWidth,
-                        1.0
-                );
+                        1.0);
             } else if (moveType == MoveType.VERTICAL_DOWNWARDS) {
                 double height = size.height * lastProgressValue;
                 if (!smooth) height = (int) height;
diff --git a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
index 485ed4f44be..fea7730043a 100644
--- a/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/RecipeProgressWidget.java
@@ -8,6 +8,7 @@
 import gregtech.integration.jei.JustEnoughItemsModule;
 import gregtech.integration.jei.recipe.RecipeMapCategory;
 import gregtech.modules.GregTechModules;
+
 import net.minecraft.util.text.TextComponentTranslation;
 
 import java.util.ArrayList;
@@ -19,22 +20,28 @@ public class RecipeProgressWidget extends ProgressWidget {
 
     private final RecipeMap recipeMap;
 
-    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, RecipeMap recipeMap) {
+    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height,
+                                RecipeMap recipeMap) {
         super(progressSupplier, x, y, width, height);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
-    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
+    public RecipeProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height,
+                                TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
         super(progressSupplier, x, y, width, height, fullImage, moveType);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
-    public RecipeProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage, MoveType moveType, RecipeMap recipeMap) {
+    public RecipeProgressWidget(int ticksPerCycle, int x, int y, int width, int height, TextureArea fullImage,
+                                MoveType moveType, RecipeMap recipeMap) {
         super(ticksPerCycle, x, y, width, height, fullImage, moveType);
         this.recipeMap = recipeMap;
-        setHoverTextConsumer(list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
+        setHoverTextConsumer(
+                list -> list.add(new TextComponentTranslation("gui.widget.recipeProgressWidget.default_tooltip")));
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java b/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
index d4259768923..88aee272e6d 100644
--- a/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ScrollableListWidget.java
@@ -6,9 +6,11 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.client.utils.RenderUtil;
-import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import net.minecraft.util.math.MathHelper;
 
+import mezz.jei.api.gui.IGhostIngredientHandler.Target;
+
 import java.awt.*;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -71,9 +73,9 @@ private void updateElementPositions() {
 
     @Override
     public void drawInForeground(int mouseX, int mouseY) {
-        //make sure mouse is not hovered on any element when outside of bounds,
-        //since foreground rendering is not scissored,
-        //because cut tooltips don't really look nice
+        // make sure mouse is not hovered on any element when outside of bounds,
+        // since foreground rendering is not scissored,
+        // because cut tooltips don't really look nice
         if (!isPositionInsideScissor(mouseX, mouseY)) {
             mouseX = Integer.MAX_VALUE;
             mouseY = Integer.MAX_VALUE;
@@ -83,7 +85,7 @@ public void drawInForeground(int mouseX, int mouseY) {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        //make sure mouse is not hovered on any element when outside of bounds
+        // make sure mouse is not hovered on any element when outside of bounds
         if (!isPositionInsideScissor(mouseX, mouseY)) {
             mouseX = Integer.MAX_VALUE;
             mouseY = Integer.MAX_VALUE;
@@ -102,8 +104,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         int scrollSliderY = Math.round(position.y + (size.height - scrollSliderHeight) * scrollPercent);
         GuiTextures.SLIDER_ICON.draw(scrollX + 1, scrollSliderY + 2, paneSize - 2, scrollSliderHeight);
 
-        RenderUtil.useScissor(position.x, position.y, size.width - paneSize, size.height, () ->
-            super.drawInBackground(finalMouseX, finalMouseY, partialTicks, context));
+        RenderUtil.useScissor(position.x, position.y, size.width - paneSize, size.height,
+                () -> super.drawInBackground(finalMouseX, finalMouseY, partialTicks, context));
     }
 
     @Override
@@ -194,7 +196,7 @@ public Object getIngredientOverMouse(int mouseX, int mouseY) {
 
     @Override
     public List> getPhantomTargets(Object ingredient) {
-        //for phantom targets, show only ones who are fully inside scissor box to avoid visual glitches
+        // for phantom targets, show only ones who are fully inside scissor box to avoid visual glitches
         return super.getPhantomTargets(ingredient).stream()
                 .filter(it -> isBoxInsideScissor(it.getArea()))
                 .collect(Collectors.toList());
diff --git a/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java b/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
index b16f914f289..3c6c872e8ee 100644
--- a/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/ServerWidgetGroup.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.network.PacketBuffer;
 
 import java.util.function.BooleanSupplier;
diff --git a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
index 5603467851e..8ca0e4ae7be 100644
--- a/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SimpleTextWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
@@ -29,11 +30,13 @@ public class SimpleTextWidget extends Widget {
     protected float scale = 1;
     protected int width;
 
-    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier) {
+    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color,
+                            Supplier textSupplier) {
         this(xPosition, yPosition, formatLocale, color, textSupplier, false);
     }
 
-    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier, boolean clientWidget) {
+    public SimpleTextWidget(int xPosition, int yPosition, String formatLocale, int color, Supplier textSupplier,
+                            boolean clientWidget) {
         super(new Position(xPosition, yPosition), Size.ZERO);
         this.color = color;
         this.formatLocale = formatLocale;
@@ -89,7 +92,8 @@ public void updateScreen() {
 
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
-        String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) : I18n.format(formatLocale, lastText);
+        String text = formatLocale.isEmpty() ? (I18n.hasKey(lastText) ? I18n.format(lastText) : lastText) :
+                I18n.format(formatLocale, lastText);
         List texts;
         if (this.width > 0) {
             texts = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(text, (int) (width * (1 / scale)));
diff --git a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
index d0af94529c8..73ec60ec40c 100644
--- a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -8,19 +7,24 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.FloatConsumer;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.resources.I18n;
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.math.MathHelper;
 
+import com.google.common.base.Preconditions;
+
+import java.util.function.BiFunction;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import java.util.function.BiFunction;
 
 public class SliderWidget extends Widget {
 
-    public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name, value.intValue());
+    public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name,
+            value.intValue());
 
     private int sliderWidth = 8;
     private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
@@ -39,7 +43,8 @@ public class SliderWidget extends Widget {
     private float sliderPosition;
     public boolean isMouseDown;
 
-    public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max, float currentValue, FloatConsumer responder) {
+    public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max,
+                        float currentValue, FloatConsumer responder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         Preconditions.checkNotNull(responder, "responder");
         Preconditions.checkNotNull(name, "name");
@@ -97,7 +102,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         if (displayString == null) {
             this.displayString = getDisplayString();
         }
-        sliderIcon.draw(pos.x + (int) (this.sliderPosition * (float) (size.width - 8)), pos.y, sliderWidth, size.height);
+        sliderIcon.draw(pos.x + (int) (this.sliderPosition * (float) (size.width - 8)), pos.y, sliderWidth,
+                size.height);
         FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
         fontRenderer.drawString(displayString,
                 pos.x + size.width / 2 - fontRenderer.getStringWidth(displayString) / 2,
diff --git a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
index b77c73fe1d8..1e0e680d8ec 100644
--- a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.INativeWidget;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.ISizeProvider;
@@ -10,6 +9,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.client.renderer.RenderHelper;
@@ -26,11 +26,14 @@
 import net.minecraftforge.items.IItemHandlerModifiable;
 import net.minecraftforge.items.SlotItemHandler;
 
-import javax.annotation.Nonnull;
+import com.google.common.base.Preconditions;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.Consumer;
 
+import javax.annotation.Nonnull;
+
 public class SlotWidget extends Widget implements INativeWidget {
 
     protected final Slot slotReference;
@@ -46,21 +49,24 @@ public class SlotWidget extends Widget implements INativeWidget {
 
     protected Consumer consumer;
 
-    public SlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public SlotWidget(IInventory inventory, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
         this.slotReference = createSlot(inventory, slotIndex);
     }
 
-    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems) {
+    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
         this.slotReference = createSlot(itemHandler, slotIndex, true);
     }
 
-    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems, boolean canPutItems, boolean canShiftClickInto) {
+    public SlotWidget(IItemHandler itemHandler, int slotIndex, int xPosition, int yPosition, boolean canTakeItems,
+                      boolean canPutItems, boolean canShiftClickInto) {
         super(new Position(xPosition, yPosition), new Size(18, 18));
         this.canTakeItems = canTakeItems;
         this.canPutItems = canPutItems;
@@ -102,12 +108,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         }
         ItemStack itemStack = slotReference.getStack();
         ModularUIGui modularUIGui = gui == null ? null : gui.getModularUIGui();
-        if (itemStack.isEmpty() && modularUIGui != null && modularUIGui.getDragSplitting() && modularUIGui.getDragSplittingSlots().contains(slotReference)) { // draw split
+        if (itemStack.isEmpty() && modularUIGui != null && modularUIGui.getDragSplitting() &&
+                modularUIGui.getDragSplittingSlots().contains(slotReference)) { // draw split
             int splitSize = modularUIGui.getDragSplittingSlots().size();
             itemStack = gui.entityPlayer.inventory.getItemStack();
             if (!itemStack.isEmpty() && splitSize > 1 && Container.canAddItemToSlot(slotReference, itemStack, true)) {
                 itemStack = itemStack.copy();
-                Container.computeStackSize(modularUIGui.getDragSplittingSlots(), modularUIGui.dragSplittingLimit, itemStack, slotReference.getStack().isEmpty() ? 0 : slotReference.getStack().getCount());
+                Container.computeStackSize(modularUIGui.getDragSplittingSlots(), modularUIGui.dragSplittingLimit,
+                        itemStack, slotReference.getStack().isEmpty() ? 0 : slotReference.getStack().getCount());
                 int k = Math.min(itemStack.getMaxStackSize(), slotReference.getItemStackLimit(itemStack));
                 if (itemStack.getCount() > k) {
                     itemStack.setCount(k);
@@ -125,7 +133,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
             GlStateManager.pushMatrix();
             RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
             itemRender.renderItemAndEffectIntoGUI(itemStack, pos.x + 1, pos.y + 1);
-            itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, itemStack, pos.x + 1, pos.y + 1, null);
+            itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, itemStack, pos.x + 1, pos.y + 1,
+                    null);
             GlStateManager.enableAlpha();
             GlStateManager.popMatrix();
             RenderHelper.disableStandardItemLighting();
@@ -275,12 +284,14 @@ public final Slot getHandle() {
     }
 
     public interface ISlotWidget {
+
         void setHover(boolean isHover);
 
         boolean isHover();
     }
 
     protected class WidgetSlot extends Slot implements ISlotWidget {
+
         boolean isHover;
 
         public WidgetSlot(IInventory inventory, int index, int xPosition, int yPosition) {
@@ -333,10 +344,12 @@ public boolean isEnabled() {
     }
 
     public class WidgetSlotItemHandler extends SlotItemHandler implements ISlotWidget {
+
         boolean isHover;
         final boolean canShiftClickInto;
 
-        public WidgetSlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition, boolean canShiftClickInto) {
+        public WidgetSlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition,
+                                     boolean canShiftClickInto) {
             super(itemHandler, index, xPosition, yPosition);
             this.canShiftClickInto = canShiftClickInto;
         }
diff --git a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
index c1b14ea5337..d053c49e7d1 100644
--- a/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SortingButtonWidget.java
@@ -11,7 +11,8 @@ public class SortingButtonWidget extends ClickButtonWidget {
     private static boolean inventoryTweaksPresent;
     private static KeyBinding sortKeyBinding;
 
-    public SortingButtonWidget(int xPosition, int yPosition, int width, int height, String displayText, Consumer onPressed) {
+    public SortingButtonWidget(int xPosition, int yPosition, int width, int height, String displayText,
+                               Consumer onPressed) {
         super(xPosition, yPosition, width, height, displayText, onPressed);
     }
 
@@ -59,5 +60,4 @@ private static int getInvTweaksSortCode() {
             return 0;
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
index 834a519ee20..526f3b113dc 100644
--- a/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SuppliedImageWidget.java
@@ -8,7 +8,8 @@ public class SuppliedImageWidget extends ImageWidget {
 
     private final Supplier areaSupplier;
 
-    public SuppliedImageWidget(int xPosition, int yPosition, int width, int height, Supplier areaSupplier) {
+    public SuppliedImageWidget(int xPosition, int yPosition, int width, int height,
+                               Supplier areaSupplier) {
         super(xPosition, yPosition, width, height);
         this.areaSupplier = areaSupplier;
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java b/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
index 98046a5ee41..977b2b0c796 100644
--- a/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/SyncableColorRectWidget.java
@@ -4,6 +4,7 @@
 import gregtech.api.gui.Widget;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.network.PacketBuffer;
 
 import java.util.function.Supplier;
@@ -57,18 +58,20 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         if (drawCheckerboard) {
             int white = 0xFFFFFFFF;
             int grey = 0xFFBFBFBF;
-            int columnWidth = (size.width - 2*borderWidth) / checkerboardGridColumns;
-            int rowHeight = (size.height - 2*borderWidth) / checkerboardGridRows;
+            int columnWidth = (size.width - 2 * borderWidth) / checkerboardGridColumns;
+            int rowHeight = (size.height - 2 * borderWidth) / checkerboardGridRows;
             boolean whiteGrey = false;
             for (int i = 0; i < checkerboardGridRows; i++) {
                 for (int j = 0; j < checkerboardGridColumns; j++) {
-                    drawSolidRect(position.x + borderWidth + i * columnWidth, position.y + borderWidth + j * rowHeight, columnWidth, rowHeight, whiteGrey ? white : grey);
+                    drawSolidRect(position.x + borderWidth + i * columnWidth, position.y + borderWidth + j * rowHeight,
+                            columnWidth, rowHeight, whiteGrey ? white : grey);
                     whiteGrey = !whiteGrey;
                 }
                 whiteGrey = !whiteGrey;
             }
         }
-        drawSolidRect(position.x + borderWidth, position.y + borderWidth, size.width - 2*borderWidth, size.height - 2*borderWidth, color);
+        drawSolidRect(position.x + borderWidth, position.y + borderWidth, size.width - 2 * borderWidth,
+                size.height - 2 * borderWidth, color);
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/gui/widgets/TabGroup.java b/src/main/java/gregtech/api/gui/widgets/TabGroup.java
index dc1e65e9aa1..6fdc44f9571 100644
--- a/src/main/java/gregtech/api/gui/widgets/TabGroup.java
+++ b/src/main/java/gregtech/api/gui/widgets/TabGroup.java
@@ -11,6 +11,7 @@
 import gregtech.api.gui.widgets.tab.VerticalTabListRenderer.HorizontalLocation;
 import gregtech.api.gui.widgets.tab.VerticalTabListRenderer.VerticalStartCorner;
 import gregtech.api.util.Position;
+
 import net.minecraft.network.PacketBuffer;
 import net.minecraft.util.Tuple;
 
@@ -109,7 +110,8 @@ public List getContainedWidgets(boolean includeHidden) {
     @Override
     public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
         super.drawInBackground(mouseX, mouseY, partialTicks, context);
-        this.tabListRenderer.renderTabs(gui, getPosition(), tabInfos, sizes.getWidth(), sizes.getHeight(), selectedTabIndex);
+        this.tabListRenderer.renderTabs(gui, getPosition(), tabInfos, sizes.getWidth(), sizes.getHeight(),
+                selectedTabIndex);
     }
 
     @Override
@@ -120,7 +122,8 @@ public void drawInForeground(int mouseX, int mouseY) {
             int[] tabSizes = tabOnMouse.getSecond();
             ITabInfo tabInfo = tabOnMouse.getFirst();
             boolean isSelected = tabInfos.get(selectedTabIndex) == tabInfo;
-            tabInfo.renderHoverText(tabSizes[0], tabSizes[1], tabSizes[2], tabSizes[3], sizes.getWidth(), sizes.getHeight(), isSelected, mouseX, mouseY);
+            tabInfo.renderHoverText(tabSizes[0], tabSizes[1], tabSizes[2], tabSizes[3], sizes.getWidth(),
+                    sizes.getHeight(), isSelected, mouseX, mouseY);
         }
     }
 
@@ -193,8 +196,10 @@ public enum TabLocation {
 
         HORIZONTAL_TOP_LEFT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.TOP)),
         HORIZONTAL_TOP_RIGHT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.TOP)),
-        HORIZONTAL_BOTTOM_LEFT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.BOTTOM)),
-        HORIZONTAL_BOTTOM_RIGHT(() -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.BOTTOM)),
+        HORIZONTAL_BOTTOM_LEFT(
+                () -> new HorizontalTabListRenderer(HorizontalStartCorner.LEFT, VerticalLocation.BOTTOM)),
+        HORIZONTAL_BOTTOM_RIGHT(
+                () -> new HorizontalTabListRenderer(HorizontalStartCorner.RIGHT, VerticalLocation.BOTTOM)),
         VERTICAL_LEFT_TOP(() -> new VerticalTabListRenderer(VerticalStartCorner.TOP, HorizontalLocation.LEFT)),
         VERTICAL_LEFT_BOTTOM(() -> new VerticalTabListRenderer(VerticalStartCorner.BOTTOM, HorizontalLocation.LEFT)),
         VERTICAL_RIGHT_TOP(() -> new VerticalTabListRenderer(VerticalStartCorner.TOP, HorizontalLocation.RIGHT)),
@@ -206,5 +211,4 @@ public enum TabLocation {
             this.supplier = supplier;
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/TankWidget.java b/src/main/java/gregtech/api/gui/widgets/TankWidget.java
index b4b1bf64039..2be6bdfeca8 100644
--- a/src/main/java/gregtech/api/gui/widgets/TankWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/TankWidget.java
@@ -9,6 +9,7 @@
 import gregtech.api.util.*;
 import gregtech.client.utils.RenderUtil;
 import gregtech.client.utils.TooltipHelper;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.renderer.GlStateManager;
@@ -28,14 +29,16 @@
 import net.minecraftforge.fluids.capability.IFluidHandlerItem;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
-import org.jetbrains.annotations.NotNull;
+
 import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
 
-import javax.annotation.Nullable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
 public class TankWidget extends Widget implements IIngredientSlot {
 
     public final IFluidTank fluidTank;
@@ -63,7 +66,8 @@ public TankWidget(IFluidTank fluidTank, int x, int y, int width, int height) {
 
     public TankWidget setClient() {
         this.isClient = true;
-        this.lastFluidInTank = fluidTank != null ? fluidTank.getFluid() != null ? fluidTank.getFluid().copy() : null : null;
+        this.lastFluidInTank = fluidTank != null ? fluidTank.getFluid() != null ? fluidTank.getFluid().copy() : null :
+                null;
         this.lastTankCapacity = fluidTank != null ? fluidTank.getCapacity() : 0;
         return this;
     }
@@ -100,7 +104,8 @@ public TankWidget setFluidRenderOffset(int fluidRenderOffset) {
 
     public TankWidget setContainerClicking(boolean allowClickContainerFilling, boolean allowClickContainerEmptying) {
         if (!(fluidTank instanceof IFluidHandler))
-            throw new IllegalStateException("Container IO is only supported for fluid tanks that implement IFluidHandler");
+            throw new IllegalStateException(
+                    "Container IO is only supported for fluid tanks that implement IFluidHandler");
         this.allowClickFilling = allowClickContainerFilling;
         this.allowClickEmptying = allowClickContainerEmptying;
         return this;
@@ -149,7 +154,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                 textureArea.draw(pos.x, pos.y, size.width, size.height);
             }
         }
-        //do not draw fluids if they are handled by JEI - it draws them itself
+        // do not draw fluids if they are handled by JEI - it draws them itself
         if (lastFluidInTank != null && !gui.isJEIHandled) {
             GlStateManager.disableBlend();
             FluidStack stackToDraw = lastFluidInTank;
@@ -170,7 +175,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
                 String s = TextFormattingUtil.formatLongToCompactString(lastFluidInTank.amount, 4) + "L";
 
                 FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-                fontRenderer.drawStringWithShadow(s, (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21, (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
+                fontRenderer.drawStringWithShadow(s,
+                        (pos.x + (size.width / 3F)) * 2 - fontRenderer.getStringWidth(s) + 21,
+                        (pos.y + (size.height / 3F) + 6) * 2, 0xFFFFFF);
                 GlStateManager.popMatrix();
             }
             GlStateManager.enableBlend();
@@ -189,7 +196,8 @@ public void drawInForeground(int mouseX, int mouseY) {
                 tooltips.add(fluid.getLocalizedName(lastFluidInTank));
 
                 // Amount Tooltip
-                tooltips.add(LocalizationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity));
+                tooltips.add(
+                        LocalizationUtils.format("gregtech.fluid.amount", lastFluidInTank.amount, lastTankCapacity));
 
                 // Add various tooltips from the material
                 List formula = FluidTooltipUtil.getFluidTooltip(lastFluidInTank);
@@ -207,15 +215,13 @@ public void drawInForeground(int mouseX, int mouseY) {
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.empty"));
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.amount", 0, lastTankCapacity));
             }
-            if(allowClickEmptying && allowClickFilling) {
+            if (allowClickEmptying && allowClickFilling) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_combined"));
-            }
-            else if (allowClickFilling) {
+            } else if (allowClickFilling) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_to_fill"));
-            }
-            else if (allowClickEmptying) {
+            } else if (allowClickEmptying) {
                 tooltips.add(""); // Add an empty line to separate from the bottom material tooltips
                 tooltips.add(LocalizationUtils.format("gregtech.fluid.click_to_empty"));
             }
@@ -253,8 +259,7 @@ public void detectAndSendChanges() {
         }
         if (fluidStack == null && lastFluidInTank != null) {
             this.lastFluidInTank = null;
-            writeUpdateInfo(1, buffer -> {
-            });
+            writeUpdateInfo(1, buffer -> {});
         } else if (fluidStack != null) {
             if (!fluidStack.isFluidEqual(lastFluidInTank)) {
                 this.lastFluidInTank = fluidStack.copy();
@@ -304,7 +309,8 @@ private ItemStack tryClickContainer(boolean tryFillAll) {
 
         ItemStack heldItemSizedOne = currentStack.copy();
         heldItemSizedOne.setCount(1);
-        IFluidHandlerItem fluidHandlerItem = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandlerItem = heldItemSizedOne
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandlerItem == null) return ItemStack.EMPTY;
 
         FluidStack tankFluid = fluidTank.getFluid();
@@ -369,7 +375,8 @@ private ItemStack fillTankFromStack(@NotNull FluidStack heldFluid, boolean tryFi
         ItemStack itemStackEmptied = ItemStack.EMPTY;
         int fluidAmountTaken = 0;
 
-        IFluidHandlerItem fluidHandler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandler = heldItemSizedOne
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandler == null) return ItemStack.EMPTY;
 
         FluidStack drained = fluidHandler.drain(freeSpace, true);
@@ -406,7 +413,8 @@ private ItemStack drainTankFromStack(boolean tryFillAll) {
         currentFluid = currentFluid.copy();
 
         int originalFluidAmount = fluidTank.getFluidAmount();
-        IFluidHandlerItem handler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem handler = heldItemSizedOne.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY,
+                null);
         if (handler == null) return ItemStack.EMPTY;
         ItemStack filledContainer = fillFluidContainer(currentFluid, heldItemSizedOne);
         if (filledContainer != ItemStack.EMPTY) {
@@ -431,7 +439,8 @@ private ItemStack drainTankFromStack(boolean tryFillAll) {
     }
 
     private ItemStack fillFluidContainer(FluidStack fluidStack, ItemStack itemStack) {
-        IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandlerItem = itemStack
+                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
         if (fluidHandlerItem == null) return ItemStack.EMPTY;
         int filledAmount = fluidHandlerItem.fill(fluidStack, true);
         if (filledAmount > 0) {
diff --git a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
index c27c83a503d..cfea1c60d28 100644
--- a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget.java
@@ -6,6 +6,7 @@
 import gregtech.api.util.MCGuiUtil;
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiTextField;
@@ -32,7 +33,8 @@ public class TextFieldWidget extends Widget {
     private boolean enableBackground;
     private boolean isClient;
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground, Supplier textSupplier, Consumer textResponder) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground,
+                           Supplier textSupplier, Consumer textResponder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             this.enableBackground = enableBackground;
@@ -40,7 +42,8 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
             if (enableBackground) {
                 this.textField = new GuiTextField(0, fontRenderer, xPosition, yPosition, width, height);
             } else {
-                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                        yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             }
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(enableBackground);
@@ -51,14 +54,16 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
         this.textResponder = textResponder;
     }
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground, Supplier textSupplier, Consumer textResponder, int maxStringLength) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground,
+                           Supplier textSupplier, Consumer textResponder, int maxStringLength) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
             if (enableBackground) {
                 this.textField = new GuiTextField(0, fontRenderer, xPosition, yPosition, width, height);
             } else {
-                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+                this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                        yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             }
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(enableBackground);
@@ -70,12 +75,14 @@ public TextFieldWidget(int xPosition, int yPosition, int width, int height, bool
         this.textResponder = textResponder;
     }
 
-    public TextFieldWidget(int xPosition, int yPosition, int width, int height, IGuiTexture background, Supplier textSupplier, Consumer textResponder) {
+    public TextFieldWidget(int xPosition, int yPosition, int width, int height, IGuiTexture background,
+                           Supplier textSupplier, Consumer textResponder) {
         super(new Position(xPosition, yPosition), new Size(width, height));
         if (isClientSide()) {
             this.enableBackground = false;
             FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
-            this.textField = new GuiTextField(0, fontRenderer, xPosition + 1, yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
+            this.textField = new GuiTextField(0, fontRenderer, xPosition + 1,
+                    yPosition + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, width - 2, height);
             this.textField.setCanLoseFocus(true);
             this.textField.setEnableBackgroundDrawing(false);
             this.textField.setMaxStringLength(maxStringLength);
@@ -116,7 +123,6 @@ public String getCurrentString() {
         return this.currentString;
     }
 
-
     @Override
     protected void onPositionUpdate() {
         if (isClientSide() && textField != null) {
@@ -138,7 +144,8 @@ protected void onSizeUpdate() {
             GuiTextField textField = this.textField;
             textField.width = enableBackground ? size.width : size.width - 2;
             textField.height = size.height;
-            textField.y = enableBackground ? position.y : position.y + (getSize().height - fontRenderer.FONT_HEIGHT) / 2 + 1;
+            textField.y = enableBackground ? position.y :
+                    position.y + (getSize().height - fontRenderer.FONT_HEIGHT) / 2 + 1;
 
         }
     }
diff --git a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
index a103f8e0bbb..4a7a57980b0 100644
--- a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
+++ b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
 import net.minecraft.client.gui.GuiScreen;
@@ -13,14 +14,16 @@
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
 import org.lwjgl.input.Keyboard;
 
-import javax.annotation.Nullable;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.regex.Pattern;
 
+import javax.annotation.Nullable;
+
 /**
  * @author brachy84
  */
@@ -132,7 +135,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         String text = getRenderText();
         if (cursorPos != cursorPos2) {
             // render marked text background
-            float startX = fontRenderer.getStringWidth(text.substring(0, toRenderTextIndex(Math.min(cursorPos, cursorPos2)))) * scale + textX;
+            float startX = fontRenderer
+                    .getStringWidth(text.substring(0, toRenderTextIndex(Math.min(cursorPos, cursorPos2)))) * scale +
+                    textX;
             String marked = getSelectedText();
             float width = fontRenderer.getStringWidth(marked);
             drawSelectionBox(startX * scaleFactor, y, width);
diff --git a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
index a342c4e9bee..2da1ba14564 100644
--- a/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
+++ b/src/main/java/gregtech/api/gui/widgets/ToggleButtonWidget.java
@@ -1,6 +1,5 @@
 package gregtech.api.gui.widgets;
 
-import com.google.common.base.Preconditions;
 import gregtech.api.gui.GuiTextures;
 import gregtech.api.gui.IRenderContext;
 import gregtech.api.gui.Widget;
@@ -10,12 +9,15 @@
 import gregtech.api.util.Position;
 import gregtech.api.util.Size;
 import gregtech.api.util.function.BooleanConsumer;
+
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
+import com.google.common.base.Preconditions;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.BooleanSupplier;
@@ -32,7 +34,8 @@ public class ToggleButtonWidget extends Widget {
     protected boolean isPressed;
     private boolean shouldUseBaseBackground;
 
-    public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition, BooleanConsumer setPressedExecutor) {
+    public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition,
+                              BooleanConsumer setPressedExecutor) {
         this(xPosition, yPosition, width, height, GuiTextures.VANILLA_BUTTON, isPressedCondition, setPressedExecutor);
     }
 
@@ -76,12 +79,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
         Position pos = getPosition();
         Size size = getSize();
         if (shouldUseBaseBackground) {
-            GuiTextures.TOGGLE_BUTTON_BACK.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, isPressed ? 0.5 : 0.0, 1.0, 0.5);
+            GuiTextures.TOGGLE_BUTTON_BACK.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0,
+                    isPressed ? 0.5 : 0.0, 1.0, 0.5);
             GlStateManager.color(1, 1, 1, 1);
             buttonTexture.draw(pos.x, pos.y, size.width, size.height);
         } else {
             if (buttonTexture instanceof SizedTextureArea) {
-                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, isPressed ? 0.5 : 0.0, 0.5);
+                ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height,
+                        isPressed ? 0.5 : 0.0, 0.5);
             } else {
                 buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, isPressed ? 0.5 : 0.0, 1.0, 0.5);
             }
@@ -135,7 +140,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
         return false;
     }
 
-
     @Override
     public void handleClientAction(int id, PacketBuffer buffer) {
         super.handleClientAction(id, buffer);
@@ -144,5 +148,4 @@ public void handleClientAction(int id, PacketBuffer buffer) {
             setPressedExecutor.apply(isPressed);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java b/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
index 5c8d907f9bb..a318f1bdefc 100644
--- a/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
+++ b/src/main/java/gregtech/api/gui/widgets/WidgetUIAccess.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.INativeWidget;
 import gregtech.api.gui.Widget;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.PacketBuffer;
 
@@ -57,5 +58,4 @@ public interface WidgetUIAccess {
      * Client will receive payload data in {@link Widget#readUpdateInfo(int, PacketBuffer)}
      */
     void writeUpdateInfo(Widget widget, int id, Consumer payloadWriter);
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
index 83158640701..d4d376caba9 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/HorizontalTabListRenderer.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.ModularUI;
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
+
 import net.minecraft.client.renderer.GlStateManager;
 
 import java.util.List;
@@ -18,7 +19,8 @@ public HorizontalTabListRenderer(HorizontalStartCorner startCorner, VerticalLoca
     }
 
     @Override
-    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
+    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight,
+                           int selectedTabIndex) {
         boolean startLeft = startCorner == HorizontalStartCorner.LEFT;
         boolean isTopLine = verticalLocation == VerticalLocation.TOP;
         int tabYPosition = isTopLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiHeight - TAB_Y_OFFSET);
@@ -29,12 +31,14 @@ public void renderTabs(ModularUI gui, Position offset, List tabInfos,
             boolean isTabFirst = tabIndex == 0;
             TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isTopLine, startLeft);
             int finalPosX = startLeft ? currentXOffset : (guiWidth - TAB_WIDTH - currentXOffset);
-            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + finalPosX, offset.y + tabYPosition, TAB_WIDTH, TAB_HEIGHT, isTabSelected);
+            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + finalPosX, offset.y + tabYPosition, TAB_WIDTH,
+                    TAB_HEIGHT, isTabSelected);
             currentXOffset += (TAB_WIDTH + SPACE_BETWEEN_TABS);
         }
     }
 
-    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isTopLine, boolean startLeft) {
+    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isTopLine,
+                                             boolean startLeft) {
         if (isTopLine) {
             return TopTextures.getTabTexture(isTabFirst, startLeft, isTabSelected);
         } else return BottomTextures.getTabTexture(isTabFirst, startLeft, isTabSelected);
@@ -46,27 +50,35 @@ public int[] getTabPos(int tabIndex, int guiWidth, int guiHeight) {
         boolean isTopLine = verticalLocation == VerticalLocation.TOP;
         int tabYPosition = isTopLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiHeight - TAB_Y_OFFSET);
         int tabXOffset = (TAB_WIDTH + SPACE_BETWEEN_TABS) * tabIndex;
-        return new int[]{startLeft ? tabXOffset : (guiWidth - TAB_WIDTH - tabXOffset), tabYPosition, TAB_WIDTH, TAB_HEIGHT};
+        return new int[] { startLeft ? tabXOffset : (guiWidth - TAB_WIDTH - tabXOffset), tabYPosition, TAB_WIDTH,
+                TAB_HEIGHT };
     }
 
     public enum HorizontalStartCorner {
-        LEFT, RIGHT
+        LEFT,
+        RIGHT
     }
 
     public enum VerticalLocation {
-        TOP, BOTTOM
+        TOP,
+        BOTTOM
     }
 
     private static final class TopTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea startTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0,
+                0.5);
         private static final TextureArea startTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0, 0.5);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
-        private static final TextureArea middleTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.0,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0,
+                0.5);
 
-        private static final TextureArea endTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
-        private static final TextureArea endTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
+        private static final TextureArea endTabInactiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0,
+                0.5);
+        private static final TextureArea endTabActiveTexture = TABS_TOP_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0,
+                0.5);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft, boolean isTabSelected) {
             return isTabFirst ? (startLeft ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -77,14 +89,20 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft,
 
     private static final class BottomTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea startTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea startTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.5, 1.0 / 3.0,
+                0.5);
+        private static final TextureArea startTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(0.0, 0.0, 1.0 / 3.0,
+                0.5);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea middleTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.5,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea middleTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(1.0 / 3.0, 0.0,
+                1.0 / 3.0, 0.5);
 
-        private static final TextureArea endTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.5, 1.0 / 3.0, 0.5);
-        private static final TextureArea endTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0, 0.5);
+        private static final TextureArea endTabInactiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.5,
+                1.0 / 3.0, 0.5);
+        private static final TextureArea endTabActiveTexture = TABS_BOTTOM_TEXTURE.getSubArea(2.0 / 3.0, 0.0, 1.0 / 3.0,
+                0.5);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft, boolean isTabSelected) {
             return isTabFirst ? (startLeft ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -92,5 +110,4 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startLeft,
                     (isTabSelected ? middleTabActiveTexture : middleTabInactiveTexture);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
index f1d4728e9af..6d1c078e8c0 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/IGuiTextureTabInfo.java
@@ -1,13 +1,16 @@
 package gregtech.api.gui.widgets.tab;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.resources.IGuiTexture;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.resources.I18n;
 import net.minecraftforge.fml.client.config.GuiUtils;
 
+import com.google.common.collect.Lists;
+
 public class IGuiTextureTabInfo implements ITabInfo {
+
     public final IGuiTexture texture;
     public final String nameLocale;
 
@@ -23,10 +26,12 @@ public void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int
     }
 
     @Override
-    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) {
+    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight,
+                                boolean isSelected, int mouseX, int mouseY) {
         String localizedText = I18n.format(nameLocale);
         Minecraft mc = Minecraft.getMinecraft();
         ScaledResolution resolution = new ScaledResolution(mc);
-        GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, resolution.getScaledWidth(), resolution.getScaledHeight(), -1, mc.fontRenderer);
+        GuiUtils.drawHoveringText(Lists.newArrayList(localizedText), mouseX, mouseY, resolution.getScaledWidth(),
+                resolution.getScaledHeight(), -1, mc.fontRenderer);
     }
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
index 28fb8daace7..961daad1eb7 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/ITabInfo.java
@@ -6,6 +6,6 @@ public interface ITabInfo {
 
     void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int ySize, boolean isSelected);
 
-    void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY);
-
+    void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected,
+                         int mouseX, int mouseY);
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
index e88e88a3e01..b00bf2c363b 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/ItemTabInfo.java
@@ -1,7 +1,7 @@
 package gregtech.api.gui.widgets.tab;
 
-import com.google.common.collect.Lists;
 import gregtech.api.gui.resources.IGuiTexture;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.renderer.GlStateManager;
@@ -10,6 +10,8 @@
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.fml.client.config.GuiUtils;
 
+import com.google.common.collect.Lists;
+
 public class ItemTabInfo implements ITabInfo {
 
     private final String nameLocale;
@@ -25,13 +27,15 @@ public void renderTab(IGuiTexture tabTexture, int posX, int posY, int xSize, int
         tabTexture.draw(posX, posY, xSize, ySize);
         GlStateManager.enableRescaleNormal();
         RenderHelper.enableGUIStandardItemLighting();
-        Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(iconStack, posX + xSize / 2 - 8, posY + ySize / 2 - 8);
+        Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(iconStack, posX + xSize / 2 - 8,
+                posY + ySize / 2 - 8);
         RenderHelper.disableStandardItemLighting();
         GlStateManager.disableRescaleNormal();
     }
 
     @Override
-    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight, boolean isSelected, int mouseX, int mouseY) {
+    public void renderHoverText(int posX, int posY, int xSize, int ySize, int guiWidth, int guiHeight,
+                                boolean isSelected, int mouseX, int mouseY) {
         if (nameLocale != null) {
             String localizedText = I18n.format(nameLocale);
             Minecraft mc = Minecraft.getMinecraft();
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
index e512ffddefd..61b44d7ada5 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/TabListRenderer.java
@@ -18,8 +18,8 @@ public abstract class TabListRenderer {
     public static final TextureArea TABS_LEFT_TEXTURE = TextureArea.fullImage("textures/gui/tab/tabs_left.png");
     public static final TextureArea TABS_RIGHT_TEXTURE = TextureArea.fullImage("textures/gui/tab/tabs_right.png");
 
-    public abstract void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex);
+    public abstract void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth,
+                                    int guiHeight, int selectedTabIndex);
 
     public abstract int[] getTabPos(int tabIndex, int guiWidth, int guiHeight);
-
 }
diff --git a/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java b/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
index 6285f155ae0..c401ed703c7 100644
--- a/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
+++ b/src/main/java/gregtech/api/gui/widgets/tab/VerticalTabListRenderer.java
@@ -3,6 +3,7 @@
 import gregtech.api.gui.ModularUI;
 import gregtech.api.gui.resources.TextureArea;
 import gregtech.api.util.Position;
+
 import net.minecraft.client.renderer.GlStateManager;
 
 import java.util.List;
@@ -18,7 +19,8 @@ public VerticalTabListRenderer(VerticalStartCorner startCorner, HorizontalLocati
     }
 
     @Override
-    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
+    public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight,
+                           int selectedTabIndex) {
         boolean startTop = startCorner == VerticalStartCorner.TOP;
         boolean isLeftLine = verticalLocation == HorizontalLocation.LEFT;
         int tabXPosition = isLeftLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiWidth - TAB_Y_OFFSET);
@@ -29,14 +31,16 @@ public void renderTabs(ModularUI gui, Position offset, List tabInfos,
             boolean isTabFirst = tabIndex == 0;
             TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isLeftLine, startTop);
             int finalPosY = startTop ? currentYPosition : (guiHeight - TAB_WIDTH - currentYPosition);
-            //noinspection SuspiciousNameCombination
-            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + tabXPosition, offset.y + finalPosY, TAB_HEIGHT, TAB_WIDTH, isTabSelected);
+            // noinspection SuspiciousNameCombination
+            tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + tabXPosition, offset.y + finalPosY, TAB_HEIGHT,
+                    TAB_WIDTH, isTabSelected);
             currentYPosition += (TAB_WIDTH + SPACE_BETWEEN_TABS);
             GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F);
         }
     }
 
-    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isLeftSide, boolean startTop) {
+    private static TextureArea getTabTexture(boolean isTabSelected, boolean isTabFirst, boolean isLeftSide,
+                                             boolean startTop) {
         if (isLeftSide) {
             return LeftTextures.getTabTexture(isTabFirst, startTop, isTabSelected);
         } else return RightTextures.getTabTexture(isTabFirst, startTop, isTabSelected);
@@ -48,27 +52,35 @@ public int[] getTabPos(int tabIndex, int guiWidth, int guiHeight) {
         boolean isLeftLine = verticalLocation == HorizontalLocation.LEFT;
         int tabXPosition = isLeftLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiWidth - TAB_Y_OFFSET);
         int tabYOffset = (TAB_WIDTH + SPACE_BETWEEN_TABS) * tabIndex;
-        return new int[]{tabXPosition, startTop ? tabYOffset : (guiHeight - TAB_WIDTH - tabYOffset), TAB_HEIGHT, TAB_WIDTH};
+        return new int[] { tabXPosition, startTop ? tabYOffset : (guiHeight - TAB_WIDTH - tabYOffset), TAB_HEIGHT,
+                TAB_WIDTH };
     }
 
     public enum VerticalStartCorner {
-        TOP, BOTTOM
+        TOP,
+        BOTTOM
     }
 
     public enum HorizontalLocation {
-        LEFT, RIGHT
+        LEFT,
+        RIGHT
     }
 
     private static final class LeftTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 0.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea startTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 0.0, 0.5,
+                1.0 / 3.0);
         private static final TextureArea startTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 0.0, 0.5, 1.0 / 3.0);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea middleTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea middleTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea middleTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea endTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea endTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea endTabInactiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea endTabActiveTexture = TABS_LEFT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, boolean isTabSelected) {
             return isTabFirst ? (startTop ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -79,14 +91,20 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, b
 
     private static final class RightTextures {
 
-        private static final TextureArea startTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 0.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea startTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 0.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea startTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 0.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea startTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 0.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea middleTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea middleTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea middleTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea middleTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 1.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
-        private static final TextureArea endTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5, 1.0 / 3.0);
-        private static final TextureArea endTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5, 1.0 / 3.0);
+        private static final TextureArea endTabInactiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.5, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
+        private static final TextureArea endTabActiveTexture = TABS_RIGHT_TEXTURE.getSubArea(0.0, 2.0 / 3.0, 0.5,
+                1.0 / 3.0);
 
         private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, boolean isTabSelected) {
             return isTabFirst ? (startTop ? (isTabSelected ? startTabActiveTexture : startTabInactiveTexture) :
@@ -94,5 +112,4 @@ private static TextureArea getTabTexture(boolean isTabFirst, boolean startTop, b
                     (isTabSelected ? middleTabActiveTexture : middleTabInactiveTexture);
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/OreDictNames.java b/src/main/java/gregtech/api/items/OreDictNames.java
index 488d5bc2078..b1ddb1c4e10 100644
--- a/src/main/java/gregtech/api/items/OreDictNames.java
+++ b/src/main/java/gregtech/api/items/OreDictNames.java
@@ -1,6 +1,5 @@
 package gregtech.api.items;
 
-
 public enum OreDictNames {
 
     string,
diff --git a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
index a761c670b14..1fedb208ce4 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java
@@ -1,11 +1,11 @@
 package gregtech.api.items.armor;
 
-
 import gregtech.api.capability.GregtechCapabilities;
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.items.armor.ArmorMetaItem.ArmorMetaValueItem;
 import gregtech.api.items.metaitem.ElectricStats;
 import gregtech.api.items.metaitem.stats.IItemHUDProvider;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
@@ -18,9 +18,10 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public abstract class ArmorLogicSuite implements ISpecialArmorLogic, IItemHUDProvider {
 
     protected final int energyPerUse;
@@ -39,9 +40,10 @@ protected ArmorLogicSuite(int energyPerUse, long maxCapacity, int tier, EntityEq
     public abstract void onArmorTick(World world, EntityPlayer player, ItemStack itemStack);
 
     @Override
-    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) {
+    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source,
+                                         double damage, EntityEquipmentSlot equipmentSlot) {
         IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-        if(item == null) {
+        if (item == null) {
             return new ArmorProperties(0, 0.0, 0);
         }
         int damageLimit = Integer.MAX_VALUE;
@@ -64,6 +66,7 @@ public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
     @Override
     public void addToolComponents(ArmorMetaValueItem mvi) {
         mvi.addComponents(new ElectricStats(maxCapacity, tier, true, false) {
+
             @Override
             public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
                 return onRightClick(world, player, hand);
@@ -85,7 +88,8 @@ public void addInfo(ItemStack itemStack, List lines) {
     public ActionResult onRightClick(World world, EntityPlayer player, EnumHand hand) {
         if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem) {
             ItemStack armor = player.getHeldItem(hand);
-            if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory.get(SLOT.getIndex()).isEmpty() && !player.isSneaking()) {
+            if (armor.getItem() instanceof ArmorMetaItem &&
+                    player.inventory.armorInventory.get(SLOT.getIndex()).isEmpty() && !player.isSneaking()) {
                 player.inventory.armorInventory.set(SLOT.getIndex(), armor.copy());
                 player.setHeldItem(hand, ItemStack.EMPTY);
                 player.playSound(new SoundEvent(new ResourceLocation("item.armor.equip_generic")), 1.0F, 1.0F);
diff --git a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
index d7dd9225644..223fb0a7425 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java
@@ -1,11 +1,10 @@
 package gregtech.api.items.armor;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Multimap;
 import gregtech.api.GregTechAPI;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.items.metaitem.stats.IEnchantabilityHelper;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.model.ModelBiped;
 import net.minecraft.enchantment.Enchantment;
@@ -24,10 +23,14 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Multimap;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-public class ArmorMetaItem.ArmorMetaValueItem> extends MetaItem implements IArmorItem, ISpecialArmor, IEnchantabilityHelper {
+public class ArmorMetaItem.ArmorMetaValueItem> extends MetaItem
+                          implements IArmorItem, ISpecialArmor, IEnchantabilityHelper {
 
     public ArmorMetaItem() {
         super((short) 0);
@@ -48,7 +51,8 @@ private IArmorLogic getArmorLogic(ItemStack itemStack) {
 
     @Nonnull
     @Override
-    public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) {
+    public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot,
+                                                                     @Nonnull ItemStack stack) {
         Multimap multimap = super.getAttributeModifiers(slot, stack);
         IArmorLogic armorLogic = getArmorLogic(stack);
         multimap.putAll(armorLogic.getAttributeModifiers(slot, stack));
@@ -56,7 +60,8 @@ public Multimap getAttributeModifiers(@Nonnull Entity
     }
 
     @Override
-    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) {
+    public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source,
+                                         double damage, int slot) {
         IArmorLogic armorLogic = getArmorLogic(armor);
         if (armorLogic instanceof ISpecialArmorLogic) {
             return ((ISpecialArmorLogic) armorLogic).getProperties(player, armor, source, damage, getSlotByIndex(slot));
@@ -74,16 +79,19 @@ public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int sl
     }
 
     @Override
-    public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot) {
+    public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage,
+                            int slot) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         armorLogic.damageArmor(entity, stack, source, damage, getSlotByIndex(slot));
     }
 
     @Override
-    public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) {
+    public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source,
+                                           double damage, int slot) {
         IArmorLogic armorLogic = getArmorLogic(armor);
         if (armorLogic instanceof ISpecialArmorLogic) {
-            return ((ISpecialArmorLogic) armorLogic).handleUnblockableDamage(entity, armor, source, damage, getSlotByIndex(slot));
+            return ((ISpecialArmorLogic) armorLogic).handleUnblockableDamage(entity, armor, source, damage,
+                    getSlotByIndex(slot));
         }
         return false;
     }
@@ -95,7 +103,8 @@ public void onArmorTick(@Nonnull World world, @Nonnull EntityPlayer player, @Non
     }
 
     @Override
-    public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSlot armorType, @Nonnull Entity entity) {
+    public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSlot armorType,
+                                @Nonnull Entity entity) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         return super.isValidArmor(stack, armorType, entity) &&
                 armorLogic.isValidArmor(stack, entity, armorType);
@@ -110,7 +119,8 @@ public EntityEquipmentSlot getEquipmentSlot(@Nonnull ItemStack stack) {
 
     @Nullable
     @Override
-    public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nonnull EntityEquipmentSlot slot, @Nonnull String type) {
+    public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nonnull EntityEquipmentSlot slot,
+                                  @Nonnull String type) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         return armorLogic.getArmorTexture(stack, entity, slot, type);
     }
@@ -118,7 +128,8 @@ public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity,
     @Nullable
     @Override
     @SideOnly(Side.CLIENT)
-    public ModelBiped getArmorModel(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack itemStack, @Nonnull EntityEquipmentSlot armorSlot, @Nonnull ModelBiped _default) {
+    public ModelBiped getArmorModel(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack itemStack,
+                                    @Nonnull EntityEquipmentSlot armorSlot, @Nonnull ModelBiped _default) {
         IArmorLogic armorLogic = getArmorLogic(itemStack);
         return armorLogic.getArmorModel(entityLiving, itemStack, armorSlot, _default);
     }
@@ -136,7 +147,8 @@ public int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
     }
 
     @Override
-    public void renderHelmetOverlay(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull ScaledResolution resolution, float partialTicks) {
+    public void renderHelmetOverlay(@Nonnull ItemStack stack, @Nonnull EntityPlayer player,
+                                    @Nonnull ScaledResolution resolution, float partialTicks) {
         IArmorLogic armorLogic = getArmorLogic(stack);
         armorLogic.renderHelmetOverlay(stack, player, resolution, partialTicks);
     }
@@ -175,7 +187,6 @@ public ArmorMetaValueItem setArmorLogic(IArmorLogic armorLogic) {
             return this;
         }
 
-
         @Override
         public ArmorMetaValueItem addComponents(IItemComponent... stats) {
             super.addComponents(stats);
@@ -228,5 +239,4 @@ public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Ench
                 return enchantment.isAllowedOnBooks();
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/armor/ArmorUtils.java b/src/main/java/gregtech/api/items/armor/ArmorUtils.java
index 4ef4bfa1e9f..12794ed3d02 100644
--- a/src/main/java/gregtech/api/items/armor/ArmorUtils.java
+++ b/src/main/java/gregtech/api/items/armor/ArmorUtils.java
@@ -1,12 +1,10 @@
 package gregtech.api.items.armor;
 
-
 import gregtech.api.capability.GregtechCapabilities;
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.util.ItemStackHashStrategy;
 import gregtech.common.ConfigHolder;
-import it.unimi.dsi.fastutil.objects.Object2IntMap;
-import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.entity.player.EntityPlayer;
@@ -22,14 +20,18 @@
 import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
+
+import it.unimi.dsi.fastutil.objects.Object2IntMap;
+import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap;
 import org.apache.commons.lang3.tuple.Pair;
 
-import javax.annotation.Nonnull;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 public class ArmorUtils {
 
     public static final Side SIDE = FMLCommonHandler.instance().getSide();
@@ -41,7 +43,8 @@ public class ArmorUtils {
     public static boolean isPossibleToCharge(ItemStack chargeable) {
         IElectricItem container = chargeable.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
         if (container != null) {
-            return container.getCharge() < container.getMaxCharge() && (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge();
+            return container.getCharge() < container.getMaxCharge() &&
+                    (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge();
         }
         return false;
     }
@@ -66,35 +69,34 @@ public static List, List>> getChargeableIte
             }
         }
 
-        if(!openMainSlots.isEmpty()) {
+        if (!openMainSlots.isEmpty()) {
             inventorySlotMap.add(Pair.of(player.inventory.mainInventory, openMainSlots));
         }
 
-
         List openArmorSlots = new ArrayList<>();
-        for(int i = 0; i < player.inventory.armorInventory.size(); i++) {
+        for (int i = 0; i < player.inventory.armorInventory.size(); i++) {
             ItemStack current = player.inventory.armorInventory.get(i);
             IElectricItem item = current.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-            if(item == null) {
+            if (item == null) {
                 continue;
             }
 
-            if(isPossibleToCharge(current) && item.getTier() <= tier) {
+            if (isPossibleToCharge(current) && item.getTier() <= tier) {
                 openArmorSlots.add(i);
             }
         }
 
-        if(!openArmorSlots.isEmpty()) {
+        if (!openArmorSlots.isEmpty()) {
             inventorySlotMap.add(Pair.of(player.inventory.armorInventory, openArmorSlots));
         }
 
         ItemStack offHand = player.inventory.offHandInventory.get(0);
         IElectricItem offHandItem = offHand.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
-        if(offHandItem == null) {
+        if (offHandItem == null) {
             return inventorySlotMap;
         }
 
-        if(isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) {
+        if (isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) {
             inventorySlotMap.add(Pair.of(player.inventory.offHandInventory, Collections.singletonList(0)));
         }
 
@@ -107,7 +109,8 @@ public static List, List>> getChargeableIte
     public static void spawnParticle(World world, EntityPlayer player, EnumParticleTypes type, double speedY) {
         if (type != null && SIDE.isClient()) {
             Vec3d forward = player.getForward();
-            world.spawnParticle(type, player.posX - forward.x, player.posY + 0.5D, player.posZ - forward.z, 0.0D, speedY, 0.0D);
+            world.spawnParticle(type, player.posX - forward.x, player.posY + 0.5D, player.posZ - forward.z, 0.0D,
+                    speedY, 0.0D);
         }
     }
 
@@ -134,7 +137,8 @@ public static void playJetpackSound(@Nonnull EntityPlayer player) {
     @SuppressWarnings("deprecation")
     public static void resetPlayerFloatingTime(EntityPlayer player) {
         if (player instanceof EntityPlayerMP) {
-            ObfuscationReflectionHelper.setPrivateValue(NetHandlerPlayServer.class, ((EntityPlayerMP) player).connection, 0, "field_147365_f", "floatingTickCount");
+            ObfuscationReflectionHelper.setPrivateValue(NetHandlerPlayServer.class,
+                    ((EntityPlayerMP) player).connection, 0, "field_147365_f", "floatingTickCount");
         }
     }
 
@@ -151,7 +155,7 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
 
         ItemFood foodItem = (ItemFood) food.getItem();
         if (player.getFoodStats().needFood()) {
-            if(!player.isCreative()) {
+            if (!player.isCreative()) {
                 food.setCount(food.getCount() - 1);
             }
 
@@ -164,8 +168,10 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
             // Increase the saturation of the food if the food replenishes more than the amount of missing haunches
             saturation += (hunger - foodItem.getHealAmount(food)) < 0 ? foodItem.getHealAmount(food) - hunger : 1.0F;
 
-            // Use this method to add stats for compat with TFC, who overrides addStats(int amount, float saturation) for their food and does nothing
-            player.getFoodStats().addStats(new ItemFood(foodItem.getHealAmount(food), saturation, foodItem.isWolfsFavoriteMeat()), food);
+            // Use this method to add stats for compat with TFC, who overrides addStats(int amount, float saturation)
+            // for their food and does nothing
+            player.getFoodStats().addStats(
+                    new ItemFood(foodItem.getHealAmount(food), saturation, foodItem.isWolfsFavoriteMeat()), food);
 
             return new ActionResult<>(EnumActionResult.SUCCESS, food);
         } else {
@@ -180,7 +186,8 @@ public static ActionResult canEat(EntityPlayer player, ItemStack food
      * @return Formated list
      */
     public static List format(List input) {
-        Object2IntMap items = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount());
+        Object2IntMap items = new Object2IntOpenCustomHashMap<>(
+                ItemStackHashStrategy.comparingAllButCount());
         List output = new ArrayList<>();
         for (ItemStack itemStack : input) {
             if (items.containsKey(itemStack)) {
@@ -198,7 +205,6 @@ public static List format(List input) {
         return output;
     }
 
-
     @Nonnull
     public static String format(long value) {
         return new DecimalFormat("###,###.##").format(value);
@@ -215,6 +221,7 @@ public static String format(double value) {
      */
     @SideOnly(Side.CLIENT)
     public static class ModularHUD {
+
         private byte stringAmount = 0;
         private final List stringList;
         private static final Minecraft mc = Minecraft.getMinecraft();
@@ -231,7 +238,8 @@ public void newString(String string) {
         public void draw() {
             for (int i = 0; i < stringAmount; i++) {
                 Pair coords = this.getStringCoord(i);
-                mc.ingameGUI.drawString(mc.fontRenderer, stringList.get(i), coords.getLeft(), coords.getRight(), 0xFFFFFF);
+                mc.ingameGUI.drawString(mc.fontRenderer, stringList.get(i), coords.getLeft(), coords.getRight(),
+                        0xFFFFFF);
             }
         }
 
@@ -265,6 +273,5 @@ public void reset() {
             this.stringAmount = 0;
             this.stringList.clear();
         }
-
     }
 }
diff --git a/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java b/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
index 37f3204e94a..91c18351856 100644
--- a/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/DummyArmorLogic.java
@@ -5,6 +5,7 @@
 import net.minecraft.item.ItemStack;
 
 class DummyArmorLogic implements IArmorLogic {
+
     @Override
     public EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack) {
         return EntityEquipmentSlot.HEAD;
diff --git a/src/main/java/gregtech/api/items/armor/IArmorItem.java b/src/main/java/gregtech/api/items/armor/IArmorItem.java
index afde8b798d9..41fb9b4eaf5 100644
--- a/src/main/java/gregtech/api/items/armor/IArmorItem.java
+++ b/src/main/java/gregtech/api/items/armor/IArmorItem.java
@@ -1,18 +1,18 @@
-package gregtech.api.items.armor;
-
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.DamageSource;
-
-public interface IArmorItem {
-
-    default int getArmorLayersAmount(ItemStack itemStack) {
-        return 1;
-    }
-
-    default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
-        return 0xFFFFFF;
-    }
-
-    void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, int slot);
-}
+package gregtech.api.items.armor;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+
+public interface IArmorItem {
+
+    default int getArmorLayersAmount(ItemStack itemStack) {
+        return 1;
+    }
+
+    default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
+        return 0xFFFFFF;
+    }
+
+    void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, int slot);
+}
diff --git a/src/main/java/gregtech/api/items/armor/IArmorLogic.java b/src/main/java/gregtech/api/items/armor/IArmorLogic.java
index 590d54234fb..66ad1627bab 100644
--- a/src/main/java/gregtech/api/items/armor/IArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/IArmorLogic.java
@@ -1,8 +1,7 @@
 package gregtech.api.items.armor;
 
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
 import gregtech.api.items.armor.ArmorMetaItem.ArmorMetaValueItem;
+
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraft.client.model.ModelBiped;
 import net.minecraft.entity.Entity;
@@ -16,9 +15,13 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nullable;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
 import java.util.UUID;
 
+import javax.annotation.Nullable;
+
 /**
  * Defines abstract armor logic that can be added to ArmorMetaItem to control it
  * It can implement {@link net.minecraftforge.common.ISpecialArmor} for extended damage calculations
@@ -29,8 +32,7 @@ public interface IArmorLogic {
     UUID ATTACK_DAMAGE_MODIFIER = UUID.fromString("CB3F55D3-645C-4F38-A144-9C13A33DB5CF");
     UUID ATTACK_SPEED_MODIFIER = UUID.fromString("FA233E1C-4180-4288-B05C-BCCE9785ACA3");
 
-    default void addToolComponents(ArmorMetaValueItem metaValueItem) {
-    }
+    default void addToolComponents(ArmorMetaValueItem metaValueItem) {}
 
     EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack);
 
@@ -38,9 +40,8 @@ default boolean canBreakWithDamage(ItemStack stack) {
         return false;
     }
 
-    default void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) {
-
-    }
+    default void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage,
+                             EntityEquipmentSlot equipmentSlot) {}
 
     default Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
         return ImmutableMultimap.of();
@@ -50,12 +51,11 @@ default boolean isValidArmor(ItemStack itemStack, Entity entity, EntityEquipment
         return getEquipmentSlot(itemStack) == equipmentSlot;
     }
 
-    default void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
-    }
+    default void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {}
 
     @SideOnly(Side.CLIENT)
-    default void renderHelmetOverlay(ItemStack itemStack, EntityPlayer player, ScaledResolution resolution, float partialTicks) {
-    }
+    default void renderHelmetOverlay(ItemStack itemStack, EntityPlayer player, ScaledResolution resolution,
+                                     float partialTicks) {}
 
     default int getArmorLayersAmount(ItemStack itemStack) {
         return 1;
@@ -68,7 +68,8 @@ default int getArmorLayerColor(ItemStack itemStack, int layerIndex) {
     String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type);
 
     @Nullable
-    default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped defaultModel) {
+    default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
+                                     ModelBiped defaultModel) {
         return null;
     }
 
diff --git a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
index 35734b1d7b3..acab02f1da0 100644
--- a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
+++ b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java
@@ -23,7 +23,8 @@ public interface ISpecialArmorLogic extends IArmorLogic {
      * same priority, damage will be distributed between them based on there
      * absorption ratio.
      */
-    ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot);
+    ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage,
+                                  EntityEquipmentSlot equipmentSlot);
 
     /**
      * Get the displayed effective armor.
@@ -40,7 +41,8 @@ public interface ISpecialArmorLogic extends IArmorLogic {
      * Returning true here means that the armor is able to meaningfully respond
      * to this damage source. Otherwise, no interaction is allowed.
      */
-    default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) {
+    default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source,
+                                            double damage, EntityEquipmentSlot equipmentSlot) {
         return false;
     }
 }
diff --git a/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java b/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
index 56901483847..5feda5eac58 100644
--- a/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/CoverItemBehavior.java
@@ -7,6 +7,7 @@
 import gregtech.api.cover.CoverRayTracer;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
 import gregtech.core.advancement.AdvancementTriggers;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.item.ItemStack;
@@ -16,6 +17,7 @@
 import net.minecraft.util.EnumHand;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
+
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -33,7 +35,8 @@ public CoverItemBehavior(@NotNull CoverDefinition definition) {
     }
 
     @Override
-    public EnumActionResult onItemUseFirst(EntityPlayer player, @NotNull World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
+    public EnumActionResult onItemUseFirst(EntityPlayer player, @NotNull World world, BlockPos pos, EnumFacing side,
+                                           float hitX, float hitY, float hitZ, EnumHand hand) {
         TileEntity tileEntity = world.getTileEntity(pos);
         if (tileEntity == null) return EnumActionResult.PASS;
 
diff --git a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
index 6700269dc35..3e4183e8d6f 100644
--- a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java
@@ -9,11 +9,11 @@
 import gregtech.api.items.gui.PlayerInventoryHolder;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
-import gregtech.core.network.packets.PacketPluginSynced;
 import gregtech.api.util.IDirtyNotifiable;
 import gregtech.common.gui.widget.monitor.WidgetPluginConfig;
 import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen;
-import io.netty.buffer.Unpooled;
+import gregtech.core.network.packets.PacketPluginSynced;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -29,11 +29,15 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
+import io.netty.buffer.Unpooled;
+
 import java.util.List;
 import java.util.function.Consumer;
 
+import javax.annotation.Nonnull;
+
 public abstract class MonitorPluginBaseBehavior implements IItemBehaviour, ItemUIFactory, IDirtyNotifiable {
+
     protected MetaTileEntityMonitorScreen screen;
     private NBTTagCompound nbtTagCompound;
 
@@ -57,7 +61,8 @@ public MetaTileEntityMonitorScreen getScreen() {
 
     /***
      * Do not override createUI below.
-     * @param holder It should be one of PlayerInventoryHolder or MetaTileEntityHolder.
+     * 
+     * @param holder       It should be one of PlayerInventoryHolder or MetaTileEntityHolder.
      * @param entityPlayer Player
      * @return WidgetGroup back
      */
@@ -73,15 +78,17 @@ public boolean hasUI() {
     }
 
     /***
-     * Server / Client. Itemstack will be synced to client when init so... yeah normally you don't need to consider nbt init.
+     * Server / Client. Itemstack will be synced to client when init so... yeah normally you don't need to consider nbt
+     * init.
      * this will be called when you markDirty.
+     * 
      * @param data nbtTag
      */
-    public void writeToNBT(NBTTagCompound data) {
-    }
+    public void writeToNBT(NBTTagCompound data) {}
 
     /***
      * Server / Client. Initialization of Server and Client.
+     * 
      * @param data nbtTag
      */
     public void readFromNBT(NBTTagCompound data) {
@@ -90,7 +97,8 @@ public void readFromNBT(NBTTagCompound data) {
 
     /***
      * Server. Same as writeCustomData in MetaTileEntity.
-     * @param id PacketID
+     * 
+     * @param id  PacketID
      * @param buf PacketBuffer
      */
     public final void writePluginData(int id, @Nonnull Consumer buf) {
@@ -104,16 +112,16 @@ public final void writePluginData(int id, @Nonnull Consumer buf) {
 
     /***
      * Client. Same as receiveCustomData in MetaTileEntity.
-     * @param id PacketID
+     * 
+     * @param id  PacketID
      * @param buf PacketBuffer
      */
-    public void readPluginData(int id, PacketBuffer buf) {
-
-    }
+    public void readPluginData(int id, PacketBuffer buf) {}
 
     /***
      * Client. Send data to Server.
-     * @param id PacketID
+     * 
+     * @param id         PacketID
      * @param dataWriter PacketBuffer
      */
     public final void writePluginAction(int id, @Nonnull Consumer dataWriter) {
@@ -127,29 +135,26 @@ public final void writePluginAction(int id, @Nonnull Consumer data
 
     /***
      * Server. receive data from client
+     * 
      * @param player player
-     * @param id PacketID
-     * @param buf PacketBuffer
+     * @param id     PacketID
+     * @param buf    PacketBuffer
      */
-    public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) {
-
-    }
+    public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) {}
 
     /***
      * Server. Same as writeInitialSyncData in MetaTileEntity.
+     * 
      * @param buf PacketBuffer
      */
-    public void writeInitialSyncData(PacketBuffer buf) {
-
-    }
+    public void writeInitialSyncData(PacketBuffer buf) {}
 
     /***
      * Client. Same as receiveInitialSyncData in MetaTileEntity.
+     * 
      * @param buf PacketBuffer
      */
-    public void receiveInitialSyncData(PacketBuffer buf) {
-
-    }
+    public void receiveInitialSyncData(PacketBuffer buf) {}
 
     /***
      * Server / Client (deprecated). Should be called when need to write persistence data to NBT
@@ -162,36 +167,36 @@ public void markAsDirty() {
         }
     }
 
-    /*** Server / Client. Called when player touch the screen.
+    /***
+     * Server / Client. Called when player touch the screen.
+     * 
      * @param playerIn Player
-     * @param hand Hand
-     * @param facing Facing
-     * @param isRight is Right Click
-     * @param x xPos of the screen (0 ~ 1.0)
-     * @param y yPos of the screen (0 ~ 1.0)
+     * @param hand     Hand
+     * @param facing   Facing
+     * @param isRight  is Right Click
+     * @param x        xPos of the screen (0 ~ 1.0)
+     * @param y        yPos of the screen (0 ~ 1.0)
      * @return trigger result
      */
-    public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) {
+    public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x,
+                                double y) {
         return false;
     }
 
     /***
      * Server / Client. Called per tick when structure formed.
      */
-    public void update() {
-
-    }
+    public void update() {}
 
     /***
      * Client. Write rendering here
      */
     @SideOnly(Side.CLIENT)
-    public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) {
-
-    }
+    public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) {}
 
     /***
      * Server / Client. Called when plugin is added or removed from the screen.
+     * 
      * @param screen
      * @param valid
      */
@@ -227,7 +232,8 @@ public final ModularUI createUI(PlayerInventoryHolder playerInventoryHolder, Ent
             behavior = behavior.createPlugin();
             behavior.readFromNBT(itemStack.getOrCreateSubCompound("monitor_plugin"));
             return ModularUI.builder(GuiTextures.BOXED_BACKGROUND, 260, 210)
-                    .widget(behavior.customUI(new WidgetPluginConfig().setBackGround(GuiTextures.BACKGROUND), playerInventoryHolder, entityPlayer))
+                    .widget(behavior.customUI(new WidgetPluginConfig().setBackGround(GuiTextures.BACKGROUND),
+                            playerInventoryHolder, entityPlayer))
                     .bindCloseListener(this::markAsDirty)
                     .build(playerInventoryHolder, entityPlayer);
         }
diff --git a/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java b/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
index b1ea0eb1fd0..ca7aa7ebc67 100644
--- a/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
+++ b/src/main/java/gregtech/api/items/behavior/ProxyHolderPluginBehavior.java
@@ -1,6 +1,7 @@
 package gregtech.api.items.behavior;
 
 import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.math.BlockPos;
@@ -9,6 +10,7 @@
 import java.util.Objects;
 
 public abstract class ProxyHolderPluginBehavior extends MonitorPluginBaseBehavior {
+
     protected IGregTechTileEntity holder;
     private BlockPos pos;
 
diff --git a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
index 2c3dff4cdce..796cfeaf535 100644
--- a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
+++ b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.ModularUI;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.entity.player.EntityPlayer;
 
 public interface ItemUIFactory extends IItemComponent {
@@ -11,5 +12,4 @@ public interface ItemUIFactory extends IItemComponent {
      * about item stack and hand, and also player
      */
     ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer);
-
 }
diff --git a/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java b/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
index a80c8863c92..98ae3e4ead9 100644
--- a/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
+++ b/src/main/java/gregtech/api/items/gui/PlayerInventoryHolder.java
@@ -2,6 +2,7 @@
 
 import gregtech.api.gui.IUIHolder;
 import gregtech.api.gui.ModularUI;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.item.ItemStack;
diff --git a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
index b58083e2898..e9be886107d 100644
--- a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
+++ b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java
@@ -5,6 +5,7 @@
 import gregtech.api.gui.UIFactory;
 import gregtech.api.items.metaitem.MetaItem;
 import gregtech.api.util.GTUtility;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.ItemStack;
@@ -22,8 +23,7 @@ public class PlayerInventoryUIFactory extends UIFactory {
 
     public static final PlayerInventoryUIFactory INSTANCE = new PlayerInventoryUIFactory();
 
-    private PlayerInventoryUIFactory() {
-    }
+    private PlayerInventoryUIFactory() {}
 
     public void init() {
         GregTechAPI.UI_FACTORY_REGISTRY.register(1, GTUtility.gregtechId("player_inventory_factory"), this);
@@ -53,5 +53,4 @@ protected void writeHolderToSyncData(PacketBuffer syncData, PlayerInventoryHolde
         syncData.writeByte(holder.hand.ordinal());
         syncData.writeItemStack(holder.getCurrentItem());
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java b/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
index e3170ffdb34..b983862e399 100644
--- a/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
+++ b/src/main/java/gregtech/api/items/itemhandlers/GTItemStackHandler.java
@@ -1,6 +1,7 @@
 package gregtech.api.items.itemhandlers;
 
 import gregtech.api.metatileentity.MetaTileEntity;
+
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.NonNullList;
 import net.minecraftforge.items.ItemStackHandler;
diff --git a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
index 630312a13e3..237a1ca09fb 100644
--- a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
+++ b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java
@@ -1,11 +1,13 @@
 package gregtech.api.items.itemhandlers;
 
 import gregtech.api.metatileentity.MetaTileEntity;
+
 import net.minecraft.item.ItemStack;
 
 import javax.annotation.Nonnull;
 
 public class InaccessibleItemStackHandler extends GTItemStackHandler {
+
     public InaccessibleItemStackHandler(MetaTileEntity metaTileEntity) {
         super(metaTileEntity);
     }
diff --git a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
index 14a6ac03016..a117bd7e2ef 100644
--- a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
+++ b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
@@ -15,7 +15,7 @@
 import gregtech.api.unification.material.registry.MaterialRegistry;
 import gregtech.api.unification.ore.OrePrefix;
 import gregtech.api.unification.stack.UnificationEntry;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import net.minecraft.block.BlockCauldron;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.client.renderer.block.model.ModelBakery;
@@ -32,13 +32,16 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 public class MetaPrefixItem extends StandardMetaItem {
 
     private final MaterialRegistry registry;
@@ -125,7 +128,8 @@ public void registerModels() {
 
             short registrationKey = (short) (prefix.id + materialIconSet.id);
             if (!alreadyRegistered.containsKey(registrationKey)) {
-                ResourceLocation resourceLocation = Objects.requireNonNull(prefix.materialIconType).getItemModelPath(materialIconSet);
+                ResourceLocation resourceLocation = Objects.requireNonNull(prefix.materialIconType)
+                        .getItemModelPath(materialIconSet);
                 ModelBakery.registerItemVariants(this, resourceLocation);
                 alreadyRegistered.put(registrationKey, new ModelResourceLocation(resourceLocation, "inventory"));
             }
@@ -136,7 +140,8 @@ public void registerModels() {
         // Make some default models for meta prefix items without any materials associated
         if (metaItems.keySet().isEmpty()) {
             MaterialIconSet defaultIcon = MaterialIconSet.DULL;
-            ResourceLocation defaultLocation = Objects.requireNonNull(OrePrefix.ingot.materialIconType).getItemModelPath(defaultIcon);
+            ResourceLocation defaultLocation = Objects.requireNonNull(OrePrefix.ingot.materialIconType)
+                    .getItemModelPath(defaultIcon);
             ModelBakery.registerItemVariants(this, defaultLocation);
         }
     }
@@ -148,7 +153,8 @@ public int getItemStackLimit(@Nonnull ItemStack stack) {
     }
 
     @Override
-    public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, boolean isSelected) {
+    public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot,
+                         boolean isSelected) {
         super.onUpdate(itemStack, worldIn, entityIn, itemSlot, isSelected);
         if (metaItems.containsKey((short) itemStack.getItemDamage()) && entityIn instanceof EntityLivingBase entity) {
             if (entityIn.ticksExisted % 20 == 0) {
@@ -160,7 +166,8 @@ public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonn
                 float heatDamage = prefix.heatDamageFunction.apply(material.getBlastTemperature());
                 ItemStack armor = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
                 if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem) {
-                    ArmorMetaItem.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem) armor.getItem()).getItem(armor);
+                    ArmorMetaItem.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem) armor.getItem())
+                            .getItem(armor);
                     if (metaValueItem != null) heatDamage *= metaValueItem.getArmorLogic().getHeatResistance();
                 }
 
@@ -175,7 +182,8 @@ public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonn
 
     @Override
     @SideOnly(Side.CLIENT)
-    public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, @Nonnull ITooltipFlag tooltipFlag) {
+    public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines,
+                               @Nonnull ITooltipFlag tooltipFlag) {
         super.addInformation(itemStack, worldIn, lines, tooltipFlag);
         Material material = getMaterial(itemStack);
         if (prefix == null || material == null) return;
@@ -226,7 +234,6 @@ public int getItemBurnTime(@Nonnull ItemStack itemStack) {
         DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST);
         if (property != null) return (int) (property.getBurnTime() * prefix.getMaterialAmount(material) / GTValues.M);
         return super.getItemBurnTime(itemStack);
-
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java b/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
index 15c40fb9655..a0084373b9f 100644
--- a/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
+++ b/src/main/java/gregtech/api/items/metaitem/DefaultSubItemHandler.java
@@ -4,6 +4,7 @@
 import gregtech.api.capability.IElectricItem;
 import gregtech.api.items.metaitem.stats.ISubItemHandler;
 import gregtech.common.ConfigHolder;
+
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.NonNullList;
@@ -20,8 +21,7 @@ public class DefaultSubItemHandler implements ISubItemHandler {
 
     public static final DefaultSubItemHandler INSTANCE = new DefaultSubItemHandler();
 
-    private DefaultSubItemHandler() {
-    }
+    private DefaultSubItemHandler() {}
 
     @Override
     public String getItemSubType(ItemStack itemStack) {
@@ -46,7 +46,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi
     }
 
     public static String getFluidContainerSubType(ItemStack itemStack) {
-        IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+        IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY,
+                null);
         if (fluidHandler != null) {
             IFluidTankProperties fluidTankProperties = fluidHandler.getTankProperties()[0];
             FluidStack fluid = fluidTankProperties.getContents();
@@ -58,7 +59,8 @@ public static String getFluidContainerSubType(ItemStack itemStack) {
     public static void addFluidContainerVariants(ItemStack itemStack, List subItems) {
         for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
             ItemStack containerStack = itemStack.copy();
-            IFluidHandlerItem fluidContainer = containerStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
+            IFluidHandlerItem fluidContainer = containerStack
+                    .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
             if (fluidContainer != null) {
                 fluidContainer.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
                 if (fluidContainer.drain(Integer.MAX_VALUE, false) == null)
diff --git a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
index 187ab86c37e..91bd1b739da 100644
--- a/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/ElectricStats.java
@@ -8,6 +8,7 @@
 import gregtech.api.items.metaitem.stats.*;
 import gregtech.common.ConfigHolder;
 import gregtech.integration.baubles.BaublesModule;
+
 import net.minecraft.client.resources.I18n;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
@@ -30,7 +31,8 @@
 import java.time.Instant;
 import java.util.List;
 
-public class ElectricStats implements IItemComponent, IItemCapabilityProvider, IItemMaxStackSizeProvider, IItemBehaviour, ISubItemHandler {
+public class ElectricStats implements IItemComponent, IItemCapabilityProvider, IItemMaxStackSizeProvider,
+                           IItemBehaviour, ISubItemHandler {
 
     public static final ElectricStats EMPTY = new ElectricStats(0, 0, false, false);
 
@@ -79,7 +81,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) {
 
             for (int i = 0; i < inventoryPlayer.getSizeInventory(); i++) {
                 ItemStack itemInSlot = inventoryPlayer.getStackInSlot(i);
-                IElectricItem slotElectricItem = itemInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
+                IElectricItem slotElectricItem = itemInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM,
+                        null);
                 IEnergyStorage feEnergyItem = itemInSlot.getCapability(CapabilityEnergy.ENERGY, null);
                 if (slotElectricItem != null && !slotElectricItem.canProvideChargeExternally()) {
 
@@ -93,7 +96,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) {
                         int energyMissing = feEnergyItem.getMaxEnergyStored() - feEnergyItem.getEnergyStored();
                         long euToCharge = FeCompat.toEu(energyMissing, ConfigHolder.compat.energy.feToEuRatio);
                         long energyToTransfer = Math.min(euToCharge, transferLimit);
-                        long maxDischargeAmount = Math.min(energyToTransfer, electricItem.discharge(energyToTransfer, electricItem.getTier(), false, true, true));
+                        long maxDischargeAmount = Math.min(energyToTransfer,
+                                electricItem.discharge(energyToTransfer, electricItem.getTier(), false, true, true));
                         FeCompat.insertEu(feEnergyItem, maxDischargeAmount);
                         electricItem.discharge(maxDischargeAmount, electricItem.getTier(), false, true, false);
                     }
@@ -172,7 +176,8 @@ private static boolean isInDischargeMode(ItemStack itemStack) {
 
     @Override
     public int getMaxStackSize(ItemStack itemStack, int defaultValue) {
-        ElectricItem electricItem = (ElectricItem) itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
+        ElectricItem electricItem = (ElectricItem) itemStack
+                .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
         if (electricItem == null || electricItem.getCharge() == 0) {
             return defaultValue;
         }
diff --git a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
index 8e5505c4ae5..2c3cbf3dff5 100644
--- a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java
@@ -6,6 +6,7 @@
 import gregtech.api.capability.impl.PropertyFluidFilter;
 import gregtech.api.items.metaitem.stats.IItemCapabilityProvider;
 import gregtech.api.items.metaitem.stats.IItemComponent;
+
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.common.capabilities.ICapabilityProvider;
 import net.minecraftforge.fluids.FluidStack;
@@ -27,7 +28,8 @@ public FilteredFluidStats(int capacity, boolean allowPartialFill, @Nullable IFil
 
     public FilteredFluidStats(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof,
                               boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) {
-        this(capacity, allowPartialFill, new PropertyFluidFilter(maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof));
+        this(capacity, allowPartialFill,
+                new PropertyFluidFilter(maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof));
     }
 
     @Override
diff --git a/src/main/java/gregtech/api/items/metaitem/FoodStats.java b/src/main/java/gregtech/api/items/metaitem/FoodStats.java
index 0ce012f359b..2a7533a624e 100644
--- a/src/main/java/gregtech/api/items/metaitem/FoodStats.java
+++ b/src/main/java/gregtech/api/items/metaitem/FoodStats.java
@@ -3,14 +3,16 @@
 import gregtech.api.GTValues;
 import gregtech.api.items.metaitem.stats.IFoodBehavior;
 import gregtech.api.util.RandomPotionEffect;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.EnumAction;
 import net.minecraft.item.ItemStack;
 import net.minecraft.potion.PotionEffect;
 
-import javax.annotation.Nullable;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
 /**
  * Simple {@link gregtech.api.items.metaitem.stats.IFoodBehavior} implementation
  *
@@ -27,7 +29,8 @@ public class FoodStats implements IFoodBehavior {
     @Nullable
     public ItemStack containerItem;
 
-    public FoodStats(int foodLevel, float saturation, boolean isDrink, boolean alwaysEdible, ItemStack containerItem, RandomPotionEffect... potionEffects) {
+    public FoodStats(int foodLevel, float saturation, boolean isDrink, boolean alwaysEdible, ItemStack containerItem,
+                     RandomPotionEffect... potionEffects) {
         this.foodLevel = foodLevel;
         this.saturation = saturation;
         this.isDrink = isDrink;
@@ -99,8 +102,7 @@ public void addInformation(ItemStack itemStack, List lines) {
             for (int i = 0; i < potionEffects.length; i++) {
                 effects[i] = potionEffects[i].effect;
             }
-//            GTUtility.addPotionTooltip(Iterables.cycle(effects), lines); todo implement this
+            // GTUtility.addPotionTooltip(Iterables.cycle(effects), lines); todo implement this
         }
     }
-
 }
diff --git a/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java b/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
index af4a8d7914a..88ac607190c 100644
--- a/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
+++ b/src/main/java/gregtech/api/items/metaitem/FoodUseManager.java
@@ -3,6 +3,7 @@
 import gregtech.api.items.metaitem.stats.IFoodBehavior;
 import gregtech.api.items.metaitem.stats.IItemBehaviour;
 import gregtech.api.items.metaitem.stats.IItemUseManager;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.EnumAction;
 import net.minecraft.item.ItemStack;
@@ -22,8 +23,7 @@ public IFoodBehavior getFoodStats() {
     }
 
     @Override
-    public void onItemUseStart(ItemStack stack, EntityPlayer player) {
-    }
+    public void onItemUseStart(ItemStack stack, EntityPlayer player) {}
 
     @Override
     public boolean canStartUsing(ItemStack stack, EntityPlayer player) {
@@ -41,12 +41,10 @@ public int getMaxItemUseDuration(ItemStack itemStack) {
     }
 
     @Override
-    public void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {
-    }
+    public void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {}
 
     @Override
-    public void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {
-    }
+    public void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {}
 
     @Override
     public ItemStack onItemUseFinish(ItemStack stack, EntityPlayer player) {
diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java
index f9942826eff..3124992ad78 100644
--- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java
+++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java
@@ -1,9 +1,5 @@
 package gregtech.api.items.metaitem;
 
-import com.enderio.core.common.interfaces.IOverlayRenderAware;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Multimap;
 import gregtech.api.GTValues;
 import gregtech.api.GregTechAPI;
 import gregtech.api.capability.GregtechCapabilities;
@@ -26,11 +22,7 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.client.utils.ToolChargeBarRenderer;
 import gregtech.common.ConfigHolder;
-import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
-import it.unimi.dsi.fastutil.objects.ObjectArraySet;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectLinkedOpenHashMap;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
-import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.renderer.block.model.ModelBakery;
 import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -62,30 +54,44 @@
 import net.minecraftforge.fml.relauncher.SideOnly;
 import net.minecraftforge.items.ItemHandlerHelper;
 import net.minecraftforge.oredict.OreDictionary;
+
+import com.enderio.core.common.interfaces.IOverlayRenderAware;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Multimap;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectArraySet;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.Validate;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.*;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 /**
  * MetaItem is item that can have up to Short.MAX_VALUE items inside one id.
  * These items even can be edible, have custom behaviours, be electric or act like fluid containers!
  * They can also have different burn time, plus be handheld, oredicted or invisible!
  * They also can be reactor components.
  * 

- * You can also extend this class and occupy some of it's MetaData, and just pass an meta offset in constructor, and everything will work properly. + * You can also extend this class and occupy some of it's MetaData, and just pass an meta offset in constructor, and + * everything will work properly. *

- * Items are added in MetaItem via {@link #addItem(int, String)}. You will get {@link MetaValueItem} instance, which you can configure in builder-alike pattern: + * Items are added in MetaItem via {@link #addItem(int, String)}. You will get {@link MetaValueItem} instance, which you + * can configure in builder-alike pattern: * {@code addItem(0, "test_item").addStats(new ElectricStats(10000, 1, false)) } * This will add single-use (not rechargeable) LV battery with initial capacity 10000 EU */ @Optional.Interface(modid = GTValues.MODID_ECORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") -public abstract class MetaItem.MetaValueItem> extends Item implements ItemUIFactory, IOverlayRenderAware { +public abstract class MetaItem.MetaValueItem> extends Item + implements ItemUIFactory, IOverlayRenderAware { private static final List> META_ITEMS = new ArrayList<>(); @@ -97,11 +103,12 @@ public static List> getMetaItems() { protected final Short2ObjectMap metaItems = new Short2ObjectLinkedOpenHashMap<>(); protected final Short2ObjectMap metaItemsModels = new Short2ObjectOpenHashMap<>(); protected final Short2ObjectMap specialItemsModels = new Short2ObjectOpenHashMap<>(); - protected static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", "inventory"); + protected static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", + "inventory"); protected final short metaItemOffset; - private CreativeTabs[] defaultCreativeTabs = new CreativeTabs[]{GregTechAPI.TAB_GREGTECH}; + private CreativeTabs[] defaultCreativeTabs = new CreativeTabs[] { GregTechAPI.TAB_GREGTECH }; private final Set additionalCreativeTabs = new ObjectArraySet<>(); public MetaItem(short metaItemOffset) { @@ -135,7 +142,8 @@ public void registerModels() { if (numberOfModels > 0) { ModelBakery.registerItemVariants(this, resourceLocation); } - metaItemsModels.put((short) (metaItemOffset + itemMetaKey), new ModelResourceLocation(resourceLocation, "inventory")); + metaItemsModels.put((short) (metaItemOffset + itemMetaKey), + new ModelResourceLocation(resourceLocation, "inventory")); } } @@ -213,11 +221,14 @@ public EnumRarity getRarity(@Nonnull ItemStack stack) { protected abstract T constructMetaValueItem(short metaValue, String unlocalizedName); public final T addItem(int metaValue, String unlocalizedName) { - Validate.inclusiveBetween(0, Short.MAX_VALUE - 1, metaValue + metaItemOffset, "MetaItem ID should be in range from 0 to Short.MAX_VALUE-1"); + Validate.inclusiveBetween(0, Short.MAX_VALUE - 1, metaValue + metaItemOffset, + "MetaItem ID should be in range from 0 to Short.MAX_VALUE-1"); T metaValueItem = constructMetaValueItem((short) metaValue, unlocalizedName); if (metaItems.containsKey((short) metaValue)) { T registeredItem = metaItems.get((short) metaValue); - throw new IllegalArgumentException(String.format("MetaId %d is already occupied by item %s (requested by item %s)", metaValue, registeredItem.unlocalizedName, unlocalizedName)); + throw new IllegalArgumentException( + String.format("MetaId %d is already occupied by item %s (requested by item %s)", metaValue, + registeredItem.unlocalizedName, unlocalizedName)); } metaItems.put((short) metaValue, metaValueItem); names.put(unlocalizedName, metaValueItem); @@ -247,8 +258,7 @@ protected short formatRawItemDamage(short metaValue) { return metaValue; } - public void registerSubItems() { - } + public void registerSubItems() {} @Override public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { @@ -277,7 +287,7 @@ public int getItemBurnTime(@Nonnull ItemStack itemStack) { } ////////////////////////////////////////////////////////////////// - // Behaviours and Use Manager Implementation // + // Behaviours and Use Manager Implementation // ////////////////////////////////////////////////////////////////// private IItemUseManager getUseManager(ItemStack itemStack) { @@ -335,7 +345,8 @@ public void onUsingTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase play } @Override - public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player, int timeLeft) { + public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player, + int timeLeft) { if (player instanceof EntityPlayer) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { @@ -367,7 +378,8 @@ public boolean onLeftClickEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer } @Override - public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, @Nonnull EntityLivingBase target, @Nonnull EnumHand hand) { + public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, + @Nonnull EntityLivingBase target, @Nonnull EnumHand hand) { boolean returnValue = false; for (IItemBehaviour behaviour : getBehaviours(stack)) { if (behaviour.itemInteractionForEntity(stack, playerIn, target, hand)) { @@ -401,10 +413,13 @@ public ActionResult onItemRightClick(@Nonnull World world, EntityPlay @Nonnull @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { ItemStack itemStack = player.getHeldItem(hand); for (IItemBehaviour behaviour : getBehaviours(itemStack)) { - EnumActionResult behaviourResult = behaviour.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); + EnumActionResult behaviourResult = behaviour.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, + hand); if (behaviourResult != EnumActionResult.PASS) { return behaviourResult; } else if (itemStack.isEmpty()) { @@ -416,11 +431,14 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world @Nonnull @Override - public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { ItemStack stack = player.getHeldItem(hand); ItemStack originalStack = stack.copy(); for (IItemBehaviour behaviour : getBehaviours(stack)) { - ActionResult behaviourResult = behaviour.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); + ActionResult behaviourResult = behaviour.onItemUse(player, world, pos, hand, facing, hitX, hitY, + hitZ); stack = behaviourResult.getResult(); if (behaviourResult.getType() != EnumActionResult.PASS) { if (!ItemStack.areItemStacksEqual(originalStack, stack)) @@ -436,7 +454,8 @@ public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @No @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { HashMultimap modifiers = HashMultimap.create(); T metaValueItem = getItem(stack); if (metaValueItem != null) { @@ -478,16 +497,20 @@ public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Ench } @Override - public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, boolean isSelected) { + public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, + boolean isSelected) { for (IItemBehaviour behaviour : getBehaviours(stack)) { behaviour.onUpdate(stack, entityIn); } } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { - //if item is equal, and old item has electric item capability, remove charge tags to stop reequip animation when charge is altered - if (ItemStack.areItemsEqual(oldStack, newStack) && oldStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { + // if item is equal, and old item has electric item capability, remove charge tags to stop reequip animation + // when charge is altered + if (ItemStack.areItemsEqual(oldStack, newStack) && + oldStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && oldStack.hasTagCompound() && newStack.hasTagCompound()) { oldStack = oldStack.copy(); newStack = newStack.copy(); @@ -538,7 +561,8 @@ public String getItemStackDisplayName(ItemStack stack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, + @Nonnull ITooltipFlag tooltipFlag) { T item = getItem(itemStack); if (item == null) return; String unlocalizedTooltip = "metaitem." + item.unlocalizedName + ".tooltip"; @@ -549,7 +573,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { if (electricItem.canProvideChargeExternally()) { - addDischargeItemTooltip(lines, electricItem.getMaxCharge(), electricItem.getCharge(), electricItem.getTier()); + addDischargeItemTooltip(lines, electricItem.getMaxCharge(), electricItem.getCharge(), + electricItem.getTier()); } else { lines.add(I18n.format("metaitem.generic.electric_item.tooltip", electricItem.getCharge(), @@ -586,7 +611,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn private static void addDischargeItemTooltip(List tooltip, long maxCharge, long currentCharge, int tier) { if (currentCharge == 0) { // do not display when empty - tooltip.add(I18n.format("metaitem.generic.electric_item.tooltip", currentCharge, maxCharge, GTValues.VNF[tier])); + tooltip.add(I18n.format("metaitem.generic.electric_item.tooltip", currentCharge, maxCharge, + GTValues.VNF[tier])); return; } Instant start = Instant.now(); @@ -644,7 +670,7 @@ public CreativeTabs[] getCreativeTabs() { @Override public MetaItem setCreativeTab(CreativeTabs tab) { - this.defaultCreativeTabs = new CreativeTabs[]{tab}; + this.defaultCreativeTabs = new CreativeTabs[] { tab }; return this; } @@ -977,7 +1003,9 @@ public ItemStack getMaxChargeOverrideStack(long maxCharge) { throw new IllegalStateException("Not an electric item."); } if (!(electricItem instanceof ElectricItem)) { - throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + electricItem.getClass()); + throw new IllegalStateException( + "Only standard ElectricItem implementation supported, but this item uses " + + electricItem.getClass()); } ((ElectricItem) electricItem).setMaxChargeOverride(maxCharge); return itemStack; @@ -990,7 +1018,9 @@ public ItemStack getChargedStackWithOverride(IElectricItem source) { throw new IllegalStateException("Not an electric item."); } if (!(electricItem instanceof ElectricItem)) { - throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + electricItem.getClass()); + throw new IllegalStateException( + "Only standard ElectricItem implementation supported, but this item uses " + + electricItem.getClass()); } ((ElectricItem) electricItem).setMaxChargeOverride(source.getMaxCharge()); long charge = source.discharge(Long.MAX_VALUE, Integer.MAX_VALUE, true, false, true); @@ -999,7 +1029,8 @@ public ItemStack getChargedStackWithOverride(IElectricItem source) { } public boolean isInCreativeTab(CreativeTabs tab) { - CreativeTabs[] tabs = this.creativeTabsOverride != null ? this.creativeTabsOverride : MetaItem.this.defaultCreativeTabs; + CreativeTabs[] tabs = this.creativeTabsOverride != null ? this.creativeTabsOverride : + MetaItem.this.defaultCreativeTabs; return tabs.length > 0 && (tab == CreativeTabs.SEARCH || ArrayUtils.contains(tabs, tab)); } diff --git a/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java b/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java index 0cf6a89067e..429450f09e5 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaOreDictItem.java @@ -1,15 +1,12 @@ package gregtech.api.items.metaitem; -import com.google.common.base.CaseFormat; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; import gregtech.api.util.SmallDigits; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; @@ -17,6 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +30,8 @@ public class MetaOreDictItem extends StandardMetaItem { private static final List DISALLOWED_TYPES = ImmutableList.of( MaterialIconType.block, MaterialIconType.ore, MaterialIconType.oreSmall, MaterialIconType.frameGt); - private static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", "inventory"); + private static final ModelResourceLocation MISSING_LOCATION = new ModelResourceLocation("builtin/missing", + "inventory"); public MetaOreDictItem(short metaItemOffset) { super(metaItemOffset); @@ -74,11 +77,14 @@ public void registerModels() { } @SuppressWarnings("unused") - public OreDictValueItem addOreDictItem(int id, String materialName, int rgb, MaterialIconSet materialIconSet, OrePrefix orePrefix) { + public OreDictValueItem addOreDictItem(int id, String materialName, int rgb, MaterialIconSet materialIconSet, + OrePrefix orePrefix) { return this.addOreDictItem(id, materialName, rgb, materialIconSet, orePrefix, null); } - public OreDictValueItem addOreDictItem(int id, String materialName, int materialRGB, MaterialIconSet materialIconSet, OrePrefix orePrefix, String chemicalFormula) { + public OreDictValueItem addOreDictItem(int id, String materialName, int materialRGB, + MaterialIconSet materialIconSet, OrePrefix orePrefix, + String chemicalFormula) { return new OreDictValueItem((short) id, materialName, materialRGB, materialIconSet, orePrefix, chemicalFormula); } @@ -92,7 +98,8 @@ public class OreDictValueItem { protected String chemicalFormula; - private OreDictValueItem(short id, String materialName, int materialRGB, MaterialIconSet materialIconSet, OrePrefix orePrefix, String chemicalFormula) { + private OreDictValueItem(short id, String materialName, int materialRGB, MaterialIconSet materialIconSet, + OrePrefix orePrefix, String chemicalFormula) { this.id = id; this.materialName = materialName; this.materialRGB = materialRGB; @@ -142,5 +149,4 @@ public int getMaterialRGB() { return materialRGB; } } - } diff --git a/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java index d23276e7e46..a505896cb24 100644 --- a/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java +++ b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java @@ -2,6 +2,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.IMusicDisc; + import net.minecraft.block.BlockJukebox; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -31,12 +32,13 @@ public SoundEvent getSound() { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { IBlockState iblockstate = world.getBlockState(pos); ItemStack itemStack = player.getHeldItem(hand); - if (iblockstate.getBlock() == Blocks.JUKEBOX && !(Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)) { + if (iblockstate.getBlock() == Blocks.JUKEBOX && !(Boolean) iblockstate.getValue(BlockJukebox.HAS_RECORD)) { if (!world.isRemote) { - ((BlockJukebox)Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, itemStack); + ((BlockJukebox) Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, itemStack); world.playEvent(SOUND_TYPE, pos, itemStack.getItemDamage()); itemStack.shrink(1); player.addStat(StatList.RECORD_PLAYED); diff --git a/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java b/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java index f08a227eb7d..39aadc1351d 100644 --- a/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/StandardMetaItem.java @@ -14,5 +14,4 @@ public StandardMetaItem(short metaItemOffset) { protected MetaValueItem constructMetaValueItem(short metaValue, String unlocalizedName) { return new MetaValueItem(metaValue, unlocalizedName); } - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java b/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java index 82a7343e8e5..2159e0d0b2f 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IEnchantabilityHelper.java @@ -10,5 +10,4 @@ public interface IEnchantabilityHelper extends IItemComponent { int getItemEnchantability(ItemStack stack); boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java index ee4bc8b2b95..b1c1da05c47 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java @@ -4,9 +4,10 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public interface IFoodBehavior extends IItemComponent { int getFoodLevel(ItemStack itemStack, @Nullable EntityPlayer player); @@ -22,5 +23,4 @@ default ItemStack onFoodEaten(ItemStack stack, EntityPlayer player) { } void addInformation(ItemStack itemStack, List lines); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java index c9cce6c917f..bd0a72dd988 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java @@ -1,7 +1,5 @@ package gregtech.api.items.metaitem.stats; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -16,32 +14,37 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + import java.util.List; +import javax.annotation.Nonnull; + public interface IItemBehaviour extends IItemComponent { default boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer player, Entity entity) { return false; } - default boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer player, EntityLivingBase target, EnumHand hand) { + default boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer player, EntityLivingBase target, + EnumHand hand) { return false; } - default EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + default EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { return EnumActionResult.PASS; } - default ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + default ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } - default void addInformation(ItemStack itemStack, List lines) { - } + default void addInformation(ItemStack itemStack, List lines) {} - default void onUpdate(ItemStack itemStack, Entity entity) { - } + default void onUpdate(ItemStack itemStack, Entity entity) {} default Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) { return HashMultimap.create(); @@ -51,6 +54,5 @@ default ActionResult onItemRightClick(World world, EntityPlayer playe return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } - default void addPropertyOverride(@Nonnull Item item) { - } + default void addPropertyOverride(@Nonnull Item item) {} } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java index 6fc0b91f2d7..8133dbf2eb6 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemCapabilityProvider.java @@ -7,5 +7,4 @@ public interface IItemCapabilityProvider extends IItemComponent { ICapabilityProvider createProvider(ItemStack itemStack); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java index 3d4998bfb4a..4517f61853e 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemComponent.java @@ -4,5 +4,4 @@ * Describes generic component attachable to metaitem * Multiple components can be attached to one item */ -public interface IItemComponent { -} +public interface IItemComponent {} diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java index 25670d3b6b6..119c8785ab4 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java @@ -1,11 +1,13 @@ package gregtech.api.items.metaitem.stats; import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; +import javax.annotation.Nullable; + public interface IItemDurabilityManager extends IItemComponent { /** The durability remaining on this item (double from 0 to 1). */ @@ -22,12 +24,18 @@ default boolean doDamagedStateColors(ItemStack itemStack) { return true; } - /** Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 0. Default true */ + /** + * Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 0. + * Default true + */ default boolean showEmptyBar(ItemStack itemStack) { return true; } - /** Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 1. Default true */ + /** + * Whether to show the durability bar when {@link IItemDurabilityManager#getDurabilityForDisplay(ItemStack)} is 1. + * Default true + */ default boolean showFullBar(ItemStack itemStack) { return true; } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java index 6287d24bd47..7f5a06adcc3 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemMaxStackSizeProvider.java @@ -6,5 +6,4 @@ public interface IItemMaxStackSizeProvider extends IItemComponent { int getMaxStackSize(ItemStack itemStack, int defaultValue); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java index 6554a4c610c..5f1199fe41e 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemModelManager.java @@ -1,4 +1,3 @@ package gregtech.api.items.metaitem.stats; -public interface IItemModelManager extends IItemComponent { -} +public interface IItemModelManager extends IItemComponent {} diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java index 90c09aedd5b..059167e3949 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemNameProvider.java @@ -6,5 +6,4 @@ public interface IItemNameProvider extends IItemComponent { String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java index 4e3a05c593f..0da05d4af15 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemUseManager.java @@ -10,18 +10,15 @@ default boolean canStartUsing(ItemStack stack, EntityPlayer player) { return true; } - default void onItemUseStart(ItemStack stack, EntityPlayer player) { - } + default void onItemUseStart(ItemStack stack, EntityPlayer player) {} EnumAction getUseAction(ItemStack stack); int getMaxItemUseDuration(ItemStack stack); - default void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) { - } + default void onItemUsingTick(ItemStack stack, EntityPlayer player, int count) {} - default void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) { - } + default void onPlayerStoppedItemUsing(ItemStack stack, EntityPlayer player, int timeLeft) {} default ItemStack onItemUseFinish(ItemStack stack, EntityPlayer player) { return stack; diff --git a/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java b/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java index 6e7f74ebd62..ab939e27570 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/ISubItemHandler.java @@ -9,5 +9,4 @@ public interface ISubItemHandler extends IItemComponent { String getItemSubType(ItemStack itemStack); void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems); - } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java b/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java index a946bf2ae21..b206c683512 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java @@ -6,6 +6,7 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; public class ItemFluidContainer implements IItemContainerItemProvider { + @Override public ItemStack getContainerItem(ItemStack itemStack) { IFluidHandlerItem handler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); diff --git a/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java b/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java index 70a48c4381d..afeedf3dfb9 100644 --- a/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java +++ b/src/main/java/gregtech/api/items/toolitem/EnchantmentLevel.java @@ -1,6 +1,7 @@ package gregtech.api.items.toolitem; public class EnchantmentLevel { + private double level; private double levelGrowth; diff --git a/src/main/java/gregtech/api/items/toolitem/IGTTool.java b/src/main/java/gregtech/api/items/toolitem/IGTTool.java index 11bb1c9716d..ed3219d685e 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTTool.java @@ -1,13 +1,5 @@ package gregtech.api.items.toolitem; -import appeng.api.implementations.items.IAEWrench; -import buildcraft.api.tools.IToolWrench; -import cofh.api.item.IToolHammer; -import com.enderio.core.common.interfaces.IOverlayRenderAware; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import crazypants.enderio.api.tool.ITool; -import forestry.api.arboriculture.IToolGrafter; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechCapabilities; @@ -36,8 +28,7 @@ import gregtech.client.utils.ToolChargeBarRenderer; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; @@ -67,8 +58,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.implementations.items.IAEWrench; +import buildcraft.api.tools.IToolWrench; +import cofh.api.item.IToolHammer; +import com.enderio.core.common.interfaces.IOverlayRenderAware; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import crazypants.enderio.api.tool.ITool; +import forestry.api.arboriculture.IToolGrafter; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -76,6 +76,9 @@ import java.util.function.Supplier; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.items.armor.IArmorLogic.ATTACK_DAMAGE_MODIFIER; import static gregtech.api.items.armor.IArmorLogic.ATTACK_SPEED_MODIFIER; import static gregtech.api.items.toolitem.ToolHelper.*; @@ -89,8 +92,10 @@ @Optional.Interface(modid = GTValues.MODID_COFH, iface = "cofh.api.item.IToolHammer"), @Optional.Interface(modid = GTValues.MODID_EIO, iface = "crazypants.enderio.api.tool.ITool"), @Optional.Interface(modid = GTValues.MODID_FR, iface = "forestry.api.arboriculture.IToolGrafter"), - @Optional.Interface(modid = GTValues.MODID_ECORE, iface = "com.enderio.core.common.interfaces.IOverlayRenderAware")}) -public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter, IOverlayRenderAware { + @Optional.Interface(modid = GTValues.MODID_ECORE, + iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") }) +public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter, + IOverlayRenderAware { /** * @return the modid of the tool @@ -156,12 +161,14 @@ default ItemStack get(Material material) { ToolProperty toolProperty = material.getProperty(PropertyKey.TOOL); // Durability formula we are working with: - // Final Durability = (material durability * material durability multiplier) + (tool definition durability * definition durability multiplier) - 1 + // Final Durability = (material durability * material durability multiplier) + (tool definition durability * + // definition durability multiplier) - 1 // Subtracts 1 internally since Minecraft treats "0" as a valid durability, but we don't want to display this. int durability = toolProperty.getToolDurability() * toolProperty.getDurabilityMultiplier(); - // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So apply the multiplier to the material durability if that would happen + // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So + // apply the multiplier to the material durability if that would happen if (toolStats.getBaseDurability(stack) == 0) { durability *= toolStats.getDurabilityMultiplier(stack); } else { @@ -176,8 +183,10 @@ default ItemStack get(Material material) { // Set tool and material enchantments Object2IntMap enchantments = new Object2IntOpenHashMap<>(); - toolProperty.getEnchantments().forEach((enchantment, level) -> enchantments.put(enchantment, level.getLevel(toolProperty.getToolHarvestLevel()))); - toolStats.getDefaultEnchantments(stack).forEach((enchantment, level) -> enchantments.put(enchantment, level.getLevel(toolProperty.getToolHarvestLevel()))); + toolProperty.getEnchantments().forEach((enchantment, level) -> enchantments.put(enchantment, + level.getLevel(toolProperty.getToolHarvestLevel()))); + toolStats.getDefaultEnchantments(stack).forEach((enchantment, level) -> enchantments.put(enchantment, + level.getLevel(toolProperty.getToolHarvestLevel()))); enchantments.forEach((enchantment, level) -> { if (stack.getItem().canApplyAtEnchantingTable(stack, enchantment)) { stack.addEnchantment(enchantment, level); @@ -188,7 +197,6 @@ default ItemStack get(Material material) { NBTTagCompound behaviourTag = getBehaviorsTag(stack); getToolStats().getBehaviors().forEach(behavior -> behavior.addBehaviorNBT(stack, behaviourTag)); - if (aoeDefinition != AoESymmetrical.none()) { behaviourTag.setInteger(MAX_AOE_COLUMN_KEY, aoeDefinition.column); behaviourTag.setInteger(MAX_AOE_ROW_KEY, aoeDefinition.row); @@ -208,7 +216,8 @@ default ItemStack get(Material material) { default ItemStack get(Material material, long defaultCharge, long defaultMaxCharge) { ItemStack stack = get(material); if (isElectric()) { - ElectricItem electricItem = (ElectricItem) stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + ElectricItem electricItem = (ElectricItem) stack + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { electricItem.setMaxChargeOverride(defaultMaxCharge); electricItem.setCharge(defaultCharge); @@ -296,7 +305,8 @@ default float getTotalToolSpeed(ItemStack stack) { if (toolTag.hasKey(TOOL_SPEED_KEY, Constants.NBT.TAG_FLOAT)) { return toolTag.getFloat(TOOL_SPEED_KEY); } - float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + getToolStats().getBaseEfficiency(stack); + float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + + getToolStats().getBaseEfficiency(stack); toolTag.setFloat(TOOL_SPEED_KEY, toolSpeed); return toolSpeed; } @@ -336,8 +346,10 @@ default int getTotalMaxDurability(ItemStack stack) { int maxDurability = getMaterialDurability(stack); int builderDurability = (int) (toolStats.getBaseDurability(stack) * toolStats.getDurabilityMultiplier(stack)); - // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material durability - maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : maxDurability + builderDurability; + // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material + // durability + maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : + maxDurability + builderDurability; toolTag.setInteger(MAX_DURABILITY_KEY, maxDurability); return maxDurability; @@ -431,9 +443,11 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { + default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, + EntityLivingBase entityLiving) { if (!worldIn.isRemote) { - getToolStats().getBehaviors().forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); + getToolStats().getBehaviors() + .forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); if ((double) state.getBlockHardness(worldIn, pos) != 0.0D) { damageItem(stack, entityLiving, getToolStats().getToolDamagePerBlockBreak(stack)); @@ -477,24 +491,31 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default Multimap definition$getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) { + default Multimap definition$getAttributeModifiers(EntityEquipmentSlot equipmentSlot, + ItemStack stack) { Multimap multimap = HashMultimap.create(); if (equipmentSlot == EntityEquipmentSlot.MAINHAND) { - multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getTotalAttackDamage(stack), 0)); - multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", Math.max(-3.9D, getTotalAttackSpeed(stack)), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), + new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getTotalAttackDamage(stack), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, + "Weapon modifier", Math.max(-3.9D, getTotalAttackSpeed(stack)), 0)); } return multimap; } - default int definition$getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + default int definition$getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return get().getToolClasses(stack).contains(toolClass) ? getTotalHarvestLevel(stack) : -1; } - default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) { - return getToolStats().getBehaviors().stream().anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); + default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, + EntityLivingBase attacker) { + return getToolStats().getBehaviors().stream() + .anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); } - default boolean definition$doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + default boolean definition$doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { return getToolStats().doesSneakBypassUse(); } @@ -528,7 +549,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return stack; } - default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { + default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, + boolean slotChanged) { if (getCharge(oldStack) != getCharge(newStack)) { return slotChanged; } @@ -540,7 +562,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return false; } - default boolean definition$canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player) { + default boolean definition$canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, + EntityPlayer player) { return true; } @@ -598,9 +621,12 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return new CombinedCapabilityProvider(providers); } - default EnumActionResult definition$onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + default EnumActionResult definition$onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, + float hitY, float hitZ, @Nonnull EnumHand hand) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) == EnumActionResult.SUCCESS) { + if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) == + EnumActionResult.SUCCESS) { return EnumActionResult.SUCCESS; } } @@ -608,9 +634,10 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return EnumActionResult.PASS; } - default EnumActionResult definition$onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + default EnumActionResult definition$onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) == EnumActionResult.SUCCESS) { + if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) == EnumActionResult.SUCCESS) { return EnumActionResult.SUCCESS; } } @@ -649,7 +676,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { // Client-side methods @SideOnly(Side.CLIENT) - default void definition$addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, ITooltipFlag flag) { + default void definition$addInformation(@Nonnull ItemStack stack, @Nullable World world, + @Nonnull List tooltip, ITooltipFlag flag) { if (!(stack.getItem() instanceof IGTTool)) return; IGTTool tool = (IGTTool) stack.getItem(); @@ -668,29 +696,36 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { // durability info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { - // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not show this + // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not + // show this int damageRemaining = tool.getTotalMaxDurability(stack) - stack.getItemDamage() + 1; if (toolStats.isSuitableForCrafting(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.crafting_uses", TextFormattingUtil.formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); + tooltip.add(I18n.format("item.gt.tool.tooltip.crafting_uses", TextFormattingUtil + .formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); } - tooltip.add(I18n.format("item.gt.tool.tooltip.general_uses", TextFormattingUtil.formatNumbers(damageRemaining))); + tooltip.add(I18n.format("item.gt.tool.tooltip.general_uses", + TextFormattingUtil.formatNumbers(damageRemaining))); } // attack info if (toolStats.isSuitableForAttacking(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.attack_damage", TextFormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); - tooltip.add(I18n.format("item.gt.tool.tooltip.attack_speed", TextFormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.attack_damage", + TextFormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.attack_speed", + TextFormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); } // mining info if (toolStats.isSuitableForBlockBreak(stack)) { - tooltip.add(I18n.format("item.gt.tool.tooltip.mining_speed", TextFormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); + tooltip.add(I18n.format("item.gt.tool.tooltip.mining_speed", + TextFormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); int harvestLevel = tool.getTotalHarvestLevel(stack); String harvestName = "item.gt.tool.harvest_level." + harvestLevel; if (I18n.hasKey(harvestName)) { // if there's a defined name for the harvest level, use it - tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level_extra", harvestLevel, I18n.format(harvestName))); + tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level_extra", harvestLevel, + I18n.format(harvestName))); } else { tooltip.add(I18n.format("item.gt.tool.tooltip.harvest_level", harvestLevel)); } @@ -733,8 +768,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { tooltip.add(I18n.format("item.gt.tool.usable_as", stack.getItem().getToolClasses(stack).stream() .map(s -> I18n.format("gt.tool.class." + s)) - .collect(Collectors.joining(", ")) - )); + .collect(Collectors.joining(", ")))); // repair info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { @@ -776,11 +810,13 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { case "enchantment.cofhcore.smelting": // cofhcore case "enchantment.as.smelting": // astral sorcery // block autosmelt enchants from AoE and Tree-Felling tools - return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && !getBehaviorsTag(stack).hasKey(TREE_FELLING_KEY); + return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && + !getBehaviorsTag(stack).hasKey(TREE_FELLING_KEY); } // Block Mending and Unbreaking on Electric tools - if (isElectric() && (enchantment instanceof EnchantmentMending || enchantment instanceof EnchantmentDurability)) { + if (isElectric() && + (enchantment instanceof EnchantmentMending || enchantment instanceof EnchantmentDurability)) { return false; } @@ -834,7 +870,8 @@ default void playCraftingSound(EntityPlayer player, ItemStack stack) { if (ConfigHolder.client.toolCraftingSounds && getSound() != null && player != null) { if (canPlaySound(stack)) { setLastCraftingSoundTime(stack); - player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), SoundCategory.PLAYERS, 1F, 1F); + player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), + SoundCategory.PLAYERS, 1F, 1F); } } } @@ -849,7 +886,8 @@ default boolean canPlaySound(ItemStack stack) { default void playSound(EntityPlayer player) { if (ConfigHolder.client.toolUseSounds && getSound() != null) { - player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), SoundCategory.PLAYERS, 1F, 1F); + player.getEntityWorld().playSound(null, player.posX, player.posY, player.posZ, getSound(), + SoundCategory.PLAYERS, 1F, 1F); } } @@ -884,12 +922,13 @@ default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlay AoESymmetrical.decreaseLayer(tag, defaultDefinition); holder.markAsDirty(); })) - .widget(new DynamicLabelWidget(23, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) - .widget(new DynamicLabelWidget(58, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) - .widget(new DynamicLabelWidget(93, 65, () -> - Integer.toString(1 + AoESymmetrical.getLayer(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(23, 65, () -> Integer.toString( + 1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(58, 65, () -> Integer.toString( + 1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) + .widget(new DynamicLabelWidget(93, 65, + () -> Integer.toString(1 + + AoESymmetrical.getLayer(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition)))) .build(holder, entityPlayer); } @@ -913,25 +952,29 @@ default boolean canWrench(ItemStack wrench, EntityPlayer player, BlockPos pos) { // IToolWrench - /*** Called to ensure that the wrench can be used. + /*** + * Called to ensure that the wrench can be used. * - * @param player - The player doing the wrenching - * @param hand - Which hand was holding the wrench - * @param wrench - The item stack that holds the wrench + * @param player - The player doing the wrenching + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench * @param rayTrace - The object that is being wrenched * - * @return true if wrenching is allowed, false if not */ + * @return true if wrenching is allowed, false if not + */ @Override default boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) { return get().getToolClasses(wrench).contains(ToolClasses.WRENCH); } - /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. + /*** + * Callback after the wrench has been used. This can be used to decrease durability or for other purposes. * - * @param player - The player doing the wrenching - * @param hand - Which hand was holding the wrench - * @param wrench - The item stack that holds the wrench - * @param rayTrace - The object that is being wrenched */ + * @param player - The player doing the wrenching + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench + * @param rayTrace - The object that is being wrenched + */ @Override default void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) { damageItem(player.getHeldItem(hand), player); diff --git a/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java b/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java index b218b788086..3602a3a19ea 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTToolDefinition.java @@ -2,11 +2,13 @@ import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; + import java.util.List; /** @@ -103,5 +105,4 @@ default boolean isEnchantable(ItemStack stack) { default ItemStack getBrokenStack() { return ItemStack.EMPTY; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java index 700b3ce8aae..405ef425369 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTAxe extends ItemAxe implements IGTTool { protected final String domain, id; @@ -42,7 +45,9 @@ public class ItemGTAxe extends ItemAxe implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTAxe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTAxe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, + List secondaryOreDicts, Supplier markerItem) { super(ToolMaterial.STONE, 0F, 0F); this.domain = domain; this.id = id; @@ -130,17 +135,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -156,12 +164,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -172,12 +182,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -203,12 +215,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -250,25 +264,31 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -295,7 +315,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTAxe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTAxe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java index b82c24e8c6c..8e56c245339 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTHoe extends ItemHoe implements IGTTool { protected final String domain, id; @@ -42,7 +45,9 @@ public class ItemGTHoe extends ItemHoe implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTHoe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTHoe(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, Set toolClasses, String oreDict, + List secondaryOreDicts, Supplier markerItem) { super(ToolMaterial.STONE); this.domain = domain; this.id = id; @@ -130,12 +135,14 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -151,12 +158,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -167,12 +176,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -198,12 +209,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -245,19 +258,23 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -281,7 +298,9 @@ public String getMaterialName() { @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { // try to do the vanilla hoe behavior first EnumActionResult result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); if (result == EnumActionResult.SUCCESS) return EnumActionResult.SUCCESS; @@ -289,7 +308,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { getToolStats().getBehaviors().forEach(behavior -> behavior.hitEntity(stack, target, attacker)); // damage by 1, as this is what vanilla does ToolHelper.damageItem(stack, attacker, 1); @@ -309,7 +329,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTHoe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTHoe(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java index de3a327d086..9f71e5a5f46 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemGTSword extends ItemSword implements IGTTool { private final String domain; @@ -135,17 +138,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -165,18 +171,21 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return false; } @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -187,12 +196,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -218,7 +229,8 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -260,20 +272,24 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { // do not utilize IGTTool method to prevent a config gui from appearing return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -300,7 +316,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTSword(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTSword(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java index 559032a6885..7fcd5a9d896 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java @@ -1,8 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.Multimap; import gregtech.api.GregTechAPI; import gregtech.api.util.LocalizationUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -22,13 +22,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Multimap; + import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * GT-styled ItemTool (generic tool item). *

@@ -47,8 +50,10 @@ public class ItemGTTool extends ItemTool implements IGTTool { protected final boolean playSoundOnBlockDestroy; protected final Supplier markerItem; - protected ItemGTTool(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, boolean playSoundOnBlockDestroy, - Set toolClasses, String oreDict, List secondaryOreDicts, Supplier markerItem) { + protected ItemGTTool(String domain, String id, int tier, IGTToolDefinition toolStats, SoundEvent sound, + boolean playSoundOnBlockDestroy, + Set toolClasses, String oreDict, List secondaryOreDicts, + Supplier markerItem) { super(0F, 0F, ToolMaterial.STONE, Collections.emptySet()); this.domain = domain; this.id = id; @@ -136,17 +141,20 @@ public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState stat } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @@ -162,12 +170,14 @@ public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack r @Nonnull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, + @Nonnull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { + public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } @@ -178,12 +188,14 @@ public Set getToolClasses(@Nonnull ItemStack stack) { } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, + @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @@ -209,12 +221,14 @@ public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull It } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, + @Nonnull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) { + public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @@ -256,25 +270,31 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } @Nonnull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @@ -301,7 +321,8 @@ public Builder(@Nonnull String domain, @Nonnull String id) { @Override public Supplier supply() { - return () -> new ItemGTTool(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, oreDict, secondaryOreDicts, markerItem); + return () -> new ItemGTTool(domain, id, tier, toolStats, sound, playSoundOnBlockDestroy, toolClasses, + oreDict, secondaryOreDicts, markerItem); } } } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java index 319a5f16c27..073e689451b 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java @@ -1,14 +1,16 @@ package gregtech.api.items.toolitem; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; import net.minecraft.item.ItemStack; import net.minecraft.util.SoundEvent; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; + import java.util.*; import java.util.function.Supplier; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; + public abstract class ToolBuilder { protected final String domain, id; @@ -102,11 +104,11 @@ public T build() { } IGTTool existing = ToolHelper.getToolFromSymbol(this.symbol); if (existing != null) { - throw new IllegalArgumentException(String.format("Symbol %s has been taken by %s already!", symbol, existing)); + throw new IllegalArgumentException( + String.format("Symbol %s has been taken by %s already!", symbol, existing)); } T supplied = supply().get(); ToolHelper.registerToolSymbol(this.symbol, supplied); return supplied; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java b/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java index 797e0fa8e6e..655f97eb148 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolDefinitionBuilder.java @@ -1,9 +1,8 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.ImmutableList; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; -import it.unimi.dsi.fastutil.objects.*; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -11,6 +10,9 @@ import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.*; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -190,7 +192,6 @@ public ToolDefinitionBuilder defaultEnchantment(Enchantment enchantment, double return this; } - public IGTToolDefinition build() { return new IGTToolDefinition() { @@ -229,9 +230,11 @@ public IGTToolDefinition build() { effectiveStatePredicate.or(state -> effectiveMaterials.contains(state.getMaterial())); } if (effectiveStates != null) { - effectiveStatePredicate = effectiveStatePredicate == null ? effectiveStates : effectiveStatePredicate.or(effectiveStates); + effectiveStatePredicate = effectiveStatePredicate == null ? effectiveStates : + effectiveStatePredicate.or(effectiveStates); } - this.effectiveStatePredicate = effectiveStatePredicate == null ? state -> false : effectiveStatePredicate; + this.effectiveStatePredicate = effectiveStatePredicate == null ? state -> false : + effectiveStatePredicate; } @Override @@ -335,5 +338,4 @@ public AoESymmetrical getAoEDefinition(ItemStack stack) { } }; } - } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java index 52423c510f7..ffd5ee89594 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java @@ -1,8 +1,5 @@ package gregtech.api.items.toolitem; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; @@ -19,8 +16,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.tools.enchants.EnchantmentHardHammer; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; @@ -50,14 +46,21 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import java.util.*; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.LV; import static gregtech.api.GTValues.V; @@ -115,11 +118,23 @@ public final class ToolHelper { private static final BiMap symbols = HashBiMap.create(); // Effective Vanilla Blocks - public static final Set PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE); - public static final Set STONE_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE); - public static final Set IRON_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE); - public static final Set SHOVEL_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH, Blocks.CONCRETE_POWDER); - public static final Set AXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); + public static final Set PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, + Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, + Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, + Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, + Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, + Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, + Blocks.STONE_PRESSURE_PLATE); + public static final Set STONE_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.IRON_BLOCK, + Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE); + public static final Set IRON_PICKAXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.DIAMOND_BLOCK, + Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE); + public static final Set SHOVEL_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.CLAY, Blocks.DIRT, + Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, + Blocks.SOUL_SAND, Blocks.GRASS_PATH, Blocks.CONCRETE_POWDER); + public static final Set AXE_HARVESTABLE_BLOCKS = ImmutableSet.of(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, + Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, + Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); // Suppliers for broken tool stacks public static final Supplier SUPPLY_POWER_UNIT_LV = () -> MetaItems.POWER_UNIT_LV.getStackForm(); @@ -136,7 +151,8 @@ public final class ToolHelper { // archaic way to get around access violations for method handles. // this was improved in Java 9 with MethodHandles.privateLookupIn(), // but that does not exist in Java 8, so we have to unreflect instead. - Method method = ObfuscationReflectionHelper.findMethod(Block.class, "func_180643_i", ItemStack.class, IBlockState.class); + Method method = ObfuscationReflectionHelper.findMethod(Block.class, "func_180643_i", ItemStack.class, + IBlockState.class); method.setAccessible(true); GET_SILK_TOUCH_DROP = MethodHandles.lookup().unreflect(method); method.setAccessible(false); @@ -176,7 +192,8 @@ public static NBTTagCompound getBehaviorsTag(ItemStack stack) { return stack.getOrCreateSubCompound(BEHAVIOURS_TAG_KEY); } - public static ItemStack getAndSetToolData(IGTTool tool, Material material, int maxDurability, int harvestLevel, float toolSpeed, float attackDamage) { + public static ItemStack getAndSetToolData(IGTTool tool, Material material, int maxDurability, int harvestLevel, + float toolSpeed, float attackDamage) { ItemStack stack = tool.getRaw(); GTUtility.getOrCreateNbtCompound(stack).setInteger(HIDE_FLAGS, 2); NBTTagCompound toolTag = getToolTag(stack); @@ -208,7 +225,8 @@ public static void damageItemWhenCrafting(@Nonnull ItemStack stack, @Nullable En if (stack.getItem() instanceof IGTTool) { damage = ((IGTTool) stack.getItem()).getToolStats().getToolDamagePerCraft(stack); } else { - if (OreDictUnifier.getOreDictionaryNames(stack).stream().anyMatch(s -> s.startsWith("tool") || s.startsWith("craftingTool"))) { + if (OreDictUnifier.getOreDictionaryNames(stack).stream() + .anyMatch(s -> s.startsWith("tool") || s.startsWith("craftingTool"))) { damage = 1; } } @@ -248,14 +266,17 @@ public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBa Random random = entity == null ? GTValues.RNG : entity.getRNG(); if (tool.isElectric()) { int electricDamage = damage * ConfigHolder.machines.energyUsageMultiplier; - IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { electricItem.discharge(electricDamage, tool.getElectricTier(), true, false, false); - if (electricItem.getCharge() > 0 && random.nextInt(100) > ConfigHolder.tools.rngDamageElectricTools) { + if (electricItem.getCharge() > 0 && + random.nextInt(100) > ConfigHolder.tools.rngDamageElectricTools) { return; } } else { - throw new IllegalStateException("Electric tool does not have an attached electric item capability."); + throw new IllegalStateException( + "Electric tool does not have an attached electric item capability."); } } int unbreakingLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack); @@ -303,7 +324,8 @@ public static void onActionDone(@Nonnull EntityPlayer player, @Nonnull World wor IGTTool tool = (IGTTool) stack.getItem(); ToolHelper.damageItem(stack, player); if (tool.getSound() != null) { - world.playSound(null, player.posX, player.posY, player.posZ, tool.getSound(), SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, tool.getSound(), SoundCategory.PLAYERS, 1.0F, + 1.0F); } player.swingArm(hand); } @@ -374,7 +396,8 @@ public static boolean areaOfEffectBlockBreakRoutine(ItemStack stack, EntityPlaye } remainingUses--; - if (stack.getItem() instanceof IGTTool && !((IGTTool) stack.getItem()).isElectric() && remainingUses == 0) { + if (stack.getItem() instanceof IGTTool && !((IGTTool) stack.getItem()).isElectric() && + remainingUses == 0) { return true; } // If the tool is an electric tool, catch the tool breaking and cancel the remaining AOE @@ -387,8 +410,11 @@ else if (!player.getHeldItemMainhand().isItemEqualIgnoreDurability(stack)) { return false; } - public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult, QuintFunction function) { - if (aoeDefinition != AoESymmetrical.none() && rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit != null) { + public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult, + QuintFunction function) { + if (aoeDefinition != AoESymmetrical.none() && rayTraceResult != null && + rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit != null) { int column = aoeDefinition.column; int row = aoeDefinition.row; int layer = aoeDefinition.layer; @@ -405,7 +431,8 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini for (int z = isX ? -column : -row; z <= (isX ? column : row); z++) { if (!(x == 0 && y == 0 && z == 0)) { BlockPos pos = rayTraceResult.getBlockPos().add(x, isDown ? y : -y, z); - if (player.canPlayerEdit(pos.offset(rayTraceResult.sideHit), rayTraceResult.sideHit, stack)) { + if (player.canPlayerEdit(pos.offset(rayTraceResult.sideHit), rayTraceResult.sideHit, + stack)) { if (function.apply(stack, world, player, pos, rayTraceResult.getBlockPos())) { validPositions.add(pos); } @@ -423,7 +450,9 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini for (int y = (row == 0 ? 0 : -1); y <= (row == 0 ? 0 : row * 2 - 1); y++) { for (int z = -column; z <= column; z++) { if (!(x == 0 && y == 0 && z == 0)) { - BlockPos pos = rayTraceResult.getBlockPos().add(isX ? (isNegative ? x : -x) : (isNegative ? z : -z), y, isX ? (isNegative ? z : -z) : (isNegative ? x : -x)); + BlockPos pos = rayTraceResult.getBlockPos().add( + isX ? (isNegative ? x : -x) : (isNegative ? z : -z), y, + isX ? (isNegative ? z : -z) : (isNegative ? x : -x)); if (function.apply(stack, world, player, pos, rayTraceResult.getBlockPos())) { validPositions.add(pos); } @@ -437,18 +466,21 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini return Collections.emptySet(); } - public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { + public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { return iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, ToolHelper::isBlockAoEHarvestable); } - private static boolean isBlockAoEHarvestable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, BlockPos hitBlockPos) { + private static boolean isBlockAoEHarvestable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + BlockPos hitBlockPos) { if (world.isAirBlock(pos)) return false; IBlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockLiquid) return false; IBlockState hitBlockState = world.getBlockState(hitBlockPos); - if (state.getBlockHardness(world, pos) < 0 || state.getBlockHardness(world, pos) - hitBlockState.getBlockHardness(world, hitBlockPos) > 8) { + if (state.getBlockHardness(world, pos) < 0 || + state.getBlockHardness(world, pos) - hitBlockState.getBlockHardness(world, hitBlockPos) > 8) { // If mining a block takes significantly longer than the center block, do not mine it. // Originally this was just a check for if it is at all harder of a block, however that // would cause some annoyances, like Grass Block not being broken if a Dirt Block was the @@ -484,7 +516,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses if (PICKAXE_HARVESTABLE_BLOCKS.contains(block)) return true; if (material == net.minecraft.block.material.Material.ROCK || material == net.minecraft.block.material.Material.IRON || - material == net.minecraft.block.material.Material.ANVIL) return true; + material == net.minecraft.block.material.Material.ANVIL) + return true; } if (toolClasses.contains(ToolClasses.SHOVEL)) { if (SHOVEL_HARVESTABLE_BLOCKS.contains(block)) return true; @@ -494,7 +527,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses if (AXE_HARVESTABLE_BLOCKS.contains(block)) return true; if (material == net.minecraft.block.material.Material.WOOD || material == net.minecraft.block.material.Material.PLANTS || - material == net.minecraft.block.material.Material.VINE) return true; + material == net.minecraft.block.material.Material.VINE) + return true; } if (toolClasses.contains(ToolClasses.SWORD)) { if (block instanceof BlockWeb) return true; @@ -502,7 +536,8 @@ public static boolean isToolEffective(IBlockState state, Set toolClasses material == net.minecraft.block.material.Material.VINE || material == net.minecraft.block.material.Material.CORAL || material == net.minecraft.block.material.Material.LEAVES || - material == net.minecraft.block.material.Material.GOURD) return true; + material == net.minecraft.block.material.Material.GOURD) + return true; } if (toolClasses.contains(ToolClasses.SCYTHE)) { if (material == net.minecraft.block.material.Material.LEAVES || @@ -547,7 +582,8 @@ public static float getDestroySpeed(IBlockState state, Set toolClasses) return -1; } - public static Set getHarvestableBlocks(ItemStack stack, World world, EntityPlayer player, RayTraceResult rayTraceResult) { + public static Set getHarvestableBlocks(ItemStack stack, World world, EntityPlayer player, + RayTraceResult rayTraceResult) { return getHarvestableBlocks(stack, getAoEDefinition(stack), world, player, rayTraceResult); } @@ -562,7 +598,6 @@ public static Set getHarvestableBlocks(ItemStack stack, EntityPlayer p } public static RayTraceResult getPlayerDefaultRaytrace(@Nonnull EntityPlayer player) { - Vec3d lookPos = player.getPositionEyes(1F); Vec3d rotation = player.getLook(1); Vec3d realLookPos = lookPos.add(rotation.x * 5, rotation.y * 5, rotation.z * 5); @@ -588,14 +623,17 @@ public static void treeFellingRoutine(EntityPlayerMP player, ItemStack stack, Bl /** * Applies Forge Hammer recipes to block broken, used for hammers or tools with hard hammer enchant applied. */ - public static void applyHammerDropConversion(ItemStack tool, IBlockState state, List drops, int fortune, float dropChance, Random random) { - if (tool.getItem().getToolClasses(tool).contains(ToolClasses.HARD_HAMMER) || EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, tool) > 0) { + public static void applyHammerDropConversion(ItemStack tool, IBlockState state, List drops, int fortune, + float dropChance, Random random) { + if (tool.getItem().getToolClasses(tool).contains(ToolClasses.HARD_HAMMER) || + EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, tool) > 0) { ItemStack silktouchDrop = getSilkTouchDrop(state); if (!silktouchDrop.isEmpty()) { // Stack lists can be immutable going into Recipe#matches barring no rewrites List dropAsList = Collections.singletonList(silktouchDrop); // Search for forge hammer recipes from all drops individually (only LV or under) - Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(V[LV], dropAsList, Collections.emptyList(), false); + Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(V[LV], dropAsList, + Collections.emptyList(), false); if (hammerRecipe != null && hammerRecipe.matches(true, dropAsList, Collections.emptyList())) { drops.clear(); OrePrefix prefix = OreDictUnifier.getPrefix(silktouchDrop); @@ -678,7 +716,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block if (state.getBlock() instanceof IShearable) { IShearable shearable = (IShearable) state.getBlock(); if (shearable.isShearable(tool, world, pos)) { - List shearedDrops = shearable.onSheared(tool, world, pos, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool)); + List shearedDrops = shearable.onSheared(tool, world, pos, + EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool)); boolean relocateMinedBlocks = getBehaviorsTag(tool).getBoolean(RELOCATE_MINED_BLOCKS_KEY); Iterator iter = shearedDrops.iterator(); while (iter.hasNext()) { @@ -690,7 +729,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block double xo = world.rand.nextFloat() * f + 0.15D; double yo = world.rand.nextFloat() * f + 0.15D; double zo = world.rand.nextFloat() * f + 0.15D; - EntityItem entityItem = new EntityItem(world, pos.getX() + xo, pos.getY() + yo, pos.getZ() + zo, stack); + EntityItem entityItem = new EntityItem(world, pos.getX() + xo, pos.getY() + yo, + pos.getZ() + zo, stack); entityItem.setDefaultPickupDelay(); player.world.spawnEntity(entityItem); } @@ -705,7 +745,8 @@ public static int shearBlockRoutine(EntityPlayerMP player, ItemStack tool, Block return -1; } - public static boolean removeBlockRoutine(@Nullable IBlockState state, World world, EntityPlayerMP player, BlockPos pos, boolean canHarvest) { + public static boolean removeBlockRoutine(@Nullable IBlockState state, World world, EntityPlayerMP player, + BlockPos pos, boolean canHarvest) { state = state == null ? world.getBlockState(pos) : state; boolean successful = state.getBlock().removedByPlayer(state, world, pos, player, canHarvest); if (successful) { @@ -731,6 +772,5 @@ public static void playToolSound(ItemStack stack, EntityPlayer player) { if (stack.getItem() instanceof IGTTool) { ((IGTTool) stack.getItem()).playSound(player); } - } } diff --git a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java index 525807639cb..2a73aac9dd3 100644 --- a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java +++ b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java @@ -1,6 +1,5 @@ package gregtech.api.items.toolitem; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayerMP; @@ -12,10 +11,13 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public final class TreeFellingListener { private final EntityPlayerMP player; @@ -28,7 +30,8 @@ private TreeFellingListener(EntityPlayerMP player, ItemStack tool, Deque onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { + default ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, + @Nonnull EnumHand hand) { return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } @SideOnly(Side.CLIENT) - default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { - } + default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) {} /** * Add the necessary NBT information to the tool + * * @param stack the tool * @param tag the nbt tag to add to */ - default void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { - } + default void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) {} /** * Add a capability to a tool. * Recommended to only use this if no other options exist. + * * @param stack the tool * @param tag the capability nbt of the item */ diff --git a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java index dcfe757a01f..4991ba06cd0 100644 --- a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java +++ b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java @@ -1,11 +1,11 @@ package gregtech.api.metatileentity; - import net.minecraft.util.text.ITextComponent; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public interface IDataInfoProvider { @Nonnull diff --git a/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java index 41f9dd0b2d2..d8bd451ee29 100644 --- a/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/IFastRenderMetaTileEntity.java @@ -1,11 +1,12 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; + public interface IFastRenderMetaTileEntity { int RENDER_PASS_NORMAL = 0; @@ -15,9 +16,7 @@ public interface IFastRenderMetaTileEntity { default void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {} @SideOnly(Side.CLIENT) - default void renderMetaTileEntity(double x, double y, double z, float partialTicks) { - - } + default void renderMetaTileEntity(double x, double y, double z, float partialTicks) {} AxisAlignedBB getRenderBoundingBox(); diff --git a/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java b/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java index 372fc3382a6..b942a132b38 100644 --- a/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java +++ b/src/main/java/gregtech/api/metatileentity/IMachineHatchMultiblock.java @@ -3,7 +3,8 @@ public interface IMachineHatchMultiblock { /** - * @return a String array of blacklisted RecipeMaps for the {@link gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMachineHatch} + * @return a String array of blacklisted RecipeMaps for the + * {@link gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMachineHatch} */ default String[] getBlacklist() { return new String[0]; diff --git a/src/main/java/gregtech/api/metatileentity/IVoidable.java b/src/main/java/gregtech/api/metatileentity/IVoidable.java index 62879b47428..16d60b6e3c7 100644 --- a/src/main/java/gregtech/api/metatileentity/IVoidable.java +++ b/src/main/java/gregtech/api/metatileentity/IVoidable.java @@ -10,7 +10,8 @@ public interface IVoidable { boolean canVoidRecipeFluidOutputs(); - // -1 is taken into account as a skip case. I would have passed Integer.MAX_VALUE, but that would have been bad for some sublisting stuff + // -1 is taken into account as a skip case. I would have passed Integer.MAX_VALUE, but that would have been bad for + // some sublisting stuff default int getItemOutputLimit() { return -1; } @@ -20,6 +21,7 @@ default int getFluidOutputLimit() { } enum VoidingMode implements IStringSerializable { + VOID_NONE("gregtech.gui.multiblock_no_voiding"), VOID_ITEMS("gregtech.gui.multiblock_item_voiding"), VOID_FLUIDS("gregtech.gui.multiblock_fluid_voiding"), @@ -39,5 +41,4 @@ public String getName() { return localeName; } } - } diff --git a/src/main/java/gregtech/api/metatileentity/MTETrait.java b/src/main/java/gregtech/api/metatileentity/MTETrait.java index ec5a8b354ee..3cc461e5c97 100644 --- a/src/main/java/gregtech/api/metatileentity/MTETrait.java +++ b/src/main/java/gregtech/api/metatileentity/MTETrait.java @@ -1,12 +1,14 @@ package gregtech.api.metatileentity; import gregtech.api.metatileentity.interfaces.ISyncedTileEntity; -import it.unimi.dsi.fastutil.objects.Object2IntFunction; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; + +import it.unimi.dsi.fastutil.objects.Object2IntFunction; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -64,19 +66,16 @@ public final int getNetworkID() { public abstract T getCapability(Capability capability); - public void onFrontFacingSet(EnumFacing newFrontFacing) { - } + public void onFrontFacingSet(EnumFacing newFrontFacing) {} - public void update() { - } + public void update() {} @NotNull public NBTTagCompound serializeNBT() { return new NBTTagCompound(); } - public void deserializeNBT(@NotNull NBTTagCompound compound) { - } + public void deserializeNBT(@NotNull NBTTagCompound compound) {} @Override public void writeInitialSyncData(@NotNull PacketBuffer buf) {} diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index b05b5790c7b..1412a674817 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -1,17 +1,5 @@ package gregtech.api.metatileentity; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.me.helpers.AENetworkProxy; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; @@ -34,16 +22,13 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -69,6 +54,22 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.me.helpers.AENetworkProxy; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; @@ -188,12 +189,11 @@ public final void writeCustomData(int discriminator, @NotNull Consumer<@NotNull } } - public void addDebugInfo(List list) { - } + public void addDebugInfo(List list) {} @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - } + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) {} /** * Override this to add extended tool information to the "Hold SHIFT to show Tool Info" tooltip section. @@ -255,9 +255,11 @@ public void setRenderContextStack(ItemStack itemStack) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { TextureAtlasSprite atlasSprite = TextureUtils.getMissingSprite(); - IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); for (EnumFacing face : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -265,7 +267,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, public boolean canRenderInLayer(BlockRenderLayer renderLayer) { return renderLayer == BlockRenderLayer.CUTOUT_MIPPED || renderLayer == BloomEffectUtil.getEffectiveBloomLayer() || - (renderLayer == BlockRenderLayer.TRANSLUCENT && !getWorld().getBlockState(getPos()).getValue(BlockMachine.OPAQUE)); + (renderLayer == BlockRenderLayer.TRANSLUCENT && + !getWorld().getBlockState(getPos()).getValue(BlockMachine.OPAQUE)); } @Override @@ -285,17 +288,14 @@ public int getPaintingColorForRendering() { * This method is typically used by torches or nether portals, as an example use-case */ @SideOnly(Side.CLIENT) - public void randomDisplayTick() { - - } + public void randomDisplayTick() {} /** * Called from ItemBlock to initialize this MTE with data contained in ItemStack * * @param itemStack itemstack of itemblock */ - public void initFromItemStackData(NBTTagCompound itemStack) { - } + public void initFromItemStackData(NBTTagCompound itemStack) {} /** * Called to write MTE specific data when it is destroyed to save it's state @@ -303,8 +303,7 @@ public void initFromItemStackData(NBTTagCompound itemStack) { * * @param itemStack itemstack from which this MTE is being placed */ - public void writeItemStackData(NBTTagCompound itemStack) { - } + public void writeItemStackData(NBTTagCompound itemStack) {} public void getSubItems(CreativeTabs creativeTab, NonNullList subItems) { subItems.add(getStackForm()); @@ -317,7 +316,8 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem * * @param creativeTab The creative tab to check * @return Whether this MTE belongs in the creative tab or not - * @see gregtech.api.block.machines.MachineItemBlock#addCreativeTab(CreativeTabs) MachineItemBlock#addCreativeTab(CreativeTabs) + * @see gregtech.api.block.machines.MachineItemBlock#addCreativeTab(CreativeTabs) + * MachineItemBlock#addCreativeTab(CreativeTabs) */ public boolean isInCreativeTab(CreativeTabs creativeTab) { return creativeTab == CreativeTabs.SEARCH || creativeTab == GregTechAPI.TAB_GREGTECH_MACHINES; @@ -430,7 +430,8 @@ public final void onCoverLeftClick(EntityPlayer playerIn, CuboidRayTraceResult r * * @return true if something happened, so animation will be played */ - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { ItemStack heldStack = playerIn.getHeldItem(hand); if (!playerIn.isSneaking() && openGUIOnRightClick()) { if (getWorld() != null && !getWorld().isRemote) { @@ -440,7 +441,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } else { // Attempt to rename the MTE first if (heldStack.getItem() == Items.NAME_TAG) { - if (playerIn.isSneaking() && heldStack.getTagCompound() != null && heldStack.getTagCompound().hasKey("display")) { + if (playerIn.isSneaking() && heldStack.getTagCompound() != null && + heldStack.getTagCompound().hasKey("display")) { MetaTileEntityHolder mteHolder = (MetaTileEntityHolder) getHolder(); mteHolder.setCustomName(heldStack.getTagCompound().getCompoundTag("display").getString("Name")); @@ -476,7 +478,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac * * @return true if something happened, so tools will get damaged and animations will be played */ - public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set toolClasses, EnumHand hand, CuboidRayTraceResult hitResult) { + public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set toolClasses, EnumHand hand, + CuboidRayTraceResult hitResult) { // the side hit from the machine grid EnumFacing gridSideHit = CoverRayTracer.determineGridSideHit(hitResult); Cover cover = gridSideHit == null ? null : getCoverAtSide(gridSideHit); @@ -509,7 +512,8 @@ public final boolean onToolClick(EntityPlayer playerIn, @NotNull Set too * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (!needsSneakToRotate() || playerIn.isSneaking()) { if (wrenchSide == getFrontFacing() || !isValidFrontFacing(wrenchSide) || !hasFrontFacing()) { return false; @@ -527,7 +531,8 @@ public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wr * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return false; } @@ -536,7 +541,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getCoverAtSide(facing) != null) { removeCover(facing); return true; @@ -549,7 +555,8 @@ public boolean onCrowbarClick(EntityPlayer playerIn, EnumHand hand, EnumFacing f * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { IControllable controllable = getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); if (controllable != null) { controllable.setWorkingEnabled(!controllable.isWorkingEnabled()); @@ -567,7 +574,8 @@ public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacin * * @return true if something happened, so the tool will get damaged and animation will be played */ - public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { toggleMuffled(); if (!getWorld().isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isMuffled() ? @@ -576,8 +584,7 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin return true; } - public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - } + public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) {} /** * @return true if the player must sneak to rotate this metatileentity, otherwise false @@ -655,12 +662,11 @@ public void onLoad() { } } - public void onUnload() { - } + public void onUnload() {} public final boolean canConnectRedstone(@Nullable EnumFacing side) { - //so far null side means either upwards or downwards redstone wire connection - //so check both top cover and bottom cover + // so far null side means either upwards or downwards redstone wire connection + // so check both top cover and bottom cover if (side == null) { return canConnectRedstone(EnumFacing.UP) || canConnectRedstone(EnumFacing.DOWN); @@ -679,7 +685,7 @@ protected boolean canMachineConnectRedstone(EnumFacing side) { @Override public final int getInputRedstoneSignal(@NotNull EnumFacing side, boolean ignoreCover) { if (!ignoreCover && getCoverAtSide(side) != null) { - return 0; //covers block input redstone signal for machine + return 0; // covers block input redstone signal for machine } return sidedRedstoneInput[side.getIndex()]; } @@ -693,8 +699,7 @@ public final boolean isBlockRedstonePowered() { return false; } - public void onNeighborChanged() { - } + public void onNeighborChanged() {} public void updateInputRedstoneSignals() { for (EnumFacing side : EnumFacing.VALUES) { @@ -711,7 +716,8 @@ public void updateInputRedstoneSignals() { } /** - * @deprecated Will be removed in 2.9. Comparators no longer supported for MetaTileEntities, as cover are interactions favored. + * @deprecated Will be removed in 2.9. Comparators no longer supported for MetaTileEntities, as cover are + * interactions favored. */ @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @Deprecated @@ -805,8 +811,7 @@ public final ItemStack getStackForm() { * @param dropsList list of meta tile entity drops * @param harvester harvester of this meta tile entity, or null */ - public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) { - } + public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) {} public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) { IndexedCuboid6 hitCuboid = result.cuboid6; @@ -814,7 +819,7 @@ public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer pla Cover cover = getCoverAtSide(coverSideData.side); return cover == null ? ItemStack.EMPTY : cover.getPickItem(); } else if (hitCuboid.data == null || hitCuboid.data instanceof CoverRayTracer.PrimaryBoxData) { - //data is null -> MetaTileEntity hull hit + // data is null -> MetaTileEntity hull hit Cover cover = getCoverAtSide(result.sideHit); if (cover != null) { return cover.getPickItem(); @@ -938,13 +943,13 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { } else if (dataId == COVER_ATTACHED_MTE) { CoverSaveHandler.readCoverPlacement(buf, this); } else if (dataId == COVER_REMOVED_MTE) { - //cover removed event + // cover removed event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; this.covers.remove(placementSide); onCoverPlacementUpdate(); scheduleRenderUpdate(); } else if (dataId == UPDATE_COVER_DATA_MTE) { - //cover custom data received + // cover custom data received EnumFacing coverSide = EnumFacing.VALUES[buf.readByte()]; Cover cover = getCoverAtSide(coverSide); int internalId = buf.readVarInt(); @@ -961,7 +966,7 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { public BlockFaceShape getCoverFaceShape(EnumFacing side) { if (getCoverAtSide(side) != null) { - return BlockFaceShape.SOLID; //covers are always solid + return BlockFaceShape.SOLID; // covers are always solid } return getFaceShape(side); } @@ -985,8 +990,8 @@ public T getCapability(Capability capability, EnumFacing side) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(getFluidInventory()); } else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && getItemInventory().getSlots() > 0) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getItemInventory()); - } + return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getItemInventory()); + } T capabilityResult = null; for (MTETrait mteTrait : this.mteTraits.values()) { capabilityResult = mteTrait.getCapability(capability); @@ -997,7 +1002,7 @@ public T getCapability(Capability capability, EnumFacing side) { if (side != null && capabilityResult instanceof IEnergyContainer) { IEnergyContainer energyContainer = (IEnergyContainer) capabilityResult; if (!energyContainer.inputsEnergy(side) && !energyContainer.outputsEnergy(side)) { - return null; //do not provide energy container if it can't input or output energy at all + return null; // do not provide energy container if it can't input or output energy at all } } return capabilityResult; @@ -1010,13 +1015,14 @@ public void fillInternalTankFromFluidContainer() { public void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler) { for (int i = 0; i < importItems.getSlots(); i++) { ItemStack inputContainerStack = importItems.extractItem(i, 1, true); - FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, + null, false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (ItemStack.areItemStacksEqual(inputContainerStack, remainingItem)) - continue; //do not fill if item stacks match + continue; // do not fill if item stacks match if (!remainingItem.isEmpty() && !GTTransferUtils.insertItem(exportItems, remainingItem, true).isEmpty()) - continue; //do not fill if can't put remaining item + continue; // do not fill if can't put remaining item FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, true); importItems.extractItem(i, 1, false); GTTransferUtils.insertItem(exportItems, remainingItem, false); @@ -1031,7 +1037,8 @@ public void fillContainerFromInternalTank() { public void fillContainerFromInternalTank(IFluidHandler fluidHandler) { for (int i = 0; i < importItems.getSlots(); i++) { ItemStack emptyContainer = importItems.extractItem(i, 1, true); - FluidActionResult result = FluidUtil.tryFillContainer(emptyContainer, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryFillContainer(emptyContainer, fluidHandler, Integer.MAX_VALUE, null, + false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (!remainingItem.isEmpty() && !GTTransferUtils.insertItem(exportItems, remainingItem, true).isEmpty()) @@ -1044,19 +1051,23 @@ public void fillContainerFromInternalTank(IFluidHandler fluidHandler) { } public void pushFluidsIntoNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, GTTransferUtils::transferFluids, allowedFaces); + transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, GTTransferUtils::transferFluids, + allowedFaces); } public void pullFluidsFromNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, (thisCap, otherCap) -> GTTransferUtils.transferFluids(otherCap, thisCap), allowedFaces); + transferToNearby(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + (thisCap, otherCap) -> GTTransferUtils.transferFluids(otherCap, thisCap), allowedFaces); } public void pushItemsIntoNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, GTTransferUtils::moveInventoryItems, allowedFaces); + transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, GTTransferUtils::moveInventoryItems, + allowedFaces); } public void pullItemsFromNearbyHandlers(EnumFacing... allowedFaces) { - transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, (thisCap, otherCap) -> GTTransferUtils.moveInventoryItems(otherCap, thisCap), allowedFaces); + transferToNearby(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + (thisCap, otherCap) -> GTTransferUtils.moveInventoryItems(otherCap, thisCap), allowedFaces); } private void transferToNearby(Capability capability, BiConsumer transfer, EnumFacing... allowedFaces) { @@ -1066,7 +1077,7 @@ private void transferToNearby(Capability capability, BiConsumer tra continue; } T otherCap = tileEntity.getCapability(capability, nearbyFacing.getOpposite()); - //use getCoverCapability so item/ore dictionary filter covers will work properly + // use getCoverCapability so item/ore dictionary filter covers will work properly T thisCap = getCoverCapability(capability, nearbyFacing); if (otherCap == null || thisCap == null) { continue; @@ -1150,7 +1161,7 @@ public boolean hasFrontFacing() { /** * @return true if this meta tile entity should serialize it's export and import inventories - * Useful when you use your own unified inventory and don't need these dummies to be saved + * Useful when you use your own unified inventory and don't need these dummies to be saved */ protected boolean shouldSerializeInventories() { return true; @@ -1235,17 +1246,14 @@ public int getItemStackLimit(ItemStack stack) { * If placing an MTE with methods such as {@link World#setBlockState(BlockPos, IBlockState)}, * this should be manually called immediately afterwards */ - public void onPlacement() { - - } + public void onPlacement() {} /** * Called from breakBlock right before meta tile entity destruction * at this stage tile entity inventory is already dropped on ground, but drops aren't fetched yet * tile entity will still get getDrops called after this, if player broke block */ - public void onRemoval() { - } + public void onRemoval() {} public void invalidate() { if (getWorld() != null && getWorld().isRemote) { @@ -1367,8 +1375,9 @@ public final AbstractRecipeLogic getRecipeLogic() { if (trait instanceof AbstractRecipeLogic) { return ((AbstractRecipeLogic) trait); } else if (trait != null) { - throw new IllegalStateException("MTE Trait " + trait.getName() + " has name " + GregtechDataCodes.ABSTRACT_WORKABLE_TRAIT + - " but is not instanceof AbstractRecipeLogic"); + throw new IllegalStateException( + "MTE Trait " + trait.getName() + " has name " + GregtechDataCodes.ABSTRACT_WORKABLE_TRAIT + + " but is not instanceof AbstractRecipeLogic"); } return null; } @@ -1382,20 +1391,25 @@ public final RecipeMap getRecipeMap() { return recipeLogic == null ? null : recipeLogic.getRecipeMap(); } - public void checkWeatherOrTerrainExplosion(float explosionPower, double additionalFireChance, IEnergyContainer energyContainer) { + public void checkWeatherOrTerrainExplosion(float explosionPower, double additionalFireChance, + IEnergyContainer energyContainer) { World world = getWorld(); - if (!world.isRemote && ConfigHolder.machines.doTerrainExplosion && !getIsWeatherOrTerrainResistant() && energyContainer.getEnergyStored() != 0) { + if (!world.isRemote && ConfigHolder.machines.doTerrainExplosion && !getIsWeatherOrTerrainResistant() && + energyContainer.getEnergyStored() != 0) { if (GTValues.RNG.nextInt(1000) == 0) { for (EnumFacing side : EnumFacing.VALUES) { Block block = getWorld().getBlockState(getPos().offset(side)).getBlock(); - if (block == Blocks.FIRE || block == Blocks.WATER || block == Blocks.FLOWING_WATER || block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { + if (block == Blocks.FIRE || block == Blocks.WATER || block == Blocks.FLOWING_WATER || + block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { doExplosion(explosionPower); return; } } } if (GTValues.RNG.nextInt(1000) == 0) { - if (world.isRainingAt(getPos()) || world.isRainingAt(getPos().east()) || world.isRainingAt(getPos().west()) || world.isRainingAt(getPos().north()) || world.isRainingAt(getPos().south())) { + if (world.isRainingAt(getPos()) || world.isRainingAt(getPos().east()) || + world.isRainingAt(getPos().west()) || world.isRainingAt(getPos().north()) || + world.isRainingAt(getPos().south())) { if (world.isThundering() && GTValues.RNG.nextInt(3) == 0) { doExplosion(explosionPower); } else if (GTValues.RNG.nextInt(10) == 0) { @@ -1457,7 +1471,7 @@ public boolean doTickProfileMessage() { } public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { - final String[] tools = {ToolClasses.WRENCH, ToolClasses.SCREWDRIVER}; + final String[] tools = { ToolClasses.WRENCH, ToolClasses.SCREWDRIVER }; return ToolHelper.isTool(mainHandStack, tools) || ToolHelper.isTool(offHandStack, tools); } @@ -1489,6 +1503,5 @@ public AENetworkProxy getProxy() { } @Method(modid = GTValues.MODID_APPENG) - public void gridChanged() { - } + public void gridChanged() {} } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index 8f8b7266275..bfaf3dd00d9 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -1,13 +1,5 @@ package gregtech.api.metatileentity; -import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.api.util.DimensionalCoord; -import appeng.me.helpers.AENetworkProxy; -import appeng.me.helpers.IGridProxyable; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; @@ -21,6 +13,7 @@ import gregtech.client.particle.GTParticleManager; import gregtech.common.ConfigHolder; import gregtech.core.network.packets.PacketRecoverMTE; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -42,20 +35,33 @@ import net.minecraftforge.fml.common.Optional.Method; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import appeng.api.networking.IGridNode; +import appeng.api.networking.security.IActionHost; +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.api.util.DimensionalCoord; +import appeng.me.helpers.AENetworkProxy; +import appeng.me.helpers.IGridProxyable; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.text.DecimalFormat; import java.util.ArrayList; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.INITIALIZE_MTE; @InterfaceList(value = { - @Interface(iface = "appeng.api.networking.security.IActionHost", modid = GTValues.MODID_APPENG, striprefs = true), + @Interface(iface = "appeng.api.networking.security.IActionHost", + modid = GTValues.MODID_APPENG, + striprefs = true), @Interface(iface = "appeng.me.helpers.IGridProxyable", modid = GTValues.MODID_APPENG, striprefs = true), }) -public class MetaTileEntityHolder extends TickableTileEntityBase implements IGregTechTileEntity, IUIHolder, IWorldNameable, IActionHost, IGridProxyable { +public class MetaTileEntityHolder extends TickableTileEntityBase implements IGregTechTileEntity, IUIHolder, + IWorldNameable, IActionHost, IGridProxyable { MetaTileEntity metaTileEntity; private boolean needToUpdateLightning = false; @@ -89,7 +95,7 @@ public MetaTileEntity setMetaTileEntity(MetaTileEntity sampleMetaTileEntity) { buffer.writeVarInt(GregTechAPI.MTE_REGISTRY.getIdByObjectName(getMetaTileEntity().metaTileEntityId)); getMetaTileEntity().writeInitialSyncData(buffer); }); - //just to update neighbours so cables and other things will work properly + // just to update neighbours so cables and other things will work properly this.needToUpdateLightning = true; world.neighborChanged(getPos(), getBlockType(), getPos()); markDirty(); @@ -126,8 +132,10 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { NBTTagCompound metaTileEntityData = compound.getCompoundTag("MetaTileEntity"); if (sampleMetaTileEntity != null) { setRawMetaTileEntity(sampleMetaTileEntity.createMetaTileEntity(this)); - /* Note: NBTs need to be read before onAttached is run, since NBTs may contain important information - * about the composition of the BlockPattern that onAttached may generate. */ + /* + * Note: NBTs need to be read before onAttached is run, since NBTs may contain important information + * about the composition of the BlockPattern that onAttached may generate. + */ this.metaTileEntity.readFromNBT(metaTileEntityData); } else { GTLog.logger.error("Failed to load MetaTileEntity with invalid ID " + metaTileEntityIdRaw); @@ -168,7 +176,8 @@ public void invalidate() { @Override public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { - Object metaTileEntityValue = metaTileEntity == null ? null : metaTileEntity.getCoverCapability(capability, facing); + Object metaTileEntityValue = metaTileEntity == null ? null : + metaTileEntity.getCoverCapability(capability, facing); return metaTileEntityValue != null || super.hasCapability(capability, facing); } @@ -204,11 +213,13 @@ public void update() { timeStatisticsIndex = (timeStatisticsIndex + 1) % timeStatistics.length; } if (tickTime > 100_000_000L && getMetaTileEntity().doTickProfileMessage() && lagWarningCount++ < 10) - GTLog.logger.warn("WARNING: Possible Lag Source at [" + getPos().getX() + ", " + getPos().getY() + ", " + getPos().getZ() + "] in Dimension " + world.provider.getDimension() + " with " + tickTime + "ns caused by an instance of " + getMetaTileEntity().getClass()); + GTLog.logger.warn("WARNING: Possible Lag Source at [" + getPos().getX() + ", " + getPos().getY() + + ", " + getPos().getZ() + "] in Dimension " + world.provider.getDimension() + " with " + + tickTime + "ns caused by an instance of " + getMetaTileEntity().getClass()); } - //increment only after current tick, so meta tile entities will get first tick as timer == 0 - //and update their settings which depend on getTimer() % N properly + // increment only after current tick, so meta tile entities will get first tick as timer == 0 + // and update their settings which depend on getTimer() % N properly super.update(); } @@ -217,20 +228,22 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) if (logLevel > 2) { if (isValid()) { list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", - new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_valid").setStyle(new Style().setColor(TextFormatting.GREEN)) - )); + new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation("behavior.tricorder.debug_machine_valid") + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } else if (metaTileEntity == null) { - //noinspection NoTranslation + // noinspection NoTranslation list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", new TextComponentTranslation("-1").setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_invalid_null").setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation("behavior.tricorder.debug_machine_invalid_null") + .setStyle(new Style().setColor(TextFormatting.RED)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.debug_machine", - new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation("behavior.tricorder.debug_machine_invalid").setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(getMetaTileEntity().metaTileEntityId.toString()) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation("behavior.tricorder.debug_machine_invalid") + .setStyle(new Style().setColor(TextFormatting.RED)))); } } if (logLevel > 1) { @@ -240,18 +253,23 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) double worstTickTime = timeStats[1]; list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(averageTickTime / timeStatistics.length)).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(timeStatistics.length)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(worstTickTime)).setStyle(new Style().setColor(TextFormatting.RED)) - )); - list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load_seconds", tricorderFormat.format(worstTickTime / 1000000000))); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(averageTickTime / timeStatistics.length)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(timeStatistics.length)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(worstTickTime)) + .setStyle(new Style().setColor(TextFormatting.RED)))); + list.add(new TextComponentTranslation("behavior.tricorder.debug_cpu_load_seconds", + tricorderFormat.format(worstTickTime / 1000000000))); } if (lagWarningCount > 0) { list.add(new TextComponentTranslation("behavior.tricorder.debug_lag_count", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(lagWarningCount)).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(100_000_000L)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(lagWarningCount)) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(100_000_000L)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } } return list; @@ -259,7 +277,7 @@ public ArrayList getDebugInfo(EntityPlayer player, int logLevel) /** * @return double array of length 2, with index 0 being the average time and index 1 the worst time, in ns. - * If there is no tick time, it will return null. + * If there is no tick time, it will return null. */ public double[] getTimeStatistics() { if (timeStatistics.length > 0) { @@ -271,7 +289,7 @@ public double[] getTimeStatistics() { worstTickTime = tickTime; } } - return new double[]{averageTickTime, worstTickTime}; + return new double[] { averageTickTime, worstTickTime }; } return null; } @@ -365,8 +383,10 @@ public void onChunkUnload() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, IBlockState newState) { - return oldState.getBlock() != newState.getBlock(); //MetaTileEntityHolder should never refresh (until block changes) + public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + IBlockState newState) { + return oldState.getBlock() != newState.getBlock(); // MetaTileEntityHolder should never refresh (until block + // changes) } @Override @@ -452,7 +472,7 @@ public void setCustomName(String customName) { } @SideOnly(Side.CLIENT) - private void updateNameTagParticle(){ + private void updateNameTagParticle() { if (hasCustomName()) { if (nameTagParticle == null) { nameTagParticle = new GTNameTagParticle(this, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5); @@ -480,7 +500,9 @@ public boolean hasCustomName() { @Nonnull @Override public ITextComponent getDisplayName() { - return this.hasCustomName() ? new TextComponentString(this.getName()) : metaTileEntity != null ? new TextComponentTranslation(metaTileEntity.getMetaFullName()) : new TextComponentString(this.getName()); + return this.hasCustomName() ? new TextComponentString(this.getName()) : + metaTileEntity != null ? new TextComponentTranslation(metaTileEntity.getMetaFullName()) : + new TextComponentString(this.getName()); } @Nullable diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java index f18f409a52b..43dd60efea2 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java @@ -5,6 +5,7 @@ import gregtech.api.gui.UIFactory; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; @@ -18,8 +19,7 @@ public class MetaTileEntityUIFactory extends UIFactory { public static final MetaTileEntityUIFactory INSTANCE = new MetaTileEntityUIFactory(); - private MetaTileEntityUIFactory() { - } + private MetaTileEntityUIFactory() {} public void init() { GregTechAPI.UI_FACTORY_REGISTRY.register(0, GTUtility.gregtechId("meta_tile_entity_factory"), this); diff --git a/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java index 6eb7cb8f8ce..473b950d63c 100644 --- a/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/NeighborCacheTileEntityBase.java @@ -1,10 +1,12 @@ package gregtech.api.metatileentity; import gregtech.api.metatileentity.interfaces.INeighborCache; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index fc165b64c1b..074ace86e8b 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -18,6 +15,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -28,28 +26,36 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class SimpleGeneratorMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide { private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value - public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction) { this(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, false); } - public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public SimpleGeneratorMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction, boolean handlesRecipeOutputs) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, handlesRecipeOutputs); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleGeneratorMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), getTankScalingFunction(), handlesRecipeOutputs); + return new SimpleGeneratorMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), + getTankScalingFunction(), handlesRecipeOutputs); } @Override @@ -98,17 +104,18 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { workableRecipeMap.getMaxOutputs() >= 6 || workableRecipeMap.getMaxFluidOutputs() >= 6) yOffset = FONT_HEIGHT; - ModularUI.Builder builder; - if (handlesRecipeOutputs) builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset); - else builder = workableRecipeMap.createUITemplateNoOutputs(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset); + if (handlesRecipeOutputs) builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, + importItems, exportItems, importFluids, exportFluids, yOffset); + else builder = workableRecipeMap.createUITemplateNoOutputs(workable::getProgressPercent, importItems, + exportItems, importFluids, exportFluids, yOffset); builder.widget(new LabelWidget(6, 6, getMetaFullName())) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); builder.widget(new CycleButtonWidget(7, 62 + yOffset, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); return builder; } @@ -117,11 +124,13 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); renderOverlays(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), + workable.isWorkingEnabled()); } @Override @@ -130,16 +139,20 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { String key = this.metaTileEntityId.getPath().split("\\.")[0]; String mainKey = String.format("gregtech.machine.%s.tooltip", key); if (I18n.hasKey(mainKey)) { tooltip.add(1, I18n.format(mainKey)); } - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); if (recipeMap.getMaxFluidInputs() > 0 || recipeMap.getMaxFluidOutputs() > 0) - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", this.getTankScalingFunction().apply(getTier()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + this.getTankScalingFunction().apply(getTier()))); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index 5f0d9b562c3..e414c212236 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; @@ -22,6 +18,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -43,16 +40,23 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.function.Function; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; -public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide, IGhostSlotConfigurable { +public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity + implements IActiveOutputSide, IGhostSlotConfigurable { private final boolean hasFrontFacing; @@ -74,11 +78,13 @@ public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity im private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value - public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing) { + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, boolean hasFrontFacing) { this(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, GTUtility.defaultTankSizeFunction); } - public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing, + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, boolean hasFrontFacing, Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); this.hasFrontFacing = hasFrontFacing; @@ -87,7 +93,8 @@ public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap< @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleMachineMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), hasFrontFacing, getTankScalingFunction()); + return new SimpleMachineMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), + hasFrontFacing, getTankScalingFunction()); } @Override @@ -119,13 +126,14 @@ public boolean hasFrontFacing() { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { - //TODO Separate into two output getters + // TODO Separate into two output getters if (getOutputFacing() == facing) return false; if (hasFrontFacing() && facing == getFrontFacing()) return false; if (!getWorld().isRemote) { - //TODO Separate into two output setters + // TODO Separate into two output setters setOutputFacing(facing); } return true; @@ -151,16 +159,20 @@ public void addCover(@NotNull EnumFacing side, @NotNull Cover cover) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (outputFacingFluids != null && getExportFluids().getTanks() > 0) { - Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingFluids, renderState, RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); + Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingFluids, renderState, + RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); } if (outputFacingItems != null && getExportItems().getSlots() > 0) { - Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingItems, renderState, RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); + Textures.PIPE_OUT_OVERLAY.renderSided(outputFacingItems, renderState, + RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); } if (isAutoOutputItems() && outputFacingItems != null) { - Textures.ITEM_OUTPUT_OVERLAY.renderSided(outputFacingItems, renderState, RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); + Textures.ITEM_OUTPUT_OVERLAY.renderSided(outputFacingItems, renderState, + RenderUtil.adjustTrans(translation, outputFacingItems, 2), pipeline); } if (isAutoOutputFluids() && outputFacingFluids != null) { - Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacingFluids, renderState, RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); + Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacingFluids, renderState, + RenderUtil.adjustTrans(translation, outputFacingFluids, 2), pipeline); } } @@ -182,16 +194,19 @@ public void update() { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideItems()) { setAllowInputFromOutputSideItems(false); setAllowInputFromOutputSideFluids(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); } else { setAllowInputFromOutputSideItems(true); setAllowInputFromOutputSideFluids(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; @@ -200,13 +215,15 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci @Override public T getCapability(Capability capability, EnumFacing side) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { - IFluidHandler fluidHandler = (side == getOutputFacingFluids() && !isAllowInputFromOutputSideFluids()) ? outputFluidInventory : fluidInventory; + IFluidHandler fluidHandler = (side == getOutputFacingFluids() && !isAllowInputFromOutputSideFluids()) ? + outputFluidInventory : fluidInventory; if (fluidHandler.getTankProperties().length > 0) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); } return null; } else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - IItemHandler itemHandler = (side == getOutputFacingItems() && !isAllowInputFromOutputSideFluids()) ? outputItemInventory : itemInventory; + IItemHandler itemHandler = (side == getOutputFacingItems() && !isAllowInputFromOutputSideFluids()) ? + outputItemInventory : itemInventory; if (itemHandler.getSlots() > 0) { return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler); } @@ -300,8 +317,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacingItems && facing != outputFacingFluids; } @@ -388,7 +405,7 @@ public void setGhostCircuitConfig(int config) { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacingItems == null || this.outputFacingFluids == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -436,11 +453,14 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { yOffset = FONT_HEIGHT; } - ModularUI.Builder builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset) + ModularUI.Builder builder = workableRecipeMap + .createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, + yOffset) .widget(new LabelWidget(5, 5, getMetaFullName())) .widget(new SlotWidget(chargerInventory, 0, 79, 62 + yOffset, true, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY) - .setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()], GTValues.VNF[getTier()])) + .setTooltipText("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()], + GTValues.VNF[getTier()])) .widget(new ImageWidget(79, 42 + yOffset, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setIgnoreColor(true) .setPredicate(workable::isHasNotEnoughEnergy)) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); @@ -450,27 +470,27 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { if (exportItems.getSlots() > 0) { builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems) - .setTooltipText("gregtech.gui.item_auto_output.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.item_auto_output.tooltip") + .shouldUseBaseBackground()); leftButtonStartX += 18; } if (exportFluids.getTanks() > 0) { builder.widget(new ToggleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids) - .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") + .shouldUseBaseBackground()); leftButtonStartX += 18; } builder.widget(new CycleButtonWidget(leftButtonStartX, 62 + yOffset, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); if (exportItems.getSlots() + exportFluids.getTanks() <= 9) { ImageWidget logo = new ImageWidget(152, 63 + yOffset, 17, 17, GTValues.XMAS.get() ? GuiTextures.GREGTECH_LOGO_XMAS : GuiTextures.GREGTECH_LOGO) - .setIgnoreColor(true); + .setIgnoreColor(true); if (this.circuitInventory != null) { SlotWidget circuitSlot = new GhostCircuitSlotWidget(circuitInventory, 0, 124, 62 + yOffset) diff --git a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java index 59b9d1ba1b7..2093b72e7ff 100644 --- a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java @@ -1,10 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -20,6 +15,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,13 +27,20 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; import java.util.Objects; +import javax.annotation.Nullable; + public abstract class SteamMetaTileEntity extends MetaTileEntity { protected static final int STEAM_CAPACITY = 16000; @@ -47,7 +50,8 @@ public abstract class SteamMetaTileEntity extends MetaTileEntity { protected RecipeLogicSteam workableHandler; protected FluidTank steamFluidTank; - public SteamMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, boolean isHighPressure) { + public SteamMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + boolean isHighPressure) { super(metaTileEntityId); this.workableHandler = new RecipeLogicSteam(this, recipeMap, isHighPressure, steamFluidTank, 1.0); @@ -83,11 +87,13 @@ public int getDefaultPaintingColor() { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { EnumFacing currentVentingSide = workableHandler.getVentingSide(); if (currentVentingSide == facing || - getFrontFacing() == facing) return false; + getFrontFacing() == facing) + return false; workableHandler.setVentingSide(facing); return true; } @@ -102,10 +108,13 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); - renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workableHandler.isActive(), workableHandler.isWorkingEnabled()); - Textures.STEAM_VENT_OVERLAY.renderSided(workableHandler.getVentingSide(), renderState, RenderUtil.adjustTrans(translation, workableHandler.getVentingSide(), 2), pipeline); + renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workableHandler.isActive(), + workableHandler.isWorkingEnabled()); + Textures.STEAM_VENT_OVERLAY.renderSided(workableHandler.getVentingSide(), renderState, + RenderUtil.adjustTrans(translation, workableHandler.getVentingSide(), 2), pipeline); } protected boolean isBrickedCasing() { @@ -153,9 +162,11 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } - randomDisplayTick(x, y, z, EnumParticleTypes.FLAME, isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL); + randomDisplayTick(x, y, z, EnumParticleTypes.FLAME, + isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL); } } diff --git a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java index 8bd1c85e58c..4e29fe09328 100644 --- a/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/SyncedTileEntityBase.java @@ -5,8 +5,7 @@ import gregtech.api.metatileentity.interfaces.ISyncedTileEntity; import gregtech.api.network.PacketDataList; import gregtech.api.util.GTLog; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; + import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -17,6 +16,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.util.Constants; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -88,7 +90,8 @@ public final void onDataPacket(@NotNull NetworkManager net, @NotNull SPacketUpda if (className == null) { className = this.getClass().getName(); } - GTLog.logger.error("Class {} failed to finish reading receiveCustomData with discriminator {} and {} bytes remaining", + GTLog.logger.error( + "Class {} failed to finish reading receiveCustomData with discriminator {} and {} bytes remaining", className, discriminatorKey, backedBuffer.readableBytes()); } } diff --git a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java index 64db1834ab9..b60908d3f3e 100644 --- a/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java +++ b/src/main/java/gregtech/api/metatileentity/TickableTileEntityBase.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity; import gregtech.api.GTValues; + import net.minecraft.util.ITickable; public abstract class TickableTileEntityBase extends NeighborCacheTileEntityBase implements ITickable { @@ -31,7 +32,5 @@ public void update() { timer++; } - protected void onFirstTick() { - } - + protected void onFirstTick() {} } diff --git a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java index 737a5728064..16c9090233b 100644 --- a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -12,6 +8,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -19,14 +16,21 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public abstract class TieredMetaTileEntity extends MetaTileEntity implements IEnergyChangeListener, ITieredMetaTileEntity { +public abstract class TieredMetaTileEntity extends MetaTileEntity + implements IEnergyChangeListener, ITieredMetaTileEntity { private final int tier; protected IEnergyContainer energyContainer; @@ -47,8 +51,7 @@ protected void reinitializeEnergyContainer() { } @Override - public void onEnergyChanged(IEnergyContainer container, boolean isInitialChange) { - } + public void onEnergyChanged(IEnergyContainer container, boolean isInitialChange) {} @SideOnly(Side.CLIENT) protected SimpleSidedCubeRenderer getBaseRenderer() { @@ -56,7 +59,8 @@ protected SimpleSidedCubeRenderer getBaseRenderer() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant()) tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist")); @@ -70,7 +74,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); } @@ -109,5 +114,4 @@ protected long getMaxInputOutputAmperage() { protected boolean isEnergyEmitter() { return false; } - } diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index ef909139eda..2b4e6b8a5be 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.*; import gregtech.api.items.itemhandlers.GTItemStackHandler; @@ -11,6 +8,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -23,13 +21,19 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; import java.util.function.Function; -public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity implements IDataInfoProvider, ICleanroomReceiver { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity + implements IDataInfoProvider, ICleanroomReceiver { protected final RecipeLogicEnergy workable; protected final RecipeMap recipeMap; @@ -41,12 +45,14 @@ public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity private ICleanroomProvider cleanroom; - public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction) { this(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction, true); } - public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, + public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, Function tankScalingFunction, boolean handlesRecipeOutputs) { super(metaTileEntityId, tier); this.renderer = renderer; @@ -69,6 +75,7 @@ protected void reinitializeEnergyContainer() { this.energyContainer = EnergyContainerHandler.emitterContainer(this, tierVoltage * 64L, tierVoltage, getMaxInputOutputAmperage()); } else this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 64L, tierVoltage, 2, 0L, 0L) { + @Override public long getInputAmperage() { if (getEnergyCapacity() / 2 > getEnergyStored() && workable.isActive()) { @@ -87,7 +94,8 @@ protected long getMaxInputOutputAmperage() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), workable.isWorkingEnabled()); + renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), workable.isActive(), + workable.isWorkingEnabled()); } @Override @@ -107,7 +115,8 @@ protected FluidTankList createImportFluidHandler() { if (workable == null) return new FluidTankList(false); NotifiableFluidTank[] fluidImports = new NotifiableFluidTank[workable.getRecipeMap().getMaxFluidInputs()]; for (int i = 0; i < fluidImports.length; i++) { - NotifiableFluidTank filteredFluidHandler = new NotifiableFluidTank(this.tankScalingFunction.apply(this.getTier()), this, false); + NotifiableFluidTank filteredFluidHandler = new NotifiableFluidTank( + this.tankScalingFunction.apply(this.getTier()), this, false); fluidImports[i] = filteredFluidHandler; } return new FluidTankList(false, fluidImports); @@ -126,10 +135,13 @@ protected FluidTankList createExportFluidHandler() { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); if (workable.getRecipeMap().getMaxFluidInputs() != 0) - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", this.tankScalingFunction.apply(getTier()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + this.tankScalingFunction.apply(getTier()))); } public Function getTankScalingFunction() { @@ -152,27 +164,35 @@ public List getDataInfo() { if (workable != null) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (energyContainer != null) { list.add(new TextComponentTranslation("behavior.tricorder.workable_stored_energy", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } // multi amp recipes: change 0 ? 0 : 1 to 0 ? 0 : amperage if (workable.consumesEnergy()) { list.add(new TextComponentTranslation("behavior.tricorder.workable_consumption", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.workable_production", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(workable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } } diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java b/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java index ea88018bdc8..9508a1d76d7 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/IHasWorldObjectAndCoords.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.interfaces; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java index cb952e4bff0..cf6a662d2cb 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/INeighborCache.java @@ -2,6 +2,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java b/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java index f38c8e8ac92..f08beb475b9 100644 --- a/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/interfaces/ISyncedTileEntity.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.interfaces; import net.minecraft.network.PacketBuffer; + import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java index 9330a01605c..9eea63c0cf4 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java @@ -2,24 +2,27 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import java.util.Map; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Map; public class CleanroomType { private static final Map CLEANROOM_TYPES = new Object2ObjectOpenHashMap<>(); - public static final CleanroomType CLEANROOM = new CleanroomType("cleanroom", "gregtech.recipe.cleanroom.display_name"); - public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", "gregtech.recipe.cleanroom_sterile.display_name"); - + public static final CleanroomType CLEANROOM = new CleanroomType("cleanroom", + "gregtech.recipe.cleanroom.display_name"); + public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", + "gregtech.recipe.cleanroom_sterile.display_name"); private final String name; private final String translationKey; public CleanroomType(@Nonnull String name, @Nonnull String translationKey) { if (CLEANROOM_TYPES.get(name) != null) - throw new IllegalArgumentException(String.format("CleanroomType with name %s is already registered!", name)); + throw new IllegalArgumentException( + String.format("CleanroomType with name %s is already registered!", name)); this.name = name; this.translationKey = translationKey; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java index bd2c9810656..198a972b725 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java @@ -1,9 +1,10 @@ package gregtech.api.metatileentity.multiblock; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; + public final class DummyCleanroom implements ICleanroomProvider { private final boolean allowsAllTypes; @@ -11,6 +12,7 @@ public final class DummyCleanroom implements ICleanroomProvider { /** * Create a Dummy Cleanroom that provides specific types + * * @param types the types to provide */ @Nonnull diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java index eefd5bb1e68..a67d7ec7b09 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java @@ -10,6 +10,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; @@ -17,10 +18,11 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public abstract class FuelMultiblockController extends RecipeMapMultiblockController { public FuelMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier) { @@ -79,32 +81,40 @@ public List getDataInfo() { List list = new ArrayList<>(); if (recipeMapWorkable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (!recipeMapWorkable.consumesEnergy()) { list.add(new TextComponentTranslation("behavior.tricorder.workable_production", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(Math.abs(recipeMapWorkable.getInfoProviderEUt()))).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getInfoProviderEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(Math.abs(recipeMapWorkable.getInfoProviderEUt()))) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getInfoProviderEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); list.add(new TextComponentTranslation("behavior.tricorder.multiblock_energy_output", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputVoltage())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getOutputVoltage())]).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputVoltage())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getOutputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } if (ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics()) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_maintenance", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } return list; @@ -122,7 +132,7 @@ protected int[] getTotalFluidAmount(FluidStack testStack, IMultipleTankHandler m } } } - return new int[]{fluidAmount, fluidCapacity}; + return new int[] { fluidAmount, fluidCapacity }; } protected void addFuelText(List textList) { @@ -140,7 +150,8 @@ protected void addFuelText(List textList) { } if (fuelStack != null) { - ITextComponent fuelName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(fuelStack), TextFormatting.GOLD); + ITextComponent fuelName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(fuelStack), + TextFormatting.GOLD); ITextComponent fuelInfo = new TextComponentTranslation("%s / %s L (%s)", TextFormattingUtil.formatNumbers(fuelStored), TextFormattingUtil.formatNumbers(fuelCapacity), diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java b/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java index 4a16f831cf3..786416fc382 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IBatteryData.java @@ -8,5 +8,6 @@ public interface IBatteryData { long getCapacity(); - @NotNull String getBatteryName(); + @NotNull + String getBatteryName(); } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java index 2bf30beed55..d71121f196d 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockAbilityPart.java @@ -7,5 +7,4 @@ public interface IMultiblockAbilityPart extends IMultiblockPart { MultiblockAbility getAbility(); void registerAbilities(List abilityList); - } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java index 4a6f58ac09f..dc6cb0e5d28 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java @@ -11,5 +11,4 @@ public interface IMultiblockPart { default boolean canPartShare() { return true; } - } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java index 8a8a0e7ea8e..77567e09af2 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IProgressBarMultiblock.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.util.text.ITextComponent; import java.util.List; @@ -12,7 +13,9 @@ default boolean showProgressBar() { return true; } - /** Can optionally have two progress bars side-by-side. Can support up to 3 bars. Any other values will default to 1. */ + /** + * Can optionally have two progress bars side-by-side. Can support up to 3 bars. Any other values will default to 1. + */ default int getNumProgressBars() { return 1; } @@ -30,6 +33,5 @@ default TextureArea getProgressBarTexture(int index) { * * @param index The index, 0, 1, or 2, of your progress bar. Only relevant if you have multiple bars. */ - default void addBarHoverText(List hoverList, int index) { - } + default void addBarHoverText(List hoverList, int index) {} } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java index fbc399be582..667333aec1c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; @@ -10,6 +9,7 @@ import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.LocalizationUtils; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,13 +23,17 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + @SuppressWarnings("unused") -public abstract class MultiMapMultiblockController extends RecipeMapMultiblockController implements IMultipleRecipeMaps { +public abstract class MultiMapMultiblockController extends RecipeMapMultiblockController + implements IMultipleRecipeMaps { // array of possible recipes, specific to each multi - used when the multi has multiple RecipeMaps private final RecipeMap[] recipeMaps; @@ -43,7 +47,8 @@ public MultiMapMultiblockController(ResourceLocation metaTileEntityId, RecipeMap } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (recipeMaps.length == 1) return true; if (!getWorld().isRemote) { if (!this.recipeMapWorkable.isActive()) { @@ -57,7 +62,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci setRecipeMapIndex(index); this.recipeMapWorkable.forceRecipeRecheck(); } else { - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.multiblock.multiple_recipemaps.switch_message"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.multiblock.multiple_recipemaps.switch_message"), true); } } @@ -89,11 +95,14 @@ public RecipeMap getCurrentRecipeMap() { } @Override - public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, boolean checkMuffler) { + public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, + boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, + boolean checkMuffler) { boolean checkedItemIn = false, checkedItemOut = false, checkedFluidIn = false, checkedFluidOut = false; TraceabilityPredicate predicate = super.autoAbilities(checkMaintenance, checkMuffler) - .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(3).setPreviewCount(1) : new TraceabilityPredicate()); for (RecipeMap recipeMap : getAvailableRecipeMaps()) { if (!checkedItemIn && checkItemIn) { @@ -129,10 +138,11 @@ public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkM if (getAvailableRecipeMaps() != null && getAvailableRecipeMaps().length > 1) { return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MULTI_MAP, getAvailableRecipeMaps().length, this::getRecipeMapIndex, this::setRecipeMapIndex) - .shouldUseBaseBackground().singleTexture() - .setTooltipHoverString(i -> - LocalizationUtils.format("gregtech.multiblock.multiple_recipemaps.header") + " " - + LocalizationUtils.format("recipemap." + getAvailableRecipeMaps()[i].getUnlocalizedName() + ".name")); + .shouldUseBaseBackground().singleTexture() + .setTooltipHoverString(i -> LocalizationUtils + .format("gregtech.multiblock.multiple_recipemaps.header") + " " + + LocalizationUtils.format( + "recipemap." + getAvailableRecipeMaps()[i].getUnlocalizedName() + ".name")); } return super.getFlexButton(x, y, width, height); } @@ -148,9 +158,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List public String recipeMapsToString() { StringBuilder recipeMapsString = new StringBuilder(); RecipeMap[] recipeMaps = getAvailableRecipeMaps(); - for(int i = 0; i < recipeMaps.length; i++) { + for (int i = 0; i < recipeMaps.length; i++) { recipeMapsString.append(recipeMaps[i].getLocalizedName()); - if(recipeMaps.length - 1 != i) + if (recipeMaps.length - 1 != i) recipeMapsString.append(", "); // For delimiting } return recipeMapsString.toString(); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java index 3bb22cecbe8..4c23893823c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java @@ -2,11 +2,13 @@ import gregtech.api.capability.*; import gregtech.api.metatileentity.MetaTileEntity; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -14,11 +16,14 @@ @SuppressWarnings("InstantiationOfUtilityClass") public class MultiblockAbility { + public static final Map> NAME_REGISTRY = new HashMap<>(); public static final Map, List> REGISTRY = new Object2ObjectOpenHashMap<>(); - public static final MultiblockAbility EXPORT_ITEMS = new MultiblockAbility<>("export_items"); - public static final MultiblockAbility IMPORT_ITEMS = new MultiblockAbility<>("import_items"); + public static final MultiblockAbility EXPORT_ITEMS = new MultiblockAbility<>( + "export_items"); + public static final MultiblockAbility IMPORT_ITEMS = new MultiblockAbility<>( + "import_items"); public static final MultiblockAbility EXPORT_FLUIDS = new MultiblockAbility<>("export_fluids"); public static final MultiblockAbility IMPORT_FLUIDS = new MultiblockAbility<>("import_fluids"); @@ -26,36 +31,49 @@ public class MultiblockAbility { public static final MultiblockAbility INPUT_ENERGY = new MultiblockAbility<>("input_energy"); public static final MultiblockAbility OUTPUT_ENERGY = new MultiblockAbility<>("output_energy"); - public static final MultiblockAbility SUBSTATION_INPUT_ENERGY = new MultiblockAbility<>("substation_input_energy"); - public static final MultiblockAbility SUBSTATION_OUTPUT_ENERGY = new MultiblockAbility<>("substation_output_energy"); + public static final MultiblockAbility SUBSTATION_INPUT_ENERGY = new MultiblockAbility<>( + "substation_input_energy"); + public static final MultiblockAbility SUBSTATION_OUTPUT_ENERGY = new MultiblockAbility<>( + "substation_output_energy"); public static final MultiblockAbility ROTOR_HOLDER = new MultiblockAbility<>("rotor_holder"); public static final MultiblockAbility PUMP_FLUID_HATCH = new MultiblockAbility<>("pump_fluid_hatch"); public static final MultiblockAbility STEAM = new MultiblockAbility<>("steam"); - public static final MultiblockAbility STEAM_IMPORT_ITEMS = new MultiblockAbility<>("steam_import_items"); - public static final MultiblockAbility STEAM_EXPORT_ITEMS = new MultiblockAbility<>("steam_export_items"); + public static final MultiblockAbility STEAM_IMPORT_ITEMS = new MultiblockAbility<>( + "steam_import_items"); + public static final MultiblockAbility STEAM_EXPORT_ITEMS = new MultiblockAbility<>( + "steam_export_items"); - public static final MultiblockAbility MAINTENANCE_HATCH = new MultiblockAbility<>("maintenance_hatch"); + public static final MultiblockAbility MAINTENANCE_HATCH = new MultiblockAbility<>( + "maintenance_hatch"); public static final MultiblockAbility MUFFLER_HATCH = new MultiblockAbility<>("muffler_hatch"); - public static final MultiblockAbility MACHINE_HATCH = new MultiblockAbility<>("machine_hatch"); + public static final MultiblockAbility MACHINE_HATCH = new MultiblockAbility<>( + "machine_hatch"); public static final MultiblockAbility TANK_VALVE = new MultiblockAbility<>("tank_valve"); - public static final MultiblockAbility PASSTHROUGH_HATCH = new MultiblockAbility<>("passthrough_hatch"); + public static final MultiblockAbility PASSTHROUGH_HATCH = new MultiblockAbility<>( + "passthrough_hatch"); - public static final MultiblockAbility DATA_ACCESS_HATCH = new MultiblockAbility<>("data_access_hatch"); - public static final MultiblockAbility OPTICAL_DATA_RECEPTION = new MultiblockAbility<>("optical_data_reception"); - public static final MultiblockAbility OPTICAL_DATA_TRANSMISSION = new MultiblockAbility<>("optical_data_transmission"); + public static final MultiblockAbility DATA_ACCESS_HATCH = new MultiblockAbility<>( + "data_access_hatch"); + public static final MultiblockAbility OPTICAL_DATA_RECEPTION = new MultiblockAbility<>( + "optical_data_reception"); + public static final MultiblockAbility OPTICAL_DATA_TRANSMISSION = new MultiblockAbility<>( + "optical_data_transmission"); public static final MultiblockAbility INPUT_LASER = new MultiblockAbility<>("input_laser"); public static final MultiblockAbility OUTPUT_LASER = new MultiblockAbility<>("output_laser"); - public static final MultiblockAbility COMPUTATION_DATA_RECEPTION = new MultiblockAbility<>("computation_data_reception"); - public static final MultiblockAbility COMPUTATION_DATA_TRANSMISSION = new MultiblockAbility<>("computation_data_transmission"); + public static final MultiblockAbility COMPUTATION_DATA_RECEPTION = new MultiblockAbility<>( + "computation_data_reception"); + public static final MultiblockAbility COMPUTATION_DATA_TRANSMISSION = new MultiblockAbility<>( + "computation_data_transmission"); - public static final MultiblockAbility HPCA_COMPONENT = new MultiblockAbility<>("hpca_component"); + public static final MultiblockAbility HPCA_COMPONENT = new MultiblockAbility<>( + "hpca_component"); public static final MultiblockAbility OBJECT_HOLDER = new MultiblockAbility<>("object_holder"); public static void registerMultiblockAbility(MultiblockAbility ability, MetaTileEntity part) { @@ -65,7 +83,7 @@ public static void registerMultiblockAbility(MultiblockAbility ability, MetaT REGISTRY.get(ability).add(part); } - public MultiblockAbility(String name){ + public MultiblockAbility(String name) { NAME_REGISTRY.put(name.toLowerCase(), this); } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java index 98e6c6d4764..ef8cf414ed3 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java @@ -1,11 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GregTechAPI; import gregtech.api.block.VariantActiveBlock; import gregtech.api.capability.GregtechCapabilities; @@ -27,6 +21,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOrientedCubeRenderer; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -44,17 +39,25 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; public abstract class MultiblockControllerBase extends MetaTileEntity implements IMultiblockController { @@ -171,7 +174,8 @@ public TextureAtlasSprite getFrontDefaultTexture() { return getFrontOverlay().getParticleSprite(); } - public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction predicate, @Nullable Supplier candidates) { + public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction predicate, + @Nullable Supplier candidates) { return new TraceabilityPredicate(blockWorldState -> { TileEntity tileEntity = blockWorldState.getTileEntity(); if (!(tileEntity instanceof IGregTechTileEntity)) @@ -179,7 +183,8 @@ public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction partsFound = blockWorldState.getMatchContext().getOrCreate("MultiblockParts", HashSet::new); + Set partsFound = blockWorldState.getMatchContext().getOrCreate("MultiblockParts", + HashSet::new); partsFound.add((IMultiblockPart) metaTileEntity); } return true; @@ -189,8 +194,10 @@ public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction tile.metaTileEntityId).toArray(ResourceLocation[]::new); - return tilePredicate((state, tile) -> ArrayUtils.contains(ids, tile.metaTileEntityId), getCandidates(metaTileEntities)); + ResourceLocation[] ids = Arrays.stream(metaTileEntities).filter(Objects::nonNull) + .map(tile -> tile.metaTileEntityId).toArray(ResourceLocation[]::new); + return tilePredicate((state, tile) -> ArrayUtils.contains(ids, tile.metaTileEntityId), + getCandidates(metaTileEntities)); } private static Supplier getCandidates(MetaTileEntity... metaTileEntities) { @@ -210,8 +217,10 @@ private static Supplier getCandidates(IBlockState... allowedStates) public static TraceabilityPredicate abilities(MultiblockAbility... allowedAbilities) { return tilePredicate((state, tile) -> tile instanceof IMultiblockAbilityPart && - ArrayUtils.contains(allowedAbilities, ((IMultiblockAbilityPart) tile).getAbility()), - getCandidates(Arrays.stream(allowedAbilities).flatMap(ability -> MultiblockAbility.REGISTRY.get(ability).stream()).toArray(MetaTileEntity[]::new))); + ArrayUtils.contains(allowedAbilities, ((IMultiblockAbilityPart) tile).getAbility()), + getCandidates(Arrays.stream(allowedAbilities) + .flatMap(ability -> MultiblockAbility.REGISTRY.get(ability).stream()) + .toArray(MetaTileEntity[]::new))); } public static TraceabilityPredicate states(IBlockState... allowedStates) { @@ -228,19 +237,22 @@ public static TraceabilityPredicate states(IBlockState... allowedStates) { * Use this predicate for Frames in your Multiblock. Allows for Framed Pipes as well as normal Frame blocks. */ public static TraceabilityPredicate frames(Material... frameMaterials) { - return states(Arrays.stream(frameMaterials).map(m -> MetaBlocks.FRAMES.get(m).getBlock(m)).toArray(IBlockState[]::new)) - .or(new TraceabilityPredicate(blockWorldState -> { - TileEntity tileEntity = blockWorldState.getTileEntity(); - if (!(tileEntity instanceof IPipeTile)) { - return false; - } - IPipeTile pipeTile = (IPipeTile) tileEntity; - return ArrayUtils.contains(frameMaterials, pipeTile.getFrameMaterial()); - })); + return states(Arrays.stream(frameMaterials).map(m -> MetaBlocks.FRAMES.get(m).getBlock(m)) + .toArray(IBlockState[]::new)) + .or(new TraceabilityPredicate(blockWorldState -> { + TileEntity tileEntity = blockWorldState.getTileEntity(); + if (!(tileEntity instanceof IPipeTile)) { + return false; + } + IPipeTile pipeTile = (IPipeTile) tileEntity; + return ArrayUtils.contains(frameMaterials, pipeTile.getFrameMaterial()); + })); } public static TraceabilityPredicate blocks(Block... block) { - return new TraceabilityPredicate(blockWorldState -> ArrayUtils.contains(block, blockWorldState.getBlockState().getBlock()), getCandidates(Arrays.stream(block).map(Block::getDefaultState).toArray(IBlockState[]::new))); + return new TraceabilityPredicate( + blockWorldState -> ArrayUtils.contains(block, blockWorldState.getBlockState().getBlock()), + getCandidates(Arrays.stream(block).map(Block::getDefaultState).toArray(IBlockState[]::new))); } public static TraceabilityPredicate air() { @@ -262,7 +274,8 @@ public TraceabilityPredicate selfPredicate() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { ICubeRenderer baseTexture = getBaseTexture(null); - pipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + pipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); if (baseTexture instanceof SimpleOrientedCubeRenderer) { baseTexture.renderOriented(renderState, translation, pipeline, getFrontFacing()); } else { @@ -270,8 +283,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } if (allowsExtendedFacing()) { - double degree = Math.PI / 2 * (upwardsFacing == EnumFacing.EAST ? -1 : upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); - Rotation rotation = new Rotation(degree, frontFacing.getXOffset(), frontFacing.getYOffset(), frontFacing.getZOffset()); + double degree = Math.PI / 2 * (upwardsFacing == EnumFacing.EAST ? -1 : + upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); + Rotation rotation = new Rotation(degree, frontFacing.getXOffset(), frontFacing.getYOffset(), + frontFacing.getZOffset()); translation.translate(0.5, 0.5, 0.5); if (frontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == EnumFacing.Axis.Z) { translation.apply(new Rotation(Math.PI, 0, 1, 0)); @@ -305,7 +320,8 @@ protected Function multiblockPartSorter() { public void checkStructurePattern() { if (structurePattern == null) return; - PatternMatchContext context = structurePattern.checkPatternFastAt(getWorld(), getPos(), getFrontFacing().getOpposite(), getUpwardsFacing(), allowsFlip()); + PatternMatchContext context = structurePattern.checkPatternFastAt(getWorld(), getPos(), + getFrontFacing().getOpposite(), getUpwardsFacing(), allowsFlip()); if (context != null && !structureFormed) { Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); ArrayList parts = new ArrayList<>(rawPartsSet); @@ -323,7 +339,8 @@ public void checkStructurePattern() { if (multiblockPart instanceof IMultiblockAbilityPart) { @SuppressWarnings("unchecked") IMultiblockAbilityPart abilityPart = (IMultiblockAbilityPart) multiblockPart; - List abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), k -> new ArrayList<>()); + List abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), + k -> new ArrayList<>()); abilityPart.registerAbilities(abilityInstancesList); } } @@ -343,8 +360,7 @@ public void checkStructurePattern() { } } - protected void formStructure(PatternMatchContext context) { - } + protected void formStructure(PatternMatchContext context) {} public void invalidateStructure() { this.multiblockParts.forEach(part -> part.removeFromMultiBlock(this)); @@ -447,7 +463,8 @@ public void setFrontFacing(EnumFacing frontFacing) { // Set the upwards facing in a way that makes it "look like" the upwards facing wasn't changed if (allowsExtendedFacing()) { - EnumFacing newUpwardsFacing = RelativeDirection.simulateAxisRotation(frontFacing, oldFrontFacing, getUpwardsFacing()); + EnumFacing newUpwardsFacing = RelativeDirection.simulateAxisRotation(frontFacing, oldFrontFacing, + getUpwardsFacing()); setUpwardsFacing(newUpwardsFacing); } @@ -477,11 +494,13 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (super.onRightClick(playerIn, hand, facing, hitResult)) return true; - if (this.getWorld().isRemote && !this.isStructureFormed() && playerIn.isSneaking() && playerIn.getHeldItem(hand).isEmpty()) { + if (this.getWorld().isRemote && !this.isStructureFormed() && playerIn.isSneaking() && + playerIn.getHeldItem(hand).isEmpty()) { MultiblockPreviewRenderer.renderMultiBlockPreview(this, 60000); return true; } @@ -489,7 +508,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (wrenchSide == getFrontFacing() && allowsExtendedFacing()) { if (!getWorld().isRemote) { setUpwardsFacing(playerIn.isSneaking() ? upwardsFacing.rotateYCCW() : upwardsFacing.rotateY()); @@ -526,7 +546,8 @@ public List getMatchingShapes() { return repetitionDFS(new ArrayList<>(), aisleRepetitions, new Stack<>()); } - private List repetitionDFS(List pages, int[][] aisleRepetitions, Stack repetitionStack) { + private List repetitionDFS(List pages, int[][] aisleRepetitions, + Stack repetitionStack) { if (repetitionStack.size() == aisleRepetitions.length) { int[] repetition = new int[repetitionStack.size()]; for (int i = 0; i < repetitionStack.size(); i++) { @@ -534,7 +555,8 @@ private List repetitionDFS(List pages, } pages.add(new MultiblockShapeInfo(Objects.requireNonNull(this.structurePattern).getPreview(repetition))); } else { - for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= aisleRepetitions[repetitionStack.size()][1]; i++) { + for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= + aisleRepetitions[repetitionStack.size()][1]; i++) { repetitionStack.push(i); repetitionDFS(pages, aisleRepetitions, repetitionStack); repetitionStack.pop(); @@ -546,7 +568,7 @@ private List repetitionDFS(List pages, @SideOnly(Side.CLIENT) public String[] getDescription() { String key = String.format("gregtech.multiblock.%s.description", metaTileEntityId.getPath()); - return I18n.hasKey(key) ? new String[]{I18n.format(key)} : new String[0]; + return I18n.hasKey(key) ? new String[] { I18n.format(key) } : new String[0]; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java index cf34d8094b9..0802125bf07 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockDisplayText.java @@ -6,6 +6,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.text.*; import java.util.List; @@ -24,7 +25,8 @@ public static Builder builder(List textList, boolean isStructure return builder(textList, isStructureFormed, true); } - public static Builder builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + public static Builder builder(List textList, boolean isStructureFormed, + boolean showIncompleteStructureWarning) { return new Builder(textList, isStructureFormed, showIncompleteStructureWarning); } @@ -40,13 +42,16 @@ public static class Builder { private String pausedKey = "gregtech.multiblock.work_paused"; private String runningKey = "gregtech.multiblock.running"; - private Builder(List textList, boolean isStructureFormed, boolean showIncompleteStructureWarning) { + private Builder(List textList, boolean isStructureFormed, + boolean showIncompleteStructureWarning) { this.textList = textList; this.isStructureFormed = isStructureFormed; if (!isStructureFormed && showIncompleteStructureWarning) { - ITextComponent base = TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.invalid_structure"); - ITextComponent hover = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure.tooltip"); + ITextComponent base = TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.invalid_structure"); + ITextComponent hover = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.invalid_structure.tooltip"); textList.add(TextComponentUtil.setHover(base, hover)); } } @@ -87,13 +92,15 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); ITextComponent bodyText = TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick", energyFormatted, voltageName); - ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_energy_per_tick_hover"); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.max_energy_per_tick_hover"); textList.add(TextComponentUtil.setHover(bodyText, hoverText)); } return this; @@ -102,7 +109,8 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { /** * Adds the max Recipe Tier that this multiblock can use for recipe lookup. *
- * Added if the structure is formed and if the passed tier is a valid energy tier index for {@link GTValues#VNF}. + * Added if the structure is formed and if the passed tier is a valid energy tier index for + * {@link GTValues#VNF}. */ public Builder addEnergyTierLine(int tier) { if (!isStructureFormed) return this; @@ -113,7 +121,8 @@ public Builder addEnergyTierLine(int tier) { TextFormatting.GRAY, "gregtech.multiblock.max_recipe_tier", voltageName); - ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.max_recipe_tier_hover"); + ITextComponent hoverText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.max_recipe_tier_hover"); textList.add(TextComponentUtil.setHover(bodyText, hoverText)); return this; } @@ -128,7 +137,8 @@ public Builder addEnergyUsageExactLine(long energyUsage) { if (energyUsage > 0) { String energyFormatted = TextFormattingUtil.formatNumbers(energyUsage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(energyUsage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getTierByVoltage(energyUsage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -148,7 +158,8 @@ public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { if (maxVoltage != 0 && maxVoltage >= -recipeEUt) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -159,16 +170,19 @@ public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { } /** - * Adds the max EU/t that this multiblock can produce, including how many amps. Recommended for multi-amp outputting multis. + * Adds the max EU/t that this multiblock can produce, including how many amps. Recommended for multi-amp + * outputting multis. *
- * Added if the structure is formed, if the amperage is greater than zero and if the max voltage is greater than zero. + * Added if the structure is formed, if the amperage is greater than zero and if the max voltage is greater than + * zero. */ public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { if (!isStructureFormed) return this; if (maxVoltage != 0 && amperage != 0) { String energyFormatted = TextFormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getFloorTierByVoltage(maxVoltage)]); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -186,7 +200,8 @@ public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { public Builder addComputationUsageLine(int maxCWUt) { if (!isStructureFormed) return this; if (maxCWUt > 0) { - ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(maxCWUt)); + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(maxCWUt)); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.computation.max", @@ -203,7 +218,8 @@ public Builder addComputationUsageLine(int maxCWUt) { public Builder addComputationUsageExactLine(int currentCWUt) { if (!isStructureFormed) return this; if (isActive && currentCWUt > 0) { - ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(currentCWUt) + " CWU/t"); + ITextComponent computation = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(currentCWUt) + " CWU/t"); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.computation.usage", @@ -285,7 +301,8 @@ public Builder addProgressLine(double progressPercent) { // todo return this; } - /** Adds a line indicating how many parallels this multi can potentially perform. + /** + * Adds a line indicating how many parallels this multi can potentially perform. *
* Added if structure is formed and the number of parallels is greater than one. */ @@ -312,7 +329,8 @@ public Builder addParallelsLine(int numParallels) { public Builder addLowPowerLine(boolean isLowPower) { if (!isStructureFormed) return this; if (isLowPower) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.not_enough_energy")); } return this; } @@ -325,7 +343,8 @@ public Builder addLowPowerLine(boolean isLowPower) { public Builder addLowComputationLine(boolean isLowComputation) { if (!isStructureFormed) return this; if (isLowComputation) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.computation.not_enough_computation")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.computation.not_enough_computation")); } return this; } @@ -338,7 +357,8 @@ public Builder addLowComputationLine(boolean isLowComputation) { public Builder addLowDynamoTierLine(boolean isTooLow) { if (!isStructureFormed) return this; if (isTooLow) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.not_enough_energy_output")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.not_enough_energy_output")); } return this; } @@ -422,8 +442,10 @@ private boolean addMaintenanceProblemHeader(boolean hasAddedHeader) { public Builder addMufflerObstructedLine(boolean isObstructed) { if (!isStructureFormed) return this; if (isObstructed) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.universal.muffler_obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.universal.muffler_obstructed_desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.universal.muffler_obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.universal.muffler_obstructed_desc")); } return this; } @@ -436,7 +458,8 @@ public Builder addMufflerObstructedLine(boolean isObstructed) { public Builder addFuelNeededLine(String fuelName, int previousRecipeDuration) { if (!isStructureFormed || !isActive) return this; ITextComponent fuelNeeded = TextComponentUtil.stringWithColor(TextFormatting.RED, fuelName); - ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA, TextFormattingUtil.formatNumbers(previousRecipeDuration)); + ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(previousRecipeDuration)); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.turbine.fuel_needed", diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java index f036a3cc08e..c065b166997 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java @@ -19,6 +19,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -31,6 +32,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import java.util.*; @@ -56,17 +58,20 @@ public abstract class MultiblockWithDisplayBase extends MultiblockControllerBase /** * Items to recover in a muffler hatch */ - protected final List recoveryItems = new ArrayList<>(Collections.singleton(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash))); + protected final List recoveryItems = new ArrayList<>( + Collections.singleton(OreDictUnifier.get(OrePrefix.dustTiny, Materials.Ash))); private int timeActive; /** * This value stores whether each of the 5 maintenance problems have been fixed. * A value of 0 means the problem is not fixed, else it is fixed - * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard Hammer, 4=Wire Cutter, 5=Crowbar + * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard + * Hammer, 4=Wire Cutter, 5=Crowbar */ protected byte maintenance_problems; - // Used for tracking if this is the initial state of the machine, for maintenance hatches which automatically fix initial issues. + // Used for tracking if this is the initial state of the machine, for maintenance hatches which automatically fix + // initial issues. private boolean initialMaintenanceDone; // Used for data preservation with Maintenance Hatch @@ -97,7 +102,8 @@ public void setMaintenanceFixed(int index) { @Override public void causeMaintenanceProblems() { this.maintenance_problems &= ~(1 << ((int) (GTValues.RNG.nextFloat() * 5))); - this.getWorld().playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getBreakdownSound(), SoundCategory.BLOCKS, 1.f, 1.f); + this.getWorld().playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + this.getBreakdownSound(), SoundCategory.BLOCKS, 1.f, 1.f); } /** @@ -113,7 +119,8 @@ public byte getMaintenanceProblems() { */ @Override public int getNumMaintenanceProblems() { - return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? 6 - Integer.bitCount(maintenance_problems) : 0; + return ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics() ? + 6 - Integer.bitCount(maintenance_problems) : 0; } /** @@ -175,7 +182,8 @@ public boolean isStructureObstructed() { @Override protected void formStructure(PatternMatchContext context) { super.formStructure(context); - if (this.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { // nothing extra if no maintenance + if (this.hasMaintenanceMechanics() && ConfigHolder.machines.enableMaintenance) { // nothing extra if no + // maintenance if (getAbilities(MultiblockAbility.MAINTENANCE_HATCH).isEmpty()) return; maintenanceHatch = getAbilities(MultiblockAbility.MAINTENANCE_HATCH).get(0); @@ -261,7 +269,8 @@ public boolean isMufflerFaceFree() { if (hasMufflerMechanics() && getAbilities(MultiblockAbility.MUFFLER_HATCH).size() == 0) return false; - return isStructureFormed() && hasMufflerMechanics() && getAbilities(MultiblockAbility.MUFFLER_HATCH).get(0).isFrontFaceFree(); + return isStructureFormed() && hasMufflerMechanics() && + getAbilities(MultiblockAbility.MUFFLER_HATCH).get(0).isFrontFaceFree(); } /** @@ -330,7 +339,8 @@ public TraceabilityPredicate autoAbilities(boolean checkMaintenance, boolean che predicate = predicate.or(maintenancePredicate()); } if (checkMuffler && hasMufflerMechanics()) { - predicate = predicate.or(abilities(MultiblockAbility.MUFFLER_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1)); + predicate = predicate + .or(abilities(MultiblockAbility.MUFFLER_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1)); } return predicate; } @@ -357,8 +367,7 @@ protected void addDisplayText(List textList) { * with special click event handler * Data is the data specified in the component */ - protected void handleDisplayClick(String componentData, ClickData clickData) { - } + protected void handleDisplayClick(String componentData, ClickData clickData) {} protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 198, 208); @@ -373,21 +382,21 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 62, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(1), 68, 115, 62, 7, progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(2), 132, 115, 62, 7, progressMulti.getProgressBarTexture(2), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 2)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 2)); builder.widget(progressBar); } else if (progressMulti.getNumProgressBars() == 2) { // double bar @@ -395,14 +404,14 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 94, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); progressBar = new ProgressWidget( () -> progressMulti.getFillPercentage(1), 100, 115, 94, 7, progressMulti.getProgressBarTexture(1), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 1)); builder.widget(progressBar); } else { // single bar @@ -410,7 +419,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { () -> progressMulti.getFillPercentage(0), 4, 115, 190, 7, progressMulti.getProgressBarTexture(0), ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); + .setHoverTextConsumer(list -> progressMulti.addBarHoverText(list, 0)); builder.widget(progressBar); } builder.widget(new IndicatorImageWidget(174, 93, 17, 17, getLogo()) @@ -441,7 +450,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { if (shouldShowVoidingModeButton()) { builder.widget(new ImageCycleButtonWidget(173, 161, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, 4, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); + .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); } else { builder.widget(new ImageWidget(173, 161, 18, 18, GuiTextures.BUTTON_VOID_NONE) .setTooltip("gregtech.gui.multiblock_voiding_not_supported")); @@ -449,8 +458,10 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Distinct Buses Button if (this instanceof IDistinctBusController distinct && distinct.canBeDistinct()) { - builder.widget(new ImageCycleButtonWidget(173, 143, 18, 18, GuiTextures.BUTTON_DISTINCT_BUSES, distinct::isDistinct, distinct::setDistinct) - .setTooltipHoverString(i -> "gregtech.multiblock.universal.distinct_" + (i == 0 ? "disabled" : "enabled"))); + builder.widget(new ImageCycleButtonWidget(173, 143, 18, 18, GuiTextures.BUTTON_DISTINCT_BUSES, + distinct::isDistinct, distinct::setDistinct) + .setTooltipHoverString(i -> "gregtech.multiblock.universal.distinct_" + + (i == 0 ? "disabled" : "enabled"))); } else { builder.widget(new ImageWidget(173, 143, 18, 18, GuiTextures.BUTTON_NO_DISTINCT_BUSES) .setTooltip("gregtech.multiblock.universal.distinct_not_supported")); @@ -466,7 +477,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { /** * Add a custom third button to the Multiblock UI. By default, this is a placeholder * stating that there is no additional functionality for this Multiblock. - *

+ *
+ *
* Parameters should be passed directly to the created widget. Size will be 18x18. */ @SuppressWarnings("SameParameterValue") @@ -521,7 +533,8 @@ protected void setVoidingMode(int mode) { this.voidingItems = mode == 1 || mode == 3; - // After changing the voiding mode, reset the notified buses in case a recipe can run now that voiding mode has been changed + // After changing the voiding mode, reset the notified buses in case a recipe can run now that voiding mode has + // been changed for (IFluidTank tank : this.getAbilities(MultiblockAbility.IMPORT_FLUIDS)) { this.getNotifiedFluidInputList().add((IFluidHandler) tank); } @@ -621,7 +634,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { } if (getWorld().provider.getDimension() == id) { - getWorld().markBlockRangeForRenderUpdate(new BlockPos(minX, minY, minZ), new BlockPos(maxX, maxY, maxZ)); + getWorld().markBlockRangeForRenderUpdate(new BlockPos(minX, minY, minZ), + new BlockPos(maxX, maxY, maxZ)); } } if (dataId == IS_WORKING) { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java b/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java index 00b3d7770a0..58f913d0e6a 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ParallelLogicType.java @@ -1,5 +1,6 @@ package gregtech.api.metatileentity.multiblock; public enum ParallelLogicType { - MULTIPLY, APPEND_ITEMS + MULTIPLY, + APPEND_ITEMS } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index 25857cf5538..e81be4277aa 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -1,9 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.IDistinctBusController; import gregtech.api.capability.IEnergyContainer; @@ -21,6 +17,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -31,12 +28,19 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; + import java.util.ArrayList; import java.util.List; -public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IDataInfoProvider, ICleanroomReceiver, IDistinctBusController { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IDataInfoProvider, + ICleanroomReceiver, IDistinctBusController { public final RecipeMap recipeMap; protected MultiblockRecipeLogic recipeMapWorkable; @@ -104,7 +108,7 @@ public void invalidateStructure() { @Override protected void updateFormedValid() { - if (!hasMufflerMechanics() || isMufflerFaceFree()){ + if (!hasMufflerMechanics() || isMufflerFaceFree()) { this.recipeMapWorkable.updateWorkable(); } } @@ -116,9 +120,11 @@ public boolean isActive() { protected void initializeAbilities() { this.inputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.IMPORT_ITEMS)); - this.inputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), getAbilities(MultiblockAbility.IMPORT_FLUIDS)); + this.inputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), + getAbilities(MultiblockAbility.IMPORT_FLUIDS)); this.outputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.EXPORT_ITEMS)); - this.outputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), getAbilities(MultiblockAbility.EXPORT_FLUIDS)); + this.outputFluidInventory = new FluidTankList(allowSameFluidFillForOutputs(), + getAbilities(MultiblockAbility.EXPORT_FLUIDS)); this.energyContainer = new EnergyContainerList(getAbilities(MultiblockAbility.INPUT_ENERGY)); } @@ -198,7 +204,8 @@ public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -240,7 +247,7 @@ public boolean isDistinct() { public void setDistinct(boolean isDistinct) { this.isDistinct = isDistinct; recipeMapWorkable.onDistinctChanged(); - //mark buses as changed on distinct toggle + // mark buses as changed on distinct toggle if (this.isDistinct) { this.notifiedItemInputList.addAll(this.getAbilities(MultiblockAbility.IMPORT_ITEMS)); } else { @@ -259,38 +266,44 @@ public List getDataInfo() { List list = new ArrayList<>(); if (recipeMapWorkable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getMaxProgress() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (recipeMapWorkable.getRecipeEUt() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.workable_consumption", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt() == 0 ? 0 : 1)).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(recipeMapWorkable.getRecipeEUt() == 0 ? 0 : 1)) + .setStyle(new Style().setColor(TextFormatting.RED)))); } list.add(new TextComponentTranslation("behavior.tricorder.multiblock_energy_input", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputVoltage())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getInputVoltage())]).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputVoltage())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(energyContainer.getInputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (ConfigHolder.machines.enableMaintenance && hasMaintenanceMechanics()) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_maintenance", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(getNumMaintenanceProblems())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } if (recipeMapWorkable.getParallelLimit() > 1) { list.add(new TextComponentTranslation("behavior.tricorder.multiblock_parallel", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getParallelLimit())).setStyle(new Style().setColor(TextFormatting.GREEN)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(recipeMapWorkable.getParallelLimit())) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } return list; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java index 7c6b9c81b3e..d5bd83b3413 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java @@ -3,6 +3,7 @@ import gregtech.api.capability.impl.*; import gregtech.api.metatileentity.MTETrait; import gregtech.api.recipes.RecipeMap; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fluids.FluidTank; @@ -22,10 +23,14 @@ public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, // just initialize inventories based on RecipeMap values by default protected void initializeAbilities() { - this.importItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxInputs(), this, false); - this.importFluids = new FluidTankList(true, makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidInputs(), false)); - this.exportItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxOutputs(), this, true); - this.exportFluids = new FluidTankList(false, makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidOutputs(), true)); + this.importItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxInputs(), this, + false); + this.importFluids = new FluidTankList(true, + makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidInputs(), false)); + this.exportItems = new NotifiableItemStackHandler(this, recipeMapWorkable.getRecipeMap().getMaxOutputs(), this, + true); + this.exportFluids = new FluidTankList(false, + makeFluidTanks(recipeMapWorkable.getRecipeMap().getMaxFluidOutputs(), true)); this.itemInventory = new ItemHandlerProxy(this.importItems, this.exportItems); this.fluidInventory = new FluidHandlerProxy(this.importFluids, this.exportFluids); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java index 025e54ea9af..fd396609419 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.ItemHandlerList; @@ -20,6 +17,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -28,6 +26,10 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; public abstract class RecipeMapSteamMultiblockController extends MultiblockWithDisplayBase { @@ -41,7 +43,8 @@ public abstract class RecipeMapSteamMultiblockController extends MultiblockWithD protected IItemHandlerModifiable outputInventory; protected IMultipleTankHandler steamFluidTank; - public RecipeMapSteamMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, double conversionRate) { + public RecipeMapSteamMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + double conversionRate) { super(metaTileEntityId); this.recipeMap = recipeMap; this.recipeMapWorkable = new SteamMultiblockRecipeLogic(this, recipeMap, steamFluidTank, conversionRate); @@ -147,7 +150,8 @@ public TraceabilityPredicate autoAbilities(boolean checkSteam, boolean checkItemOut, boolean checkMuffler) { TraceabilityPredicate predicate = super.autoAbilities(checkMaintainer, checkMuffler) - .or(checkSteam ? abilities(MultiblockAbility.STEAM).setMinGlobalLimited(1).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkSteam ? abilities(MultiblockAbility.STEAM).setMinGlobalLimited(1).setPreviewCount(1) : + new TraceabilityPredicate()); if (checkItemIn) { if (recipeMap.getMaxInputs() > 0) { predicate = predicate.or(abilities(MultiblockAbility.STEAM_IMPORT_ITEMS).setPreviewCount(1)); @@ -155,7 +159,7 @@ public TraceabilityPredicate autoAbilities(boolean checkSteam, } if (checkItemOut) { if (recipeMap.getMaxOutputs() > 0) { - predicate = predicate.or(abilities(MultiblockAbility.STEAM_EXPORT_ITEMS).setPreviewCount(1)); + predicate = predicate.or(abilities(MultiblockAbility.STEAM_EXPORT_ITEMS).setPreviewCount(1)); } } return predicate; @@ -169,7 +173,8 @@ protected boolean shouldUpdate(MTETrait trait) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -184,7 +189,8 @@ public boolean isActive() { @Override protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 176, 208); + ModularUI.Builder builder = ModularUI + .builder(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 176, 208); builder.shouldColor(false); builder.image(4, 4, 168, 117, GuiTextures.DISPLAY_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks)); builder.label(9, 9, getMetaFullName(), 0xFFFFFF); @@ -194,7 +200,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { builder.widget(new IndicatorImageWidget(152, 101, 17, 17, getLogo()) .setWarningStatus(getWarningLogo(), this::addWarningText) .setErrorStatus(getErrorLogo(), this::addErrorText)); - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 7, 125); + builder.bindPlayerInventory(entityPlayer.inventory, + GuiTextures.SLOT_STEAM.get(ConfigHolder.machines.steelSteamMultiblocks), 7, 125); return builder; } } diff --git a/src/main/java/gregtech/api/modules/IGregTechModule.java b/src/main/java/gregtech/api/modules/IGregTechModule.java index f767e09471f..847a87878ec 100644 --- a/src/main/java/gregtech/api/modules/IGregTechModule.java +++ b/src/main/java/gregtech/api/modules/IGregTechModule.java @@ -2,69 +2,62 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.event.*; + import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; + /** * All modules must implement this interface. *

- * Provides methods for responding to FML lifecycle events, adding event bus subscriber classes, and processing IMC messages. + * Provides methods for responding to FML lifecycle events, adding event bus subscriber classes, and processing IMC + * messages. */ public interface IGregTechModule { /** * What other modules this module depends on. *

- * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module "foo_module" in the container "gregtech" + * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module + * "foo_module" in the container "gregtech" */ @Nonnull default Set getDependencyUids() { return Collections.emptySet(); } - default void construction(FMLConstructionEvent event) { - } + default void construction(FMLConstructionEvent event) {} - default void preInit(FMLPreInitializationEvent event) { - } + default void preInit(FMLPreInitializationEvent event) {} - default void init(FMLInitializationEvent event) { - } + default void init(FMLInitializationEvent event) {} - default void postInit(FMLPostInitializationEvent event) { - } + default void postInit(FMLPostInitializationEvent event) {} - default void loadComplete(FMLLoadCompleteEvent event) { - } + default void loadComplete(FMLLoadCompleteEvent event) {} - default void serverAboutToStart(FMLServerAboutToStartEvent event) { - } + default void serverAboutToStart(FMLServerAboutToStartEvent event) {} - default void serverStarting(FMLServerStartingEvent event) { - } + default void serverStarting(FMLServerStartingEvent event) {} - default void serverStarted(FMLServerStartedEvent event) { - } + default void serverStarted(FMLServerStartedEvent event) {} - default void serverStopping(FMLServerStoppingEvent event) { - } + default void serverStopping(FMLServerStoppingEvent event) {} - default void serverStopped(FMLServerStoppedEvent event) { - } + default void serverStopped(FMLServerStoppedEvent event) {} /** * Register packets using GregTech's packet handling API here. */ - default void registerPackets() { - } + default void registerPackets() {} /** * @return A list of classes to subscribe to the Forge event bus. - * As the class gets subscribed, not any specific instance, event handlers must be static! + * As the class gets subscribed, not any specific instance, event handlers must be static! */ @Nonnull default List> getEventBusSubscribers() { diff --git a/src/main/java/gregtech/api/modules/IModuleManager.java b/src/main/java/gregtech/api/modules/IModuleManager.java index 6ce3bac26ef..e6a04f62075 100644 --- a/src/main/java/gregtech/api/modules/IModuleManager.java +++ b/src/main/java/gregtech/api/modules/IModuleManager.java @@ -1,6 +1,7 @@ package gregtech.api.modules; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; public interface IModuleManager { diff --git a/src/main/java/gregtech/api/modules/ModuleContainer.java b/src/main/java/gregtech/api/modules/ModuleContainer.java index dd66e14d4fa..a589fa5e0bd 100644 --- a/src/main/java/gregtech/api/modules/ModuleContainer.java +++ b/src/main/java/gregtech/api/modules/ModuleContainer.java @@ -10,5 +10,4 @@ */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) -public @interface ModuleContainer { -} +public @interface ModuleContainer {} diff --git a/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java b/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java index 5328fd4c685..092de63ee5e 100644 --- a/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java +++ b/src/main/java/gregtech/api/modules/ModuleContainerRegistryEvent.java @@ -2,5 +2,4 @@ import net.minecraftforge.fml.common.eventhandler.Event; -public class ModuleContainerRegistryEvent extends Event { -} +public class ModuleContainerRegistryEvent extends Event {} diff --git a/src/main/java/gregtech/api/network/IPacket.java b/src/main/java/gregtech/api/network/IPacket.java index e18da5a0081..f5152e13410 100644 --- a/src/main/java/gregtech/api/network/IPacket.java +++ b/src/main/java/gregtech/api/network/IPacket.java @@ -3,22 +3,27 @@ import net.minecraft.network.PacketBuffer; /** - * The general structure of Network Packets.

+ * The general structure of Network Packets.
+ *
*

* To implement a new packet, implement both {@link IPacket#encode(PacketBuffer)} and - * {@link IPacket#decode(PacketBuffer)}, and register the packet to {@link gregtech.api.GregTechAPI#networkHandler}.

+ * {@link IPacket#decode(PacketBuffer)}, and register the packet to {@link gregtech.api.GregTechAPI#networkHandler}.
+ *
+ *

+ * Additionally, do one of the following: *

- * Additionally, do one of the following:

* - If this Packet is to be received on the SERVER, implement {@link IServerExecutor}. *

- * - If this Packet is to be received on the CLIENT, implement {@link IClientExecutor}.

+ * - If this Packet is to be received on the CLIENT, implement {@link IClientExecutor}.
+ *
*

* Lastly, add a no-args constructor to your Packet class. */ public interface IPacket { /** - * Used to write data from a Packet into a PacketBuffer.

+ * Used to write data from a Packet into a PacketBuffer.
+ *
*

* This is the first step in sending a Packet to a different thread, * and is done on the "sending" side. @@ -28,7 +33,8 @@ public interface IPacket { void encode(PacketBuffer buf); /** - * Used to read data from a PacketBuffer into this Packet.

+ * Used to read data from a PacketBuffer into this Packet.
+ *
*

* This is the next step of sending a Packet to a different thread, * and is done on the "receiving" side. diff --git a/src/main/java/gregtech/api/network/PacketDataList.java b/src/main/java/gregtech/api/network/PacketDataList.java index 427c0e7bea2..e2f57507eff 100644 --- a/src/main/java/gregtech/api/network/PacketDataList.java +++ b/src/main/java/gregtech/api/network/PacketDataList.java @@ -2,12 +2,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; + import org.jetbrains.annotations.NotNull; /** * An optimised data structure backed by two arrays. * This is essentially equivalent to List>, but more efficient. - * {@link it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap} can not be used since it doesn't allow duplicate discriminators. + * {@link it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap} can not be used since it doesn't allow duplicate + * discriminators. */ public class PacketDataList { diff --git a/src/main/java/gregtech/api/pattern/BlockPattern.java b/src/main/java/gregtech/api/pattern/BlockPattern.java index 4e1ac49e858..ec3cba8402b 100644 --- a/src/main/java/gregtech/api/pattern/BlockPattern.java +++ b/src/main/java/gregtech/api/pattern/BlockPattern.java @@ -8,8 +8,7 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.RelativeDirection; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -20,9 +19,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nonnull; import java.lang.reflect.Array; import java.util.Arrays; import java.util.HashMap; @@ -30,15 +31,18 @@ import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class BlockPattern { - static EnumFacing[] FACINGS = {EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP, EnumFacing.DOWN}; + static EnumFacing[] FACINGS = { EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP, + EnumFacing.DOWN }; public final int[][] aisleRepetitions; public final RelativeDirection[] structureDir; - protected final TraceabilityPredicate[][][] blockMatches; //[z][y][x] - protected final int fingerLength; //z size - protected final int thumbLength; //y size - protected final int palmLength; //x size + protected final TraceabilityPredicate[][][] blockMatches; // [z][y][x] + protected final int fingerLength; // z size + protected final int thumbLength; // y size + protected final int palmLength; // x size protected final BlockWorldState worldState = new BlockWorldState(); protected final PatternMatchContext matchContext = new PatternMatchContext(); protected final Map globalCount; @@ -83,10 +87,11 @@ private void initializeCenterOffsets() { loop: for (int x = 0; x < this.palmLength; x++) { for (int y = 0; y < this.thumbLength; y++) { - for (int z = 0, minZ = 0, maxZ = 0; z < this.fingerLength; minZ += aisleRepetitions[z][0], maxZ += aisleRepetitions[z][1], z++) { + for (int z = 0, minZ = 0, maxZ = 0; z < + this.fingerLength; minZ += aisleRepetitions[z][0], maxZ += aisleRepetitions[z][1], z++) { TraceabilityPredicate predicate = this.blockMatches[z][y][x]; if (predicate.isCenter) { - centerOffset = new int[]{x, y, z, minZ, maxZ}; + centerOffset = new int[] { x, y, z, minZ, maxZ }; break loop; } } @@ -101,7 +106,8 @@ public PatternError getError() { return worldState.error; } - public PatternMatchContext checkPatternFastAt(World world, BlockPos centerPos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean allowsFlip) { + public PatternMatchContext checkPatternFastAt(World world, BlockPos centerPos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean allowsFlip) { if (!cache.isEmpty()) { boolean pass = true; for (Map.Entry entry : cache.entrySet()) { @@ -139,7 +145,8 @@ public void clearCache() { cache.clear(); } - private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean isFlipped) { + private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean isFlipped) { boolean findFirstAisle = false; int minZ = -centerOffset[4]; @@ -147,13 +154,13 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum this.globalCount.clear(); this.layerCount.clear(); cache.clear(); - //Checking aisles + // Checking aisles for (int c = 0, z = minZ++, r; c < this.fingerLength; c++) { - //Checking repeatable slices + // Checking repeatable slices int validRepetitions = 0; loop: for (r = 0; (findFirstAisle ? r < aisleRepetitions[c][1] : z <= -centerOffset[3]); r++) { - //Checking single slice + // Checking single slice this.layerCount.clear(); for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { @@ -166,24 +173,26 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum if (predicate != TraceabilityPredicate.ANY) { if (tileEntity instanceof IGregTechTileEntity) { if (((IGregTechTileEntity) tileEntity).isValid()) { - cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); + cache.put(pos.toLong(), + new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); } else { cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), null, predicate)); } } else { - cache.put(pos.toLong(), new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); + cache.put(pos.toLong(), + new BlockInfo(worldState.getBlockState(), tileEntity, predicate)); } } if (!predicate.test(worldState)) { if (findFirstAisle) { - if (r < aisleRepetitions[c][0]) {//retreat to see if the first aisle can start later + if (r < aisleRepetitions[c][0]) {// retreat to see if the first aisle can start later r = c = 0; z = minZ++; matchContext.reset(); findFirstAisle = false; } } else { - z++;//continue searching for the first aisle + z++;// continue searching for the first aisle } continue loop; } @@ -192,7 +201,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum findFirstAisle = true; z++; - //Check layer-local matcher predicate + // Check layer-local matcher predicate for (Map.Entry entry : layerCount.entrySet()) { if (entry.getValue() < entry.getKey().minLayerCount) { worldState.setError(new TraceabilityPredicate.SinglePredicateError(entry.getKey(), 3)); @@ -201,7 +210,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum } validRepetitions++; } - //Repetitions out of range + // Repetitions out of range if (r < aisleRepetitions[c][0]) { if (!worldState.hasError()) { worldState.setError(new PatternError()); @@ -213,7 +222,7 @@ private PatternMatchContext checkPatternAt(World world, BlockPos centerPos, Enum formedRepetitionCount[c] = validRepetitions; } - //Check count matches amount + // Check count matches amount for (Map.Entry entry : globalCount.entrySet()) { if (entry.getValue() < entry.getKey().minGlobalCount) { worldState.setError(new TraceabilityPredicate.SinglePredicateError(entry.getKey(), 1)); @@ -242,8 +251,9 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { for (int a = 0, x = -centerOffset[0]; a < this.palmLength; a++, x++) { TraceabilityPredicate predicate = this.blockMatches[c][b][a]; - BlockPos pos = setActualRelativeOffset(x, y, z, facing, controllerBase.getUpwardsFacing(), controllerBase.isFlipped()) - .add(centerPos.getX(), centerPos.getY(), centerPos.getZ()); + BlockPos pos = setActualRelativeOffset(x, y, z, facing, controllerBase.getUpwardsFacing(), + controllerBase.isFlipped()) + .add(centerPos.getX(), centerPos.getY(), centerPos.getZ()); worldState.update(world, pos, matchContext, globalCount, layerCount, predicate); if (!world.getBlockState(pos).getMaterial().isReplaceable()) { blocks.put(pos, world.getBlockState(pos)); @@ -257,11 +267,13 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (limit.minLayerCount > 0) { if (!cacheLayer.containsKey(limit)) { cacheLayer.put(limit, 1); - } else if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || cacheLayer.get(limit) < limit.maxLayerCount)) { - cacheLayer.put(limit, cacheLayer.get(limit) + 1); - } else { - continue; - } + } else + if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || + cacheLayer.get(limit) < limit.maxLayerCount)) { + cacheLayer.put(limit, cacheLayer.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -277,11 +289,13 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (limit.minGlobalCount > 0) { if (!cacheGlobal.containsKey(limit)) { cacheGlobal.put(limit, 1); - } else if (cacheGlobal.get(limit) < limit.minGlobalCount && (limit.maxGlobalCount == -1 || cacheGlobal.get(limit) < limit.maxGlobalCount)) { - cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); - } else { - continue; - } + } else if (cacheGlobal.get(limit) < limit.minGlobalCount && + (limit.maxGlobalCount == -1 || + cacheGlobal.get(limit) < limit.maxGlobalCount)) { + cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -295,9 +309,11 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa } if (!find) { // no limited for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { - if (limit.maxLayerCount != -1 && cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) + if (limit.maxLayerCount != -1 && + cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) continue; - if (limit.maxGlobalCount != -1 && cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxGlobalCount) + if (limit.maxGlobalCount != -1 && + cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxGlobalCount) continue; if (!cacheInfos.containsKey(limit)) { cacheInfos.put(limit, limit.candidates == null ? null : limit.candidates.get()); @@ -316,27 +332,35 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa } for (TraceabilityPredicate.SimplePredicate common : predicate.common) { if (!cacheInfos.containsKey(common)) { - cacheInfos.put(common, common.candidates == null ? null : common.candidates.get()); + cacheInfos.put(common, + common.candidates == null ? null : common.candidates.get()); } infos = ArrayUtils.addAll(infos, cacheInfos.get(common)); } } - List candidates = Arrays.stream(infos).filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { - IBlockState blockState = info.getBlockState(); - MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; - if (metaTileEntity != null) { - return metaTileEntity.getStackForm(); - } else { - return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, blockState.getBlock().damageDropped(blockState)); - } - }).collect(Collectors.toList()); + List candidates = Arrays.stream(infos) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { + IBlockState blockState = info.getBlockState(); + MetaTileEntity metaTileEntity = info + .getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) info.getTileEntity()) + .getMetaTileEntity() : + null; + if (metaTileEntity != null) { + return metaTileEntity.getStackForm(); + } else { + return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, + blockState.getBlock().damageDropped(blockState)); + } + }).collect(Collectors.toList()); if (candidates.isEmpty()) continue; // check inventory ItemStack found = null; if (!player.isCreative()) { for (ItemStack itemStack : player.inventory.mainInventory) { - if (candidates.stream().anyMatch(candidate -> candidate.isItemEqual(itemStack)) && !itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlock) { + if (candidates.stream().anyMatch(candidate -> candidate.isItemEqual(itemStack)) && + !itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlock) { found = itemStack.copy(); itemStack.setCount(itemStack.getCount() - 1); break; @@ -354,14 +378,17 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa if (found == null) continue; } ItemBlock itemBlock = (ItemBlock) found.getItem(); - IBlockState state = itemBlock.getBlock().getStateFromMeta(itemBlock.getMetadata(found.getMetadata())); + IBlockState state = itemBlock.getBlock() + .getStateFromMeta(itemBlock.getMetadata(found.getMetadata())); blocks.put(pos, state); world.setBlockState(pos, state); TileEntity holder = world.getTileEntity(pos); if (holder instanceof IGregTechTileEntity) { - MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY.getObjectById(found.getItemDamage()); + MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY + .getObjectById(found.getItemDamage()); if (sampleMetaTileEntity != null) { - MetaTileEntity metaTileEntity = ((IGregTechTileEntity) holder).setMetaTileEntity(sampleMetaTileEntity); + MetaTileEntity metaTileEntity = ((IGregTechTileEntity) holder) + .setMetaTileEntity(sampleMetaTileEntity); metaTileEntity.onPlacement(); blocks.put(pos, metaTileEntity); if (found.getTagCompound() != null) { @@ -375,7 +402,9 @@ public void autoBuild(EntityPlayer player, MultiblockControllerBase controllerBa z++; } } - EnumFacing[] facings = ArrayUtils.addAll(new EnumFacing[]{controllerBase.getFrontFacing()}, FACINGS); // follow controller first + EnumFacing[] facings = ArrayUtils.addAll(new EnumFacing[] { controllerBase.getFrontFacing() }, FACINGS); // follow + // controller + // first blocks.forEach((pos, block) -> { // adjust facing if (block instanceof MetaTileEntity) { MetaTileEntity metaTileEntity = (MetaTileEntity) block; @@ -413,14 +442,15 @@ public BlockInfo[][][] getPreview(int[] repetition) { int maxZ = Integer.MIN_VALUE; for (int l = 0, x = 0; l < this.fingerLength; l++) { for (int r = 0; r < repetition[l]; r++) { - //Checking single slice + // Checking single slice Map cacheLayer = new HashMap<>(); for (int y = 0; y < this.thumbLength; y++) { for (int z = 0; z < this.palmLength; z++) { TraceabilityPredicate predicate = this.blockMatches[l][y][z]; boolean find = false; BlockInfo[] infos = null; - for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { // check layer and previewCount + for (TraceabilityPredicate.SimplePredicate limit : predicate.limited) { // check layer and + // previewCount if (limit.minLayerCount > 0) { if (!cacheLayer.containsKey(limit)) { cacheLayer.put(limit, 1); @@ -503,7 +533,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { for (TraceabilityPredicate.SimplePredicate common : predicate.common) { if (common.previewCount == -1) { if (!cacheInfos.containsKey(common)) { - cacheInfos.put(common, common.candidates == null ? null : common.candidates.get()); + cacheInfos.put(common, + common.candidates == null ? null : common.candidates.get()); } infos = cacheInfos.get(common); find = true; @@ -561,7 +592,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { x++; } } - BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, maxZ - minZ + 1); + BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, + maxZ - minZ + 1); int finalMinX = minX; int finalMinY = minY; int finalMinZ = minZ; @@ -581,7 +613,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { if (!find) { for (EnumFacing enumFacing : FACINGS) { BlockInfo blockInfo = blocks.get(pos.offset(enumFacing)); - if (blockInfo != null && blockInfo.getBlockState().getBlock() == Blocks.AIR && metaTileEntity.isValidFrontFacing(enumFacing)) { + if (blockInfo != null && blockInfo.getBlockState().getBlock() == Blocks.AIR && + metaTileEntity.isValidFrontFacing(enumFacing)) { metaTileEntity.setFrontFacing(enumFacing); break; } @@ -593,8 +626,9 @@ public BlockInfo[][][] getPreview(int[] repetition) { return result; } - private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, EnumFacing upwardsFacing, boolean isFlipped) { - int[] c0 = new int[]{x, y, z}, c1 = new int[3]; + private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, EnumFacing upwardsFacing, + boolean isFlipped) { + int[] c0 = new int[] { x, y, z }, c1 = new int[3]; if (facing == EnumFacing.UP || facing == EnumFacing.DOWN) { EnumFacing of = facing == EnumFacing.DOWN ? upwardsFacing : upwardsFacing.getOpposite(); for (int i = 0; i < 3; i++) { @@ -638,10 +672,12 @@ private BlockPos setActualRelativeOffset(int x, int y, int z, EnumFacing facing, } } if (upwardsFacing == EnumFacing.WEST || upwardsFacing == EnumFacing.EAST) { - int xOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getXOffset() : facing.rotateY().getOpposite().getXOffset(); - int zOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getZOffset() : facing.rotateY().getOpposite().getZOffset(); + int xOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getXOffset() : + facing.rotateY().getOpposite().getXOffset(); + int zOffset = upwardsFacing == EnumFacing.WEST ? facing.rotateY().getZOffset() : + facing.rotateY().getOpposite().getZOffset(); int tmp; - if(xOffset == 0) { + if (xOffset == 0) { tmp = c1[2]; c1[2] = zOffset > 0 ? -c1[1] : c1[1]; c1[1] = zOffset > 0 ? tmp : -tmp; diff --git a/src/main/java/gregtech/api/pattern/BlockWorldState.java b/src/main/java/gregtech/api/pattern/BlockWorldState.java index 6be658482ca..07fef964ba8 100644 --- a/src/main/java/gregtech/api/pattern/BlockWorldState.java +++ b/src/main/java/gregtech/api/pattern/BlockWorldState.java @@ -7,9 +7,10 @@ import net.minecraft.util.math.BlockPos.MutableBlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + public class BlockWorldState { protected World world; @@ -23,7 +24,10 @@ public class BlockWorldState { protected TraceabilityPredicate predicate; protected PatternError error; - public void update(World worldIn, BlockPos posIn, PatternMatchContext matchContext, Map globalCount, Map layerCount, TraceabilityPredicate predicate) { + public void update(World worldIn, BlockPos posIn, PatternMatchContext matchContext, + Map globalCount, + Map layerCount, + TraceabilityPredicate predicate) { this.world = worldIn; this.pos = posIn; this.state = null; diff --git a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java index 32bef31c9a0..e83c519186d 100644 --- a/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java +++ b/src/main/java/gregtech/api/pattern/FactoryBlockPattern.java @@ -1,7 +1,8 @@ package gregtech.api.pattern; -import com.google.common.base.Joiner; import gregtech.api.util.RelativeDirection; + +import com.google.common.base.Joiner; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -60,11 +61,14 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. } if (aisle.length != this.aisleHeight) { - throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + ", but was given one with a height of " + aisle.length + ")"); + throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + + ", but was given one with a height of " + aisle.length + ")"); } else { for (String s : aisle) { if (s.length() != this.rowWidth) { - throw new IllegalArgumentException("Not all rows in the given aisle are the correct width (expected " + this.rowWidth + ", found one with " + s.length() + ")"); + throw new IllegalArgumentException( + "Not all rows in the given aisle are the correct width (expected " + this.rowWidth + + ", found one with " + s.length() + ")"); } for (char c0 : s.toCharArray()) { @@ -77,7 +81,7 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. this.depth.add(aisle); if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.add(new int[]{minRepeat, maxRepeat}); + aisleRepetitions.add(new int[] { minRepeat, maxRepeat }); return this; } } else { @@ -98,7 +102,7 @@ public FactoryBlockPattern aisle(String... aisle) { public FactoryBlockPattern setRepeatable(int minRepeat, int maxRepeat) { if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.set(aisleRepetitions.size() - 1, new int[]{minRepeat, maxRepeat}); + aisleRepetitions.set(aisleRepetitions.size() - 1, new int[] { minRepeat, maxRepeat }); return this; } @@ -113,7 +117,8 @@ public static FactoryBlockPattern start() { return new FactoryBlockPattern(RIGHT, UP, BACK); } - public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, RelativeDirection aisleDir) { + public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, + RelativeDirection aisleDir) { return new FactoryBlockPattern(charDir, stringDir, aisleDir); } @@ -123,12 +128,14 @@ public FactoryBlockPattern where(char symbol, TraceabilityPredicate blockMatcher } public BlockPattern build() { - return new BlockPattern(makePredicateArray(), structureDir, aisleRepetitions.toArray(new int[aisleRepetitions.size()][])); + return new BlockPattern(makePredicateArray(), structureDir, + aisleRepetitions.toArray(new int[aisleRepetitions.size()][])); } private TraceabilityPredicate[][][] makePredicateArray() { this.checkMissingPredicates(); - TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array.newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); + TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array + .newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); for (int i = 0; i < this.depth.size(); ++i) { for (int j = 0; j < this.aisleHeight; ++j) { diff --git a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java index dbecbff8a6f..a4bd56a9150 100644 --- a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java +++ b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java @@ -4,17 +4,19 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.BlockInfo; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class MultiblockShapeInfo { /** {@code [x][y][z]} */ @@ -75,7 +77,8 @@ public Builder where(char symbol, Supplier partSupplier, EnumFacing frontSide return where(symbol, (IBlockState) part); } else if (part instanceof MetaTileEntity) { return where(symbol, (MetaTileEntity) part, frontSideIfTE); - } else throw new IllegalArgumentException("Supplier must supply either a MetaTileEntity or an IBlockState! Actual: " + part.getClass()); + } else throw new IllegalArgumentException( + "Supplier must supply either a MetaTileEntity or an IBlockState! Actual: " + part.getClass()); } @Nonnull @@ -118,7 +121,5 @@ public Builder shallowCopy() { public MultiblockShapeInfo build() { return new MultiblockShapeInfo(bakeArray()); } - } - } diff --git a/src/main/java/gregtech/api/pattern/PatternStringError.java b/src/main/java/gregtech/api/pattern/PatternStringError.java index 8867593b240..fc62bfecb27 100644 --- a/src/main/java/gregtech/api/pattern/PatternStringError.java +++ b/src/main/java/gregtech/api/pattern/PatternStringError.java @@ -2,7 +2,8 @@ import net.minecraft.client.resources.I18n; -public class PatternStringError extends PatternError{ +public class PatternStringError extends PatternError { + public final String translateKey; public PatternStringError(String translateKey) { diff --git a/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java b/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java index 10051b909ad..da9483998be 100644 --- a/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java +++ b/src/main/java/gregtech/api/pattern/TraceabilityPredicate.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.util.BlockInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -25,7 +26,9 @@ public class TraceabilityPredicate { // Allow any block. public static TraceabilityPredicate ANY = new TraceabilityPredicate((state) -> true); // Allow the air block. - public static TraceabilityPredicate AIR = new TraceabilityPredicate(blockWorldState -> blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(), blockWorldState.getWorld(), blockWorldState.getPos())); + public static TraceabilityPredicate AIR = new TraceabilityPredicate( + blockWorldState -> blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(), + blockWorldState.getWorld(), blockWorldState.getPos())); // Allow all heating coils, and require them to have the same type. public static Supplier HEATING_COILS = () -> new TraceabilityPredicate(blockWorldState -> { IBlockState blockState = blockWorldState.getBlockState(); @@ -45,7 +48,7 @@ public class TraceabilityPredicate { .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) .map(entry -> new BlockInfo(entry.getKey(), null)) .toArray(BlockInfo[]::new)) - .addTooltips("gregtech.multiblock.pattern.error.coils"); + .addTooltips("gregtech.multiblock.pattern.error.coils"); public final List common = new ArrayList<>(); public final List limited = new ArrayList<>(); @@ -53,8 +56,7 @@ public class TraceabilityPredicate { protected boolean hasAir = false; protected boolean isSingle = true; - public TraceabilityPredicate() { - } + public TraceabilityPredicate() {} public TraceabilityPredicate(TraceabilityPredicate predicate) { common.addAll(predicate.common); @@ -81,7 +83,8 @@ public boolean isSingle() { } /** - * Mark it as the controller of this multi. Normally you won't call it yourself. Use {@link MultiblockControllerBase#selfPredicate()} plz. + * Mark it as the controller of this multi. Normally you won't call it yourself. Use + * {@link MultiblockControllerBase#selfPredicate()} plz. */ public TraceabilityPredicate setCenter() { isCenter = true; @@ -238,6 +241,7 @@ public TraceabilityPredicate or(TraceabilityPredicate other) { } public static class SimplePredicate { + public final Supplier candidates; public final Predicate predicate; @@ -266,7 +270,8 @@ public List getToolTips(TraceabilityPredicate predicates) { if (minGlobalCount == maxGlobalCount && maxGlobalCount != -1) { result.add(I18n.format("gregtech.multiblock.pattern.error.limited_exact", minGlobalCount)); } else if (minGlobalCount != maxGlobalCount && minGlobalCount != -1 && maxGlobalCount != -1) { - result.add(I18n.format("gregtech.multiblock.pattern.error.limited_within", minGlobalCount, maxGlobalCount)); + result.add(I18n.format("gregtech.multiblock.pattern.error.limited_within", minGlobalCount, + maxGlobalCount)); } else { if (minGlobalCount != -1) { result.add(I18n.format("gregtech.multiblock.pattern.error.limited.1", minGlobalCount)); @@ -322,19 +327,23 @@ public boolean testLayer(BlockWorldState blockWorldState) { } public List getCandidates() { - return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { - IBlockState blockState = info.getBlockState(); - MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; - if (metaTileEntity != null) { - return metaTileEntity.getStackForm(); - } else { - return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, blockState.getBlock().damageDropped(blockState)); - } - }).collect(Collectors.toList()); + return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()) + .filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(info -> { + IBlockState blockState = info.getBlockState(); + MetaTileEntity metaTileEntity = info.getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) info.getTileEntity()).getMetaTileEntity() : null; + if (metaTileEntity != null) { + return metaTileEntity.getStackForm(); + } else { + return new ItemStack(Item.getItemFromBlock(blockState.getBlock()), 1, + blockState.getBlock().damageDropped(blockState)); + } + }).collect(Collectors.toList()); } } public static class SinglePredicateError extends PatternError { + public final SimplePredicate predicate; public final int type; @@ -359,5 +368,4 @@ public String getErrorInfo() { return I18n.format("gregtech.multiblock.pattern.error.limited." + type, number); } } - } diff --git a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java index f195b5788b9..e7326479210 100644 --- a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java +++ b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java @@ -8,7 +8,8 @@ import javax.annotation.Nonnull; /** - * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is + * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be + * available server-side, so ensure the code is * server-safe and doesn't use client-side code. *

* Mostly based on and (copied from) CoFHCore with minor tweaks @@ -27,7 +28,8 @@ public interface IBlockAppearance { IBlockState getVisualState(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side); /** - * This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance. + * This function returns whether the block's renderer will visually connect to other blocks implementing + * IBlockAppearance. */ boolean supportsVisualConnections(); } diff --git a/src/main/java/gregtech/api/pipenet/IRoutePath.java b/src/main/java/gregtech/api/pipenet/IRoutePath.java index b1291e025bc..31b5ac9f15e 100644 --- a/src/main/java/gregtech/api/pipenet/IRoutePath.java +++ b/src/main/java/gregtech/api/pipenet/IRoutePath.java @@ -1,13 +1,14 @@ package gregtech.api.pipenet; import gregtech.api.pipenet.tile.IPipeTile; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.UnknownNullability; public interface IRoutePath> { diff --git a/src/main/java/gregtech/api/pipenet/PipeNet.java b/src/main/java/gregtech/api/pipenet/PipeNet.java index 644a9ec894b..384d15134a1 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNet.java +++ b/src/main/java/gregtech/api/pipenet/PipeNet.java @@ -1,9 +1,5 @@ package gregtech.api.pipenet; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; @@ -14,6 +10,11 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.INBTSerializable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.*; import java.util.Map.Entry; @@ -21,13 +22,14 @@ public abstract class PipeNet implements INBTSerializable> worldData; private final Map> nodeByBlockPos = new HashMap<>(); - private final Map> unmodifiableNodeByBlockPos = Collections.unmodifiableMap(nodeByBlockPos); + private final Map> unmodifiableNodeByBlockPos = Collections + .unmodifiableMap(nodeByBlockPos); private final Map ownedChunks = new HashMap<>(); private long lastUpdate; boolean isValid = false; public PipeNet(WorldPipeNet> world) { - //noinspection unchecked + // noinspection unchecked this.worldData = (WorldPipeNet>) world; } @@ -57,11 +59,9 @@ protected void onNodeConnectionsUpdate() { /** * Is called when any connection of any pipe in the net changes */ - public void onPipeConnectionsUpdate() { - } + public void onPipeConnectionsUpdate() {} - public void onNeighbourUpdate(BlockPos fromPos) { - } + public void onNeighbourUpdate(BlockPos fromPos) {} public Map> getAllNodes() { return unmodifiableNodeByBlockPos; @@ -131,25 +131,26 @@ protected void updateBlockedConnections(BlockPos nodePos, EnumFacing facing, boo BlockPos offsetPos = nodePos.offset(facing); PipeNet pipeNetAtOffset = worldData.getNetFromPos(offsetPos); if (pipeNetAtOffset == null) { - //if there is no any pipe net at this side, - //updating blocked status of it won't change anything in any net + // if there is no any pipe net at this side, + // updating blocked status of it won't change anything in any net return; } - //if we are on that side of node too - //and it is blocked now + // if we are on that side of node too + // and it is blocked now if (pipeNetAtOffset == this) { - //if side was unblocked, well, there is really nothing changed in this e-net - //if it is blocked now, but was able to connect with neighbour node before, try split networks + // if side was unblocked, well, there is really nothing changed in this e-net + // if it is blocked now, but was able to connect with neighbour node before, try split networks if (isBlocked) { - //need to unblock node before doing canNodesConnectCheck + // need to unblock node before doing canNodesConnectCheck setBlocked(selfNode, facing, false); if (canNodesConnect(selfNode, facing, getNodeAt(offsetPos), this)) { - //now block again to call findAllConnectedBlocks + // now block again to call findAllConnectedBlocks setBlocked(selfNode, facing, true); HashMap> thisENet = findAllConnectedBlocks(nodePos); if (!getAllNodes().equals(thisENet)) { - //node visibility has changed, split network into 2 - //node that code below is similar to removeNodeInternal, but only for 2 networks, and without node removal + // node visibility has changed, split network into 2 + // node that code below is similar to removeNodeInternal, but only for 2 networks, and without + // node removal PipeNet newPipeNet = worldData.createNetInstance(); thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); newPipeNet.transferNodeData(thisENet, this); @@ -157,16 +158,16 @@ protected void updateBlockedConnections(BlockPos nodePos, EnumFacing facing, boo } } } - //there is another network on that side - //if this is an unblock, and we can connect with their node, merge them + // there is another network on that side + // if this is an unblock, and we can connect with their node, merge them } else if (!isBlocked) { Node neighbourNode = pipeNetAtOffset.getNodeAt(offsetPos); - //check connection availability from both networks + // check connection availability from both networks if (canNodesConnect(selfNode, facing, neighbourNode, pipeNetAtOffset) && pipeNetAtOffset.canNodesConnect(neighbourNode, facing.getOpposite(), selfNode, this)) { - //so, side is unblocked now, and nodes can connect, merge two networks - //our network consumes other one + // so, side is unblocked now, and nodes can connect, merge two networks + // our network consumes other one uniteNetworks(pipeNetAtOffset); } } @@ -187,32 +188,32 @@ protected void updateMark(BlockPos nodePos, int newMark) { PipeNet otherPipeNet = worldData.getNetFromPos(offsetPos); Node secondNode = otherPipeNet == null ? null : otherPipeNet.getNodeAt(offsetPos); if (secondNode == null) - continue; //there is noting here + continue; // there is noting here if (!areNodeBlockedConnectionsCompatible(selfNode, facing, secondNode) || !areNodesCustomContactable(selfNode.data, secondNode.data, otherPipeNet)) - continue; //if connections aren't compatible, skip them + continue; // if connections aren't compatible, skip them if (areMarksCompatible(oldMark, secondNode.mark) == areMarksCompatible(newMark, secondNode.mark)) - continue; //if compatibility didn't change, skip it + continue; // if compatibility didn't change, skip it if (areMarksCompatible(newMark, secondNode.mark)) { - //if marks are compatible now, and offset network is different network, merge them - //if it is same network, just update mask and paths + // if marks are compatible now, and offset network is different network, merge them + // if it is same network, just update mask and paths if (otherPipeNet != this) { uniteNetworks(otherPipeNet); } - //marks are incompatible now, and this net is connected with it + // marks are incompatible now, and this net is connected with it } else if (otherPipeNet == this) { - //search connected nodes from newly marked node - //populate self connected blocks lazily only once + // search connected nodes from newly marked node + // populate self connected blocks lazily only once if (selfConnectedBlocks == null) { selfConnectedBlocks = findAllConnectedBlocks(nodePos); } if (getAllNodes().equals(selfConnectedBlocks)) { - continue; //if this node is still connected to this network, just continue + continue; // if this node is still connected to this network, just continue } - //otherwise, it is not connected + // otherwise, it is not connected HashMap> offsetConnectedBlocks = findAllConnectedBlocks(offsetPos); - //if in the result of remarking offset node has separated from main network, - //and it is also separated from current cable too, form new network for it + // if in the result of remarking offset node has separated from main network, + // and it is also separated from current cable too, form new network for it if (!offsetConnectedBlocks.equals(selfConnectedBlocks)) { offsetConnectedBlocks.keySet().forEach(this::removeNodeWithoutRebuilding); PipeNet offsetPipeNet = worldData.createNetInstance(); @@ -250,7 +251,8 @@ protected final void uniteNetworks(PipeNet unitedPipeNet) { transferNodeData(allNodes, unitedPipeNet); } - private boolean areNodeBlockedConnectionsCompatible(Node first, EnumFacing firstFacing, Node second) { + private boolean areNodeBlockedConnectionsCompatible(Node first, EnumFacing firstFacing, + Node second) { return !first.isBlocked(firstFacing) && !second.isBlocked(firstFacing.getOpposite()); } @@ -263,13 +265,14 @@ private static boolean areMarksCompatible(int mark1, int mark2) { * Note that this logic should equal with block connection logic * for proper work of network */ - protected final boolean canNodesConnect(Node first, EnumFacing firstFacing, Node second, PipeNet secondPipeNet) { + protected final boolean canNodesConnect(Node first, EnumFacing firstFacing, Node second, + PipeNet secondPipeNet) { return areNodeBlockedConnectionsCompatible(first, firstFacing, second) && areMarksCompatible(first.mark, second.mark) && areNodesCustomContactable(first.data, second.data, secondPipeNet); } - //we need to search only this network + // we need to search only this network protected HashMap> findAllConnectedBlocks(BlockPos startPos) { HashMap> observedSet = new HashMap<>(); observedSet.put(startPos, getNodeAt(startPos)); @@ -281,8 +284,10 @@ protected HashMap> findAllConnectedBlocks(BlockPos for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); Node secondNode = getNodeAt(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current - if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && !observedSet.containsKey(currentPos)) { + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current + if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && + !observedSet.containsKey(currentPos)) { observedSet.put(currentPos.toImmutable(), getNodeAt(currentPos)); firstNode = secondNode; moveStack.push(facing.getOpposite()); @@ -297,7 +302,7 @@ protected HashMap> findAllConnectedBlocks(BlockPos return observedSet; } - //called when node is removed to rebuild network + // called when node is removed to rebuild network protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node selfNode) { int amountOfConnectedSides = 0; for (EnumFacing facing : EnumFacing.values()) { @@ -305,26 +310,26 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node if (containsNode(offsetPos)) amountOfConnectedSides++; } - //if we are connected only on one side or not connected at all, we don't need to find connected blocks - //because they are only on on side or doesn't exist at all - //this saves a lot of performance in big networks, which are quite big to depth-first them fastly + // if we are connected only on one side or not connected at all, we don't need to find connected blocks + // because they are only on on side or doesn't exist at all + // this saves a lot of performance in big networks, which are quite big to depth-first them fastly if (amountOfConnectedSides >= 2) { for (EnumFacing facing : EnumFacing.VALUES) { BlockPos offsetPos = nodePos.offset(facing); Node secondNode = getNodeAt(offsetPos); if (secondNode == null || !canNodesConnect(selfNode, facing, secondNode, this)) { - //if there isn't any neighbour node, or it wasn't connected with us, just skip it + // if there isn't any neighbour node, or it wasn't connected with us, just skip it continue; } HashMap> thisENet = findAllConnectedBlocks(offsetPos); if (getAllNodes().equals(thisENet)) { - //if cable on some direction contains all nodes of this network - //the network didn't change so keep it as is + // if cable on some direction contains all nodes of this network + // the network didn't change so keep it as is break; } else { - //and use them to create new network with caching active nodes set + // and use them to create new network with caching active nodes set PipeNet energyNet = worldData.createNetInstance(); - //remove blocks that aren't connected with this network + // remove blocks that aren't connected with this network thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); energyNet.transferNodeData(thisENet, this); worldData.addPipeNet(energyNet); @@ -332,14 +337,15 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node } } if (getAllNodes().isEmpty()) { - //if this energy net is empty now, remove it + // if this energy net is empty now, remove it worldData.removePipeNet(this); } onNodeConnectionsUpdate(); worldData.markDirty(); } - protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, PipeNet secondNodePipeNet) { + protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, + PipeNet secondNodePipeNet) { return true; } @@ -354,7 +360,8 @@ protected boolean canAttachNode(NodeDataType nodeData) { * from parent network and add it to it's own tank, keeping network contents when old network is split * Note that it should be called when parent net doesn't have transferredNodes in allNodes already */ - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { transferredNodes.forEach(this::addNodeSilently); onNodeConnectionsUpdate(); worldData.markDirty(); @@ -458,5 +465,4 @@ protected NBTTagCompound serializeAllNodeList(Map> compound.setTag("WireProperties", wirePropertiesList); return compound; } - } diff --git a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java index 970b2720b89..bbcc08842a2 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java +++ b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java @@ -3,22 +3,30 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GTLog; import gregtech.common.pipelike.itempipe.net.ItemNetWalker; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; +import javax.annotation.Nullable; + /** * This is a helper class to get information about a pipe net - *

The walker is written that it will always find the shortest path to any destination - *

On the way it can collect information about the pipes and it's neighbours - *

After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data - *

Do not walk a walker more than once - *

For example implementations look at {@link ItemNetWalker} + *

+ * The walker is written that it will always find the shortest path to any destination + *

+ * On the way it can collect information about the pipes and it's neighbours + *

+ * After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data + *

+ * Do not walk a walker more than once + *

+ * For example implementations look at {@link ItemNetWalker} */ public abstract class PipeNetWalker> { @@ -52,7 +60,8 @@ protected PipeNetWalker(World world, BlockPos sourcePipe, int walkedBlocks) { * @param walkedBlocks distance from source in blocks * @return new sub walker */ - protected abstract PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks); + protected abstract PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, + int walkedBlocks); /** * You can increase walking stats here. for example @@ -69,7 +78,8 @@ protected PipeNetWalker(World world, BlockPos sourcePipe, int walkedBlocks) { * @param faceToNeighbour face to neighbour * @param neighbourTile neighbour tile */ - protected abstract void checkNeighbour(T pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile); + protected abstract void checkNeighbour(T pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile); /** * If the pipe is valid to perform a walk on @@ -100,8 +110,7 @@ protected EnumFacing[] getSurroundingPipeSides() { * * @param subWalker the finished sub walker */ - protected void onRemoveSubWalker(PipeNetWalker subWalker) { - } + protected void onRemoveSubWalker(PipeNetWalker subWalker) {} public void traversePipeNet() { traversePipeNet(32768); @@ -120,7 +129,7 @@ public void traversePipeNet(int maxWalks) { walked = new ObjectOpenHashSet<>(); int i = 0; running = true; - while (running && !walk() && i++ < maxWalks) ; + while (running && !walk() && i++ < maxWalks); running = false; walked = null; if (i >= maxWalks) @@ -148,7 +157,9 @@ private boolean walk() { walkers = new ArrayList<>(); for (int i = 0; i < nextPipeFacings.size(); i++) { EnumFacing side = nextPipeFacings.get(i); - PipeNetWalker walker = Objects.requireNonNull(createSubWalker(world, side, currentPos.offset(side), walkedBlocks + 1), "Walker can't be null"); + PipeNetWalker walker = Objects.requireNonNull( + createSubWalker(world, side, currentPos.offset(side), walkedBlocks + 1), + "Walker can't be null"); walker.root = root; walker.currentPipe = nextPipes.get(i); walker.from = side.getOpposite(); @@ -187,14 +198,15 @@ private boolean checkPos() { // check for surrounding pipes and item handlers for (EnumFacing accessSide : getSurroundingPipeSides()) { - //skip sides reported as blocked by pipe network + // skip sides reported as blocked by pipe network if (accessSide == from || !pipeTile.isConnected(accessSide)) continue; TileEntity tile = pipeTile.getNeighbor(accessSide); if (tile != null && getBasePipeClass().isAssignableFrom(tile.getClass())) { T otherPipe = (T) tile; - if (!otherPipe.isConnected(accessSide.getOpposite()) || otherPipe.isFaceBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) + if (!otherPipe.isConnected(accessSide.getOpposite()) || + otherPipe.isFaceBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) continue; if (isValidPipe(pipeTile, otherPipe, currentPos, accessSide)) { nextPipeFacings.add(accessSide); diff --git a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java index 7026c6a9634..aa6d2d47ac1 100644 --- a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java +++ b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java @@ -9,10 +9,11 @@ import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; import java.lang.ref.WeakReference; import java.util.*; +import javax.annotation.Nonnull; + public abstract class WorldPipeNet> extends WorldSavedData { private WeakReference worldRef = new WeakReference<>(null); diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 2fccb22fdf8..0333f07e149 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -1,9 +1,5 @@ package gregtech.api.pipenet.block; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.vec.Cuboid6; import gregtech.api.block.BuiltInRenderBlock; import gregtech.api.cover.Cover; import gregtech.api.cover.CoverHolder; @@ -23,6 +19,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; @@ -46,19 +43,27 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.raytracer.RayTracer; +import codechicken.lib.vec.Cuboid6; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.metatileentity.MetaTileEntity.FULL_CUBE_COLLISION; @SuppressWarnings("deprecation") -public abstract class BlockPipe & IPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BuiltInRenderBlock implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { +public abstract class BlockPipe & IPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> extends BuiltInRenderBlock + implements ITileEntityProvider, IFacadeWrapper, IBlockAppearance { protected final ThreadLocal> tileEntities = new ThreadLocal<>(); @@ -153,7 +158,8 @@ public void onBlockAdded(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockSt } @Override - public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) { + public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Random rand) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { int activeConnections = pipeTile.getConnections(); @@ -164,7 +170,8 @@ public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { setTileEntityData((TileEntityPipeBase) pipeTile, stack); @@ -174,7 +181,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn ItemStack offhand = placer.getHeldItemOffhand(); for (int i = 0; i < EnumDyeColor.values().length; i++) { if (offhand.isItemEqual(MetaItems.SPRAY_CAN_DYES[i].getStackForm())) { - MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); + MetaItems.SPRAY_CAN_DYES[i].getBehaviours().get(0).onItemUse((EntityPlayer) placer, worldIn, + pos, EnumHand.OFF_HAND, EnumFacing.UP, 0, 0, 0); break; } } @@ -183,7 +191,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { if (worldIn.isRemote) return; IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { @@ -193,7 +202,8 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, pipeTile.onNeighborChanged(facing); if (!ConfigHolder.machines.gt6StylePipesCables) { boolean open = pipeTile.isConnected(facing); - boolean canConnect = pipeTile.getCoverableImplementation().getCoverAtSide(facing) != null || canConnect(pipeTile, facing); + boolean canConnect = pipeTile.getCoverableImplementation().getCoverAtSide(facing) != null || + canConnect(pipeTile, facing); if (!open && canConnect && state.getBlock() != blockIn) pipeTile.setConnection(facing, true, false); if (open && !canConnect) @@ -215,7 +225,9 @@ public void onNeighborChange(@NotNull IBlockAccess world, @NotNull BlockPos pos, } @Override - public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, @Nonnull BlockPos changedBlockPos) { + public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, + @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, + @Nonnull BlockPos changedBlockPos) { PipeNet net = getWorldPipeNet(world).getNetFromPos(observerPos); if (net != null) { net.onNeighbourUpdate(changedBlockPos); @@ -223,30 +235,34 @@ public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side) { + public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nullable EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(world, pos); return pipeTile != null && pipeTile.getCoverableImplementation().canConnectRedstone(side); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, + @Nonnull EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(blockAccess, pos); return pipeTile == null ? 0 : pipeTile.getCoverableImplementation().getOutputRedstoneSignal(side.getOpposite()); } - public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, IPipeTile pipeTile) { + public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, + IPipeTile pipeTile) { if (worldIn.isRemote) return; PipeNet pipeNet = getWorldPipeNet(worldIn).getNetFromPos(pos); if (pipeNet != null && pipeTile != null) { - int activeConnections = pipeTile.getConnections(); //remove blocked connections + int activeConnections = pipeTile.getConnections(); // remove blocked connections boolean isActiveNodeNow = activeConnections != 0; boolean modeChanged = pipeNet.markNodeAsActive(pos, isActiveNodeNow); if (modeChanged) { @@ -265,12 +281,12 @@ public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) { * Can be used to update tile entity to tickable when node becomes active * usable for fluid pipes, as example */ - protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) { - } + protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) {} @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { IPipeTile pipeTile = getPipeTileEntity(world, pos); if (pipeTile == null) { return ItemStack.EMPTY; @@ -286,7 +302,9 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = getServerCollisionRayTrace(playerIn, pos, worldIn); @@ -296,7 +314,9 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ return onPipeActivated(worldIn, state, pos, playerIn, hand, facing, rayTraceResult, pipeTile); } - public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, EnumFacing side, CuboidRayTraceResult hit, IPipeTile pipeTile) { + public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, + EnumHand hand, EnumFacing side, CuboidRayTraceResult hit, + IPipeTile pipeTile) { ItemStack itemStack = entityPlayer.getHeldItem(hand); if (pipeTile.getFrameMaterial() == null && @@ -304,9 +324,11 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent pipeTile.getPipeType().getThickness() < 1) { BlockFrame frameBlock = BlockFrame.getFrameBlockFromItem(itemStack); if (frameBlock != null) { - ((TileEntityPipeBase) pipeTile).setFrameMaterial(frameBlock.getGtMaterial(itemStack)); + ((TileEntityPipeBase) pipeTile) + .setFrameMaterial(frameBlock.getGtMaterial(itemStack)); SoundType type = frameBlock.getSoundType(itemStack); - world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, + (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); if (!entityPlayer.capabilities.isCreativeMode) { itemStack.shrink(1); } @@ -320,7 +342,8 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent ItemBlockPipe itemBlockPipe = (ItemBlockPipe) itemStack.getItem(); if (itemBlockPipe.blockPipe.getItemPipeType(itemStack) == getItemPipeType(itemStack)) { BlockFrame frameBlock = (BlockFrame) blockStateAtSide.getBlock(); - boolean wasPlaced = frameBlock.replaceWithFramedPipe(world, pos.offset(side), blockStateAtSide, entityPlayer, itemStack, side); + boolean wasPlaced = frameBlock.replaceWithFramedPipe(world, pos.offset(side), blockStateAtSide, + entityPlayer, itemStack, side); if (wasPlaced) { pipeTile.setConnection(side, true, false); } @@ -358,7 +381,8 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent } } - if ((itemStack.isEmpty() && entityPlayer.isSneaking()) || itemStack.getItem().getToolClasses(itemStack).contains(ToolClasses.SCREWDRIVER)) { + if ((itemStack.isEmpty() && entityPlayer.isSneaking()) || + itemStack.getItem().getToolClasses(itemStack).contains(ToolClasses.SCREWDRIVER)) { if (cover.onScrewdriverClick(entityPlayer, hand, hit) == EnumActionResult.SUCCESS) { if (!itemStack.isEmpty()) { ToolHelper.damageItem(itemStack, entityPlayer); @@ -382,24 +406,30 @@ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, Ent if (activateFrame(world, state, pos, entityPlayer, hand, hit, pipeTile)) { return true; } - return entityPlayer.isSneaking() && entityPlayer.getHeldItemMainhand().isEmpty() && cover.onScrewdriverClick(entityPlayer, hand, hit) != EnumActionResult.PASS; + return entityPlayer.isSneaking() && entityPlayer.getHeldItemMainhand().isEmpty() && + cover.onScrewdriverClick(entityPlayer, hand, hit) != EnumActionResult.PASS; } return true; } - private boolean activateFrame(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, CuboidRayTraceResult hit, IPipeTile pipeTile) { - if (pipeTile.getFrameMaterial() != null && !(entityPlayer.getHeldItem(hand).getItem() instanceof ItemBlockPipe)) { + private boolean activateFrame(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, + EnumHand hand, CuboidRayTraceResult hit, IPipeTile pipeTile) { + if (pipeTile.getFrameMaterial() != null && + !(entityPlayer.getHeldItem(hand).getItem() instanceof ItemBlockPipe)) { BlockFrame blockFrame = MetaBlocks.FRAMES.get(pipeTile.getFrameMaterial()); - return blockFrame.onBlockActivated(world, pos, state, entityPlayer, hand, hit.sideHit, (float) hit.hitVec.x, (float) hit.hitVec.y, (float) hit.hitVec.z); + return blockFrame.onBlockActivated(world, pos, state, entityPlayer, hand, hit.sideHit, (float) hit.hitVec.x, + (float) hit.hitVec.y, (float) hit.hitVec.z); } return false; } /** * @return 1 if successfully used tool, 0 if failed to use tool, - * -1 if ItemStack failed the capability check (no action done, continue checks). + * -1 if ItemStack failed the capability check (no action done, continue checks). */ - public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stack, EnumFacing coverSide, IPipeTile pipeTile, EntityPlayer entityPlayer, EnumHand hand) { + public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stack, EnumFacing coverSide, + IPipeTile pipeTile, EntityPlayer entityPlayer, + EnumHand hand) { if (isPipeTool(stack)) { if (!entityPlayer.world.isRemote) { if (entityPlayer.isSneaking() && pipeTile.canHaveBlockedFaces()) { @@ -453,15 +483,18 @@ public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, En @SuppressWarnings("unchecked") @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, + @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : (IPipeTile) te); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { - IPipeTile pipeTile = tileEntities.get() == null ? getPipeTileEntity(world, pos) : tileEntities.get(); + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { + IPipeTile pipeTile = tileEntities.get() == null ? getPipeTileEntity(world, pos) : + tileEntities.get(); if (pipeTile == null) return; if (pipeTile.getFrameMaterial() != null) { BlockFrame blockFrame = MetaBlocks.FRAMES.get(pipeTile.getFrameMaterial()); @@ -471,7 +504,9 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { + public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + @Nullable Entity entityIn, boolean isActualState) { // This iterator causes some heap memory overhead IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null && pipeTile.getFrameMaterial() != null) { @@ -489,7 +524,8 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World worldIn, @Nonnull BlockPos pos, + @Nonnull Vec3d start, @Nonnull Vec3d end) { if (worldIn.isRemote) { return getClientCollisionRayTrace(worldIn, pos, start, end); } @@ -497,8 +533,10 @@ public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World w } @SideOnly(Side.CLIENT) - public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { - return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos, Minecraft.getMinecraft().player)); + public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, + @Nonnull Vec3d end) { + return RayTracer.rayTraceCuboidsClosest(start, end, pos, + getCollisionBox(worldIn, pos, Minecraft.getMinecraft().player)); } /** @@ -508,13 +546,13 @@ public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPo public CuboidRayTraceResult getServerCollisionRayTrace(EntityPlayer playerIn, BlockPos pos, World worldIn) { return RayTracer.rayTraceCuboidsClosest( RayTracer.getStartVec(playerIn), RayTracer.getEndVec(playerIn), - pos, getCollisionBox(worldIn, pos, playerIn) - ); + pos, getCollisionBox(worldIn, pos, playerIn)); } @Nonnull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null && pipeTile.getCoverableImplementation().getCoverAtSide(face) != null) { return BlockFaceShape.SOLID; @@ -523,7 +561,8 @@ public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull } @Override - public boolean recolorBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumDyeColor color) { + public boolean recolorBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, + @Nonnull EnumDyeColor color) { IPipeTile tileEntityPipe = (IPipeTile) world.getTileEntity(pos); if (tileEntityPipe != null && tileEntityPipe.getPipeType() != null && tileEntityPipe.getPipeType().isPaintable() && @@ -547,7 +586,8 @@ public IPipeTile getPipeTileEntity(IBlockAccess world, B } public IPipeTile getPipeTileEntity(TileEntity tileEntityAtPos) { - if (tileEntityAtPos instanceof IPipeTile && isThisPipeBlock(((IPipeTile) tileEntityAtPos).getPipeBlock())) { + if (tileEntityAtPos instanceof IPipeTile && + isThisPipeBlock(((IPipeTile) tileEntityAtPos).getPipeBlock())) { return (IPipeTile) tileEntityAtPos; } return null; @@ -570,9 +610,11 @@ public boolean canConnect(IPipeTile selfTile, EnumFacing return canPipeConnectToBlock(selfTile, facing, other); } - public abstract boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile); + public abstract boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile); - public abstract boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile); + public abstract boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile); private List getCollisionBox(IBlockAccess world, BlockPos pos, @Nullable Entity entityIn) { IPipeTile pipeTile = getPipeTileEntity(world, pos); @@ -642,7 +684,8 @@ public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRender @Nonnull @Override - public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, @Nonnull BlockPos otherPos) { + public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, + @Nonnull BlockPos otherPos) { return getFacade(world, pos, side); } @@ -671,11 +714,11 @@ public boolean supportsVisualConnections() { } public static class PipeConnectionData { + public final EnumFacing side; public PipeConnectionData(EnumFacing side) { this.side = side; } } - } diff --git a/src/main/java/gregtech/api/pipenet/block/IPipeType.java b/src/main/java/gregtech/api/pipenet/block/IPipeType.java index 59723b1c371..c0b4caf8121 100644 --- a/src/main/java/gregtech/api/pipenet/block/IPipeType.java +++ b/src/main/java/gregtech/api/pipenet/block/IPipeType.java @@ -9,5 +9,4 @@ public interface IPipeType extends IStringSerializable { NodeDataType modifyProperties(NodeDataType baseProperties); boolean isPaintable(); - } diff --git a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java index 6d4a2bd32b0..b9984165cfa 100644 --- a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.common.ConfigHolder; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -29,8 +30,10 @@ public int getMetadata(int damage) { } @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull IBlockState newState) { boolean superVal = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState); if (superVal && !world.isRemote) { IPipeTile selfTile = (IPipeTile) world.getTileEntity(pos); @@ -48,9 +51,10 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play otherPipe.setConnection(facing.getOpposite(), false, true); } } - } else if (!ConfigHolder.machines.gt6StylePipesCables && selfTile.getPipeBlock().canPipeConnectToBlock(selfTile, facing, te)) { - selfTile.setConnection(facing, true, false); - } + } else if (!ConfigHolder.machines.gt6StylePipesCables && + selfTile.getPipeBlock().canPipeConnectToBlock(selfTile, facing, te)) { + selfTile.setConnection(facing, true, false); + } } } return superVal; diff --git a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java index 11f546be217..7ba754ea746 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java @@ -12,6 +12,7 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.client.renderer.pipe.PipeRenderer; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; @@ -21,10 +22,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.Objects; -public abstract class BlockMaterialPipe & IPipeType & IMaterialPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BlockPipe { +import javax.annotation.Nonnull; + +public abstract class BlockMaterialPipe< + PipeType extends Enum & IPipeType & IMaterialPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> + extends BlockPipe { protected final PipeType pipeType; private final MaterialRegistry registry; @@ -65,7 +70,8 @@ public Material getItemMaterial(ItemStack itemStack) { @Override public void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack) { - ((TileEntityMaterialPipeBase) pipeTile).setPipeData(this, pipeType, getItemMaterial(itemStack)); + ((TileEntityMaterialPipeBase) pipeTile).setPipeData(this, pipeType, + getItemMaterial(itemStack)); } @Override @@ -100,7 +106,7 @@ public void onModelRegister() { new ResourceLocation(GTValues.MODID, // force pipe models to always be GT's Objects.requireNonNull(this.getRegistryName()).getPath()), MetaBlocks.statePropertiesToString(state.getProperties())); - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), resourceLocation); } diff --git a/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java b/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java index 7ea113f4cda..bada7d3c132 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java +++ b/src/main/java/gregtech/api/pipenet/block/material/IMaterialPipeTile.java @@ -4,7 +4,8 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.unification.material.Material; -public interface IMaterialPipeTile & IPipeType, NodeDataType> extends IPipeTile { +public interface IMaterialPipeTile & IPipeType, NodeDataType> + extends IPipeTile { Material getPipeMaterial(); } diff --git a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java index 93bafb74e79..6932ebe24ae 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java @@ -2,11 +2,13 @@ import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.api.unification.material.Material; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; -public class ItemBlockMaterialPipe & IMaterialPipeType, NodeDataType> extends ItemBlockPipe { +public class ItemBlockMaterialPipe & IMaterialPipeType, NodeDataType> + extends ItemBlockPipe { public ItemBlockMaterialPipe(BlockMaterialPipe block) { super(block); diff --git a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java index a447f93dae4..fd8d9d43e85 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.registry.MaterialRegistry; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -13,7 +14,9 @@ import static gregtech.api.capability.GregtechDataCodes.UPDATE_PIPE_MATERIAL; -public abstract class TileEntityMaterialPipeBase & IMaterialPipeType, NodeDataType> extends TileEntityPipeBase implements IMaterialPipeTile { +public abstract class TileEntityMaterialPipeBase & IMaterialPipeType, + NodeDataType> extends TileEntityPipeBase + implements IMaterialPipeTile { private Material pipeMaterial = Materials.Aluminium; diff --git a/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java b/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java index 26d77f17a8a..52e344243c8 100644 --- a/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java +++ b/src/main/java/gregtech/api/pipenet/block/simple/BlockSimplePipe.java @@ -6,9 +6,12 @@ import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.pipenet.tile.TileEntityPipeBase; + import net.minecraft.item.ItemStack; -public abstract class BlockSimplePipe & IPipeType, NodeDataType, WorldPipeNetType extends WorldPipeNet>> extends BlockPipe { +public abstract class BlockSimplePipe & IPipeType, NodeDataType, + WorldPipeNetType extends WorldPipeNet>> + extends BlockPipe { @Override public NodeDataType createProperties(IPipeTile pipeTile) { diff --git a/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java b/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java index 1fb867c01fa..af6b6a9e076 100644 --- a/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java +++ b/src/main/java/gregtech/api/pipenet/block/simple/EmptyNodeData.java @@ -5,6 +5,5 @@ public class EmptyNodeData { public static final EmptyNodeData INSTANCE = new EmptyNodeData(); - private EmptyNodeData() { - } + private EmptyNodeData() {} } diff --git a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java index 9f6c8756699..418ab91caf7 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java +++ b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -16,14 +17,16 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BlockLongDistancePipe extends Block implements ILDNetworkPart { private final LongDistancePipeType pipeType; @@ -37,7 +40,8 @@ public BlockLongDistancePipe(LongDistancePipeType pipeType) { } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (worldIn.isRemote) return; // first find all neighbouring networks @@ -61,7 +65,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn network.getPipeType() + " is not valid for network type " + network.getPipeType()); } ILDEndpoint endpoint = ILDEndpoint.tryGet(worldIn, offsetPos); - // only count the network as connected if it's not an endpoint or the endpoints input or output face is connected + // only count the network as connected if it's not an endpoint or the endpoints input or output face is + // connected if (endpoint == null || endpoint.getFrontFacing().getAxis() == facing.getAxis()) { networks.add(network); } @@ -104,12 +109,14 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("gregtech.block.tooltip.no_mob_spawning")); } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java index 73bc47eda2a..8b7e506faa7 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDEndpoint.java @@ -2,10 +2,12 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.interfaces.INeighborCache; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -85,6 +87,8 @@ static ILDEndpoint tryGet(World world, BlockPos pos) { } enum IOType { - NONE, INPUT, OUTPUT + NONE, + INPUT, + OUTPUT } } diff --git a/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java index 0a3b9ad9805..2e68fc04ec6 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java +++ b/src/main/java/gregtech/api/pipenet/longdist/ILDNetworkPart.java @@ -3,6 +3,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java index fda17edbd71..486d6b9e5b4 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistanceNetwork.java @@ -1,12 +1,7 @@ package gregtech.api.pipenet.longdist; import gregtech.api.pipenet.WorldPipeNet; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -17,6 +12,13 @@ import net.minecraft.world.World; import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -149,7 +151,8 @@ public void onPlaceEndpoint(ILDEndpoint endpoint) { */ protected void mergePipeNet(LongDistanceNetwork network) { if (getPipeType() != network.getPipeType()) { - throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + network.getPipeType().getName() + " !"); + throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + + network.getPipeType().getName() + " !"); } for (BlockPos pos : network.longDistancePipeBlocks) { this.world.putNetwork(pos, this); @@ -261,9 +264,9 @@ private int find(ILDEndpoint endpoint) { } public boolean isIOIndexInvalid() { - return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) - || (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) - || this.activeInputIndex < 0 != this.activeOutputIndex < 0; + return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) || + (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) || + this.activeInputIndex < 0 != this.activeOutputIndex < 0; } public ILDEndpoint getActiveInputIndex() { diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java index 39c01a82157..65da862e92f 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java @@ -2,13 +2,16 @@ import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Objects; +import javax.annotation.Nonnull; + /** * This class defines a long distance pipe type. This class MUST be a singleton class! */ diff --git a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java index 5c90d866122..2eb375b5c23 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java +++ b/src/main/java/gregtech/api/pipenet/longdist/NetworkBuilder.java @@ -1,8 +1,5 @@ package gregtech.api.pipenet.longdist; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -12,6 +9,10 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderServer; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -34,7 +35,8 @@ public class NetworkBuilder extends Thread { private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); private final ObjectOpenHashSet loadedChunks = new ObjectOpenHashSet<>(); - public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, Collection starts) { + public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, + Collection starts) { this.worldData = Objects.requireNonNull(worldData); this.originalNetwork = Objects.requireNonNull(network); this.network = network; @@ -52,7 +54,8 @@ public void run() { start = this.starts.remove(0); LongDistanceNetwork ldn = this.worldData.getNetwork(start); if (ldn == this.originalNetwork) { - // this starting point was caught during a previous iteration, so we don't need to create another network here + // this starting point was caught during a previous iteration, so we don't need to create another + // network here continue; } // create a new network, since the current was already calculated diff --git a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java index 554327b7459..14246888d7a 100644 --- a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java +++ b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNet.java @@ -2,16 +2,19 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; + import net.minecraft.util.ITickable; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; + import org.apache.commons.lang3.tuple.Pair; import java.util.*; import java.util.stream.Collectors; -public abstract class TickableWorldPipeNet & ITickable> extends WorldPipeNet { +public abstract class TickableWorldPipeNet & ITickable> + extends WorldPipeNet { private final Map> loadedChunksByPipeNet = new HashMap<>(); private final Set tickingPipeNets = new HashSet<>(); @@ -33,7 +36,7 @@ public void update() { if (getWorld().getTotalWorldTime() % getUpdateRate() == 0L) { tickingPipeNets.forEach(ITickable::update); } - if(removeLater.size() > 0) { + if (removeLater.size() > 0) { removeLater.forEach(tickingPipeNets::remove); removeLater.clear(); } diff --git a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java index 9762126eb3f..8ee0e7d61bd 100644 --- a/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java +++ b/src/main/java/gregtech/api/pipenet/tickable/TickableWorldPipeNetEventHandler.java @@ -1,6 +1,7 @@ package gregtech.api.pipenet.tickable; import gregtech.api.GTValues; + import net.minecraft.world.World; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; diff --git a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java index 0500179f2c3..486ddfa6d8b 100644 --- a/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java +++ b/src/main/java/gregtech/api/pipenet/tile/IPipeTile.java @@ -4,17 +4,19 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.unification.material.Material; + import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; -public interface IPipeTile & IPipeType, NodeDataType> extends INeighborCache { +public interface IPipeTile & IPipeType, NodeDataType> + extends INeighborCache { World getPipeWorld(); diff --git a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java index c36150247d7..fdf40e93375 100644 --- a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java +++ b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java @@ -6,6 +6,7 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -14,13 +15,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.EnumMap; import java.util.function.Consumer; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.*; public class PipeCoverableImplementation implements CoverHolder { @@ -97,7 +100,7 @@ public void onLoad() { @Override public final int getInputRedstoneSignal(@NotNull EnumFacing side, boolean ignoreCover) { if (!ignoreCover && getCoverAtSide(side) != null) { - return 0; //covers block input redstone signal for machine + return 0; // covers block input redstone signal for machine } return sidedRedstoneInput[side.getIndex()]; } @@ -162,8 +165,8 @@ public final boolean acceptsCovers() { } public boolean canConnectRedstone(@Nullable EnumFacing side) { - //so far null side means either upwards or downwards redstone wire connection - //so check both top cover and bottom cover + // so far null side means either upwards or downwards redstone wire connection + // so check both top cover and bottom cover if (side == null) { return canConnectRedstone(EnumFacing.UP) || canConnectRedstone(EnumFacing.DOWN); @@ -222,12 +225,12 @@ public void readCustomData(int dataId, PacketBuffer buf) { if (dataId == COVER_ATTACHED_PIPE) { CoverSaveHandler.readCoverPlacement(buf, this); } else if (dataId == COVER_REMOVED_PIPE) { - //cover removed event + // cover removed event EnumFacing placementSide = EnumFacing.VALUES[buf.readByte()]; this.covers.remove(placementSide); holder.scheduleChunkForRenderUpdate(); } else if (dataId == UPDATE_COVER_DATA_PIPE) { - //cover custom data received + // cover custom data received EnumFacing coverSide = EnumFacing.VALUES[buf.readByte()]; Cover cover = getCoverAtSide(coverSide); int internalId = buf.readVarInt(); diff --git a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java index 954e425a9b7..9bf3d61e2c1 100644 --- a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java @@ -10,6 +10,7 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.unification.material.Material; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -25,13 +26,15 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; +import java.util.function.Consumer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.function.Consumer; import static gregtech.api.capability.GregtechDataCodes.*; -public abstract class TileEntityPipeBase & IPipeType, NodeDataType> extends NeighborCacheTileEntityBase implements IPipeTile { +public abstract class TileEntityPipeBase & IPipeType, + NodeDataType> extends NeighborCacheTileEntityBase implements IPipeTile { protected final PipeCoverableImplementation coverableImplementation = new PipeCoverableImplementation(this); protected int paintingColor = -1; @@ -45,8 +48,7 @@ public abstract class TileEntityPipeBase & IPipe // set when this pipe is replaced with a ticking variant to redirect sync packets private TileEntityPipeBase tickingPipe; - public TileEntityPipeBase() { - } + public TileEntityPipeBase() {} public void setPipeData(BlockPipe pipeBlock, PipeType pipeType) { this.pipeBlock = pipeBlock; @@ -129,7 +131,7 @@ public IPipeTile setSupportsTicking() { // reuse ticking pipe return this.tickingPipe; } - //create new tickable tile entity, transfer data, and replace it + // create new tickable tile entity, transfer data, and replace it TileEntityPipeBase newTile = getPipeBlock().createNewTileEntity(true); if (!newTile.supportsTicking()) throw new IllegalStateException("Expected pipe to be ticking, but isn't!"); newTile.transferDataFrom(this); @@ -142,7 +144,7 @@ public IPipeTile setSupportsTicking() { public BlockPipe getPipeBlock() { if (pipeBlock == null) { Block block = getBlockState().getBlock(); - //noinspection unchecked + // noinspection unchecked this.pipeBlock = block instanceof BlockPipe blockPipe ? blockPipe : null; } return pipeBlock; @@ -205,7 +207,8 @@ public static boolean isConnected(int connections, EnumFacing side) { @Override public void setConnection(EnumFacing side, boolean connected, boolean fromNeighbor) { - // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to it. + // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to + // it. if (!getWorld().isRemote) { if (isConnected(side) == connected) { return; @@ -308,7 +311,7 @@ public int getVisualConnections() { float selfThickness = getPipeType().getThickness(); for (EnumFacing facing : EnumFacing.values()) { if (isConnected(facing)) { - if (world.getTileEntity(pos.offset(facing)) instanceof IPipeTile pipeTile && + if (world.getTileEntity(pos.offset(facing)) instanceof IPipeTilepipeTile && pipeTile.isConnected(facing.getOpposite()) && pipeTile.getPipeType().getThickness() < selfThickness) { connections |= 1 << (facing.getIndex() + 6); @@ -362,7 +365,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { super.writeToNBT(compound); BlockPipe pipeBlock = getPipeBlock(); if (pipeBlock != null) { - //noinspection ConstantConditions + // noinspection ConstantConditions compound.setString("PipeBlock", pipeBlock.getRegistryName().toString()); } compound.setInteger("PipeType", pipeType.ordinal()); @@ -385,7 +388,7 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { super.readFromNBT(compound); if (compound.hasKey("PipeBlock", NBT.TAG_STRING)) { Block block = Block.REGISTRY.getObject(new ResourceLocation(compound.getString("PipeBlock"))); - //noinspection unchecked + // noinspection unchecked this.pipeBlock = block instanceof BlockPipe blockPipe ? blockPipe : null; } this.pipeType = getPipeTypeClass().getEnumConstants()[compound.getInteger("PipeType")]; @@ -531,14 +534,16 @@ public boolean isValidTile() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, IBlockState newSate) { + public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + IBlockState newSate) { return oldState.getBlock() != newSate.getBlock(); } public void doExplosion(float explosionPower) { getWorld().setBlockToAir(getPos()); if (!getWorld().isRemote) { - ((WorldServer) getWorld()).spawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, + ((WorldServer) getWorld()).spawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5, + getPos().getY() + 0.5, getPos().getZ() + 0.5, 10, 0.2, 0.2, 0.2, 0.0); } getWorld().createExplosion(null, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, diff --git a/src/main/java/gregtech/api/recipes/FluidCellInput.java b/src/main/java/gregtech/api/recipes/FluidCellInput.java index c25d6d2eca8..28fdcd02c48 100644 --- a/src/main/java/gregtech/api/recipes/FluidCellInput.java +++ b/src/main/java/gregtech/api/recipes/FluidCellInput.java @@ -2,6 +2,7 @@ import gregtech.api.recipes.ingredients.GTRecipeItemInput; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -21,8 +22,9 @@ public FluidCellInput(Fluid fluid) { public static ItemStack getFilledCell(Fluid fluid, int count) { ItemStack fluidCell = MetaItems.FLUID_CELL.getStackForm().copy(); - IFluidHandlerItem fluidHandlerItem = fluidCell.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (fluidHandlerItem ==null) { + IFluidHandlerItem fluidHandlerItem = fluidCell + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + if (fluidHandlerItem == null) { throw new IllegalStateException("Could not get FluidHandlerItem capability for the fluid cell."); } fluidHandlerItem.fill(new FluidStack(fluid, 1000), true); @@ -41,9 +43,10 @@ public boolean acceptsStack(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.isEmpty()) { return false; } - IFluidHandlerItem stackFluid = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem stackFluid = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); FluidStack drained = stackFluid == null ? null : stackFluid.getTankProperties()[0].getContents(); - return MetaItems.FLUID_CELL.isItemEqual(itemStack) && drained != null && drained.getFluid() == fluid && drained.amount == 1000; + return MetaItems.FLUID_CELL.isItemEqual(itemStack) && drained != null && drained.getFluid() == fluid && + drained.amount == 1000; } - } diff --git a/src/main/java/gregtech/api/recipes/FluidKey.java b/src/main/java/gregtech/api/recipes/FluidKey.java index f5123af881c..79709382769 100644 --- a/src/main/java/gregtech/api/recipes/FluidKey.java +++ b/src/main/java/gregtech/api/recipes/FluidKey.java @@ -24,13 +24,12 @@ public FluidKey copy() { return new FluidKey(new FluidStack(getFluid(), this.amount, tag)); } - @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FluidKey)) return false; FluidKey fluidKey = (FluidKey) o; - if (!Objects.equals(fluid, fluidKey.fluid) ) + if (!Objects.equals(fluid, fluidKey.fluid)) return false; if (tag == null && fluidKey.tag != null) return false; else return tag == null || tag.equals(fluidKey.tag); diff --git a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java index 714e2ba9ff7..d08e3d6b851 100644 --- a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java +++ b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -16,14 +17,14 @@ public class GTRecipeHandler { * An example of how to use it: * * - * removeRecipesByInputs(RecipeMaps.CHEMICAL_RECIPES, - * new ItemStack[]{ - * OreDictUnifier.get(OrePrefix.dust, Materials.SodiumHydroxide, 3) - * }, - * new FluidStack[]{ - * Materials.HypochlorousAcid.getFluid(1000), - * Materials.AllylChloride.getFluid(1000) - * }); + * removeRecipesByInputs(RecipeMaps.CHEMICAL_RECIPES, + * new ItemStack[]{ + * OreDictUnifier.get(OrePrefix.dust, Materials.SodiumHydroxide, 3) + * }, + * new FluidStack[]{ + * Materials.HypochlorousAcid.getFluid(1000), + * Materials.AllylChloride.getFluid(1000) + * }); * * * This method also has varargs parameter methods for when there is only ItemStack or FluidStack inputs. @@ -34,15 +35,15 @@ public class GTRecipeHandler { * * @return true if a recipe was removed, false otherwise. */ - public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack[] itemInputs, FluidStack[] fluidInputs) { - + public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack[] itemInputs, + FluidStack[] fluidInputs) { List fluidNames = new ArrayList<>(); List itemNames = new ArrayList<>(); List itemIn = new ArrayList<>(); for (ItemStack s : itemInputs) { itemIn.add(s); - if(ConfigHolder.misc.debug) { + if (ConfigHolder.misc.debug) { itemNames.add(String.format("%s x %d", s.getDisplayName(), s.getCount())); } } @@ -50,7 +51,7 @@ public static > boolean removeRecipesByInputs(RecipeM List fluidIn = new ArrayList<>(); for (FluidStack s : fluidInputs) { fluidIn.add(s); - if(ConfigHolder.misc.debug) { + if (ConfigHolder.misc.debug) { fluidNames.add(String.format("%s x %d", s.getFluid().getName(), s.amount)); } } @@ -65,11 +66,13 @@ public static > boolean removeRecipesByInputs(RecipeM return wasRemoved; } - public static > boolean removeRecipesByInputs(RecipeMap map, ItemStack... itemInputs) { + public static > boolean removeRecipesByInputs(RecipeMap map, + ItemStack... itemInputs) { return removeRecipesByInputs(map, itemInputs, new FluidStack[0]); } - public static > boolean removeRecipesByInputs(RecipeMap map, FluidStack... fluidInputs) { + public static > boolean removeRecipesByInputs(RecipeMap map, + FluidStack... fluidInputs) { return removeRecipesByInputs(map, new ItemStack[0], fluidInputs); } @@ -79,7 +82,7 @@ public static > boolean removeRecipesByInputs(RecipeM * An example of how to use it: * * - * removeAllRecipes(RecipeMaps.BREWING_RECIPES); + * removeAllRecipes(RecipeMaps.BREWING_RECIPES); * * * @param map The RecipeMap to clear all recipes from. diff --git a/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java b/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java index 8f2242dbca4..f72fb572f6e 100644 --- a/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java +++ b/src/main/java/gregtech/api/recipes/GTRecipeInputCache.java @@ -4,6 +4,7 @@ import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.ArrayList; @@ -54,7 +55,7 @@ public static void disableCache() { * * @param recipeInput ingredient instance to be deduplicated * @return Either previously cached instance, or {@code recipeInput} marked cached; - * or unmodified {@code recipeInput} instance if the cache is disabled + * or unmodified {@code recipeInput} instance if the cache is disabled */ public static GTRecipeInput deduplicate(GTRecipeInput recipeInput) { if (!isCacheEnabled() || recipeInput.isCached()) { diff --git a/src/main/java/gregtech/api/recipes/ModHandler.java b/src/main/java/gregtech/api/recipes/ModHandler.java index 278bfaefd33..bea1f8cf14a 100644 --- a/src/main/java/gregtech/api/recipes/ModHandler.java +++ b/src/main/java/gregtech/api/recipes/ModHandler.java @@ -1,7 +1,5 @@ package gregtech.api.recipes; -import crafttweaker.mc1120.actions.ActionAddFurnaceRecipe; -import crafttweaker.mc1120.furnace.MCFurnaceManager; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.toolitem.IGTTool; @@ -24,6 +22,7 @@ import gregtech.common.crafting.GTShapedOreRecipe; import gregtech.common.crafting.GTShapelessOreRecipe; import gregtech.common.crafting.ShapedOreEnergyTransferRecipe; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -39,20 +38,25 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.registries.IForgeRegistry; + +import crafttweaker.mc1120.actions.ActionAddFurnaceRecipe; +import crafttweaker.mc1120.furnace.MCFurnaceManager; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.Field; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class ModHandler { - public static final boolean ERROR_ON_INVALID_RECIPE = GTValues.isDeobfEnvironment() || !ConfigHolder.misc.ignoreErrorOrInvalidRecipes; + public static final boolean ERROR_ON_INVALID_RECIPE = GTValues.isDeobfEnvironment() || + !ConfigHolder.misc.ignoreErrorOrInvalidRecipes; public static boolean hasInvalidRecipe = false; private ModHandler() {} @@ -149,12 +153,14 @@ public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStac FurnaceRecipes recipes = FurnaceRecipes.instance(); if (recipes.getSmeltingResult(input).isEmpty()) { - //register only if there is no recipe with duplicate input + // register only if there is no recipe with duplicate input recipes.addSmeltingRecipe(input, output, experience); } else { logInvalidRecipe(String.format("Tried to register duplicate Furnace Recipe: %sx %s:%s -> %sx %s:%s, %sexp", - input.getCount(), Objects.requireNonNull(input.getItem().getRegistryName()).getNamespace(), input.getDisplayName(), - output.getCount(), Objects.requireNonNull(output.getItem().getRegistryName()).getNamespace(), output.getDisplayName(), experience)); + input.getCount(), Objects.requireNonNull(input.getItem().getRegistryName()).getNamespace(), + input.getDisplayName(), + output.getCount(), Objects.requireNonNull(output.getItem().getRegistryName()).getNamespace(), + output.getDisplayName(), experience)); } } @@ -173,26 +179,28 @@ public static ItemStack getSmeltingOutput(@Nonnull ItemStack input) { /** * Adds Shaped Crafting Recipes. *

- * {@link MetaItem.MetaValueItem}'s are converted to ItemStack via {@link MetaItem.MetaValueItem#getStackForm()} method. + * {@link MetaItem.MetaValueItem}'s are converted to ItemStack via {@link MetaItem.MetaValueItem#getStackForm()} + * method. *

* For Enums - {@link Enum#name()} is called. *

* For {@link UnificationEntry} - {@link UnificationEntry#toString()} is called. *

- * For Lowercase Characters - gets IGTool from {@link ToolHelper#getToolFromSymbol(Character)}, and calls {@link IGTTool#getOreDictName()} + * For Lowercase Characters - gets IGTool from {@link ToolHelper#getToolFromSymbol(Character)}, and calls + * {@link IGTTool#getOreDictName()} *

* Base tool names are as follows: *

    - *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • - *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • - *
  • {@code 'f'} - {@code craftingToolFile}
  • - *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • - *
  • {@code 'k'} - {@code craftingToolKnife}
  • - *
  • {@code 'm'} - {@code craftingToolMortar}
  • - *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • - *
  • {@code 's'} - {@code craftingToolSaw}
  • - *
  • {@code 'w'} - {@code craftingToolWrench}
  • - *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • + *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • + *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • + *
  • {@code 'f'} - {@code craftingToolFile}
  • + *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • + *
  • {@code 'k'} - {@code craftingToolKnife}
  • + *
  • {@code 'm'} - {@code craftingToolMortar}
  • + *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • + *
  • {@code 's'} - {@code craftingToolSaw}
  • + *
  • {@code 'w'} - {@code craftingToolWrench}
  • + *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • *
* * @param regName the registry name for the recipe @@ -204,7 +212,8 @@ public static void addShapedRecipe(@Nonnull String regName, @Nonnull ItemStack r } /** - * Adds a shaped recipe with a single fluid container, which gets consumed as input and is output with different contents + * Adds a shaped recipe with a single fluid container, which gets consumed as input and is output with different + * contents * * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ @@ -227,7 +236,8 @@ public static void addShapedNBTClearingRecipe(String regName, ItemStack result, * @param withUnificationData whether to use unification data * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedRecipe(boolean withUnificationData, String regName, ItemStack result, Object... recipe) { + public static void addShapedRecipe(boolean withUnificationData, String regName, ItemStack result, + Object... recipe) { addShapedRecipe(withUnificationData, regName, result, false, false, recipe); } @@ -246,7 +256,8 @@ public static void addMirroredShapedRecipe(String regName, ItemStack result, Obj * @param isMirrored whether the recipe should be mirrored * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedRecipe(boolean withUnificationData, @Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { + public static void addShapedRecipe(boolean withUnificationData, @Nonnull String regName, @Nonnull ItemStack result, + boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; addRecipe(regName, result, isNBTClearing, isMirrored, recipe); @@ -259,13 +270,14 @@ public static void addShapedRecipe(boolean withUnificationData, @Nonnull String /** * @see ModHandler#addFluidReplaceRecipe(String, ItemStack, Object...) */ - public static void addFluidReplaceRecipe(String regName, ItemStack result, boolean isNBTClearing, Object... recipe) { + public static void addFluidReplaceRecipe(String regName, ItemStack result, boolean isNBTClearing, + Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; IRecipe shapedOreRecipe = new FluidReplaceRecipe(isNBTClearing, null, result.copy(), finalizeShapedRecipeInput(recipe)) - .setMirrored(false) //make all recipes not mirrored by default - .setRegistryName(regName); + .setMirrored(false) // make all recipes not mirrored by default + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @@ -276,28 +288,34 @@ public static void addFluidReplaceRecipe(String regName, ItemStack result, boole * @param transferMaxCharge whether to transfer all the potential charge * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedEnergyTransferRecipe(String regName, ItemStack result, Predicate chargePredicate, boolean overrideCharge, boolean transferMaxCharge, Object... recipe) { + public static void addShapedEnergyTransferRecipe(String regName, ItemStack result, + Predicate chargePredicate, boolean overrideCharge, + boolean transferMaxCharge, Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; - IRecipe shapedOreRecipe = new ShapedOreEnergyTransferRecipe(null, result.copy(), chargePredicate, overrideCharge, transferMaxCharge, finalizeShapedRecipeInput(recipe)) - .setMirrored(false) - .setRegistryName(regName); + IRecipe shapedOreRecipe = new ShapedOreEnergyTransferRecipe(null, result.copy(), chargePredicate, + overrideCharge, transferMaxCharge, finalizeShapedRecipeInput(recipe)) + .setMirrored(false) + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @SuppressWarnings("BooleanMethodIsAlwaysInverted") - private static boolean validateRecipeWithOutput(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + private static boolean validateRecipeWithOutput(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { if (result.isEmpty()) { if (setErroredInvalidRecipe("Recipe output cannot be an empty ItemStack. Recipe: " + regName)) return false; } return validateRecipe(regName, recipe); } - private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { - IRecipe shapedOreRecipe = new GTShapedOreRecipe(isNBTClearing, null, result.copy(), finalizeShapedRecipeInput(recipe)) - .setMirrored(isMirrored) - .setRegistryName(regName); + private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, + boolean isMirrored, @Nonnull Object... recipe) { + IRecipe shapedOreRecipe = new GTShapedOreRecipe(isNBTClearing, null, result.copy(), + finalizeShapedRecipeInput(recipe)) + .setMirrored(isMirrored) + .setRegistryName(regName); registerRecipe(shapedOreRecipe); } @@ -323,15 +341,18 @@ private static boolean validateRecipe(String regName, Object... recipe) { .map(Object::toString) .map(s -> "\"" + s + "\"") .collect(Collectors.joining(", ")); - return !setErroredInvalidRecipe("Recipe cannot contain null elements or Empty ItemStacks. Recipe: " + recipeMessage); + return !setErroredInvalidRecipe( + "Recipe cannot contain null elements or Empty ItemStacks. Recipe: " + recipeMessage); } else { ModContainer container = Loader.instance().activeModContainer(); - if (ForgeRegistries.RECIPES.containsKey(new ResourceLocation(container == null ? GTValues.MODID : container.getModId().toLowerCase(), regName))) { + if (ForgeRegistries.RECIPES.containsKey(new ResourceLocation( + container == null ? GTValues.MODID : container.getModId().toLowerCase(), regName))) { String recipeMessage = Arrays.stream(recipe) .map(Object::toString) .map(s -> "\"" + s + "\"") .collect(Collectors.joining(", ")); - logInvalidRecipe("Tried to register recipe, " + regName + ", with duplicate key. Recipe: " + recipeMessage); + logInvalidRecipe( + "Tried to register recipe, " + regName + ", with duplicate key. Recipe: " + recipeMessage); return false; } } @@ -383,15 +404,12 @@ public static Object finalizeIngredient(@Nonnull Object ingredient) { logInvalidRecipe("Attempted to create recipe for invalid/missing Unification Entry " + ingredient); } ingredient = ingredient.toString(); - } else if (!(ingredient instanceof ItemStack - || ingredient instanceof Item - || ingredient instanceof Block - || ingredient instanceof String - || ingredient instanceof Character - || ingredient instanceof Boolean - || ingredient instanceof Ingredient)) { - throw new IllegalArgumentException(ingredient.getClass().getSimpleName() + " type is not suitable for crafting input."); - } + } else if (!(ingredient instanceof ItemStack || ingredient instanceof Item || ingredient instanceof Block || + ingredient instanceof String || ingredient instanceof Character || ingredient instanceof Boolean || + ingredient instanceof Ingredient)) { + throw new IllegalArgumentException( + ingredient.getClass().getSimpleName() + " type is not suitable for crafting input."); + } return ingredient; } @@ -415,7 +433,8 @@ public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @Nonnull * @param result the output of the recipe * @param recipe the recipe to add */ - public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { addShapelessRecipe(regName, result, false, recipe); } @@ -424,7 +443,8 @@ public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStac * * @see ModHandler#addShapelessRecipe(String, ItemStack, boolean, Object...) */ - public static void addShapelessNBTClearingRecipe(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + public static void addShapelessNBTClearingRecipe(@Nonnull String regName, @Nonnull ItemStack result, + @Nonnull Object... recipe) { addShapelessRecipe(regName, result, true, recipe); } @@ -452,12 +472,11 @@ public static void addShapelessRecipe(String regName, ItemStack result, boolean throw new IllegalArgumentException("Tool name is not found for char " + recipe[i]); } recipe[i] = tool.getOreDictName(); - } else if (!(recipe[i] instanceof ItemStack - || recipe[i] instanceof Item - || recipe[i] instanceof Block - || recipe[i] instanceof String)) { - throw new IllegalArgumentException(recipe.getClass().getSimpleName() + " type is not suitable for crafting input."); - } + } else if (!(recipe[i] instanceof ItemStack || recipe[i] instanceof Item || recipe[i] instanceof Block || + recipe[i] instanceof String)) { + throw new IllegalArgumentException( + recipe.getClass().getSimpleName() + " type is not suitable for crafting input."); + } } IRecipe shapelessRecipe = new GTShapelessOreRecipe(isNBTClearing, null, result.copy(), recipe) .setRegistryName(regName); @@ -503,7 +522,10 @@ public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { if (setErroredInvalidRecipe("Cannot remove furnace recipe with empty input.")) return false; } - boolean wasRemoved = FurnaceRecipes.instance().getSmeltingList().keySet().removeIf(currentStack -> currentStack.getItem() == input.getItem() && (currentStack.getMetadata() == GTValues.W || currentStack.getMetadata() == input.getMetadata())); + boolean wasRemoved = FurnaceRecipes.instance().getSmeltingList().keySet() + .removeIf(currentStack -> currentStack.getItem() == input.getItem() && + (currentStack.getMetadata() == GTValues.W || + currentStack.getMetadata() == input.getMetadata())); if (ConfigHolder.misc.debug) { if (wasRemoved) { @@ -524,7 +546,8 @@ public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { */ @SuppressWarnings("UnusedReturnValue") public static int removeRecipeByOutput(@Nonnull ItemStack output) { - int recipesRemoved = removeRecipeByOutput(recipe -> ItemStack.areItemStacksEqual(recipe.getRecipeOutput(), output)); + int recipesRemoved = removeRecipeByOutput( + recipe -> ItemStack.areItemStacksEqual(recipe.getRecipeOutput(), output)); if (ConfigHolder.misc.debug) { if (recipesRemoved != 0) { @@ -619,7 +642,7 @@ public static void removeTieredRecipeByName(@Nonnull String recipeName, int star } /////////////////////////////////////////////////// - // Get Recipe Output Helpers // + // Get Recipe Output Helpers // /////////////////////////////////////////////////// /** @@ -679,12 +702,13 @@ public static void removeSmeltingEBFMetals() { if (material.hasProperty(PropertyKey.BLAST)) { ItemStack dust = OreDictUnifier.get(OrePrefix.dust, material); ItemStack ingot = OreDictUnifier.get(OrePrefix.ingot, material); - //Check if the inputs are actually dust -> ingot + // Check if the inputs are actually dust -> ingot if (ingot.isItemEqual(output) && dust.isItemEqual(input)) { if (isCTLoaded) { if (actionAddFurnaceRecipe$output == null) { try { - actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class.getDeclaredField("output"); + actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class + .getDeclaredField("output"); actionAddFurnaceRecipe$output.setAccessible(true); } catch (NoSuchFieldException e) { GTLog.logger.error("Could not reflect Furnace output field", e); @@ -697,7 +721,9 @@ public static void removeSmeltingEBFMetals() { // ..was a cached stack in an existing ActionAddFurnaceRecipe as well if (actionAddFurnaceRecipe$output.get(aafr) == output) { if (ConfigHolder.misc.debug) { - GTLog.logger.info("Not removing Smelting Recipe for EBF material {} as it is added via CT", LocalizationUtils.format(material.getUnlocalizedName())); + GTLog.logger.info( + "Not removing Smelting Recipe for EBF material {} as it is added via CT", + LocalizationUtils.format(material.getUnlocalizedName())); } continue outer; } @@ -708,7 +734,8 @@ public static void removeSmeltingEBFMetals() { } recipeIterator.remove(); if (ConfigHolder.misc.debug) { - GTLog.logger.info("Removing Smelting Recipe for EBF material {}", LocalizationUtils.format(material.getUnlocalizedName())); + GTLog.logger.info("Removing Smelting Recipe for EBF material {}", + LocalizationUtils.format(material.getUnlocalizedName())); } } } diff --git a/src/main/java/gregtech/api/recipes/Recipe.java b/src/main/java/gregtech/api/recipes/Recipe.java index f38f8baf47f..79290c08806 100644 --- a/src/main/java/gregtech/api/recipes/Recipe.java +++ b/src/main/java/gregtech/api/recipes/Recipe.java @@ -1,6 +1,5 @@ package gregtech.api.recipes; -import com.google.common.collect.ImmutableList; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.recipes.category.GTRecipeCategory; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; @@ -15,29 +14,41 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackHashStrategy; import gregtech.integration.groovy.GroovyScriptModule; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.oredict.OreDictionary; + +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; import java.util.*; +import javax.annotation.Nonnull; + /** - * Class that represent machine recipe.

+ * Class that represent machine recipe. + *

+ *

+ * Recipes are created using {@link RecipeBuilder} or its subclasses in builder-alike pattern. To get RecipeBuilder use + * {@link RecipeMap#recipeBuilder()}. *

- * Recipes are created using {@link RecipeBuilder} or its subclasses in builder-alike pattern. To get RecipeBuilder use {@link RecipeMap#recipeBuilder()}.

*

* Example: - * RecipeMap.POLARIZER_RECIPES.recipeBuilder().inputs(new ItemStack(Items.APPLE)).outputs(new ItemStack(Items.GOLDEN_APPLE)).duration(256).EUt(480).buildAndRegister();

- * This will create and register Polarizer recipe with Apple as input and Golden apple as output, duration - 256 ticks and energy consumption of 480 EU/t.

- * To get example for particular RecipeMap see {@link RecipeMap}

+ * RecipeMap.POLARIZER_RECIPES.recipeBuilder().inputs(new ItemStack(Items.APPLE)).outputs(new + * ItemStack(Items.GOLDEN_APPLE)).duration(256).EUt(480).buildAndRegister(); + *

+ * This will create and register Polarizer recipe with Apple as input and Golden apple as output, duration - 256 ticks + * and energy consumption of 480 EU/t. + *

+ * To get example for particular RecipeMap see {@link RecipeMap} + *

*

* Recipes are immutable. */ @@ -102,7 +113,8 @@ public Recipe(@Nonnull List inputs, boolean isCTRecipe, IRecipePropertyStorage recipePropertyStorage, @Nonnull GTRecipeCategory recipeCategory) { - this.recipePropertyStorage = recipePropertyStorage == null ? EmptyRecipePropertyStorage.INSTANCE : recipePropertyStorage; + this.recipePropertyStorage = recipePropertyStorage == null ? EmptyRecipePropertyStorage.INSTANCE : + recipePropertyStorage; this.inputs = GTRecipeInputCache.deduplicateInputs(inputs); if (outputs.isEmpty()) { this.outputs = EMPTY; @@ -139,7 +151,8 @@ public Recipe copy() { * @param fluidTrimLimit The Limit to which fluid outputs should be trimmed to, -1 for no trimming * @return A new Recipe whose outputs have been trimmed. */ - public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipeMap, int itemTrimLimit, int fluidTrimLimit) { + public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipeMap, int itemTrimLimit, + int fluidTrimLimit) { // Fast return early if no trimming desired if (itemTrimLimit == -1 && fluidTrimLimit == -1) { return currentRecipe; @@ -154,24 +167,27 @@ public static Recipe trimRecipeOutputs(Recipe currentRecipe, RecipeMap recipe builder.clearChancedFluidOutputs(); // Chanced outputs are removed in this if they cannot fit the limit - Pair, List> recipeOutputs = currentRecipe.getItemAndChanceOutputs(itemTrimLimit); + Pair, List> recipeOutputs = currentRecipe + .getItemAndChanceOutputs(itemTrimLimit); // Add the trimmed chanced outputs and outputs builder.chancedOutputs(recipeOutputs.getRight()); builder.outputs(recipeOutputs.getLeft()); - Pair, List> recipeFluidOutputs = currentRecipe.getFluidAndChanceOutputs(fluidTrimLimit); + Pair, List> recipeFluidOutputs = currentRecipe + .getFluidAndChanceOutputs(fluidTrimLimit); // Add the trimmed fluid outputs builder.chancedFluidOutputs(recipeFluidOutputs.getRight()); builder.fluidOutputs(recipeFluidOutputs.getLeft()); - return builder.build().getResult(); } - public final boolean matches(boolean consumeIfSuccessful, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) { - return matches(consumeIfSuccessful, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs)); + public final boolean matches(boolean consumeIfSuccessful, IItemHandlerModifiable inputs, + IMultipleTankHandler fluidInputs) { + return matches(consumeIfSuccessful, GTUtility.itemHandlerToList(inputs), + GTUtility.fluidHandlerToList(fluidInputs)); } /** @@ -383,7 +399,7 @@ public String toString() { } /////////////////// - // Getters // + // Getters // /////////////////// public List getInputs() { @@ -451,18 +467,17 @@ public List getResultItemOutputs(int recipeTier, int machineTier, Rec public Pair, List> getItemAndChanceOutputs(int outputLimit) { List outputs = new ArrayList<>(); - // Create an entry for the chanced outputs, and initially populate it List chancedOutputs = new ArrayList<>(getChancedOutputs().getChancedEntries()); - // No limiting if (outputLimit == -1) { outputs.addAll(GTUtility.copyStackList(getOutputs())); } // If just the regular outputs would satisfy the outputLimit else if (getOutputs().size() >= outputLimit) { - outputs.addAll(GTUtility.copyStackList(getOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); + outputs.addAll( + GTUtility.copyStackList(getOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); // clear the chanced outputs, as we are only getting regular outputs chancedOutputs.clear(); } @@ -503,7 +518,6 @@ public List getAllItemOutputs() { return recipeOutputs; } - public ChancedOutputList getChancedOutputs() { return chancedOutputs; } @@ -541,18 +555,17 @@ public List getFluidOutputs() { public Pair, List> getFluidAndChanceOutputs(int outputLimit) { List outputs = new ArrayList<>(); - // Create an entry for the chanced outputs, and initially populate it List chancedOutputs = new ArrayList<>(getChancedFluidOutputs().getChancedEntries()); - // No limiting if (outputLimit == -1) { outputs.addAll(GTUtility.copyFluidList(getFluidOutputs())); } // If just the regular outputs would satisfy the outputLimit else if (getOutputs().size() >= outputLimit) { - outputs.addAll(GTUtility.copyFluidList(getFluidOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); + outputs.addAll( + GTUtility.copyFluidList(getFluidOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); // clear the chanced outputs, as we are only getting regular outputs chancedOutputs.clear(); } @@ -678,7 +691,7 @@ public GTRecipeCategory getRecipeCategory() { } /////////////////////////////////////////////////////////// - // Property Helper Methods // + // Property Helper Methods // /////////////////////////////////////////////////////////// public T getProperty(RecipeProperty property, T defaultValue) { return recipePropertyStorage.getRecipePropertyValue(property, defaultValue); @@ -709,11 +722,11 @@ public int getPropertyCount() { } public int getUnhiddenPropertyCount() { - return (int) recipePropertyStorage.getRecipeProperties().stream().filter((property) -> !property.getKey().isHidden()).count(); + return (int) recipePropertyStorage.getRecipeProperties().stream() + .filter((property) -> !property.getKey().isHidden()).count(); } public IRecipePropertyStorage getRecipePropertyStorage() { return recipePropertyStorage; } - } diff --git a/src/main/java/gregtech/api/recipes/RecipeBuilder.java b/src/main/java/gregtech/api/recipes/RecipeBuilder.java index 9de376bd7ca..703bb1a2f13 100644 --- a/src/main/java/gregtech/api/recipes/RecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/RecipeBuilder.java @@ -1,9 +1,5 @@ package gregtech.api.recipes; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.metatileentity.MetaTileEntity; @@ -29,6 +25,7 @@ import gregtech.api.util.ValidationResult; import gregtech.common.ConfigHolder; import gregtech.integration.groovy.GroovyScriptModule; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -36,14 +33,20 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import crafttweaker.CraftTweakerAPI; import org.apache.commons.lang3.builder.ToStringBuilder; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @see Recipe */ @@ -285,7 +288,8 @@ public R inputNBT(Item item, int count, int meta, NBTMatcher matcher, NBTConditi return inputNBT(new GTRecipeItemInput(new ItemStack(item, count, meta)), matcher, condition); } - public R inputNBT(Item item, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, NBTCondition condition) { + public R inputNBT(Item item, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, + NBTCondition condition) { return inputNBT(new GTRecipeItemInput(new ItemStack(item, count, GTValues.W)), matcher, condition); } @@ -297,7 +301,8 @@ public R inputNBT(Block block, int count, NBTMatcher matcher, NBTCondition condi return inputNBT(new GTRecipeItemInput(new ItemStack(block, count)), matcher, condition); } - public R inputNBT(Block block, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, NBTCondition condition) { + public R inputNBT(Block block, int count, @SuppressWarnings("unused") boolean wild, NBTMatcher matcher, + NBTCondition condition) { return inputNBT(new GTRecipeItemInput(new ItemStack(block, count, GTValues.W)), matcher, condition); } @@ -529,7 +534,8 @@ public R chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { return (R) this; } if (0 >= chance || chance > ChancedOutputLogic.getMaxChancedValue()) { - GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", ChancedOutputLogic.getMaxChancedValue(), chance); + GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", + ChancedOutputLogic.getMaxChancedValue(), chance); GTLog.logger.error("Stacktrace:", new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return (R) this; @@ -576,7 +582,8 @@ public R chancedFluidOutput(FluidStack stack, int chance, int tierChanceBoost) { return (R) this; } if (0 >= chance || chance > ChancedOutputLogic.getMaxChancedValue()) { - GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", ChancedOutputLogic.getMaxChancedValue(), chance); + GTLog.logger.error("Chance cannot be less or equal to 0 or more than {}. Actual: {}.", + ChancedOutputLogic.getMaxChancedValue(), chance); GTLog.logger.error("Stacktrace:", new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return (R) this; @@ -657,7 +664,8 @@ public void chancedOutputsMultiply(Recipe chancedOutputsFrom, int numberOfOperat int boost = entry.getChanceBoost(); // Add individual chanced outputs per number of parallel operations performed, to mimic regular recipes. - // This is done instead of simply batching the chanced outputs by the number of parallel operations performed + // This is done instead of simply batching the chanced outputs by the number of parallel operations + // performed for (int i = 0; i < numberOfOperations; i++) { this.chancedOutput(entry.getIngredient().copy(), chance, boost); } @@ -667,7 +675,8 @@ public void chancedOutputsMultiply(Recipe chancedOutputsFrom, int numberOfOperat int boost = entry.getChanceBoost(); // Add individual chanced outputs per number of parallel operations performed, to mimic regular recipes. - // This is done instead of simply batching the chanced outputs by the number of parallel operations performed + // This is done instead of simply batching the chanced outputs by the number of parallel operations + // performed for (int i = 0; i < numberOfOperations; i++) { this.chancedFluidOutput(entry.getIngredient().copy(), chance, boost); } @@ -736,13 +745,11 @@ protected static void multiplyInputsAndOutputs(List newRecipeInpu } }); - recipe.getOutputs().forEach(itemStack -> - outputItems.add(copyItemStackWithCount(itemStack, - itemStack.getCount() * numberOfOperations))); + recipe.getOutputs().forEach(itemStack -> outputItems.add(copyItemStackWithCount(itemStack, + itemStack.getCount() * numberOfOperations))); - recipe.getFluidOutputs().forEach(fluidStack -> - outputFluids.add(copyFluidStackWithAmount(fluidStack, - fluidStack.amount * numberOfOperations))); + recipe.getFluidOutputs().forEach(fluidStack -> outputFluids.add(copyFluidStackWithAmount(fluidStack, + fluidStack.amount * numberOfOperations))); } public int getParallel() { @@ -837,7 +844,8 @@ protected EnumValidationResult validate() { } else if (category.getRecipeMap() != this.recipeMap) { GTLog.logger.error("Cannot apply Category with incompatible RecipeMap", new IllegalArgumentException()); if (isCTRecipe) { - CraftTweakerAPI.logError("Cannot apply Category with incompatible RecipeMap", new IllegalArgumentException()); + CraftTweakerAPI.logError("Cannot apply Category with incompatible RecipeMap", + new IllegalArgumentException()); } recipeStatus = EnumValidationResult.INVALID; } @@ -861,8 +869,10 @@ protected void validateGroovy(GroovyLog.Msg errorMsg) { int maxFluidOutput = recipeMap.getMaxFluidOutputs(); errorMsg.add(inputs.size() > maxInput, () -> getRequiredString(maxInput, inputs.size(), "item input")); errorMsg.add(outputs.size() > maxOutput, () -> getRequiredString(maxOutput, outputs.size(), "item output")); - errorMsg.add(fluidInputs.size() > maxFluidInput, () -> getRequiredString(maxFluidInput, fluidInputs.size(), "fluid input")); - errorMsg.add(fluidOutputs.size() > maxFluidOutput, () -> getRequiredString(maxFluidOutput, fluidOutputs.size(), "fluid output")); + errorMsg.add(fluidInputs.size() > maxFluidInput, + () -> getRequiredString(maxFluidInput, fluidInputs.size(), "fluid input")); + errorMsg.add(fluidOutputs.size() > maxFluidOutput, + () -> getRequiredString(maxFluidOutput, fluidOutputs.size(), "fluid output")); } @Nonnull @@ -897,7 +907,7 @@ public void buildAndRegister() { } /////////////////// - // Getters // + // Getters // /////////////////// public List getInputs() { diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index ec553bb0bb7..eb45f147c3b 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -1,12 +1,5 @@ package gregtech.api.recipes; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.google.common.collect.ImmutableList; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.IMultipleTankHandler; @@ -33,12 +26,7 @@ import gregtech.integration.groovy.GroovyScriptModule; import gregtech.integration.groovy.VirtualizedRecipeMap; import gregtech.modules.GregTechModules; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.SoundEvent; @@ -46,13 +34,24 @@ import net.minecraftforge.fml.common.Optional.Method; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.oredict.OreDictionary; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.google.common.collect.ImmutableList; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.ApiStatus; -import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.*; +import stanhebben.zenscript.annotations.Optional; -import javax.annotation.Nonnegative; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.*; import java.util.function.Consumer; @@ -60,6 +59,10 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.recipe.RecipeMap") @ZenRegister public class RecipeMap> { @@ -173,15 +176,15 @@ public RecipeMap(@Nonnull String unlocalizedName, this.isHidden = isHidden; defaultRecipeBuilder.setRecipeMap(this); - defaultRecipeBuilder.category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); + defaultRecipeBuilder + .category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); this.recipeBuilderSample = defaultRecipeBuilder; RECIPE_MAP_REGISTRY.put(unlocalizedName, this); - this.grsVirtualizedRecipeMap = GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) - ? new VirtualizedRecipeMap(this) : null; + this.grsVirtualizedRecipeMap = GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) ? + new VirtualizedRecipeMap(this) : null; } - @ZenMethod public static List> getRecipeMaps() { return ImmutableList.copyOf(RECIPE_MAP_REGISTRY.values()); @@ -206,7 +209,10 @@ public static void setFoundInvalidRecipe(boolean foundInvalidRecipe) { OrePrefix currentOrePrefix = OrePrefix.getCurrentProcessingPrefix(); if (currentOrePrefix != null) { Material currentMaterial = OrePrefix.getCurrentMaterial(); - GTLog.logger.error("Error happened during processing ore registration of prefix {} and material {}. " + "Seems like cross-mod compatibility issue. Report to GTCEu github.", currentOrePrefix, currentMaterial); + GTLog.logger.error( + "Error happened during processing ore registration of prefix {} and material {}. " + + "Seems like cross-mod compatibility issue. Report to GTCEu github.", + currentOrePrefix, currentMaterial); } } @@ -217,7 +223,8 @@ public RecipeMap setProgressBar(TextureArea progressBar, MoveType moveType) { } public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, TextureArea slotOverlay) { - return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, slotOverlay); + return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, + slotOverlay); } public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, TextureArea slotOverlay) { @@ -374,10 +381,12 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< int amount = recipe.getInputs().size(); if (amount > getMaxInputs()) { - GTLog.logger.error("Invalid amount of recipe inputs. Actual: {}. Should be at most {}.", amount, getMaxInputs()); + GTLog.logger.error("Invalid amount of recipe inputs. Actual: {}. Should be at most {}.", amount, + getMaxInputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Inputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe inputs. Actual: %s. Should be at most %s.", amount, getMaxInputs())); + CraftTweakerAPI.logError(String.format( + "Invalid amount of recipe inputs. Actual: %s. Should be at most %s.", amount, getMaxInputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Inputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -385,10 +394,13 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getOutputs().size() + recipe.getChancedOutputs().getChancedEntries().size(); if (amount > getMaxOutputs()) { - GTLog.logger.error("Invalid amount of recipe outputs. Actual: {}. Should be at most {}.", amount, getMaxOutputs()); + GTLog.logger.error("Invalid amount of recipe outputs. Actual: {}. Should be at most {}.", amount, + getMaxOutputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Outputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe outputs. Actual: %s. Should be at most %s.", amount, getMaxOutputs())); + CraftTweakerAPI + .logError(String.format("Invalid amount of recipe outputs. Actual: %s. Should be at most %s.", + amount, getMaxOutputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Outputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -396,10 +408,13 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getFluidInputs().size(); if (amount > getMaxFluidInputs()) { - GTLog.logger.error("Invalid amount of recipe fluid inputs. Actual: {}. Should be at most {}.", amount, getMaxFluidInputs()); + GTLog.logger.error("Invalid amount of recipe fluid inputs. Actual: {}. Should be at most {}.", amount, + getMaxFluidInputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Inputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe fluid inputs. Actual: %s. Should be at most %s.", amount, getMaxFluidInputs())); + CraftTweakerAPI.logError( + String.format("Invalid amount of recipe fluid inputs. Actual: %s. Should be at most %s.", + amount, getMaxFluidInputs())); CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Inputs")); } recipeStatus = EnumValidationResult.INVALID; @@ -407,11 +422,15 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< amount = recipe.getFluidOutputs().size() + recipe.getChancedFluidOutputs().getChancedEntries().size(); if (amount > getMaxFluidOutputs()) { - GTLog.logger.error("Invalid amount of recipe fluid outputs. Actual: {}. Should be at most {}.", amount, getMaxFluidOutputs()); + GTLog.logger.error("Invalid amount of recipe fluid outputs. Actual: {}. Should be at most {}.", amount, + getMaxFluidOutputs()); GTLog.logger.error("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Outputs")); if (recipe.getIsCTRecipe()) { - CraftTweakerAPI.logError(String.format("Invalid amount of recipe fluid outputs. Actual: %s. Should be at most %s.", amount, getMaxFluidOutputs())); - CraftTweakerAPI.logError("Stacktrace:", new IllegalArgumentException("Invalid number of Fluid Outputs")); + CraftTweakerAPI.logError( + String.format("Invalid amount of recipe fluid outputs. Actual: %s. Should be at most %s.", + amount, getMaxFluidOutputs())); + CraftTweakerAPI.logError("Stacktrace:", + new IllegalArgumentException("Invalid number of Fluid Outputs")); } recipeStatus = EnumValidationResult.INVALID; } @@ -446,9 +465,11 @@ public Recipe findRecipe(long voltage, List inputs, List * @return the Recipe it has found or null for no matching Recipe */ @Nullable - public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, boolean exactVoltage) { + public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, + boolean exactVoltage) { final List items = inputs.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList()); - final List fluids = fluidInputs.stream().filter(f -> f != null && f.amount != 0).collect(Collectors.toList()); + final List fluids = fluidInputs.stream().filter(f -> f != null && f.amount != 0) + .collect(Collectors.toList()); return find(items, fluids, recipe -> { if (exactVoltage && recipe.getEUt() != voltage) { @@ -471,7 +492,8 @@ public Recipe findRecipe(long voltage, final List inputs, final List< * @return a List of Lists of AbstractMapIngredients used for finding recipes */ @Nullable - protected List> prepareRecipeFind(@Nonnull Collection items, @Nonnull Collection fluids) { + protected List> prepareRecipeFind(@Nonnull Collection items, + @Nonnull Collection fluids) { // First, check if items and fluids are valid. if (items.size() == Integer.MAX_VALUE || fluids.size() == Integer.MAX_VALUE) { return null; @@ -499,7 +521,8 @@ protected List> prepareRecipeFind(@Nonnull Collectio * @return the recipe found */ @Nullable - public Recipe find(@Nonnull Collection items, @Nonnull Collection fluids, @Nonnull Predicate canHandle) { + public Recipe find(@Nonnull Collection items, @Nonnull Collection fluids, + @Nonnull Predicate canHandle) { List> list = prepareRecipeFind(items, fluids); // couldn't build any inputs to use for search, so no recipe could be found if (list == null) return null; @@ -621,7 +644,8 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List canHandle.test(potentialRecipe) ? potentialRecipe : null, - potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, count, skip)); + potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, + count, skip)); if (r != null) { return r; } @@ -642,8 +666,10 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List> ingredients, @Nonnull Branch map, - @Nonnull Predicate canHandle, int currentIndex, int count, long skip) { + private Recipe diveIngredientTreeFindRecipe(@Nonnull List> ingredients, + @Nonnull Branch map, + @Nonnull Predicate canHandle, int currentIndex, int count, + long skip) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -653,7 +679,8 @@ private Recipe diveIngredientTreeFindRecipe(@Nonnull List findRecipeCollisions(Collection items, Collection< * @param collidingRecipes the list to store recipe collisions */ private void recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch branchRoot, @Nonnull Set collidingRecipes) { + @Nonnull Branch branchRoot, + @Nonnull Set collidingRecipes) { // Try each ingredient as a starting point, adding it to the skip-list. // The skip-list is a packed long, where each 1 bit represents an index to skip for (int i = 0; i < ingredients.size(); i++) { @@ -722,7 +750,8 @@ private Recipe recurseIngredientTreeFindRecipeCollisions(@Nonnull List recipe, - right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, collidingRecipes)); + right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, + collidingRecipes)); if (r != null) { collidingRecipes.add(r); } @@ -744,7 +773,8 @@ private Recipe recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch map, int currentIndex, int count, long skip, @Nonnull Set collidingRecipes) { + @Nonnull Branch map, int currentIndex, int count, long skip, + @Nonnull Set collidingRecipes) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -754,7 +784,8 @@ private Recipe diveIngredientTreeFindRecipeCollisions(@Nonnull List itemSlotsToLeft * itemSlotsToDown) { itemSlotsToDown = itemSlotsToLeft; } } - return new int[]{itemSlotsToLeft, itemSlotsToDown}; + return new int[] { itemSlotsToLeft, itemSlotsToDown }; } /** @@ -907,6 +952,7 @@ private VirtualizedRecipeMap getGroovyScriptRecipeMap() { /** * This height is used to determine Y position to start drawing info on JEI. + * * @deprecated remove overrides, this method is no longer used in any way. */ @Deprecated @@ -924,7 +970,8 @@ public int getPropertyListHeight(Recipe recipe) { * @param index where in the ingredients list we are. * @param count how many branches were added already. */ - private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, @Nonnull List> ingredients, + private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, + @Nonnull List> ingredients, @Nonnull Branch branchMap, int index, int count) { if (count >= ingredients.size()) return true; if (index >= ingredients.size()) { @@ -951,19 +998,25 @@ private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, @Nonnull List recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), count + 1)) + .filter(m -> recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), + count + 1)) .isPresent(); if (!addedNextBranch) { @@ -1062,7 +1118,8 @@ protected static Map> determineRoo * @param list the list of MapIngredients to add to * @param fluidInputs the GTRecipeInputs to convert */ - protected void buildFromRecipeFluids(@Nonnull List> list, @Nonnull List fluidInputs) { + protected void buildFromRecipeFluids(@Nonnull List> list, + @Nonnull List fluidInputs) { for (GTRecipeInput fluidInput : fluidInputs) { AbstractMapIngredient ingredient = new MapFluidIngredient(fluidInput); retrieveCachedIngredient(list, ingredient, fluidIngredientRoot); @@ -1076,7 +1133,8 @@ protected void buildFromRecipeFluids(@Nonnull List> * @param defaultIngredient the ingredient to use as a default value, if not cached * @param cache the ingredient root to retrieve from */ - protected static void retrieveCachedIngredient(@Nonnull List> list, @Nonnull AbstractMapIngredient defaultIngredient, + protected static void retrieveCachedIngredient(@Nonnull List> list, + @Nonnull AbstractMapIngredient defaultIngredient, @Nonnull WeakHashMap> cache) { WeakReference cached = cache.get(defaultIngredient); if (cached != null && cached.get() != null) { @@ -1093,7 +1151,8 @@ protected static void retrieveCachedIngredient(@Nonnull List> list, @Nonnull Iterable ingredients) { + protected void buildFromFluidStacks(@Nonnull List> list, + @Nonnull Iterable ingredients) { for (FluidStack t : ingredients) { list.add(Collections.singletonList(new MapFluidIngredient(t))); } @@ -1107,7 +1166,8 @@ protected void buildFromFluidStacks(@Nonnull List> l */ @Nonnull protected List> fromRecipe(@Nonnull Recipe r) { - List> list = new ObjectArrayList<>((r.getInputs().size()) + r.getFluidInputs().size()); + List> list = new ObjectArrayList<>( + (r.getInputs().size()) + r.getFluidInputs().size()); if (r.getInputs().size() > 0) { buildFromRecipeItems(list, uniqueIngredientsList(r.getInputs())); } @@ -1131,7 +1191,8 @@ protected void buildFromRecipeItems(List> list, @Non this.hasOreDictedInputs = true; if (r.hasNBTMatchingCondition()) { hasNBTMatcherInputs = true; - ingredient = new MapOreDictNBTIngredient(r.getOreDict(), r.getNBTMatcher(), r.getNBTMatchingCondition()); + ingredient = new MapOreDictNBTIngredient(r.getOreDict(), r.getNBTMatcher(), + r.getNBTMatchingCondition()); } else { ingredient = new MapOreDictIngredient(r.getOreDict()); } @@ -1169,7 +1230,8 @@ protected void buildFromRecipeItems(List> list, @Non * @param list the list to populate * @param ingredients the ingredients to convert */ - protected void buildFromItemStacks(@Nonnull List> list, @Nonnull ItemStack[] ingredients) { + protected void buildFromItemStacks(@Nonnull List> list, + @Nonnull ItemStack[] ingredients) { AbstractMapIngredient ingredient; for (ItemStack stack : ingredients) { int meta = stack.getMetadata(); @@ -1203,19 +1265,21 @@ protected void buildFromItemStacks(@Nonnull List> li } protected RecipeMap setSpecialTexture(int x, int y, int width, int height, TextureArea area) { - this.specialTexturePosition = new int[]{x, y, width, height}; + this.specialTexturePosition = new int[] { x, y, width, height }; this.specialTexture = area; return this; } protected ModularUI.Builder addSpecialTexture(ModularUI.Builder builder) { - builder.image(specialTexturePosition[0], specialTexturePosition[1], specialTexturePosition[2], specialTexturePosition[3], specialTexture); + builder.image(specialTexturePosition[0], specialTexturePosition[1], specialTexturePosition[2], + specialTexturePosition[3], specialTexture); return builder; } public Collection getRecipeList() { ObjectOpenHashSet recipes = new ObjectOpenHashSet<>(); - return lookup.getRecipes(true).filter(recipes::add).sorted(RECIPE_DURATION_THEN_EU).collect(Collectors.toList()); + return lookup.getRecipes(true).filter(recipes::add).sorted(RECIPE_DURATION_THEN_EU) + .collect(Collectors.toList()); } public SoundEvent getSound() { @@ -1225,9 +1289,12 @@ public SoundEvent getSound() { @ZenMethod("findRecipe") @Method(modid = GTValues.MODID_CT) @Nullable - public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { - List mcItemInputs = itemInputs == null ? Collections.emptyList() : Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList()); - List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList()); + public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, + @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { + List mcItemInputs = itemInputs == null ? Collections.emptyList() : + Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList()); + List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : + Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList()); Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, true); return backingRecipe == null ? null : new CTRecipe(this, backingRecipe); } @@ -1265,7 +1332,9 @@ public R recipeBuilder() { * @param branchMap the current branch in the recursion. */ @Nullable - private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonnull List> ingredients, @Nonnull Branch branchMap, int depth) { + private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, + @Nonnull List> ingredients, + @Nonnull Branch branchMap, int depth) { // for every ingredient for (List current : ingredients) { // for all possibilities as keys @@ -1280,7 +1349,8 @@ private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonn // if there is a recipe (left mapping), return it immediately as found // otherwise, recurse and go to the next branch. Do so by omitting the current ingredient. Recipe r = result.map(potentialRecipe -> potentialRecipe, - potentialBranch -> recurseIngredientTreeRemove(recipeToRemove, ingredients.subList(1, ingredients.size()), potentialBranch, depth + 1)); + potentialBranch -> recurseIngredientTreeRemove(recipeToRemove, + ingredients.subList(1, ingredients.size()), potentialBranch, depth + 1)); if (r == recipeToRemove) { found = r; } else { @@ -1290,7 +1360,8 @@ private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, @Nonn this.unlocalizedName, CTRecipeHelper.getRecipeRemoveLine(this, recipeToRemove))); } if (ConfigHolder.misc.debug || GTValues.isDeobfEnvironment()) { - GTLog.logger.warn("Failed to remove recipe from RecipeMap {}. See next lines for details", this.unlocalizedName); + GTLog.logger.warn("Failed to remove recipe from RecipeMap {}. See next lines for details", + this.unlocalizedName); GTLog.logger.warn("Failed to remove Recipe: {}", recipeToRemove.toString()); } } @@ -1376,7 +1447,8 @@ public void setMaxFluidOutputs(@Nonnegative int maxFluidOutputs) { if (modifyFluidOutputs) { this.maxFluidOutputs = Math.max(this.maxFluidOutputs, maxFluidOutputs); } else { - throw new UnsupportedOperationException("Cannot change max fluid output amount for " + getUnlocalizedName()); + throw new UnsupportedOperationException( + "Cannot change max fluid output amount for " + getUnlocalizedName()); } } diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index 28daab475b7..cd222d4105b 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -1,6 +1,5 @@ package gregtech.api.recipes; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.widgets.ProgressWidget; @@ -13,8 +12,11 @@ import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.util.AssemblyLineManager; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenProperty; @@ -36,213 +38,239 @@ public class RecipeMaps { /** * Example: + * *

-     * 	 	RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Tin)
-     * 			    .input(OrePrefix.ingot, Materials.Copper, 3)
-     * 			    .output(OrePrefix.ingot, Materials.Bronze, 4)
-     * 				.duration(600)
-     * 				.EUt(5)
-     * 				.buildAndRegister();
+     * RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Tin)
+     *         .input(OrePrefix.ingot, Materials.Copper, 3)
+     *         .output(OrePrefix.ingot, Materials.Bronze, 4)
+     *         .duration(600)
+     *         .EUt(5)
+     *         .buildAndRegister();
      * 
* * This is a relatively simple example for creating Bronze. * Note that the use of OrePrefix ensures that OreDictionary Entries are used for the recipe. */ @ZenProperty - public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 2, 1, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 	 	RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 			    .output(OrePrefix.ingot, Materials.WroughtIron)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .output(OrePrefix.ingot, Materials.WroughtIron)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
* - * The Arc Furnace has a special action that is performed when the recipe is built, designated by the onRecipeBuild - * call on the Recipe Map. This action checks that there are no fluid inputs supplied for the recipe, and if true adds - * Oxygen equal to the recipe duration. This behavior can be negated by supplying your own fluid to the recipe, such as + * The Arc Furnace has a special action that is performed when the recipe is built, designated by the + * onRecipeBuild + * call on the Recipe Map. This action checks that there are no fluid inputs supplied for the recipe, and if true + * adds + * Oxygen equal to the recipe duration. This behavior can be negated by supplying your own fluid to the recipe, such + * as * *
-     * 	 	RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 			    .fluidInputs(Materials.Water.getFluid(100))
-     * 			    .output(OrePrefix.ingot, Materials.WroughtIron)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .fluidInputs(Materials.Water.getFluid(100))
+     *         .output(OrePrefix.ingot, Materials.WroughtIron)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); - } - }); + public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); + } + }); /** * Example: + * *
-     *      RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder()
-     *               .circuitMeta(2)
-     *               .inputs(new ItemStack(Items.COAL, 1, GTValues.W))
-     *               .input(OrePrefix.stick, Materials.Wood, 1)
-     *               .outputs(new ItemStack(Blocks.TORCH, 4))
-     *               .duration(100).EUt(1).buildAndRegister();
+     * RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder()
+     *         .circuitMeta(2)
+     *         .inputs(new ItemStack(Items.COAL, 1, GTValues.W))
+     *         .input(OrePrefix.stick, Materials.Wood, 1)
+     *         .outputs(new ItemStack(Blocks.TORCH, 4))
+     *         .duration(100).EUt(1).buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 9, 1, 1, 0, new AssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.fluidInputs.size() == 1 && recipeBuilder.fluidInputs.get(0).getInputFluidStack().getFluid() == Materials.SolderingAlloy.getFluid()) { - int amount = recipeBuilder.fluidInputs.get(0).getInputFluidStack().amount; - - recipeBuilder.copy().clearFluidInputs().fluidInputs(Materials.Tin.getFluid(amount * 2)).buildAndRegister(); - } - - if (recipeBuilder.isWithRecycling()) { - // ignore input fluids for recycling - ItemStack outputStack = recipeBuilder.getOutputs().get(0); - ItemMaterialInfo info = RecyclingHandler.getRecyclingIngredients(recipeBuilder.getInputs(), outputStack.getCount()); - if (info != null) { - OreDictUnifier.registerOre(outputStack, info); - } - } - }); + public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 9, 1, 1, 0, + new AssemblerRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.fluidInputs.size() == 1 && + recipeBuilder.fluidInputs.get(0).getInputFluidStack().getFluid() == + Materials.SolderingAlloy.getFluid()) { + int amount = recipeBuilder.fluidInputs.get(0).getInputFluidStack().amount; + + recipeBuilder.copy().clearFluidInputs().fluidInputs(Materials.Tin.getFluid(amount * 2)) + .buildAndRegister(); + } + + if (recipeBuilder.isWithRecycling()) { + // ignore input fluids for recycling + ItemStack outputStack = recipeBuilder.getOutputs().get(0); + ItemMaterialInfo info = RecyclingHandler.getRecyclingIngredients(recipeBuilder.getInputs(), + outputStack.getCount()); + if (info != null) { + OreDictUnifier.registerOre(outputStack, info); + } + } + }); /** * Example: + * *
-     *      RecipeMaps.ASSEMBLY_LINE_RECIPES.recipeBuilder()
-     *               .input(OrePrefix.stickLong, Materials.SamariumMagnetic)
-     *               .input(OrePrefix.stickLong, Materials.HSSS, 2)
-     *               .input(OrePrefix.ring, Materials.HSSS, 2)
-     *               .input(OrePrefix.round, Materials.HSSS, 4)
-     *               .input(OrePrefix.wireFine, Materials.Ruridit, 64)
-     *               .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2)
-     *               .fluidInputs(Materials.SolderingAlloy.getFluid(GTValues.L))
-     *               .fluidInputs(Materials.Lubricant.getFluid(250))
-     *               .output(MetaItems.ELECTRIC_MOTOR_LuV)
-     *               .duration(600).EUt(6000).buildAndRegister();
+     * RecipeMaps.ASSEMBLY_LINE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.stickLong, Materials.SamariumMagnetic)
+     *         .input(OrePrefix.stickLong, Materials.HSSS, 2)
+     *         .input(OrePrefix.ring, Materials.HSSS, 2)
+     *         .input(OrePrefix.round, Materials.HSSS, 4)
+     *         .input(OrePrefix.wireFine, Materials.Ruridit, 64)
+     *         .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2)
+     *         .fluidInputs(Materials.SolderingAlloy.getFluid(GTValues.L))
+     *         .fluidInputs(Materials.Lubricant.getFluid(250))
+     *         .output(MetaItems.ELECTRIC_MOTOR_LuV)
+     *         .duration(600).EUt(6000).buildAndRegister();
      * 
* * The Assembly Line Recipe Builder has no special properties/build actions yet, but will in the future */ @ZenProperty - public static final RecipeMap ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>("assembly_line", 16, false, 1, false, 4, false, 1, false, new AssemblyLineRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(AssemblyLineManager::createDefaultResearchRecipe); + public static final RecipeMap ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>( + "assembly_line", 16, false, 1, false, 4, false, 1, false, new AssemblyLineRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(AssemblyLineManager::createDefaultResearchRecipe); /** * Example: + * *
-     * 	 	RecipeMap.AUTOCLAVE_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Carbon, 16))
-     * 				.fluidInputs(Materials.Lutetium.getFluid(4))
-     * 				.chancedOutput(MetaItems.CARBON_FIBERS.getStackForm(2), 3333, 1000)
-     * 				.duration(600)
-     * 				.EUt(5)
-     * 				.buildAndRegister();
+     * RecipeMap.AUTOCLAVE_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Carbon, 16))
+     *         .fluidInputs(Materials.Lutetium.getFluid(4))
+     *         .chancedOutput(MetaItems.CARBON_FIBERS.getStackForm(2), 3333, 1000)
+     *         .duration(600)
+     *         .EUt(5)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 2, 2, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 2, 2, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 		RecipeMap.BENDER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.plate, Materials.Tin, 12)
-     * 			    .circuitMeta(4)
-     * 				.outputs(MetaItems.FLUID_CELL.getStackForm(4))
-     * 				.duration(1200)
-     * 				.EUt(8)
-     * 				.buildAndRegister();
+     * RecipeMap.BENDER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.plate, Materials.Tin, 12)
+     *         .circuitMeta(4)
+     *         .outputs(MetaItems.FLUID_CELL.getStackForm(4))
+     *         .duration(1200)
+     *         .EUt(8)
+     *         .buildAndRegister();
      * 
* * Just like other SimpleRecipeBuilder RecipeMaps, circuit can be used to easily set a circuit */ @ZenProperty - public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MOTOR); + public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MOTOR); /** * Example: + * *
-     * 	    RecipeMap.BLAST_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Glass), OreDictUnifier.get(OrePrefix.dust, Materials.Carbon))
-     * 				.fluidInputs(Materials.Electrum.getFluid(16))
-     * 				.outputs(ItemList.Circuit_Board_Fiberglass.get(16))
-     * 				.duration(80)
-     * 				.EUt(480)
-     * 				.blastFurnaceTemp(2600)
-     * 				.buildAndRegister();
+     * RecipeMap.BLAST_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Glass),
+     *                 OreDictUnifier.get(OrePrefix.dust, Materials.Carbon))
+     *         .fluidInputs(Materials.Electrum.getFluid(16))
+     *         .outputs(ItemList.Circuit_Board_Fiberglass.get(16))
+     *         .duration(80)
+     *         .EUt(480)
+     *         .blastFurnaceTemp(2600)
+     *         .buildAndRegister();
      * 
* * The Electric Blast Furnace requires specification of a blast furnace temperature through the builder call of * blastFurnaceTemp. This value will set the temperature required for the recipe to run, restricting recipes * to certain coils. * - * Anything with a Blast Furnace Temperature of greater than 1750K will also autogenerate a hot ingot and a hot ingot + * Anything with a Blast Furnace Temperature of greater than 1750K will also autogenerate a hot ingot and a hot + * ingot * cooling recipe. */ @ZenProperty - public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 3, 3, 1, 1, new BlastRecipeBuilder(), false) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 3, 3, 1, + 1, new BlastRecipeBuilder(), false) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     *      RecipeMap.BREWING_RECIPES.recipeBuilder()
-     *         		.input(MetaItems.BIO_CHAFF)
-     *         		.fluidInput(Materials.Water.getFluid(750))
-     *         		.fluidOutput(Materials.Biomass.getFluid(750))
-     *         	    .duration(128).EUt(4)
-     *         		.buildAndRegister();
+     * RecipeMap.BREWING_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BIO_CHAFF)
+     *         .fluidInput(Materials.Water.getFluid(750))
+     *         .fluidOutput(Materials.Biomass.getFluid(750))
+     *         .duration(128).EUt(4)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Brewery not specifying a duration value will default to 128. * Any Recipe added to the Brewery not specifying an EUt value will default 4. */ @ZenProperty - public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 0, 1, 1, new SimpleRecipeBuilder().duration(128).EUt(4), false) - .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 0, 1, 1, + new SimpleRecipeBuilder().duration(128).EUt(4), false) + .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     *       RecipeMap.CANNER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.BATTERY_HULL_LV)
-     * 			    .input(OrePrefix.dust, Materials.Cadmium, 2)
-     * 				.outputs(MetaItems.BATTERY_LV_CADMIUM)
-     * 				.duration(100)
-     * 				.EUt(2)
-     * 				.buildAndRegister();
+     * RecipeMap.CANNER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BATTERY_HULL_LV)
+     *         .input(OrePrefix.dust, Materials.Cadmium, 2)
+     *         .outputs(MetaItems.BATTERY_LV_CADMIUM)
+     *         .duration(100)
+     *         .EUt(2)
+     *         .buildAndRegister();
      * 
* * The Canner combines the functionality of the item canning machine and the former fluid canning machine. @@ -250,25 +278,27 @@ public class RecipeMaps { * It will empty or fill any fluid handler, so there is no need to add explicit recipes for the fluid handlers. */ @ZenProperty - public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner", 2, 2, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BATH); + public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner", 2, 2, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BATH); /** * Examples: + * *
-     * 		RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.ImpureNaquadriaSolution.getFluid(2000))
-     * 				.output(OrePrefix.dust, Materials.IndiumPhosphide)
-     * 			    .output(OrePrefix.dust, Materials.AntimonyTrifluoride, 2)
-     * 			    .fluidOutputs(Materials.NaquadriaSolution.getFluid(1000))
-     * 				.duration(400).EUt(GTValues.VA[GTValues.EV])
-     * 				.buildAndRegister();
+     * RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.ImpureNaquadriaSolution.getFluid(2000))
+     *         .output(OrePrefix.dust, Materials.IndiumPhosphide)
+     *         .output(OrePrefix.dust, Materials.AntimonyTrifluoride, 2)
+     *         .fluidOutputs(Materials.NaquadriaSolution.getFluid(1000))
+     *         .duration(400).EUt(GTValues.VA[GTValues.EV])
+     *         .buildAndRegister();
      *
      * 
* @@ -278,34 +308,38 @@ public class RecipeMaps { * Any Centrifuge recipe not specifying an EUt value will have the value default to 5. */ @ZenProperty - public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMap<>("centrifuge", 2, 6, 1, 6, new SimpleRecipeBuilder().EUt(5), false) - .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CENTRIFUGE); + public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMap<>("centrifuge", 2, 6, 1, 6, + new SimpleRecipeBuilder().EUt(5), false) + .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CENTRIFUGE); /** * Example: + * *
-     * 		RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.gem, Materials.EnderEye)
-     * 				.fluidInputs(Materials.Radon.getFluid(250))
-     * 				.output(MetaItems.QUANTUM_EYE)
-     * 				.duration(480).EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.gem, Materials.EnderEye)
+     *         .fluidInputs(Materials.Radon.getFluid(250))
+     *         .output(MetaItems.QUANTUM_EYE)
+     *         .duration(480).EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 6, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.BATH); + public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 6, 1, + 1, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) + .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .setSound(GTSoundEvents.BATH); /** * Example: + * *
      *      RecipeMap.CHEMICAL_RECIPES.recipeBuilder()
      * 				.circuitMeta(1))
@@ -327,43 +361,45 @@ public class RecipeMaps {
      * Any recipe added to the Chemical Reactor not specifying an EUt value will default to 30.
      */
     @ZenProperty
-    public static final RecipeMap CHEMICAL_RECIPES = new RecipeMap<>("chemical_reactor", 2, 2, 3, 2, new SimpleRecipeBuilder().EUt(VA[LV]), false)
-            .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1)
-            .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2)
-            .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3)
-            .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4)
-            .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1)
-            .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
-            .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR)
-            .onRecipeBuild(recipeBuilder -> {
-                recipeBuilder.invalidateOnBuildAction();
-                RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder()
-                        .inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
-                        .fluidInputs(recipeBuilder.getFluidInputs())
-                        .outputs(recipeBuilder.getOutputs())
-                        .chancedOutputs(recipeBuilder.getChancedOutputs())
-                        .fluidOutputs(recipeBuilder.getFluidOutputs())
-                        .chancedFluidOutputs(recipeBuilder.getChancedFluidOutputs())
-                        .cleanroom(recipeBuilder.getCleanroom())
-                        .duration(recipeBuilder.duration)
-                        .EUt(recipeBuilder.EUt)
-                        .buildAndRegister();
-            });
+    public static final RecipeMap CHEMICAL_RECIPES = new RecipeMap<>("chemical_reactor", 2, 2, 3,
+            2, new SimpleRecipeBuilder().EUt(VA[LV]), false)
+                    .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1)
+                    .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2)
+                    .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3)
+                    .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4)
+                    .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1)
+                    .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
+                    .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR)
+                    .onRecipeBuild(recipeBuilder -> {
+                        recipeBuilder.invalidateOnBuildAction();
+                        RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder()
+                                .inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
+                                .fluidInputs(recipeBuilder.getFluidInputs())
+                                .outputs(recipeBuilder.getOutputs())
+                                .chancedOutputs(recipeBuilder.getChancedOutputs())
+                                .fluidOutputs(recipeBuilder.getFluidOutputs())
+                                .chancedFluidOutputs(recipeBuilder.getChancedFluidOutputs())
+                                .cleanroom(recipeBuilder.getCleanroom())
+                                .duration(recipeBuilder.duration)
+                                .EUt(recipeBuilder.EUt)
+                                .buildAndRegister();
+                    });
 
     /**
      * Example:
+     * 
      * 
-     *      RecipeMap.CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.BASIC_CIRCUIT_BOARD)
-     * 				.input(MetaItems.INTEGRATED_LOGIC_CIRCUIT)
-     * 			    .input(OrePrefix.component, Component.Resistor, 2)
-     * 				.input(OrePrefix.component, Component.Diode, 2)
-     * 				.input(OrePrefix.wireFine, Materials.Copper, 2)
-     * 			    .input(OrePrefix.bolt, Materials.Tin, 2)
-     * 				.duration(200)
-     * 				.EUt(16)
-     * 				.buildAndRegister();
+     * RecipeMap.CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.BASIC_CIRCUIT_BOARD)
+     *         .input(MetaItems.INTEGRATED_LOGIC_CIRCUIT)
+     *         .input(OrePrefix.component, Component.Resistor, 2)
+     *         .input(OrePrefix.component, Component.Diode, 2)
+     *         .input(OrePrefix.wireFine, Materials.Copper, 2)
+     *         .input(OrePrefix.bolt, Materials.Tin, 2)
+     *         .duration(200)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
* * The Circuit Assembler has a special action that is performed for any recipe added to its recipe map, seen in its @@ -371,68 +407,79 @@ public class RecipeMaps { * in the recipe will automatically have recipes generated using Soldering Alloy and Tin for the input fluids. * * The amount of these fluids is based on the Soldering Multiplier, which is a special addition to the - * Circuit Assembler Recipe Builder. It is called through .solderMultiplier(int multiplier) on the Recipe Builder. + * Circuit Assembler Recipe Builder. It is called through .solderMultiplier(int multiplier) on the Recipe + * Builder. * The Multiplier itself is limited to numbers between 1 and (64000 / 144) inclusive. * * This action can be negated by simply specifying a fluid input in the recipe. */ @ZenProperty - public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMap<>("circuit_assembler", 6, 1, 1, 0, new CircuitAssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - recipeBuilder.copy() - .fluidInputs(Materials.SolderingAlloy.getFluid(Math.max(1, (GTValues.L / 2) * ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))) - .buildAndRegister(); - - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. - // Adding a second call will result in duplicate recipe generation attempts - recipeBuilder.fluidInputs(Materials.Tin.getFluid(Math.max(1, GTValues.L * ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))); - } - }); + public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMap<>( + "circuit_assembler", 6, 1, 1, 0, new CircuitAssemblerRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ASSEMBLER) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + recipeBuilder.copy() + .fluidInputs(Materials.SolderingAlloy.getFluid(Math.max(1, + (GTValues.L / 2) * ((CircuitAssemblerRecipeBuilder) recipeBuilder) + .getSolderMultiplier()))) + .buildAndRegister(); + + // Don't call buildAndRegister as we are mutating the original recipe and already in the + // middle of a buildAndRegister call. + // Adding a second call will result in duplicate recipe generation attempts + recipeBuilder.fluidInputs(Materials.Tin.getFluid(Math.max(1, GTValues.L * + ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))); + } + }); /** * Example: + * *
-     *      RecipeMap.COKE_OVEN_RECIPES.recipeBuilder()
-     *         		.input(OrePrefix.log, Materials.Wood)
-     *         		.output(OrePrefix.gem, Materials.Charcoal)
-     *         	    .fluidOutputs(Materials.Creosote.getFluid(250))
-     *         		.duration(900)
-     *         		.buildAndRegister();
+     * RecipeMap.COKE_OVEN_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.log, Materials.Wood)
+     *         .output(OrePrefix.gem, Materials.Charcoal)
+     *         .fluidOutputs(Materials.Creosote.getFluid(250))
+     *         .duration(900)
+     *         .buildAndRegister();
      * 
* * As a Primitive Machine, the Coke Oven does not need an EUt parameter specified for the Recipe Builder. */ @ZenProperty - public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapCokeOven<>("coke_oven", 1, false, 1, false, 0, false, 1, false, new PrimitiveRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapCokeOven<>("coke_oven", 1, + false, 1, false, 0, false, 1, false, new PrimitiveRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.COMPRESSOR_RECIPES.recipeBuilder()
-     *         		.input(OrePrefix.dust, Materials.Fireclay)
-     *         		.outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm())
-     *         		.duration(80)
-     *         		.EUt(4)
-     *         		.buildAndRegister();
+     * RecipeMap.COMPRESSOR_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.dust, Materials.Fireclay)
+     *         .outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm())
+     *         .duration(80)
+     *         .EUt(4)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Compressor not specifying an EUt value will default to 2. * Any Recipe added to the Compressor not specifying a duration value will default to 200. */ @ZenProperty - public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 0, 0, new SimpleRecipeBuilder().duration(200).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 0, 0, + new SimpleRecipeBuilder().duration(200).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * Example: + * *
      *      RecipeMap.CRACKING_RECIPES.recipeBuilder()
      *              .circuitMeta(1))
@@ -445,22 +492,24 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap CRACKING_RECIPES = new RecipeMapCrackerUnit<>("cracker", 1, true, 0, true, 2, false, 2, true, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap CRACKING_RECIPES = new RecipeMapCrackerUnit<>("cracker", 1, true, + 0, true, 2, false, 2, true, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) + .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.CUTTER_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.LOG, 1, GTValues.W))
-     * 				.outputs(new ItemStack(Blocks.PLANKS), OreDictUnifier.get(OrePrefix.dust, Materials.Wood, 1L))
-     * 				.duration(200)
-     * 				.EUt(8)
-     * 				.buildAndRegister();
+     * RecipeMap.CUTTER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.LOG, 1, GTValues.W))
+     *         .outputs(new ItemStack(Blocks.PLANKS), OreDictUnifier.get(OrePrefix.dust, Materials.Wood, 1L))
+     *         .duration(200)
+     *         .EUt(8)
+     *         .buildAndRegister();
      * 
* * The Cutting Machine has a special action that will be performed when its recipe is built, signified by the @@ -469,267 +518,299 @@ public class RecipeMaps { * * The amount of these fluids used is some arcane formula, probably copied from GT5 * - * To negate this onRecipeBuild action, simply add a fluid input to the recipe passed to the Cutter Recipe Map. + * To negate this onRecipeBuild action, simply add a fluid input to the recipe passed to the Cutter Recipe + * Map. */ @ZenProperty - public static final RecipeMap CUTTER_RECIPES = new RecipeMap<>("cutter", 1, 2, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT) - .onRecipeBuild(recipeBuilder -> { - recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.getFluidInputs().isEmpty()) { - - recipeBuilder - .copy() - .fluidInputs(Materials.Water.getFluid(Math.max(4, Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt / 320)))) - .duration(recipeBuilder.duration * 2) - .buildAndRegister(); - - recipeBuilder - .copy() - .fluidInputs(Materials.DistilledWater.getFluid(Math.max(3, Math.min(750, recipeBuilder.duration * recipeBuilder.EUt / 426)))) - .duration((int) (recipeBuilder.duration * 1.5)) - .buildAndRegister(); - - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. - // Adding a second call will result in duplicate recipe generation attempts - recipeBuilder - .fluidInputs(Materials.Lubricant.getFluid(Math.max(1, Math.min(250, recipeBuilder.duration * recipeBuilder.EUt / 1280)))) - .duration(Math.max(1, recipeBuilder.duration)); - - } - }); + public static final RecipeMap CUTTER_RECIPES = new RecipeMap<>("cutter", 1, 2, 1, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) + .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CUT) + .onRecipeBuild(recipeBuilder -> { + recipeBuilder.invalidateOnBuildAction(); + if (recipeBuilder.getFluidInputs().isEmpty()) { + + recipeBuilder + .copy() + .fluidInputs(Materials.Water.getFluid(Math.max(4, + Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt / 320)))) + .duration(recipeBuilder.duration * 2) + .buildAndRegister(); + + recipeBuilder + .copy() + .fluidInputs(Materials.DistilledWater.getFluid(Math.max(3, + Math.min(750, recipeBuilder.duration * recipeBuilder.EUt / 426)))) + .duration((int) (recipeBuilder.duration * 1.5)) + .buildAndRegister(); + + // Don't call buildAndRegister as we are mutating the original recipe and already in the + // middle of a buildAndRegister call. + // Adding a second call will result in duplicate recipe generation attempts + recipeBuilder + .fluidInputs(Materials.Lubricant.getFluid(Math.max(1, + Math.min(250, recipeBuilder.duration * recipeBuilder.EUt / 1280)))) + .duration(Math.max(1, recipeBuilder.duration)); + + } + }); /** * Examples: + * *
-     * 	    RecipeMap.DISTILLATION_RECIPES.recipeBuilder()
-     * 	        	.fluidInputs(Materials.CoalTar.getFluid(1000))
-     * 	        	.output(OrePrefix.dustSmall, Materials.Coke)
-     * 	        	.fluidOutputs(Materials.Naphthalene.getFluid(400))
-     * 	            .fluidOutputs(Materials.HydrogenSulfide.getFluid(300))
-     * 	            .fluidOutputs(Materials.Creosote.getFluid(200))
-     * 	            .fluidOutputs(Materials.Phenol.getFluid(100))
-     * 	        	.duration(80)
-     * 	        	.EUt(GTValues.VA[GTValues.MV])
-     * 	        	.buildAndRegister();
+     * RecipeMap.DISTILLATION_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.CoalTar.getFluid(1000))
+     *         .output(OrePrefix.dustSmall, Materials.Coke)
+     *         .fluidOutputs(Materials.Naphthalene.getFluid(400))
+     *         .fluidOutputs(Materials.HydrogenSulfide.getFluid(300))
+     *         .fluidOutputs(Materials.Creosote.getFluid(200))
+     *         .fluidOutputs(Materials.Phenol.getFluid(100))
+     *         .duration(80)
+     *         .EUt(GTValues.VA[GTValues.MV])
+     *         .buildAndRegister();
      * 
* - * The Distillation Tower is a special Multiblock, as it will create recipes in the Distillery breaking down its multi- - * fluid output recipes. EG, a recipe in the Distillation tower outputs two different fluids from input fluid A. When - * this recipe is built, 2 separate recipes will be created in the Distillery. One for fluid A into the first output, - * and the second for fluid A into the second output. + * The Distillation Tower is a special Multiblock, as it will create recipes in the Distillery breaking down its + * multi- + * fluid output recipes. EG, a recipe in the Distillation tower outputs two different fluids from input fluid A. + * When + * this recipe is built, 2 separate recipes will be created in the Distillery. One for fluid A into the first + * output, + * and the second for fluid A into the second output. * - * This behavior can be disabled by adding a .disableDistilleryRecipes() onto the recipe builder. + * This behavior can be disabled by adding a .disableDistilleryRecipes() onto the recipe builder. */ @ZenProperty - public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower("distillation_tower", 0, true, 1, true, 1, true, 12, false, new UniversalDistillationRecipeBuilder(), false) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower( + "distillation_tower", 0, true, 1, true, 1, true, 12, false, new UniversalDistillationRecipeBuilder(), false) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     * 	 	RecipeMap.DISTILLERY_RECIPES.recipeBuilder()
-     * 	 			.circuitMeta(1)
-     * 	 			.fluidInputs(Materials.Toluene.getFluid(30))
-     * 	 			.fluidOutputs(Materials.LightFuel.getFluid(30))
-     * 	 			.duration(160)
-     * 	 			.EUt(24)
-     * 	 			.buildAndRegister();
+     * RecipeMap.DISTILLERY_RECIPES.recipeBuilder()
+     *         .circuitMeta(1)
+     *         .fluidInputs(Materials.Toluene.getFluid(30))
+     *         .fluidOutputs(Materials.LightFuel.getFluid(30))
+     *         .duration(160)
+     *         .EUt(24)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap DISTILLERY_RECIPES = new RecipeMap<>("distillery", 1, 1, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap DISTILLERY_RECIPES = new RecipeMap<>("distillery", 1, 1, 1, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BOILER); /** * Examples: + * *
-     * 		RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.SaltWater.getFluid(1000))
-     * 				.output(OrePrefix.dust, Materials.SodiumHydroxide, 3)
-     * 				.fluidOutputs(Materials.Chlorine.getFluid(1000))
-     * 				.fluidOutputs(Materials.Hydrogen.getFluid(1000))
-     * 				.duration(720)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.SaltWater.getFluid(1000))
+     *         .output(OrePrefix.dust, Materials.SodiumHydroxide, 3)
+     *         .fluidOutputs(Materials.Chlorine.getFluid(1000))
+     *         .fluidOutputs(Materials.Hydrogen.getFluid(1000))
+     *         .duration(720)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMap<>("electrolyzer", 2, 6, 1, 6, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMap<>("electrolyzer", 2, 6, 1, + 6, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) + .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     * 	    RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.dustPure, Materials.Aluminium)
-     * 				.outputs(OrePrefix.dust, Materials.Aluminium)
-     * 				.chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 4000, 850)
-     * 				.chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 2000, 600)
-     * 				.duration(200)
-     * 				.EUt(24)
-     * 				.buildAndRegister();
+     * RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.dustPure, Materials.Aluminium)
+     *         .outputs(OrePrefix.dust, Materials.Aluminium)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 4000, 850)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dustSmall, Materials.Aluminium), 2000, 600)
+     *         .duration(200)
+     *         .EUt(24)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>("electromagnetic_separator", 1, 3, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>( + "electromagnetic_separator", 1, 3, 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
-     *      RecipeMap.EXTRACTOR_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(MetaBlocks.RUBBER_LEAVES, 16))
-     * 				.output(OrePrefix.dust, Materials.RawRubber)
-     * 				.duration(300)
-     * 				.buildAndRegister();
+     * RecipeMap.EXTRACTOR_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(MetaBlocks.RUBBER_LEAVES, 16))
+     *         .output(OrePrefix.dust, Materials.RawRubber)
+     *         .duration(300)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Extractor not specifying an EUt value will default to 2. * Any Recipe added to the Extractor not specifying an duration value will default to 400. */ @ZenProperty - public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 1, 1, 0, 1, new SimpleRecipeBuilder().duration(400).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 1, 1, 0, 1, + new SimpleRecipeBuilder().duration(400).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * Example: + * *
-     *      RecipeMap.EXTRUDER_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.BorosilicateGlass)
-     * 				.notConsumable(MetaItems.SHAPE_EXTRUDER_WIRE)
-     * 				.output(OrePrefix.wireFine, Materials.BorosilicateGlass, 8)
-     * 				.duration(160)
-     * 				.EUt(96)
-     * 				.buildAndRegister();
+     * RecipeMap.EXTRUDER_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.BorosilicateGlass)
+     *         .notConsumable(MetaItems.SHAPE_EXTRUDER_WIRE)
+     *         .output(OrePrefix.wireFine, Materials.BorosilicateGlass, 8)
+     *         .duration(160)
+     *         .EUt(96)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
-     *      RecipeMap.FERMENTING_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.Biomass.getFluid(100))
-     * 				.fluidOutputs(Materials.FermentedBiomass.getFluid(100))
-     * 				.duration(150)
-     * 				.buildAndRegister();
+     * RecipeMap.FERMENTING_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.Biomass.getFluid(100))
+     *         .fluidOutputs(Materials.FermentedBiomass.getFluid(100))
+     *         .duration(150)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Fermenter not specifying an EUt value will default to 2. */ @ZenProperty - public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 1, 1, 1, 1, new SimpleRecipeBuilder().EUt(2), false) - .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 1, 1, 1, 1, + new SimpleRecipeBuilder().EUt(2), false) + .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR); /** * Example: + * *
-     * 		RecipeMap.FLUID_HEATER_RECIPES.recipeBuilder()
-     * 				.circuitMeta(1)
-     * 				.fluidInputs(Materials.Water.getFluid(6))
-     * 				.fluidOutputs(Materials.Steam.getFluid(960))
-     * 				.duration(30)
-     * 				.EUt(GTValues.VA[GTValues.LV])
-     * 				.buildAndRegister();
+     * RecipeMap.FLUID_HEATER_RECIPES.recipeBuilder()
+     *         .circuitMeta(1)
+     *         .fluidInputs(Materials.Water.getFluid(6))
+     *         .fluidOutputs(Materials.Steam.getFluid(960))
+     *         .duration(30)
+     *         .EUt(GTValues.VA[GTValues.LV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 0, 1, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 0, 1, + 1, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.BOILER); /** * Example: + * *
-     *  	RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
-     * 				.notConsumable(MetaItems.SHAPE_MOLD_CYLINDER)
-     * 				.fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L / 8))
-     * 				.output(MetaItems.PETRI_DISH, 2)
-     * 				.duration(40)
-     * 				.EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
+     *         .notConsumable(MetaItems.SHAPE_MOLD_CYLINDER)
+     *         .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L / 8))
+     *         .output(MetaItems.PETRI_DISH, 2)
+     *         .duration(40)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", 1, 1, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", + 1, 1, 1, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     *      RecipeMap.FORGE_HAMMER_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.STONE))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(16)
-     * 				.EUt(10)
-     * 				.buildAndRegister();
+     * RecipeMap.FORGE_HAMMER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.STONE))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(16)
+     *         .EUt(10)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) - .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) - .setSound(GTSoundEvents.FORGE_HAMMER); + public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) + .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) + .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) + .setSound(GTSoundEvents.FORGE_HAMMER); /** * Example: + * *
-     *      RecipeMap.FORMING_PRESS_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.STONE))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(16)
-     * 				.EUt(10)
-     * 				.buildAndRegister();
+     * RecipeMap.FORMING_PRESS_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.STONE))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(16)
+     *         .EUt(10)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress("forming_press", 6, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMPRESSOR); + public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress( + "forming_press", 6, 1, 0, 0, new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMPRESSOR); /** * * Example: + * *
-     * 		RecipeMap.FURNACE_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.SAND))
-     * 				.outputs(new ItemStack(Blocks.COBBLESTONE))
-     * 				.duration(128)
-     * 				.EUt(4)
-     * 				.buildAndRegister();
+     * RecipeMap.FURNACE_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.SAND))
+     *         .outputs(new ItemStack(Blocks.COBBLESTONE))
+     *         .duration(128)
+     *         .EUt(4)
+     *         .buildAndRegister();
      * 
* * When looking up recipes from the GTCEu Furnaces, they will first check the Vanilla Furnace Recipe list, therefore @@ -740,24 +821,27 @@ public class RecipeMaps { * Recipe List, so any recipes added will be exclusive to the GTCEu Furnaces. */ @ZenProperty - public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, + 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FURNACE); /** * Example: + * *
-     * 		RecipeMap.FUSION_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Materials.Lithium.getFluid(16), Materials.Tungsten.getFluid(16))
-     * 				.fluidOutputs(Materials.Iridium.getFluid(16))
-     * 				.duration(32)
-     * 				.EUt(GTValues.VA[GTValues.LuV])
-     * 				.EUToStart(300000000)
-     * 				.buildAndRegister();
+     * RecipeMap.FUSION_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.Lithium.getFluid(16), Materials.Tungsten.getFluid(16))
+     *         .fluidOutputs(Materials.Iridium.getFluid(16))
+     *         .duration(32)
+     *         .EUt(GTValues.VA[GTValues.LuV])
+     *         .EUToStart(300000000)
+     *         .buildAndRegister();
      * 
* - * The Fusion Reactor requires an EUToStart call, which is used to gate recipes behind requiring different tier + * The Fusion Reactor requires an EUToStart call, which is used to gate recipes behind requiring different + * tier * Fusion Reactors. This value must be greater than 0. * * The Breakpoints for this value currently are: @@ -766,65 +850,74 @@ public class RecipeMaps { * MK3: 320MEU - 640MEU */ @ZenProperty - public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 2, 1, new FusionRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 2, 1, + new FusionRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); @ZenProperty - public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, 0, 0, 1, new GasCollectorRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, + 0, 0, 1, new GasCollectorRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) + .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     *      RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
-     *         		.input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
-     *         		.explosivesAmount(8)
-     *         		.outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
-     *         	    .duration(400)
-     *         	    .EUt(GTValues.VA[GTValues.HV])
-     *         		.buildAndRegister();
+     * RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
+     *         .input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
+     *         .explosivesAmount(8)
+     *         .outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
+     *         .duration(400)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* *
-     *      RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
-     *         		.input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
-     *         		.explosivesType(MetaItems.DYNAMITE.getStackForm(4))
-     *         		.outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
-     *         	    .duration(400)
-     *         	    .EUt(GTValues.VA[GTValues.HV])
-     *         		.buildAndRegister();
+     * RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
+     *         .input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
+     *         .explosivesType(MetaItems.DYNAMITE.getStackForm(4))
+     *         .outputs(OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh, 4))
+     *         .duration(400)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * The Implosion Compressor can specify explosives used for its recipes in two different ways. The first is using - * explosivesAmount(int amount), which will generate a recipe using TNT as the explosive, with the count of TNT + * explosivesAmount(int amount), which will generate a recipe using TNT as the explosive, with the count of + * TNT * being the passed amount. Note that this must be between 1 and 64 inclusive. * - * The second method is to use explosivesType(ItemStack item). In this case, the passed ItemStack will be used + * The second method is to use explosivesType(ItemStack item). In this case, the passed ItemStack will be + * used * as the explosive, with the number of explosives being the count of the passed ItemStack. * Note that the count must be between 1 and 64 inclusive */ @ZenProperty - public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 3, 2, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(VA[LV]), false) - .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) - .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSound(SoundEvents.ENTITY_GENERIC_EXPLODE); + public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 3, + 2, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(VA[LV]), false) + .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) + .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setSound(SoundEvents.ENTITY_GENERIC_EXPLODE); /** * Example: + * *
-     *      RecipeMap.LARGE_CHEMICAL_RECIPES.recipeBuilder()
-     * 			    .fluidInputs(Materials.NitrogenDioxide.getFluid(4000))
-     * 			    .fluidInputs(Materials.Oxygen.getFluid(1000))
-     * 				.fluidInputs(Materials.Water.getFluid(2000))
-     * 				.fluidOutputs(Materials.NitricAcid.getFluid(4000))
-     * 				.duration(950)
-     * 				.EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.LARGE_CHEMICAL_RECIPES.recipeBuilder()
+     *         .fluidInputs(Materials.NitrogenDioxide.getFluid(4000))
+     *         .fluidInputs(Materials.Oxygen.getFluid(1000))
+     *         .fluidInputs(Materials.Water.getFluid(2000))
+     *         .fluidOutputs(Materials.NitricAcid.getFluid(4000))
+     *         .duration(950)
+     *         .EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * Note that any recipes added to the Large Chemical Reactor recipe map will be exclusive to the LCR, unlike @@ -833,91 +926,99 @@ public class RecipeMaps { * Any Recipe added to the Large Chemical Reactor not specifying an EUt value will default to 30. */ @ZenProperty - public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMap<>("large_chemical_reactor", 3, 3, 5, 4, new SimpleRecipeBuilder().EUt(VA[LV]), false) - .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) - .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) - .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR) - .setSmallRecipeMap(CHEMICAL_RECIPES); + public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMap<>( + "large_chemical_reactor", 3, 3, 5, 4, new SimpleRecipeBuilder().EUt(VA[LV]), false) + .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) + .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) + .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) + .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) + .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CHEMICAL_REACTOR) + .setSmallRecipeMap(CHEMICAL_RECIPES); /** * Example: + * *
-     * 		RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder()
-     * 				.input(MetaItems.SILICON_WAFER)
-     * 				.notConsumable(OrePrefix.craftingLens, MarkerMaterials.Color.Red)
-     * 				.output(MetaItems.INTEGRATED_LOGIC_CIRCUIT_WAFER)
-     * 				.duration(900)
-     * 				.EUt(GTValues.VA[GTValues.MV])
-     * 				.buildAndRegister();
+     * RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder()
+     *         .input(MetaItems.SILICON_WAFER)
+     *         .notConsumable(OrePrefix.craftingLens, MarkerMaterials.Color.Red)
+     *         .output(MetaItems.INTEGRATED_LOGIC_CIRCUIT_WAFER)
+     *         .duration(900)
+     *         .EUt(GTValues.VA[GTValues.MV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 1, + 0, 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     * 	     RecipeMap.LATHE_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Blocks.WOODEN_SLAB, 1, GTValues.W))
-     * 				.outputs(new ItemStack(Items.BOWL))
-     * 				.output(OrePrefix.dustSmall, Materials.Wood)
-     * 				.duration(50).EUt(GTValues.VA[GTValues.ULV])
-     * 				.buildAndRegister();
+     * RecipeMap.LATHE_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.WOODEN_SLAB, 1, GTValues.W))
+     *         .outputs(new ItemStack(Items.BOWL))
+     *         .output(OrePrefix.dustSmall, Materials.Wood)
+     *         .duration(50).EUt(GTValues.VA[GTValues.ULV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap LATHE_RECIPES = new RecipeMap<>("lathe", 1, 2, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) - .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT); + public static final RecipeMap LATHE_RECIPES = new RecipeMap<>("lathe", 1, 2, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) + .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) + .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CUT); /** * Example: + * *
-     * 		RecipeMap.MACERATOR_RECIPES.recipeBuilder()
-     * 				.inputs(new ItemStack(Items.CHICKEN))
-     * 				.output(OrePrefix.dust, Materials.Meat)
-     * 				.output(OrePrefix.dustTiny, Materials.Bone)
-     * 				.duration(102).buildAndRegister();
+     * RecipeMap.MACERATOR_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Items.CHICKEN))
+     *         .output(OrePrefix.dust, Materials.Meat)
+     *         .output(OrePrefix.dustTiny, Materials.Bone)
+     *         .duration(102).buildAndRegister();
      * 
* * Any Recipe added to the Macerator not specifying an EUt value will default to 2. * Any Recipe added to the Macerator not specifying a duration value will default to 150. */ @ZenProperty - public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 4, 0, 0, new SimpleRecipeBuilder().duration(150).EUt(2), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MACERATOR); - + public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 4, 0, 0, + new SimpleRecipeBuilder().duration(150).EUt(2), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MACERATOR); /** * Currently unused */ @ZenProperty @SuppressWarnings("unused") - public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMap<>("mass_fabricator", 1, 0, 1, 2, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.ATOMIC_OVERLAY_1) - .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2) - .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.REPLICATOR); + public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMap<>("mass_fabricator", 1, + 0, 1, 2, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.ATOMIC_OVERLAY_1) + .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2) + .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) + .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.REPLICATOR); /** * Example: + * *
      * 		RecipeMap.MIXER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.dust, Materials.Redstone, 5)
@@ -929,14 +1030,16 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 6, 1, 2, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.MIXER); + public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 6, 1, 2, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .setSound(GTSoundEvents.MIXER); /** * Example: + * *
      * 		RecipeMap.ORE_WASHER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.crushed, Materials.Aluminum)
@@ -950,14 +1053,16 @@ public class RecipeMaps {
      * Any Recipe added to the Ore Washer not specifying a duration value will default to 400.
      */
     @ZenProperty
-    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 2, 3, 1, 0, new SimpleRecipeBuilder().duration(400).EUt(16), false)
-            .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
-            .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
-            .setSound(GTSoundEvents.BATH);
+    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 2, 3, 1, 0,
+            new SimpleRecipeBuilder().duration(400).EUt(16), false)
+                    .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
+                    .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
+                    .setSound(GTSoundEvents.BATH);
 
     /**
      * Example:
+     * 
      * 
      * 		RecipeMap.PACKER_RECIPES.recipeBuilder()
      * 				.inputs(new ItemStack(Items.WHEAT, 9))
@@ -971,30 +1076,34 @@ public class RecipeMaps {
      * Any Recipe added to the Packer not specifying a duration value will default to 10.
      */
     @ZenProperty
-    public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 0, 0, new SimpleRecipeBuilder().EUt(12).duration(10), false)
-            .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY)
-            .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY)
-            .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL)
-            .setSound(GTSoundEvents.ASSEMBLER);
+    public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 0, 0,
+            new SimpleRecipeBuilder().EUt(12).duration(10), false)
+                    .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY)
+                    .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY)
+                    .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL)
+                    .setSound(GTSoundEvents.ASSEMBLER);
 
     /**
      * Example:
+     * 
      * 
-     * 		RecipeMap.POLARIZER_RECIPES.recipeBuilder()
-     * 				.inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Iron))
-     * 				.outputs(OreDictUnifier.get(OrePrefix.plate, Materials.IronMagnetic))
-     * 				.duration(100)
-     * 				.EUt(16)
-     * 				.buildAndRegister();
+     * RecipeMap.POLARIZER_RECIPES.recipeBuilder()
+     *         .inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Iron))
+     *         .outputs(OreDictUnifier.get(OrePrefix.plate, Materials.IronMagnetic))
+     *         .duration(100)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ARC); /** * Example: + * *
      *      RecipeMap.PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder()
      *     			.input(OrePrefix.ingot, Materials.Iron)
@@ -1005,188 +1114,211 @@ public class RecipeMaps {
      *     			.buildAndRegister();
      * 
* - * As a Primitive Machine, the Primitive Blast Furnace does not need an EUt parameter specified for the Recipe Builder. + * As a Primitive Machine, the Primitive Blast Furnace does not need an EUt parameter specified for the + * Recipe Builder. */ @ZenProperty - public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>("primitive_blast_furnace", 3, false, 3, false, 0, false, 0, false, new PrimitiveRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>( + "primitive_blast_furnace", 3, false, 3, false, 0, false, 0, false, new PrimitiveRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
-     *      RecipeMap.PYROLYSE_RECIPES.recipeBuilder()
-     *     			.input(OrePrefix.log, Materials.Wood, 16)
-     *     			.circuitMeta(2)
-     *     			.fluidInputs(Materials.Nitrogen.getFluid(1000))
-     *     			.outputs(new ItemStack(Items.COAL, 20, 1))
-     *     			.fluidOutputs(Materials.Creosote.getFluid(4000))
-     *     			.duration(320)
-     *     			.EUt(96)
-     *     			.buildAndRegister();
+     * RecipeMap.PYROLYSE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.log, Materials.Wood, 16)
+     *         .circuitMeta(2)
+     *         .fluidInputs(Materials.Nitrogen.getFluid(1000))
+     *         .outputs(new ItemStack(Items.COAL, 20, 1))
+     *         .fluidOutputs(Materials.Creosote.getFluid(4000))
+     *         .duration(320)
+     *         .EUt(96)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 1, 1, 1, new SimpleRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 1, 1, 1, + new SimpleRecipeBuilder(), false) + .setSound(GTSoundEvents.FIRE); /** * Currently unused */ @ZenProperty - public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 2, 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.ATOMIC_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) - .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.REPLICATOR); + public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 2, 1, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.ATOMIC_OVERLAY_1) + .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) + .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) + .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.REPLICATOR); @ZenProperty - public static final RecipeMap RESEARCH_STATION_RECIPES = new RecipeMapResearchStation<>("research_station", 2, 1, 0, 0, new ComputationRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY) - .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); + public static final RecipeMap RESEARCH_STATION_RECIPES = new RecipeMapResearchStation<>( + "research_station", 2, 1, 0, 0, new ComputationRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY) + .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); @ZenProperty - public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 4, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 4, 0, + 0, new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.FIRE); /** * Example: + * *
      * RecipeMaps.SCANNER_RECIPES.recipeBuilder()
-     *              .inputNBT(MetaItems.TOOL_DATA_STICK, NBTMatcher.ANY, NBTCondition.ANY)
-     *              .input(MetaItems.ELECTRIC_MOTOR_IV)
-     *              .output(MetaItems.TOOL_DATA_STICK)
-     *              .duration(100)
-     *              .EUt(2)
-     *              .buildAndRegister();
+     *         .inputNBT(MetaItems.TOOL_DATA_STICK, NBTMatcher.ANY, NBTCondition.ANY)
+     *         .input(MetaItems.ELECTRIC_MOTOR_IV)
+     *         .output(MetaItems.TOOL_DATA_STICK)
+     *         .duration(100)
+     *         .EUt(2)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", 2, 1, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", 2, 1, 1, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.ELECTROLYZER); /** * Example: + * *
-     *     RecipeMap.SIFTER_RECIPES.recipeBuilder()
-     *     			.inputs(new ItemStack(Blocks.SAND))
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemExquisite, Materials.Ruby, 1L), 300)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawless, Materials.Ruby, 1L), 1200)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawed, Materials.Ruby, 1L), 4500)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.gemChipped, Materials.Ruby, 1L), 1400)
-     *     			.chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Ruby, 1L), 2800)
-     *     			.duration(800)
-     *     			.EUt(16)
-     *     			.buildAndRegister();
+     * RecipeMap.SIFTER_RECIPES.recipeBuilder()
+     *         .inputs(new ItemStack(Blocks.SAND))
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemExquisite, Materials.Ruby, 1L), 300)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawless, Materials.Ruby, 1L), 1200)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemFlawed, Materials.Ruby, 1L), 4500)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.gemChipped, Materials.Ruby, 1L), 1400)
+     *         .chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Ruby, 1L), 2800)
+     *         .duration(800)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 6, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) - .setSound(SoundEvents.BLOCK_SAND_PLACE); + public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 6, 0, 0, + new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) + .setSound(SoundEvents.BLOCK_SAND_PLACE); /** * Example: + * *
-     *     RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder()
-     *     			.input(OrePrefix.crushed, Materials.Aluminum)
-     *     			.outputs(OreDictUnifier.get(OrePrefix.crushedPurified, Materials.Aluminum), OreDictUnifier.get(OrePrefix.dustTiny, Materials.Bauxite, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone))
-     *     			.duration(800)
-     *     			.EUt(16)
-     *     			.buildAndRegister();
+     * RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.crushed, Materials.Aluminum)
+     *         .outputs(OreDictUnifier.get(OrePrefix.crushedPurified, Materials.Aluminum),
+     *                 OreDictUnifier.get(OrePrefix.dustTiny, Materials.Bauxite, 3),
+     *                 OreDictUnifier.get(OrePrefix.dust, Materials.Stone))
+     *         .duration(800)
+     *         .EUt(16)
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Thermal Centrifuge not specifying an EUt value will default to 30. * Any Recipe added to the Thermal Centrifuge not specifying a duration value will default to 400. */ @ZenProperty - public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>("thermal_centrifuge", 1, 3, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(30), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CENTRIFUGE); + public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>( + "thermal_centrifuge", 1, 3, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(30), false) + .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) + .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.CENTRIFUGE); /** * Example: + * *
-     * 		RecipeMap.VACUUM_RECIPES.recipeBuilder()
-     * 				.fluidInputs(Air.getFluid(4000))
-     * 				.fluidOutputs(LiquidAir.getFluid(4000))
-     * 				.duration(80).EUt(GTValues.VA[GTValues.HV])
-     * 				.buildAndRegister();
+     * RecipeMap.VACUUM_RECIPES.recipeBuilder()
+     *         .fluidInputs(Air.getFluid(4000))
+     *         .fluidOutputs(LiquidAir.getFluid(4000))
+     *         .duration(80).EUt(GTValues.VA[GTValues.HV])
+     *         .buildAndRegister();
      * 
* * Any Recipe added to the Thermal Centrifuge not specifying an EUt value will default to 120. */ @ZenProperty - public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 1, 1, 2, 1, new SimpleRecipeBuilder().EUt(VA[MV]), false) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 1, 1, 2, 1, + new SimpleRecipeBuilder().EUt(VA[MV]), false) + .setSound(GTSoundEvents.COOLING); /** * Example: + * *
-     * 		RecipeMap.WIREMILL_RECIPES.recipeBuilder()
-     * 				.input(OrePrefix.ingot, Materials.Iron)
-     * 				.output(OrePrefix.wireGtSingle, Materials.Iron, 2)
-     * 				.duration(200)
-     * 				.EUt(GTValues.VA[GTValues.ULV])
-     * 				.buildAndRegister();
+     * RecipeMap.WIREMILL_RECIPES.recipeBuilder()
+     *         .input(OrePrefix.ingot, Materials.Iron)
+     *         .output(OrePrefix.wireGtSingle, Materials.Iron, 2)
+     *         .duration(200)
+     *         .EUt(GTValues.VA[GTValues.ULV])
+     *         .buildAndRegister();
      * 
*/ @ZenProperty - public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 2, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MOTOR); - + public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 2, 1, 0, 0, + new SimpleRecipeBuilder(), false) + .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) + .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.MOTOR); ////////////////////////////////////// - // Fuel Recipe Maps // + // Fuel Recipe Maps // ////////////////////////////////////// @ZenProperty - public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMap<>("combustion_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMap<>( + "combustion_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMBUSTION) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMap<>("gas_turbine", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMap<>("gas_turbine", 0, 0, 1, 0, + new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMap<>("steam_turbine", 0, 0, 1, 1, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMap<>("steam_turbine", 0, 0, 1, 1, + new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMap<>("semi_fluid_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMap<>( + "semi_fluid_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.COMBUSTION) + .allowEmptyOutput(); @ZenProperty - public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMap<>("plasma_generator", 0, 0, 1, 1, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMap<>("plasma_generator", 0, 0, + 1, 1, new FuelRecipeBuilder(), false) + .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSoundEvents.TURBINE) + .allowEmptyOutput(); } diff --git a/src/main/java/gregtech/api/recipes/RecyclingHandler.java b/src/main/java/gregtech/api/recipes/RecyclingHandler.java index ae803b51a13..a075bede3c8 100644 --- a/src/main/java/gregtech/api/recipes/RecyclingHandler.java +++ b/src/main/java/gregtech/api/recipes/RecyclingHandler.java @@ -10,12 +10,14 @@ import gregtech.api.unification.stack.ItemMaterialInfo; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.unification.stack.UnificationEntry; -import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2LongMap; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + +import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -75,8 +77,7 @@ public class RecyclingHandler { return new ItemMaterialInfo(materialStacksExploded.entrySet().stream() .map(e -> new MaterialStack(e.getKey(), e.getValue() / outputCount)) .sorted(Comparator.comparingLong(m -> -m.amount)) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); } public static @Nullable ItemMaterialInfo getRecyclingIngredients(List inputs, int outputCount) { diff --git a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java index e97ee27176a..cd43f285278 100644 --- a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java @@ -10,14 +10,16 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class AssemblyLineRecipeBuilder extends RecipeBuilder { private final Collection recipeEntries = new ArrayList<>(); @@ -62,13 +64,15 @@ private boolean applyResearchProperty(ResearchPropertyData.ResearchEntry researc } if (!generatingRecipes) { - GTLog.logger.error("Cannot generate recipes when using researchWithoutRecipe()", new IllegalArgumentException()); + GTLog.logger.error("Cannot generate recipes when using researchWithoutRecipe()", + new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; return false; } if (recipePropertyStorage != null && recipePropertyStorage.hasRecipeProperty(ResearchProperty.getInstance())) { - ResearchPropertyData property = recipePropertyStorage.getRecipePropertyValue(ResearchProperty.getInstance(), null); + ResearchPropertyData property = recipePropertyStorage.getRecipePropertyValue(ResearchProperty.getInstance(), + null); if (property == null) throw new IllegalStateException("Property storage has a null property"); property.add(researchEntry); return true; @@ -97,7 +101,7 @@ public AssemblyLineRecipeBuilder researchWithoutRecipe(@Nonnull String researchI * Does not generate a research recipe. * * @param researchId the researchId for the recipe - * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. + * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. * @return this */ public AssemblyLineRecipeBuilder researchWithoutRecipe(@Nonnull String researchId, @Nonnull ItemStack dataStack) { @@ -156,14 +160,15 @@ public static class ResearchRecipeEntry { private final int CWUt; /** - * @param researchId the id of the research to store + * @param researchId the id of the research to store * @param researchStack the stack to scan for research - * @param dataStack the stack to contain the data - * @param duration the duration of the recipe - * @param EUt the EUt of the recipe - * @param CWUt how much computation per tick this recipe needs if in Research Station + * @param dataStack the stack to contain the data + * @param duration the duration of the recipe + * @param EUt the EUt of the recipe + * @param CWUt how much computation per tick this recipe needs if in Research Station */ - public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack researchStack, @Nonnull ItemStack dataStack, int duration, int EUt, int CWUt) { + public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack researchStack, + @Nonnull ItemStack dataStack, int duration, int EUt, int CWUt) { this.researchId = researchId; this.researchStack = researchStack; this.dataStack = dataStack; diff --git a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java index e51469da6ee..c330c3fc23d 100644 --- a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java @@ -6,14 +6,14 @@ import gregtech.api.recipes.recipeproperties.TemperatureProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; public class BlastRecipeBuilder extends RecipeBuilder { - public BlastRecipeBuilder() { - } + public BlastRecipeBuilder() {} public BlastRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -39,7 +39,8 @@ public boolean applyProperty(@Nonnull String key, Object value) { public BlastRecipeBuilder blastFurnaceTemp(int blastFurnaceTemp) { if (blastFurnaceTemp <= 0) { - GTLog.logger.error("Blast Furnace Temperature cannot be less than or equal to 0", new IllegalArgumentException()); + GTLog.logger.error("Blast Furnace Temperature cannot be less than or equal to 0", + new IllegalArgumentException()); recipeStatus = EnumValidationResult.INVALID; } this.applyProperty(TemperatureProperty.getInstance(), blastFurnaceTemp); diff --git a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java index 99ea4a73501..f8b383a2b37 100644 --- a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java @@ -13,8 +13,7 @@ public class CircuitAssemblerRecipeBuilder extends RecipeBuilder recipeMap) { super(recipe, recipeMap); @@ -43,5 +42,4 @@ public CircuitAssemblerRecipeBuilder solderMultiplier(int multiplier) { public int getSolderMultiplier() { return this.solderMultiplier; } - } diff --git a/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java index a00e7a502d7..d6cadabc988 100644 --- a/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ComputationRecipeBuilder.java @@ -7,6 +7,7 @@ import gregtech.api.recipes.recipeproperties.TotalComputationProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.jetbrains.annotations.NotNull; public class ComputationRecipeBuilder extends RecipeBuilder { diff --git a/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java index a535dc54403..c905e10af14 100644 --- a/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/FuelRecipeBuilder.java @@ -6,9 +6,7 @@ public class FuelRecipeBuilder extends RecipeBuilder { - public FuelRecipeBuilder() { - - } + public FuelRecipeBuilder() {} public FuelRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -22,5 +20,4 @@ public FuelRecipeBuilder(RecipeBuilder recipeBuilder) { public FuelRecipeBuilder copy() { return new FuelRecipeBuilder(this); } - } diff --git a/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java index 589ce4d29b4..8f3e5adf6df 100644 --- a/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/FusionRecipeBuilder.java @@ -6,14 +6,14 @@ import gregtech.api.recipes.recipeproperties.FusionEUToStartProperty; import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; + import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; public class FusionRecipeBuilder extends RecipeBuilder { - public FusionRecipeBuilder() { - } + public FusionRecipeBuilder() {} public FusionRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); diff --git a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java index 9b1b4d51e5a..5bebddca8f7 100644 --- a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java @@ -1,22 +1,23 @@ package gregtech.api.recipes.builders; -import crafttweaker.CraftTweakerAPI; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.GasCollectorDimensionProperty; + +import crafttweaker.CraftTweakerAPI; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.apache.commons.lang3.builder.ToStringBuilder; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class GasCollectorRecipeBuilder extends RecipeBuilder { - public GasCollectorRecipeBuilder() { - } + public GasCollectorRecipeBuilder() {} public GasCollectorRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -36,20 +37,21 @@ public boolean applyProperty(@Nonnull String key, Object value) { if (key.equals(GasCollectorDimensionProperty.KEY)) { if (value instanceof Integer) { this.dimension((Integer) value); - } else if (value instanceof List && !((List) value).isEmpty() && ((List) value).get(0) instanceof Integer) { - IntList dimensionIDs = getDimensionIDs(); - if (dimensionIDs == IntLists.EMPTY_LIST) { - dimensionIDs = new IntArrayList(); - this.applyProperty(GasCollectorDimensionProperty.getInstance(), dimensionIDs); - } - dimensionIDs.addAll((List) value); - } else { - if (isCTRecipe) { - CraftTweakerAPI.logError("Dimension for Gas Collector needs to be a Integer"); - return false; - } - throw new IllegalArgumentException("Invalid Dimension Property Type!"); - } + } else if (value instanceof List && !((List) value).isEmpty() && + ((List) value).get(0) instanceof Integer) { + IntList dimensionIDs = getDimensionIDs(); + if (dimensionIDs == IntLists.EMPTY_LIST) { + dimensionIDs = new IntArrayList(); + this.applyProperty(GasCollectorDimensionProperty.getInstance(), dimensionIDs); + } + dimensionIDs.addAll((List) value); + } else { + if (isCTRecipe) { + CraftTweakerAPI.logError("Dimension for Gas Collector needs to be a Integer"); + return false; + } + throw new IllegalArgumentException("Invalid Dimension Property Type!"); + } return true; } return super.applyProperty(key, value); diff --git a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java index 885f86f1355..a4d1b308881 100644 --- a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java @@ -8,8 +8,10 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; import gregtech.api.util.ValidationResult; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.builder.ToStringBuilder; import stanhebben.zenscript.annotations.ZenMethod; @@ -17,9 +19,7 @@ public class ImplosionRecipeBuilder extends RecipeBuilder { - public ImplosionRecipeBuilder() { - - } + public ImplosionRecipeBuilder() {} public ImplosionRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -71,7 +71,8 @@ public ItemStack getExplosivesType() { if (this.recipePropertyStorage == null) { return ItemStack.EMPTY; } - return this.recipePropertyStorage.getRecipePropertyValue(ImplosionExplosiveProperty.getInstance(), ItemStack.EMPTY); + return this.recipePropertyStorage.getRecipePropertyValue(ImplosionExplosiveProperty.getInstance(), + ItemStack.EMPTY); } public ValidationResult build() { diff --git a/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java index 317f1bb8c85..858a94d1177 100644 --- a/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/PrimitiveRecipeBuilder.java @@ -8,8 +8,7 @@ public class PrimitiveRecipeBuilder extends RecipeBuilder { - public PrimitiveRecipeBuilder() { - } + public PrimitiveRecipeBuilder() {} public PrimitiveRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); diff --git a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java index 333394bb716..3563ab3798d 100644 --- a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java @@ -6,6 +6,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.AssemblyLineManager; import gregtech.api.util.GTStringUtils; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; @@ -55,7 +56,7 @@ protected void validateResearchItem() { } boolean foundBehavior = false; - if (dataStack.getItem() instanceof MetaItem metaItem) { + if (dataStack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(dataStack)) { if (behaviour instanceof IDataItem) { foundBehavior = true; @@ -98,7 +99,8 @@ protected AssemblyLineRecipeBuilder.ResearchRecipeEntry build() { validateResearchItem(); if (duration <= 0) duration = DEFAULT_SCANNER_DURATION; if (eut <= 0) eut = DEFAULT_SCANNER_EUT; - return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, eut, 0); + return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, + eut, 0); } } @@ -146,7 +148,8 @@ protected AssemblyLineRecipeBuilder.ResearchRecipeEntry build() { int duration = totalCWU; if (eut <= 0) eut = DEFAULT_STATION_EUT; - return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, eut, cwut); + return new AssemblyLineRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, + eut, cwut); } } } diff --git a/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java index 013389aefb7..61bcfdf1015 100644 --- a/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/SimpleRecipeBuilder.java @@ -6,8 +6,7 @@ public class SimpleRecipeBuilder extends RecipeBuilder { - public SimpleRecipeBuilder() { - } + public SimpleRecipeBuilder() {} public SimpleRecipeBuilder(Recipe recipe, RecipeMap recipeMap) { super(recipe, recipeMap); @@ -21,5 +20,4 @@ public SimpleRecipeBuilder(RecipeBuilder recipeBuilder) { public SimpleRecipeBuilder copy() { return new SimpleRecipeBuilder(this); } - } diff --git a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java index 8f0bc60a3de..88b0549212f 100644 --- a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java @@ -4,6 +4,7 @@ import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.RecipeMaps; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -15,8 +16,7 @@ public class UniversalDistillationRecipeBuilder extends RecipeBuilder recipeMap) { super(recipe, recipeMap); @@ -39,19 +39,24 @@ public void buildAndRegister() { } for (int i = 0; i < fluidOutputs.size(); i++) { - SimpleRecipeBuilder builder = RecipeMaps.DISTILLERY_RECIPES.recipeBuilder().copy().EUt(Math.max(1, this.EUt / 4)).circuitMeta(i + 1); + SimpleRecipeBuilder builder = RecipeMaps.DISTILLERY_RECIPES.recipeBuilder().copy() + .EUt(Math.max(1, this.EUt / 4)).circuitMeta(i + 1); - int ratio = getRatioForDistillery(this.fluidInputs.get(0).getInputFluidStack(), this.fluidOutputs.get(i), !this.outputs.isEmpty() ? this.outputs.get(0) : null); + int ratio = getRatioForDistillery(this.fluidInputs.get(0).getInputFluidStack(), this.fluidOutputs.get(i), + !this.outputs.isEmpty() ? this.outputs.get(0) : null); int recipeDuration = (int) (this.duration * STANDARD_OVERCLOCK_DURATION_DIVISOR); boolean shouldDivide = ratio != 1; - boolean fluidsDivisible = isFluidStackDivisibleForDistillery(this.fluidInputs.get(0).getInputFluidStack(), ratio) && + boolean fluidsDivisible = isFluidStackDivisibleForDistillery(this.fluidInputs.get(0).getInputFluidStack(), + ratio) && isFluidStackDivisibleForDistillery(this.fluidOutputs.get(i), ratio); - FluidStack dividedInputFluid = new FluidStack(this.fluidInputs.get(0).getInputFluidStack(), Math.max(1, this.fluidInputs.get(0).getAmount() / ratio)); - FluidStack dividedOutputFluid = new FluidStack(this.fluidOutputs.get(i), Math.max(1, this.fluidOutputs.get(i).amount / ratio)); + FluidStack dividedInputFluid = new FluidStack(this.fluidInputs.get(0).getInputFluidStack(), + Math.max(1, this.fluidInputs.get(0).getAmount() / ratio)); + FluidStack dividedOutputFluid = new FluidStack(this.fluidOutputs.get(i), + Math.max(1, this.fluidOutputs.get(i).amount / ratio)); if (shouldDivide && fluidsDivisible) builder.fluidInputs(dividedInputFluid) @@ -84,8 +89,9 @@ else if (!shouldDivide) { super.buildAndRegister(); } - private static int getRatioForDistillery(FluidStack fluidInput, FluidStack fluidOutput, @Nullable ItemStack output) { - int[] divisors = new int[]{2, 5, 10, 25, 50}; + private static int getRatioForDistillery(FluidStack fluidInput, FluidStack fluidOutput, + @Nullable ItemStack output) { + int[] divisors = new int[] { 2, 5, 10, 25, 50 }; int ratio = -1; for (int divisor : divisors) { @@ -114,5 +120,4 @@ public UniversalDistillationRecipeBuilder disableDistilleryRecipes() { this.doDistilleryRecipes = false; return this; } - } diff --git a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java index 1e188e1ff26..acf8057649f 100644 --- a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java +++ b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java @@ -1,11 +1,13 @@ package gregtech.api.recipes.category; import gregtech.api.recipes.RecipeMap; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import java.util.Map; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Map; public final class GTRecipeCategory { @@ -28,8 +30,10 @@ public final class GTRecipeCategory { * @return the new category */ @Nonnull - public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String categoryName, @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { - return categories.computeIfAbsent(categoryName, (k) -> new GTRecipeCategory(modid, categoryName, translationKey, recipeMap)); + public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String categoryName, + @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { + return categories.computeIfAbsent(categoryName, + (k) -> new GTRecipeCategory(modid, categoryName, translationKey, recipeMap)); } /** @@ -41,7 +45,8 @@ public static GTRecipeCategory getByName(@Nonnull String categoryName) { return categories.get(categoryName); } - private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { + private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull String translationKey, + @Nonnull RecipeMap recipeMap) { this.modid = modid; this.name = name; this.uniqueID = modid + ':' + this.name; diff --git a/src/main/java/gregtech/api/recipes/category/RecipeCategories.java b/src/main/java/gregtech/api/recipes/category/RecipeCategories.java index a965a8f9399..1eee70a5607 100644 --- a/src/main/java/gregtech/api/recipes/category/RecipeCategories.java +++ b/src/main/java/gregtech/api/recipes/category/RecipeCategories.java @@ -7,21 +7,21 @@ public final class RecipeCategories { public static final GTRecipeCategory ARC_FURNACE_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "arc_furnace_recycling", - "gregtech.recipe.category.arc_furnace_recycling", - RecipeMaps.ARC_FURNACE_RECIPES) + "arc_furnace_recycling", + "gregtech.recipe.category.arc_furnace_recycling", + RecipeMaps.ARC_FURNACE_RECIPES) .jeiIcon(GuiTextures.ARC_FURNACE_RECYLCING_CATEGORY); public static final GTRecipeCategory MACERATOR_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "macerator_recycling", - "gregtech.recipe.category.macerator_recycling", - RecipeMaps.MACERATOR_RECIPES) + "macerator_recycling", + "gregtech.recipe.category.macerator_recycling", + RecipeMaps.MACERATOR_RECIPES) .jeiIcon(GuiTextures.MACERATOR_RECYLCING_CATEGORY); public static final GTRecipeCategory EXTRACTOR_RECYCLING = GTRecipeCategory.create(GTValues.MODID, - "extractor_recycling", - "gregtech.recipe.category.extractor_recycling", - RecipeMaps.EXTRACTOR_RECIPES) + "extractor_recycling", + "gregtech.recipe.category.extractor_recycling", + RecipeMaps.EXTRACTOR_RECIPES) .jeiIcon(GuiTextures.EXTRACTOR_RECYLCING_CATEGORY); private RecipeCategories() {} diff --git a/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java b/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java index 0d36789cedb..e5eeda1a875 100644 --- a/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java +++ b/src/main/java/gregtech/api/recipes/chance/ChanceEntry.java @@ -12,7 +12,8 @@ public interface ChanceEntry { /** * @return the ingredient */ - @NotNull T getIngredient(); + @NotNull + T getIngredient(); /** * @return the chance of operating with the ingredient @@ -22,5 +23,6 @@ public interface ChanceEntry { /** * @return a copy of the chance entry */ - @NotNull ChanceEntry copy(); + @NotNull + ChanceEntry copy(); } diff --git a/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java b/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java index 8e4983d69be..e885f08af58 100644 --- a/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java +++ b/src/main/java/gregtech/api/recipes/chance/boost/ChanceBoostFunction.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.boost; import gregtech.api.GTValues; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java b/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java index 1a973e4ffbd..c7cadf8bc7c 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/BoostableChanceOutput.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.output; import gregtech.api.recipes.chance.boost.BoostableChanceEntry; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java index b275239f6d1..9689fc1b208 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutput.java @@ -1,8 +1,7 @@ package gregtech.api.recipes.chance.output; -import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.recipes.chance.BaseChanceEntry; -import net.minecraftforge.items.IItemHandler; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java index 23d0308ea09..71856282127 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputList.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.chance.output; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -37,7 +38,8 @@ public ChancedOutputList(@NotNull ChancedOutputLogic chancedOutputLogic, @NotNul * @param machineTier the tier the recipe is run at * @return a list of the rolled outputs */ - public @Nullable @Unmodifiable List roll(@NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable List roll(@NotNull ChanceBoostFunction boostFunction, int baseTier, + int machineTier) { return chancedOutputLogic.roll(getChancedEntries(), boostFunction, baseTier, machineTier); } diff --git a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java index 00819432a14..738d9176233 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java +++ b/src/main/java/gregtech/api/recipes/chance/output/ChancedOutputLogic.java @@ -1,9 +1,10 @@ package gregtech.api.recipes.chance.output; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.recipes.chance.boost.BoostableChanceEntry; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + +import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -20,8 +21,12 @@ public interface ChancedOutputLogic { * Chanced Output Logic where any ingredients succeeding their roll will be produced */ ChancedOutputLogic OR = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { ImmutableList.Builder builder = null; for (T entry : chancedEntries) { if (passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { @@ -47,8 +52,12 @@ public String toString() { * Chanced Output Logic where all ingredients must succeed their roll in order for any to be produced */ ChancedOutputLogic AND = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { for (T entry : chancedEntries) { if (!passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { return null; @@ -72,8 +81,12 @@ public String toString() { * Chanced Output Logic where only the first ingredient succeeding its roll will be produced */ ChancedOutputLogic XOR = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { for (T entry : chancedEntries) { if (passesChance(getChance(entry, boostFunction, baseTier, machineTier))) { return Collections.singletonList(entry); @@ -97,8 +110,12 @@ public String toString() { * Chanced Output Logic where nothing is produced */ ChancedOutputLogic NONE = new ChancedOutputLogic() { + @Override - public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { + public @Nullable @Unmodifiable > List<@NotNull T> roll(@NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier) { return null; } @@ -110,19 +127,19 @@ public String toString() { @Override public String toString() { return "ChancedOutputLogic{NONE}"; - } }; /** * @param entry the entry to get the complete chance for * @param boostFunction the function boosting the entry's chance - * @param baseTier the base tier of the recipe - * @param machineTier the tier the recipe is run at + * @param baseTier the base tier of the recipe + * @param machineTier the tier the recipe is run at * @return the total chance for the entry */ - static int getChance(@NotNull ChancedOutput entry, @NotNull ChanceBoostFunction boostFunction, int baseTier, int machineTier) { - if (entry instanceof BoostableChanceEntry boostableChanceEntry) { + static int getChance(@NotNull ChancedOutput entry, @NotNull ChanceBoostFunction boostFunction, int baseTier, + int machineTier) { + if (entry instanceof BoostableChanceEntryboostableChanceEntry) { return boostFunction.getBoostedChance(boostableChanceEntry, baseTier, machineTier); } return entry.getChance(); @@ -153,8 +170,10 @@ static int getMaxChancedValue() { * @return a list of the produced outputs */ > @Nullable @Unmodifiable List<@NotNull T> roll( - @NotNull @Unmodifiable List<@NotNull T> chancedEntries, @NotNull ChanceBoostFunction boostFunction, - int baseTier, int machineTier); + @NotNull @Unmodifiable List<@NotNull T> chancedEntries, + @NotNull ChanceBoostFunction boostFunction, + int baseTier, int machineTier); - @NotNull String getTranslationKey(); + @NotNull + String getTranslationKey(); } diff --git a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java index 38a8c6c3433..81a145fe1c8 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedFluidOutput.java @@ -1,7 +1,9 @@ package gregtech.api.recipes.chance.output.impl; import gregtech.api.recipes.chance.output.BoostableChanceOutput; + import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java index d01407b3954..b49e640d942 100644 --- a/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java +++ b/src/main/java/gregtech/api/recipes/chance/output/impl/ChancedItemOutput.java @@ -2,7 +2,9 @@ import gregtech.api.recipes.chance.output.BoostableChanceOutput; import gregtech.api.util.GTStringUtils; + import net.minecraft.item.ItemStack; + import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java index ccd9ee7f9fd..db02945d430 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java @@ -3,9 +3,10 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class GTRecipeFluidInput extends GTRecipeInput { private final FluidStack inputStack; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java index f7e1ac45180..76f18cc39fc 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java @@ -2,20 +2,23 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectLists; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectLists; + import java.util.Collection; import java.util.Comparator; import java.util.List; +import javax.annotation.Nullable; + /** * Definition of ItemStacks, Ore dicts, of ingredients for * use on RecipeMaps Recipes go here. @@ -44,7 +47,8 @@ public abstract class GTRecipeInput { */ public static final int SORTING_ORDER_INT_CIRCUIT = 10; - public static final Comparator RECIPE_INPUT_COMPARATOR = Comparator.comparingInt(GTRecipeInput::getSortingOrder); + public static final Comparator RECIPE_INPUT_COMPARATOR = Comparator + .comparingInt(GTRecipeInput::getSortingOrder); /** * All items will initially match the with is NBT (OreDicts have a null tag?) @@ -180,9 +184,9 @@ public int hashCode() { /** * @return true if the input matches another input, while ignoring its amount field and - * non-consumable status. - *

- * used for unique input matching in RecipeMap + * non-consumable status. + *

+ * used for unique input matching in RecipeMap * @see gregtech.api.recipes.RecipeMap#uniqueIngredientsList(Collection) RecipeMap#uniqueIngredientsList(Collection) */ public abstract boolean equalIgnoreAmount(GTRecipeInput input); @@ -200,6 +204,7 @@ public int getSortingOrder() { } protected static class ItemToMetaList implements Object2ObjectMap.Entry> { + protected Item item; protected List metaToTAGList; @@ -232,6 +237,7 @@ public List setValue(List value) { } protected static class MetaToTAGList implements Int2ObjectMap.Entry> { + protected int meta; protected List tagToStack; @@ -269,6 +275,7 @@ public List setValue(List value) { } protected static class TagToStack implements Object2ObjectMap.Entry { + NBTTagCompound tag; ItemStack stack; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java index bb159449d59..8fed7a4d4c5 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeItemInput.java @@ -1,12 +1,14 @@ package gregtech.api.recipes.ingredients; import gregtech.api.GTValues; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.NonNullList; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -18,11 +20,11 @@ public class GTRecipeItemInput extends GTRecipeInput { private final List itemList = new ObjectArrayList<>(); public GTRecipeItemInput(ItemStack stack) { - this(new ItemStack[]{stack}, stack.getCount()); + this(new ItemStack[] { stack }, stack.getCount()); } public GTRecipeItemInput(ItemStack stack, int amount) { - this(new ItemStack[]{stack}, amount); + this(new ItemStack[] { stack }, amount); } public GTRecipeItemInput(GTRecipeInput input) { @@ -218,7 +220,8 @@ public boolean equalIgnoreAmount(GTRecipeInput input) { if (this.inputStacks.length != other.inputStacks.length) return false; for (int i = 0; i < this.inputStacks.length; i++) { - if (!ItemStack.areItemsEqual(this.inputStacks[i], other.inputStacks[i]) || !ItemStack.areItemStackTagsEqual(this.inputStacks[i], other.inputStacks[i])) + if (!ItemStack.areItemsEqual(this.inputStacks[i], other.inputStacks[i]) || + !ItemStack.areItemStackTagsEqual(this.inputStacks[i], other.inputStacks[i])) return false; } return true; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java index 1f36a8c48d2..8596b80d955 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java @@ -3,12 +3,14 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class GTRecipeOreInput extends GTRecipeInput { private final int ore; @@ -86,8 +88,9 @@ public GTRecipeInput copyWithAmount(int amount) { return copy; } - //The items returned here are not updated after its first call, so they are not suitable for use while recipes are being processed and - //the OreDicts being modified. + // The items returned here are not updated after its first call, so they are not suitable for use while recipes are + // being processed and + // the OreDicts being modified. @Override public ItemStack[] getInputStacks() { if (this.inputStacks == null) { @@ -157,7 +160,7 @@ public boolean equalIgnoreAmount(GTRecipeInput input) { @Override public String toString() { - //noinspection StringConcatenationMissingWhitespace + // noinspection StringConcatenationMissingWhitespace return amount + "x" + OreDictionary.getOreName(ore); } } diff --git a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java index 989fa04b55a..4181b978d03 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java +++ b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java @@ -4,13 +4,15 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class IntCircuitIngredient extends GTRecipeInput { public static final int CIRCUIT_MIN = 0; @@ -72,7 +74,7 @@ public int getAmount() { @Override public ItemStack[] getInputStacks() { if (this.inputStacks == null) { - this.inputStacks = new ItemStack[]{getIntegratedCircuit(this.matchingConfigurations)}; + this.inputStacks = new ItemStack[] { getIntegratedCircuit(this.matchingConfigurations) }; } return this.inputStacks; } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java index 6472d9c4625..ee8b61833a8 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/ListNBTCondition.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.ingredients.nbtmatch; import gregtech.api.util.GTLog; + import net.minecraft.nbt.NBTBase; import java.util.List; @@ -25,7 +26,7 @@ protected ListNBTCondition(NBTTagType listTagType, String nbtKey, Object value) @Override public String toString() { - return nbtKey + " (type " + listTagType + ") :" + value; + return nbtKey + " (type " + listTagType + ") :" + value; } @Override @@ -45,5 +46,4 @@ public boolean equals(Object obj) { } return false; } - } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java index fda0330bdac..f8c5010c5a9 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java @@ -2,9 +2,10 @@ import gregtech.api.util.GTLog; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + /** * This class is used to check if a NBT tag matches a condition, not necessarily matching the original item tag */ diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java index e11eafec087..fccda3c820d 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java @@ -5,9 +5,10 @@ import net.minecraft.nbt.NBTTagLongArray; import net.minecraftforge.fluids.FluidStack; +import java.util.Objects; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Objects; /** * This class is used to match NBT tags. Used to match a MapItemStackNBTIngredient NBT tag to a given NBT tag value. @@ -107,7 +108,8 @@ static boolean hasKey(NBTTagCompound tag, String key, int tagType) { return tag.getString(condition.nbtKey).equals(condition.value); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); + return tag.getTagList(condition.nbtKey, + ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); } else { return false; } @@ -127,8 +129,9 @@ static boolean hasKey(NBTTagCompound tag, String key, int tagType) { * If NBTTagCompound is found, evaluates recursively. */ NBTMatcher RECURSIVE_EQUAL_TO = new NBTMatcher() { + @Override - public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition condition) { + public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition condition) { if (condition == null || condition.tagType == null) { return false; } @@ -145,7 +148,8 @@ public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition con return tag.getString(condition.nbtKey).equals(condition.value); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); + return tag.getTagList(condition.nbtKey, + ((ListNBTCondition) condition).listTagType.typeId).tagList.equals(condition.value); } else { return false; } @@ -184,7 +188,8 @@ public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition con return tag.getString(condition.nbtKey).isEmpty(); case LIST: if (condition instanceof ListNBTCondition) { - return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId).isEmpty(); + return tag.getTagList(condition.nbtKey, ((ListNBTCondition) condition).listTagType.typeId) + .isEmpty(); } else { return false; } @@ -218,5 +223,4 @@ default boolean evaluate(@Nonnull ItemStack stack, @Nullable NBTCondition nbtCon default boolean evaluate(@Nonnull FluidStack stack, @Nullable NBTCondition nbtCondition) { return evaluate(stack.tag, nbtCondition); } - } diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java index 12efee5d722..139ceb4f742 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTTagType.java @@ -18,13 +18,13 @@ public enum NBTTagType { NUMBER(99); public static boolean isNumeric(NBTTagType type) { - return type == BYTE || type == SHORT || type == INT || type == LONG || type == FLOAT || type == DOUBLE || type == NUMBER; + return type == BYTE || type == SHORT || type == INT || type == LONG || type == FLOAT || type == DOUBLE || + type == NUMBER; } - + public final int typeId; - + NBTTagType(int typeId) { this.typeId = typeId; } - } diff --git a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java index 7b0e605c1dd..f9c5e139222 100644 --- a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java @@ -7,6 +7,7 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; import javax.annotation.Nonnull; @@ -23,7 +24,8 @@ public interface IParallelableRecipeLogic { default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} /** - * Method which finds a recipe which can be parallelized, works by multiplying the recipe by the parallelization factor, + * Method which finds a recipe which can be parallelized, works by multiplying the recipe by the parallelization + * factor, * and shrinking the recipe till its outputs can fit * * @param recipeMap the recipe map @@ -37,7 +39,13 @@ default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap recipeMap, @Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, int parallelLimit, long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap recipeMap, + @Nonnull Recipe currentRecipe, + @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, + @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, int parallelLimit, + long maxVoltage, @Nonnull IVoidable voidable) { return ParallelLogic.doParallelRecipes( currentRecipe, recipeMap, @@ -62,7 +70,10 @@ default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap reci * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable inputs, @Nonnull IItemHandlerModifiable outputs, int parallelLimit, long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable inputs, + @Nonnull IItemHandlerModifiable outputs, int parallelLimit, + long maxVoltage, @Nonnull IVoidable voidable) { return ParallelLogic.appendItemRecipes( recipeMap, inputs, @@ -73,11 +84,16 @@ default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap re } // Recipes passed in here should be already trimmed, if desired - default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { + default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, + @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { if (parallelLimit > 1 && getRecipeMap() != null) { RecipeBuilder parallelBuilder = switch (getParallelLogicType()) { - case MULTIPLY -> findMultipliedParallelRecipe(getRecipeMap(), currentRecipe, inputs, fluidInputs, outputs, fluidOutputs, parallelLimit, maxVoltage, getMetaTileEntity()); - case APPEND_ITEMS -> findAppendedParallelItemRecipe(getRecipeMap(), inputs, outputs, parallelLimit, maxVoltage, getMetaTileEntity()); + case MULTIPLY -> findMultipliedParallelRecipe(getRecipeMap(), currentRecipe, inputs, fluidInputs, + outputs, fluidOutputs, parallelLimit, maxVoltage, getMetaTileEntity()); + case APPEND_ITEMS -> findAppendedParallelItemRecipe(getRecipeMap(), inputs, outputs, parallelLimit, + maxVoltage, getMetaTileEntity()); }; // if the builder returned is null, no recipe was found. @@ -85,13 +101,13 @@ default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemH invalidateInputs(); return null; } else { - //if the builder returned does not parallel, its outputs are full + // if the builder returned does not parallel, its outputs are full if (parallelBuilder.getParallel() == 0) { invalidateOutputs(); return null; } else { setParallelRecipesPerformed(parallelBuilder.getParallel()); - //apply any parallel bonus + // apply any parallel bonus applyParallelBonus(parallelBuilder); return parallelBuilder.build().getResult(); } diff --git a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java index 3d23c6ee91b..bb9a6787954 100644 --- a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java @@ -27,7 +27,8 @@ public class OverclockingLogic { * @return an int array of {OverclockedEUt, OverclockedDuration} */ @Nonnull - public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, double durationDivisor, double voltageMultiplier) { + public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, + double durationDivisor, double voltageMultiplier) { double resultDuration = recipeDuration; double resultVoltage = recipeEUt; @@ -53,7 +54,7 @@ public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, in resultVoltage = potentialVoltage; } - return new int[]{(int) resultVoltage, (int) resultDuration}; + return new int[] { (int) resultVoltage, (int) resultDuration }; } /** @@ -68,7 +69,7 @@ private static int calculateAmountCoilEUtDiscount(int providedTemp, int required /** * Handles applying the coil EU/t discount. Call before overclocking. * - * @param recipeEUt the EU/t of the recipe + * @param recipeEUt the EU/t of the recipe * @param providedTemp the temperate provided by the machine * @param requiredTemp the required temperature of the recipe * @return the discounted EU/t @@ -81,19 +82,24 @@ public static int applyCoilEUtDiscount(int recipeEUt, int providedTemp, int requ } @Nonnull - public static int[] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, int maxOverclocks, int currentTemp, int recipeRequiredTemp) { + public static int[] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, + int maxOverclocks, int currentTemp, int recipeRequiredTemp) { int amountPerfectOC = calculateAmountCoilEUtDiscount(currentTemp, recipeRequiredTemp) / 2; // perfect overclock for every 1800k over recipe temperature if (amountPerfectOC > 0) { // use the normal overclock logic to do perfect OCs up to as many times as calculated - int[] overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + int[] overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, + PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); // overclock normally as much as possible after perfects are exhausted - return standardOverclockingLogic(overclock[0], maximumVoltage, overclock[1], maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(overclock[0], maximumVoltage, overclock[1], + maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, + STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } // no perfects are performed, do normal overclocking - return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, + STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } } diff --git a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java index 7d6baa4a9d7..9640df1db80 100644 --- a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java @@ -11,18 +11,21 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.api.util.OverlayedFluidHandler; import gregtech.api.util.OverlayedItemHandler; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.*; +import javax.annotation.Nonnull; + public abstract class ParallelLogic { /** @@ -33,7 +36,8 @@ public abstract class ParallelLogic { * @return returns the amount of possible time a recipe can be made from a given input inventory */ - public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable inputs, @Nonnull IMultipleTankHandler fluidInputs, int parallelAmount) { + public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable inputs, + @Nonnull IMultipleTankHandler fluidInputs, int parallelAmount) { // Find all the items in the combined Item Input inventories and create oversized ItemStacks Object2IntMap ingredientStacks = GTHashMaps.fromItemHandler(inputs); @@ -62,11 +66,14 @@ public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemH * @param voidFluids If the result of the fluid parallel limiting should be ignored * @return returns the amount of recipes that can be merged successfully into a given output inventory */ - public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable outputs, @Nonnull IMultipleTankHandler fluidOutputs, int parallelAmount, boolean voidItems, boolean voidFluids) { + public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable outputs, + @Nonnull IMultipleTankHandler fluidOutputs, int parallelAmount, + boolean voidItems, boolean voidFluids) { int modifiedItemParallelAmount = Integer.MAX_VALUE; int modifiedFluidParallelAmount = Integer.MAX_VALUE; - // If we are voiding both items and fluids, return the maximum number of parallels that can be performed from the inputs + // If we are voiding both items and fluids, return the maximum number of parallels that can be performed from + // the inputs if (voidItems && voidFluids) { return parallelAmount; } @@ -77,7 +84,8 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan if (voidItems) { modifiedItemParallelAmount = parallelAmount; } else { - modifiedItemParallelAmount = limitParallelByItems(recipe, new OverlayedItemHandler(outputs), parallelAmount); + modifiedItemParallelAmount = limitParallelByItems(recipe, new OverlayedItemHandler(outputs), + parallelAmount); } // If we are not voiding, and cannot fit any items, return 0 @@ -91,7 +99,8 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan if (voidFluids) { modifiedFluidParallelAmount = parallelAmount; } else { - modifiedFluidParallelAmount = limitParallelByFluids(recipe, new OverlayedFluidHandler(fluidOutputs), modifiedItemParallelAmount); + modifiedFluidParallelAmount = limitParallelByFluids(recipe, new OverlayedFluidHandler(fluidOutputs), + modifiedItemParallelAmount); } // If we are not voiding, and cannot fit any fluids, return 0 @@ -106,11 +115,13 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan /** * @param recipe the recipe from which we get the input to product ratio * @param multiplier the maximum possible multiplied we can get from the input inventory - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without - * voiding products. + * voiding products. */ - public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull OverlayedItemHandler overlayedItemHandler, int multiplier) { + public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull OverlayedItemHandler overlayedItemHandler, + int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -150,11 +161,15 @@ public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull Overlaye * @param recipeOutputList the recipe outputs from the recipe we are building up to its maximum parallel limit * @param outputsToAppend the recipe outputs from the recipe we want to append to the recipe we are building * @param multiplier the maximum possible multiplied we can get from the input inventory - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without - * voiding products. + * voiding products. */ - public static int limitParallelByItemsIncremental(@Nonnull List recipeOutputList, @Nonnull List outputsToAppend, @Nonnull OverlayedItemHandler overlayedItemHandler, final int multiplier) { + public static int limitParallelByItemsIncremental(@Nonnull List recipeOutputList, + @Nonnull List outputsToAppend, + @Nonnull OverlayedItemHandler overlayedItemHandler, + final int multiplier) { int minMultiplier = 0; int currentMultiplier = multiplier; int maxMultiplier = multiplier; @@ -163,8 +178,10 @@ public static int limitParallelByItemsIncremental(@Nonnull List recip Object2IntMap recipeOutputs = GTHashMaps.fromItemStackCollection(recipeOutputList); Object2IntMap recipeOutputsToAppend = GTHashMaps.fromItemStackCollection(outputsToAppend); - Object2IntMap appendedResultMap = new Object2IntLinkedOpenCustomHashMap<>(recipeOutputs, ItemStackHashStrategy.comparingAllButCount()); - recipeOutputsToAppend.forEach((stackKey, amt) -> appendedResultMap.merge(stackKey, amt * multiplier, Integer::sum)); + Object2IntMap appendedResultMap = new Object2IntLinkedOpenCustomHashMap<>(recipeOutputs, + ItemStackHashStrategy.comparingAllButCount()); + recipeOutputsToAppend + .forEach((stackKey, amt) -> appendedResultMap.merge(stackKey, amt * multiplier, Integer::sum)); while (minMultiplier != maxMultiplier) { overlayedItemHandler.reset(); @@ -210,7 +227,7 @@ public static int limitParallelByItemsIncremental(@Nonnull List recip * @param multiplier the current multiplier * @param maxMultiplier the last know multiplier that resulted in simulation failure * @return an array consisting of the last known multiplier, new multiplier to be attempted and - * the last know multiplier that resulted in failure + * the last know multiplier that resulted in failure */ @Nonnull public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int multiplier, int maxMultiplier) { @@ -225,17 +242,19 @@ public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int m if (maxMultiplier - minMultiplier <= 1) { multiplier = maxMultiplier = minMultiplier; } - return new int[]{minMultiplier, multiplier, maxMultiplier}; + return new int[] { minMultiplier, multiplier, maxMultiplier }; } /** * @param recipe the recipe from which we get the fluid input to product ratio * @param multiplier the maximum possible multiplied we can get from the input tanks - * see {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} + * see + * {@link ParallelLogic#getMaxRecipeMultiplier(Recipe, IItemHandlerModifiable, IMultipleTankHandler, int)} * @return the amount of times a {@link Recipe} outputs can be merged into a fluid handler without - * voiding products. + * voiding products. */ - public static int limitParallelByFluids(@Nonnull Recipe recipe, @Nonnull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { + public static int limitParallelByFluids(@Nonnull Recipe recipe, + @Nonnull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -271,17 +290,20 @@ public static int limitParallelByFluids(@Nonnull Recipe recipe, @Nonnull Overlay } /** - * Finds the maximum number of Recipes that can be performed at the same time based on the items in the item input inventory + * Finds the maximum number of Recipes that can be performed at the same time based on the items in the item input + * inventory * - * @param countIngredients a {@link Map} of {@link ItemStack}s that is the result of calling {@link GTHashMaps#fromItemHandler(IItemHandler)} + * @param countIngredients a {@link Map} of {@link ItemStack}s that is the result of calling + * {@link GTHashMaps#fromItemHandler(IItemHandler)} * @param recipe The {@link Recipe} for which to find the maximum that can be run simultaneously * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Items */ - protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngredients, @Nonnull Recipe recipe, int parallelAmount) { + protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngredients, @Nonnull Recipe recipe, + int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; - //map the recipe ingredients to account for duplicated and notConsumable ingredients. - //notConsumable ingredients are not counted towards the max ratio + // map the recipe ingredients to account for duplicated and notConsumable ingredients. + // notConsumable ingredients are not counted towards the max ratio Object2IntOpenHashMap notConsumableMap = new Object2IntOpenHashMap<>(); Object2IntOpenHashMap countableMap = new Object2IntOpenHashMap<>(); for (GTRecipeInput recipeIngredient : recipe.getInputs()) { @@ -315,16 +337,20 @@ protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngr } } } - // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC input - // with size 2, and only 1 in the input, needed will be equal to available, but this situation should still fail + // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC + // input + // with size 2, and only 1 in the input, needed will be equal to available, but this situation should still + // fail // as not all inputs are present if (needed >= available) { return 0; } } - // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the input bus - // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit that check + // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the + // input bus + // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit + // that check if (countableMap.isEmpty() && !notConsumableMap.isEmpty()) { return parallelAmount; } @@ -354,24 +380,28 @@ protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngr /** * Finds the maximum number of a specific recipe that can be performed based upon the fluids in the fluid inputs * - * @param countFluid a {@link Set} of {@link FluidStack}s that is the result of calling {@link GTHashMaps#fromFluidHandler(IFluidHandler)} + * @param countFluid a {@link Set} of {@link FluidStack}s that is the result of calling + * {@link GTHashMaps#fromFluidHandler(IFluidHandler)} * @param recipe The {@link Recipe} for which to find the maximum that can be run simultaneously * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Fluids */ - protected static int getMaxRatioFluid(@Nonnull Map countFluid, @Nonnull Recipe recipe, int parallelAmount) { + protected static int getMaxRatioFluid(@Nonnull Map countFluid, @Nonnull Recipe recipe, + int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; - //map the recipe input fluids to account for duplicated fluids, - //so their sum is counted against the total of fluids available in the input + // map the recipe input fluids to account for duplicated fluids, + // so their sum is counted against the total of fluids available in the input Map fluidCountMap = new HashMap<>(); Map notConsumableMap = new HashMap<>(); for (GTRecipeInput fluidInput : recipe.getFluidInputs()) { int fluidAmount = fluidInput.getAmount(); if (fluidInput.isNonConsumable()) { - notConsumableMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), (k, v) -> v + fluidAmount); + notConsumableMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), + (k, v) -> v + fluidAmount); notConsumableMap.putIfAbsent(new FluidKey(fluidInput.getInputFluidStack()), fluidAmount); } else { - fluidCountMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), (k, v) -> v + fluidAmount); + fluidCountMap.computeIfPresent(new FluidKey(fluidInput.getInputFluidStack()), + (k, v) -> v + fluidAmount); fluidCountMap.putIfAbsent(new FluidKey(fluidInput.getInputFluidStack()), fluidAmount); } } @@ -382,7 +412,8 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid int available = 0; // For every fluid gathered from the fluid inputs. for (Map.Entry inputFluid : countFluid.entrySet()) { - // Strip the Non-consumable tags here, as FluidKey compares the tags, which causes finding matching fluids + // Strip the Non-consumable tags here, as FluidKey compares the tags, which causes finding matching + // fluids // in the input tanks to fail, because there is nothing in those hatches with a non-consumable tag if (notConsumableFluid.getKey().equals(inputFluid.getKey())) { available = inputFluid.getValue(); @@ -397,16 +428,20 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid } } } - // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC input - // with size 1000, and only 500 in the input, needed will be equal to available, but this situation should still fail + // We need to check >= available here because of Non-Consumable inputs with stack size. If there is a NC + // input + // with size 1000, and only 500 in the input, needed will be equal to available, but this situation should + // still fail // as not all inputs are present if (needed >= available) { return 0; } } - // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the input bus - // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit that check + // Return the maximum parallel limit here if there are only non-consumed inputs, which are all found in the + // input bus + // At this point, we would have already returned 0 if we were missing any non-consumable inputs, so we can omit + // that check if (fluidCountMap.isEmpty() && !notConsumableMap.isEmpty()) { return parallelAmount; } @@ -433,8 +468,14 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid return minMultiplier; } - // At this point, the recipe is already trimmed according to the item and fluid output limit, so we just need to take care of voiding - public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, @Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable importInventory, @Nonnull IMultipleTankHandler importFluids, @Nonnull IItemHandlerModifiable exportInventory, @Nonnull IMultipleTankHandler exportFluids, int parallelAmount, long maxVoltage, @Nonnull IVoidable voidable) { + // At this point, the recipe is already trimmed according to the item and fluid output limit, so we just need to + // take care of voiding + public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, @Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable importInventory, + @Nonnull IMultipleTankHandler importFluids, + @Nonnull IItemHandlerModifiable exportInventory, + @Nonnull IMultipleTankHandler exportFluids, int parallelAmount, + long maxVoltage, @Nonnull IVoidable voidable) { // First check if we are limited by recipe inputs. This can short circuit a lot of consecutive checking int multiplierByInputs = getMaxRecipeMultiplier(currentRecipe, importInventory, importFluids, parallelAmount); if (multiplierByInputs == 0) { @@ -450,18 +491,19 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, boolean voidItems = voidable.canVoidRecipeItemOutputs(); boolean voidFluids = voidable.canVoidRecipeFluidOutputs(); - // Simulate the merging of the maximum amount of recipes that can be run with these items // and limit by the amount we can successfully merge int limitByOutput; - limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, exportInventory, exportFluids, multiplierByInputs, voidItems, voidFluids); + limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, exportInventory, exportFluids, + multiplierByInputs, voidItems, voidFluids); int recipeEUt = currentRecipe.getEUt(); if (recipeEUt != 0) { int limitByVoltage = Math.abs((int) (maxVoltage / recipeEUt)); int parallelizable = Math.min(limitByVoltage, limitByOutput); if (parallelizable != 0) - // Use the minimum between the amount of recipes we can run with available inputs and amount of recipe outputs that can fit + // Use the minimum between the amount of recipes we can run with available inputs and amount of recipe + // outputs that can fit recipeBuilder.append(currentRecipe, Math.min(parallelizable, multiplierByInputs), false); } else if (limitByOutput > 0) { recipeBuilder.append(currentRecipe, limitByOutput, false); @@ -471,7 +513,8 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, } /** - * Constructs a {@link RecipeBuilder} containing the recipes from the ItemStacks available in the {@code importInventory} + * Constructs a {@link RecipeBuilder} containing the recipes from the ItemStacks available in the + * {@code importInventory} * Does NOT take fluids into account whatsoever * * @param recipeMap The {@link RecipeMap} to search for recipes @@ -480,9 +523,13 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, * @param parallelAmount The maximum amount of recipes that can be performed at one time * @param maxVoltage The maximum voltage of the machine * @param voidable The MetaTileEntity performing the parallel recipe - * @return A {@link RecipeBuilder} containing the recipes that can be performed in parallel, limited by the ingredients available, and the output space available. + * @return A {@link RecipeBuilder} containing the recipes that can be performed in parallel, limited by the + * ingredients available, and the output space available. */ - public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap, @Nonnull IItemHandlerModifiable importInventory, @Nonnull IItemHandlerModifiable exportInventory, int parallelAmount, long maxVoltage, IVoidable voidable) { + public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap, + @Nonnull IItemHandlerModifiable importInventory, + @Nonnull IItemHandlerModifiable exportInventory, + int parallelAmount, long maxVoltage, IVoidable voidable) { RecipeBuilder recipeBuilder = null; OverlayedItemHandler overlayedItemHandler = new OverlayedItemHandler(exportInventory); @@ -506,11 +553,11 @@ public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap if (matchingRecipe != null) { inputIngredient = matchingRecipe.getInputs().get(0); if (recipeBuilder == null) { - //here we make a copy of the recipe builder of the current recipe map, while zeroing - //the recipe builder EUt, since we're going to add to the total EUt of the recipes appended. - //not zeroing means there is a base cost of 1 recipe EUt while doing parallel recipes - //for example running 2 parallel recipes would cost the EUt of doing 3 recipes. - //same should apply for the recipe map duration + // here we make a copy of the recipe builder of the current recipe map, while zeroing + // the recipe builder EUt, since we're going to add to the total EUt of the recipes appended. + // not zeroing means there is a base cost of 1 recipe EUt while doing parallel recipes + // for example running 2 parallel recipes would cost the EUt of doing 3 recipes. + // same should apply for the recipe map duration recipeBuilder = recipeMap.recipeBuilder().EUt(0).duration(0); } @@ -521,22 +568,24 @@ public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap throw new IllegalStateException( String.format("Got recipe with null ingredient %s", matchingRecipe)); - // Trim the recipe outputs here if required - matchingRecipe = Recipe.trimRecipeOutputs(matchingRecipe, recipeMap, voidable.getItemOutputLimit(), voidable.getFluidOutputLimit()); - + matchingRecipe = Recipe.trimRecipeOutputs(matchingRecipe, recipeMap, voidable.getItemOutputLimit(), + voidable.getFluidOutputLimit()); - //equivalent of getting the max ratio from the inputs from Parallel logic - int ingredientRatio = Math.min(parallelAmount - engagedItems, currentInputItem.getCount() / Math.max(matchingRecipe.getInputs().get(0).getAmount(), 1)); + // equivalent of getting the max ratio from the inputs from Parallel logic + int ingredientRatio = Math.min(parallelAmount - engagedItems, + currentInputItem.getCount() / Math.max(matchingRecipe.getInputs().get(0).getAmount(), 1)); - //how much we can add to the output inventory + // how much we can add to the output inventory int limitByOutput = Integer.MAX_VALUE; if (!voidable.canVoidRecipeItemOutputs()) { - // Limit by the number of recipe outputs and chanced outputs, to simulate cases where 100% chanced outputs were obtained - limitByOutput = limitParallelByItemsIncremental(recipeBuilder.getAllItemOutputs(), matchingRecipe.getOutputs(), overlayedItemHandler, ingredientRatio); + // Limit by the number of recipe outputs and chanced outputs, to simulate cases where 100% chanced + // outputs were obtained + limitByOutput = limitParallelByItemsIncremental(recipeBuilder.getAllItemOutputs(), + matchingRecipe.getOutputs(), overlayedItemHandler, ingredientRatio); } - //amount to actually multiply the recipe by + // amount to actually multiply the recipe by int multiplierRecipeAmount = Math.min(ingredientRatio, limitByOutput); if (multiplierRecipeAmount > 0) { diff --git a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java index 197900a00c8..fead3278c62 100644 --- a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java @@ -2,9 +2,10 @@ import gregtech.api.recipes.Recipe; +import java.util.Collection; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Collection; public interface IResearchRecipeMap { @@ -12,7 +13,7 @@ public interface IResearchRecipeMap { * Add a recipe to the data stick registry for the {@link gregtech.api.recipes.RecipeMap} * * @param researchId the ID to match recipes to, typically derived from the recipe output - * @param recipe the recipe to add to the registry + * @param recipe the recipe to add to the registry */ void addDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); @@ -27,7 +28,7 @@ public interface IResearchRecipeMap { * Remove a recipe from the data stick registry for the {@link gregtech.api.recipes.RecipeMap} * * @param researchId the ID to match recipes to, typically derived from the recipe output - * @param recipe the recipe to remove from the registry + * @param recipe the recipe to remove from the registry * @return true if the recipe was successfully removed, otherwise false */ boolean removeDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); diff --git a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java index f213e2c96b4..e5ae0f57ca3 100644 --- a/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IScannerRecipeMap.java @@ -1,8 +1,10 @@ package gregtech.api.recipes.machines; import gregtech.api.recipes.Recipe; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +28,8 @@ interface ICustomScannerLogic { * recipe is not found to run. Return null if no recipe should be run by your logic. */ @Nullable - Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage); + Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage); /** * @return A list of Recipes that are never registered, but are added to JEI to demonstrate the custom logic. diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java index d255e14a345..a3650667c9b 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java @@ -10,38 +10,48 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.ResearchProperty; import gregtech.api.recipes.recipeproperties.ResearchPropertyData; + +import net.minecraftforge.items.IItemHandlerModifiable; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class RecipeMapAssemblyLine> extends RecipeMap implements IResearchRecipeMap { /** Contains the recipes for each research key */ private final Map> researchEntries = new Object2ObjectOpenHashMap<>(); - public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override @Nonnull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 176) - .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, ProgressWidget.MoveType.VERTICAL)); + .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, + ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, + ProgressWidget.MoveType.VERTICAL)); this.addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); this.addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); return builder; } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHandlerModifiable itemHandler, @Nonnull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHandlerModifiable itemHandler, + @Nonnull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int startInputsX = 80 - 4 * 18; int fluidInputsCount = fluidHandler.getTanks(); int startInputsY = 37 - 2 * 18; @@ -55,7 +65,8 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHa for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { int slotIndex = i * 4 + j; - addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, false, false); + addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, + false, false); } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java index 8d736bd3b55..034ec60c4b9 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java @@ -6,19 +6,25 @@ import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; public class RecipeMapCokeOven> extends RecipeMap { - public RecipeMapCokeOven(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapCokeOven(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100) - .widget(new ProgressWidget(200, 70, 19, 36, 18, GuiTextures.PROGRESS_BAR_COKE_OVEN, ProgressWidget.MoveType.HORIZONTAL)); + .widget(new ProgressWidget(200, 70, 19, 36, 18, GuiTextures.PROGRESS_BAR_COKE_OVEN, + ProgressWidget.MoveType.HORIZONTAL)); addSlot(builder, 52, 10, 0, importItems, null, false, false); addSlot(builder, 106, 10, 0, exportItems, null, false, true); addSlot(builder, 106, 28, 0, null, exportFluids, true, true); diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java index 0a18c706f30..a0af84c51dc 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java @@ -1,6 +1,5 @@ package gregtech.api.recipes.machines; -import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -8,20 +7,27 @@ import gregtech.api.gui.widgets.RecipeProgressWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.util.concurrent.AtomicDouble; import org.apache.commons.lang3.tuple.Pair; import java.util.function.DoubleSupplier; public class RecipeMapCrackerUnit> extends RecipeMap { - public RecipeMapCrackerUnit(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapCrackerUnit(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); if (getMaxInputs() == 1) { addSlot(builder, 52, 24 + yOffset, 0, importItems, importFluids, false, false); @@ -29,7 +35,8 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, int[] grid = determineSlotsGrid(getMaxInputs()); for (int y = 0; y < grid[1]; y++) { for (int x = 0; x < grid[0]; x++) { - addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, + addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), + 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, y * grid[0] + x, importItems, importFluids, false, false); } } @@ -40,14 +47,18 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, addSlot(builder, 34, 24 + yOffset + 19 + 18, 1, importItems, importFluids, true, false); Pair suppliers = createPairedSupplier(200, 41, 0.5); - builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, this)); - builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture, moveType, this)); + builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, + GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, this)); + builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture, + moveType, this)); return builder; } - public static Pair createPairedSupplier(int ticksPerCycle, int width, double splitPoint) { + public static Pair createPairedSupplier(int ticksPerCycle, int width, + double splitPoint) { AtomicDouble tracker = new AtomicDouble(0.0); DoubleSupplier supplier1 = new ProgressWidget.TimedProgressSupplier(ticksPerCycle, width, false) { + @Override public double getAsDouble() { double val = super.getAsDouble(); @@ -55,7 +66,8 @@ public double getAsDouble() { return val >= splitPoint ? 1.0 : (1.0 / splitPoint) * val; } }; - DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; + DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; return Pair.of(supplier1, supplier2); } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java index 8fc71d7bb51..d338f8c5898 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java @@ -9,22 +9,27 @@ import gregtech.api.gui.widgets.TankWidget; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.UniversalDistillationRecipeBuilder; + import net.minecraftforge.items.IItemHandlerModifiable; public class RecipeMapDistillationTower extends RecipeMap { - public RecipeMapDistillationTower(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, boolean modifyFluidOutputs, UniversalDistillationRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); + public RecipeMapDistillationTower(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, + boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, + boolean modifyFluidOutputs, UniversalDistillationRecipeBuilder defaultRecipe, + boolean isHidden) { + super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, + modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); } @Override - protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { if (isFluid) { TankWidget tankWidget = new TankWidget(fluidHandler.getTankAt(slotIndex), x, y, 18, 18); TextureArea base = GuiTextures.FLUID_SLOT; - if (!isOutputs) tankWidget.setBackgroundTexture(base, GuiTextures.BEAKER_OVERLAY_1); else if (slotIndex == 0 || slotIndex == 3 || slotIndex == 6 || slotIndex == 9) @@ -47,10 +52,12 @@ else if (slotIndex == 2 || slotIndex == 5 || slotIndex == 8 || slotIndex == 11) } @Override - //this DOES NOT include machine control widgets or binds player inventory - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + // this DOES NOT include machine control widgets or binds player inventory + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); - builder.widget(new ProgressWidget(200, 47, 8, 66, 58, GuiTextures.PROGRESS_BAR_DISTILLATION_TOWER, ProgressWidget.MoveType.HORIZONTAL)); + builder.widget(new ProgressWidget(200, 47, 8, 66, 58, GuiTextures.PROGRESS_BAR_DISTILLATION_TOWER, + ProgressWidget.MoveType.HORIZONTAL)); addInventorySlotGroup(builder, importItems, importFluids, false, 9); addInventorySlotGroup(builder, exportItems, exportFluids, true, 9); if (this.specialTexture != null && this.specialTexturePosition != null) @@ -59,7 +66,8 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int itemInputsCount = itemHandler.getSlots(); int fluidInputsCount = fluidHandler.getTanks(); boolean invertFluids = false; @@ -78,9 +86,11 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi if (wasGroupOutput && isOutputs) startInputsY -= 9; if (itemHandler.getSlots() == 6 && fluidHandler.getTanks() == 2 && !isOutputs) startInputsY -= 9; if (!isOutputs) - addSlot(builder, 40, startInputsY + (itemSlotsToDown - 1) * 18 - 18, 0, itemHandler, fluidHandler, invertFluids, false); + addSlot(builder, 40, startInputsY + (itemSlotsToDown - 1) * 18 - 18, 0, itemHandler, fluidHandler, + invertFluids, false); else - addSlot(builder, 94, startInputsY + (itemSlotsToDown - 1) * 18, 0, itemHandler, fluidHandler, invertFluids, true); + addSlot(builder, 94, startInputsY + (itemSlotsToDown - 1) * 18, 0, itemHandler, fluidHandler, invertFluids, + true); if (wasGroupOutput) startInputsY += 2; diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 22f63862a4b..561bb506f06 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -4,17 +4,20 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeItemInput; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFluidCanner extends RecipeMap { - public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } @@ -25,7 +28,8 @@ public Recipe findRecipe(long voltage, List inputs, List if (recipe != null) return recipe; for (ItemStack input : inputs) { - if (input != null && input != ItemStack.EMPTY && input.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + if (input != null && input != ItemStack.EMPTY && + input.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { // Make a copy to use for creating recipes ItemStack inputStack = input.copy(); @@ -33,15 +37,16 @@ public Recipe findRecipe(long voltage, List inputs, List // Make another copy to use for draining and filling ItemStack fluidHandlerItemStack = inputStack.copy(); - IFluidHandlerItem fluidHandlerItem = fluidHandlerItemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = fluidHandlerItemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return null; FluidStack containerFluid = fluidHandlerItem.drain(Integer.MAX_VALUE, true); if (containerFluid != null) { - //if we actually drained something, then it's draining recipe + // if we actually drained something, then it's draining recipe return recipeBuilder() - //we can reuse recipe as long as input container stack fully matches our one + // we can reuse recipe as long as input container stack fully matches our one .inputs(new GTRecipeItemInput(inputStack, 1)) .outputs(fluidHandlerItem.getContainer()) .fluidOutputs(containerFluid) @@ -49,13 +54,13 @@ public Recipe findRecipe(long voltage, List inputs, List .build().getResult(); } - //if we didn't drain anything, try filling container + // if we didn't drain anything, try filling container if (!fluidInputs.isEmpty() && fluidInputs.get(0) != null) { FluidStack inputFluid = fluidInputs.get(0).copy(); inputFluid.amount = fluidHandlerItem.fill(inputFluid, true); if (inputFluid.amount > 0) { return recipeBuilder() - //we can reuse recipe as long as input container stack fully matches our one + // we can reuse recipe as long as input container stack fully matches our one .inputs(new GTRecipeItemInput(inputStack, 1)) .fluidInputs(inputFluid) .outputs(fluidHandlerItem.getContainer()) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index 6efc42853c9..bb44e5842d5 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -11,19 +11,22 @@ import gregtech.api.recipes.ingredients.GTRecipeItemInput; import gregtech.api.util.GTUtility; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFormingPress extends RecipeMap { private static ItemStack NAME_MOLD = ItemStack.EMPTY; - public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } @@ -49,7 +52,8 @@ public Recipe findRecipe(long voltage, List inputs, List if (moldStack.isEmpty() && inputStack.isItemEqual(NAME_MOLD)) { // only valid if the name mold has a name, which is stored in the "display" sub-compound - if (inputStack.getTagCompound() != null && inputStack.getTagCompound().hasKey("display", Constants.NBT.TAG_COMPOUND)) { + if (inputStack.getTagCompound() != null && + inputStack.getTagCompound().hasKey("display", Constants.NBT.TAG_COMPOUND)) { moldStack = inputStack; } } else if (itemStack.isEmpty()) { @@ -62,7 +66,8 @@ public Recipe findRecipe(long voltage, List inputs, List ItemStack output = GTUtility.copy(1, itemStack); output.setStackDisplayName(moldStack.getDisplayName()); return this.recipeBuilder() - .notConsumable(new GTRecipeItemInput(moldStack)) //recipe is reusable as long as mold stack matches + .notConsumable(new GTRecipeItemInput(moldStack)) // recipe is reusable as long as mold stack + // matches .inputs(GTUtility.copy(1, itemStack)) .outputs(output) .duration(40).EUt(4) @@ -74,7 +79,8 @@ public Recipe findRecipe(long voltage, List inputs, List } @Override - protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { SlotWidget slotWidget = new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs); TextureArea base = GuiTextures.SLOT; if (isOutputs) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java index 513f6a3d400..4d27dd2bca5 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java @@ -5,18 +5,21 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.util.GTUtility; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapFurnace extends RecipeMap { public static final int RECIPE_EUT = 4; public static final int RECIPE_DURATION = 128; - public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java index ea3a7099d37..f75138d6f27 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java @@ -8,7 +8,9 @@ import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraftforge.items.IItemHandlerModifiable; + import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; @@ -17,18 +19,22 @@ public class RecipeMapResearchStation> extends RecipeMap implements IScannerRecipeMap { public RecipeMapResearchStation(@NotNull String unlocalizedName, int maxInputs, int maxOutputs, - int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, boolean isHidden) { + int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, + boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipeBuilder, isHidden); } @Override @NotNull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { Pair pairedSuppliers = RecipeMapCrackerUnit.createPairedSupplier(200, 90, 0.75); return ModularUI.builder(GuiTextures.BACKGROUND, 176, 166) .widget(new ImageWidget(10, 0, 84, 60, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_BASE)) - .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) + .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) .widget(new SlotWidget(importItems, 0, 115, 50, true, true) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)) .widget(new SlotWidget(importItems, 1, 43, 21, true, true) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index c404b7d173a..a0b297d8a83 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -3,19 +3,23 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class RecipeMapScanner extends RecipeMap implements IScannerRecipeMap { private static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); - public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { + public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); } diff --git a/src/main/java/gregtech/api/recipes/map/Branch.java b/src/main/java/gregtech/api/recipes/map/Branch.java index de452fbbc42..f6e61e15689 100644 --- a/src/main/java/gregtech/api/recipes/map/Branch.java +++ b/src/main/java/gregtech/api/recipes/map/Branch.java @@ -1,13 +1,16 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.Recipe; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import javax.annotation.Nonnull; import java.util.Map; import java.util.stream.Stream; +import javax.annotation.Nonnull; + public class Branch { + // Keys on this have *(should)* unique hashcodes. private Map> nodes; // Keys on this have collisions, and must be differentiated by equality. @@ -16,13 +19,16 @@ public class Branch { public Stream getRecipes(boolean filterHidden) { Stream stream = null; if (nodes != null) { - stream = nodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); + stream = nodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); } if (specialNodes != null) { if (stream == null) { - stream = specialNodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); + stream = specialNodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden))); } else { - stream = Stream.concat(stream, specialNodes.values().stream().flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden)))); + stream = Stream.concat(stream, specialNodes.values().stream() + .flatMap(either -> either.map(Stream::of, right -> right.getRecipes(filterHidden)))); } } if (stream == null) { diff --git a/src/main/java/gregtech/api/recipes/map/Either.java b/src/main/java/gregtech/api/recipes/map/Either.java index c9cbf0b8987..cfe5e1356a6 100644 --- a/src/main/java/gregtech/api/recipes/map/Either.java +++ b/src/main/java/gregtech/api/recipes/map/Either.java @@ -7,6 +7,7 @@ public abstract class Either { private static final class Left extends Either { + private final L value; public Left(final L value) { @@ -14,7 +15,8 @@ public Left(final L value) { } @Override - public Either mapBoth(final Function f1, final Function f2) { + public Either mapBoth(final Function f1, + final Function f2) { return new Left<>(f1.apply(value)); } @@ -67,8 +69,8 @@ public int hashCode() { } } - private static final class Right extends Either { + private final R value; public Right(final R value) { @@ -76,7 +78,8 @@ public Right(final R value) { } @Override - public Either mapBoth(final Function f1, final Function f2) { + public Either mapBoth(final Function f1, + final Function f2) { return new Right<>(f2.apply(value)); } @@ -129,10 +132,10 @@ public int hashCode() { } } - private Either() { - } + private Either() {} - public abstract Either mapBoth(final Function f1, final Function f2); + public abstract Either mapBoth(final Function f1, + final Function f2); public abstract T map(final Function l, Function r); diff --git a/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java b/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java index 0e12e99b277..354358916bc 100644 --- a/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapFluidIngredient.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -25,7 +26,8 @@ public MapFluidIngredient(FluidStack fluidStack) { @Override protected int hash() { - //the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but will still have the same fluidName. + // the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but + // will still have the same fluidName. int hash = 31 + fluid.getName().hashCode(); if (tag != null) { return 31 * hash + tag.hashCode(); @@ -37,7 +39,8 @@ protected int hash() { public boolean equals(Object o) { if (super.equals(o)) { MapFluidIngredient other = (MapFluidIngredient) o; - //the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, but will still have the same fluidName. + // the Fluid registered to the fluidName on game load might not be the same Fluid after loading the world, + // but will still have the same fluidName. if (this.fluid.getName().equals(other.fluid.getName())) { return Objects.equals(tag, other.tag); } diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java index 9681f28ce80..ec9dffd4b36 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java @@ -1,15 +1,17 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.List; -public class MapItemStackIngredient extends AbstractMapIngredient { +import javax.annotation.Nonnull; +public class MapItemStackIngredient extends AbstractMapIngredient { protected ItemStack stack; protected int meta; @@ -69,6 +71,7 @@ protected int hash() { @Override public String toString() { - return "MapItemStackIngredient{" + "item=" + stack.getItem().getRegistryName() + "} {meta=" + meta + "} {tag=" + tag + "}"; + return "MapItemStackIngredient{" + "item=" + stack.getItem().getRegistryName() + "} {meta=" + meta + "} {tag=" + + tag + "}"; } } diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java index 1b6b0df3ed8..8261cb94461 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java @@ -1,14 +1,18 @@ package gregtech.api.recipes.map; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.List; +import javax.annotation.Nonnull; + public class MapItemStackNBTIngredient extends MapItemStackIngredient { + protected GTRecipeInput gtRecipeInput = null; public MapItemStackNBTIngredient(ItemStack stack, int meta, NBTTagCompound tag) { diff --git a/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java b/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java index 4814f5bdfc0..f02df80bc9c 100644 --- a/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapOreDictIngredient.java @@ -20,5 +20,4 @@ public boolean equals(Object obj) { } return false; } - } diff --git a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java index 953c19b2a4d..e0dc3939107 100644 --- a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java @@ -1,7 +1,8 @@ package gregtech.api.recipes.map; -import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; +import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; + import net.minecraft.nbt.NBTTagCompound; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java index 0418211d0db..1235a278cf7 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.metatileentity.multiblock.CleanroomType; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java index 47542ab97bb..20fa33c1a05 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ComputationProperty.java @@ -22,6 +22,7 @@ public static ComputationProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.computation_per_tick", castValue(value)), x, y, color); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.computation_per_tick", castValue(value)), x, y, + color); } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java index 7c444f32bc8..9620d1b6a22 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/DefaultProperty.java @@ -13,5 +13,4 @@ public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe." + getKey(), castValue(value)), x, y, color); } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java index 2310d82d6ad..89f6bb201d6 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/EmptyRecipePropertyStorage.java @@ -8,9 +8,7 @@ public final class EmptyRecipePropertyStorage implements IRecipePropertyStorage public static final EmptyRecipePropertyStorage INSTANCE = new EmptyRecipePropertyStorage(); - private EmptyRecipePropertyStorage() { - - } + private EmptyRecipePropertyStorage() {} @Override public boolean store(RecipeProperty recipeProperty, Object value) { @@ -23,9 +21,7 @@ public boolean remove(RecipeProperty recipeProperty) { } @Override - public void freeze(boolean frozen) { - - } + public void freeze(boolean frozen) {} @Override public IRecipePropertyStorage copy() { diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java index d1742922576..12fd90e7748 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/FusionEUToStartProperty.java @@ -1,8 +1,10 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.util.TextFormattingUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.Validate; import java.util.Map; @@ -31,7 +33,8 @@ public static FusionEUToStartProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.eu_to_start", - TextFormattingUtil.formatLongToCompactString(castValue(value))) + getFusionTier(castValue(value)), x, y, color); + TextFormattingUtil.formatLongToCompactString(castValue(value))) + getFusionTier(castValue(value)), x, y, + color); } private static String getFusionTier(Long eu) { @@ -48,6 +51,5 @@ public static void registerFusionTier(int tier, String shortName) { Validate.notNull(shortName); long maxEU = 16 * 10000000L * (long) Math.pow(2, tier - 6); registeredFusionTiers.put(maxEU, shortName); - } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java index 7d12ad2f138..94bb810e3b1 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/GasCollectorDimensionProperty.java @@ -1,15 +1,15 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.worldgen.config.WorldGenRegistry; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.IntList; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; -import java.util.List; -import java.util.Map; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.IntList; public class GasCollectorDimensionProperty extends RecipeProperty { + public static final String KEY = "dimension"; private static GasCollectorDimensionProperty INSTANCE; @@ -45,5 +45,4 @@ private static String getDimensionsForRecipe(IntList value) { } return str; } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java index bdcbdce5576..234434bf003 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/IRecipePropertyStorage.java @@ -59,5 +59,4 @@ public interface IRecipePropertyStorage { * @return {@link Object} value on success; otherwise {@code null} */ Object getRawRecipePropertyValue(String key); - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java index 512e837e58d..725129e8843 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ImplosionExplosiveProperty.java @@ -10,7 +10,6 @@ public class ImplosionExplosiveProperty extends RecipeProperty { private static ImplosionExplosiveProperty INSTANCE; - private ImplosionExplosiveProperty() { super(KEY, ItemStack.class); } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java index 13f689e9401..524fd7180fe 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/PrimitiveProperty.java @@ -22,8 +22,7 @@ public static PrimitiveProperty getInstance() { } @Override - public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - } + public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) {} @Override public boolean hideTotalEU() { diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java index a04120bc509..9dde81bb195 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/RecipeProperty.java @@ -8,6 +8,7 @@ import java.util.Objects; public abstract class RecipeProperty { + private final Class type; private final String key; @@ -25,8 +26,7 @@ public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value, } @SideOnly(Side.CLIENT) - public void getTooltipStrings(List tooltip, int mouseX, int mouseY, Object value) { - } + public void getTooltipStrings(List tooltip, int mouseX, int mouseY, Object value) {} public int getInfoHeight(Object value) { return 10; // GTRecipeWrapper#LINE_HEIGHT diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java b/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java index 2645053bd93..a74ba78da6d 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorage.java @@ -1,6 +1,7 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.util.GTLog; + import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import java.util.HashSet; @@ -131,5 +132,4 @@ private RecipeProperty getRecipePropertyValue(String key) { return null; } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java index 4b60e4f0283..d69a8ec7332 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java @@ -2,11 +2,12 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import javax.annotation.Nonnull; + public final class ResearchPropertyData implements Iterable { private final Collection entries = new ArrayList<>(); @@ -38,7 +39,7 @@ public static final class ResearchEntry { /** * @param researchId the id of the research - * @param dataItem the item allowed to contain the research + * @param dataItem the item allowed to contain the research */ public ResearchEntry(@Nonnull String researchId, @Nonnull ItemStack dataItem) { this.researchId = researchId; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java index e3cc67122e1..e364e5c0d7e 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java @@ -1,15 +1,19 @@ package gregtech.api.recipes.recipeproperties; import gregtech.api.unification.material.Material; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.Validate; -import javax.annotation.Nonnull; import java.util.Map; import java.util.TreeMap; +import javax.annotation.Nonnull; + public class TemperatureProperty extends RecipeProperty { + public static final String KEY = "temperature"; private static final TreeMap registeredCoilTypes = new TreeMap<>((x, y) -> y - x); @@ -65,5 +69,4 @@ public static void registerCoilType(int temperature, Material coilMaterial, Stri registeredCoilTypes.put(temperature, coilMaterial); } } - } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java index 32088b197e9..3557539d1ee 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/TotalComputationProperty.java @@ -22,7 +22,8 @@ public static TotalComputationProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total_computation", castValue(value)), x, y, color); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total_computation", castValue(value)), x, y, + color); } @Override diff --git a/src/main/java/gregtech/api/storage/ICraftingStorage.java b/src/main/java/gregtech/api/storage/ICraftingStorage.java index 355c26f714a..15d49e87511 100644 --- a/src/main/java/gregtech/api/storage/ICraftingStorage.java +++ b/src/main/java/gregtech/api/storage/ICraftingStorage.java @@ -1,10 +1,12 @@ package gregtech.api.storage; import gregtech.common.metatileentities.storage.CraftingRecipeMemory; + import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; public interface ICraftingStorage { + World getWorld(); ItemStackHandler getCraftingGrid(); diff --git a/src/main/java/gregtech/api/terminal/TerminalRegistry.java b/src/main/java/gregtech/api/terminal/TerminalRegistry.java index b23bfbae207..7e99e758a8a 100644 --- a/src/main/java/gregtech/api/terminal/TerminalRegistry.java +++ b/src/main/java/gregtech/api/terminal/TerminalRegistry.java @@ -30,6 +30,7 @@ import gregtech.common.terminal.app.worldprospector.WorldProspectorARApp; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.SimpleReloadableResourceManager; @@ -40,12 +41,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.io.File; import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class TerminalRegistry { + public static final Map APP_REGISTER = new LinkedHashMap<>(); public static final Map HW_REGISTER = new LinkedHashMap<>(); public static final Map[]> APP_HW_DEMAND = new HashMap<>(); @@ -161,10 +164,10 @@ public static void init() { @SideOnly(Side.CLIENT) public static void initTerminalFiles() { - ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(TerminalRegistry::onResourceManagerReload); + ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(TerminalRegistry::onResourceManagerReload); } - @SideOnly(Side.CLIENT) public static void onResourceManagerReload(IResourceManager resourceManager) { FileUtility.extractJarFiles(String.format("/assets/%s/%s", GTValues.MODID, "terminal"), TERMINAL_PATH, false); @@ -188,7 +191,8 @@ public static void registerHardware(Hardware hardware) { HW_REGISTER.put(name, hardware); } - public static void registerHardwareDemand(String name, boolean isDefaultApp, @Nonnull List[] hardware, @Nonnull List[] upgrade) { + public static void registerHardwareDemand(String name, boolean isDefaultApp, @Nonnull List[] hardware, + @Nonnull List[] upgrade) { if (name != null && APP_REGISTER.containsKey(name)) { if (isDefaultApp) { DEFAULT_APPS.add(name); @@ -225,17 +229,19 @@ public static List getAppHardwareDemand(String name, int tier) { } public static List getAppHardwareUpgradeConditions(String name, int tier) { - return APP_UPGRADE_CONDITIONS.get(name)[tier] != null ? APP_UPGRADE_CONDITIONS.get(name)[tier] : Collections.emptyList(); + return APP_UPGRADE_CONDITIONS.get(name)[tier] != null ? APP_UPGRADE_CONDITIONS.get(name)[tier] : + Collections.emptyList(); } private static class AppRegistryBuilder { + AbstractApplication app; boolean isDefaultApp; BatteryHardware[] battery; List[] hardware; List[] upgrade; - public static AppRegistryBuilder create(AbstractApplication app){ + public static AppRegistryBuilder create(AbstractApplication app) { AppRegistryBuilder builder = new AppRegistryBuilder(); builder.app = app; builder.battery = new BatteryHardware[app.getMaxTier() + 1]; @@ -244,7 +250,7 @@ public static AppRegistryBuilder create(AbstractApplication app){ return builder; } - public AppRegistryBuilder defaultApp(){ + public AppRegistryBuilder defaultApp() { this.isDefaultApp = true; return this; } diff --git a/src/main/java/gregtech/api/terminal/app/ARApplication.java b/src/main/java/gregtech/api/terminal/app/ARApplication.java index 273e11fa631..c5bd9a4e564 100644 --- a/src/main/java/gregtech/api/terminal/app/ARApplication.java +++ b/src/main/java/gregtech/api/terminal/app/ARApplication.java @@ -2,6 +2,7 @@ import gregtech.api.terminal.os.SystemCall; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -14,14 +15,19 @@ * @Author: KilaBash * @Date: 2021/09/13 * @Description: Application for AR. - * When AR is running, {@link #tickAR(EntityPlayer)} and {@link #drawARScreen(RenderWorldLastEvent)} will be called when you hold the terminal in one of your hands. - * Therefore, at most one AR app is active on the terminal at any one time. And when you open the terminal GUI it automatically closes the currently running AR. - * You have access to the app's NBT of the handheld terminal when the AR is active, to load configs, init and so on. - * Don't try to write NBT, you should always be aware that the AR is running on the client side. - * if you really want to do something on the server side when AR is running, plz send packets. Because it's always running on the client side!!!!!!!!!! - * (If you need data from NBT, dont forget to write nbt when closeApp {@link #closeApp()}) + * When AR is running, {@link #tickAR(EntityPlayer)} and {@link #drawARScreen(RenderWorldLastEvent)} will + * be called when you hold the terminal in one of your hands. + * Therefore, at most one AR app is active on the terminal at any one time. And when you open the terminal + * GUI it automatically closes the currently running AR. + * You have access to the app's NBT of the handheld terminal when the AR is active, to load configs, init + * and so on. + * Don't try to write NBT, you should always be aware that the AR is running on the client side. + * if you really want to do something on the server side when AR is running, plz send packets. Because + * it's always running on the client side!!!!!!!!!! + * (If you need data from NBT, dont forget to write nbt when closeApp {@link #closeApp()}) */ -public abstract class ARApplication extends AbstractApplication{ +public abstract class ARApplication extends AbstractApplication { + protected ItemStack heldStack; public ARApplication(String name) { @@ -69,9 +75,7 @@ protected final void openAR() { * this will be fired every time you first switch selected slot to the held terminal. */ @SideOnly(Side.CLIENT) - public void onAROpened() { - - } + public void onAROpened() {} /** * this will be fired when switch the current slot (terminal) to other slots or open this terminal. @@ -84,17 +88,17 @@ public void onARClosed() { /** * Be careful! do not try to use non-static field or call a non-static function here. - * This method is called with the registered instance. {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} + * This method is called with the registered instance. + * {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} */ @SideOnly(Side.CLIENT) - public void tickAR(EntityPlayer player) { - } + public void tickAR(EntityPlayer player) {} /** * Be careful! do not try to use non-static field or call a non-static function here. - * This method is called with the registered instance. {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} + * This method is called with the registered instance. + * {@link gregtech.api.terminal.TerminalRegistry#registerApp(AbstractApplication)} */ @SideOnly(Side.CLIENT) public abstract void drawARScreen(RenderWorldLastEvent event); - } diff --git a/src/main/java/gregtech/api/terminal/app/AbstractApplication.java b/src/main/java/gregtech/api/terminal/app/AbstractApplication.java index ae4c53a5d0b..30f5878f829 100644 --- a/src/main/java/gregtech/api/terminal/app/AbstractApplication.java +++ b/src/main/java/gregtech/api/terminal/app/AbstractApplication.java @@ -12,6 +12,7 @@ import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; @@ -81,7 +82,8 @@ public IGuiTexture getIcon() { @SideOnly(Side.CLIENT) public String getDescription() { if (I18n.hasKey("terminal." + getRegistryName() + ".description")) { - return NEW_LINE_PATTERN.matcher(I18n.format("terminal." + getRegistryName() + ".description")).replaceAll("\n"); + return NEW_LINE_PATTERN.matcher(I18n.format("terminal." + getRegistryName() + ".description")) + .replaceAll("\n"); } return I18n.format("terminal.app_name.description"); } @@ -145,6 +147,7 @@ public AbstractApplication initApp() { /** * you should store the persistent data for both side here. + * * @return nbt data. if its a clientSideApp and the nbt not null, this nbt should be synced to the server side. */ public NBTTagCompound closeApp() { @@ -163,7 +166,9 @@ public boolean isBackgroundApp() { * If the app doesn't require server execution, it better be a client side app. * For details about data synchronization, see {@link #closeApp()} */ - public boolean isClientSideApp() {return false;} + public boolean isClientSideApp() { + return false; + } public TerminalOSWidget getOs() { return os; @@ -171,6 +176,7 @@ public TerminalOSWidget getOs() { /** * Add components to menu bar. + * * @see IMenuComponent */ public List getMenuComponents() { @@ -218,7 +224,8 @@ protected void loadLocalConfig(Consumer reader) { if (isClient && reader != null) { NBTTagCompound nbt = null; try { - nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); + nbt = CompressedStreamTools.read( + new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); } catch (IOException e) { GTLog.logger.error("error while loading local nbt for {}", getRegistryName(), e); } @@ -238,7 +245,8 @@ protected void saveLocalConfig(Consumer writer) { try { writer.accept(nbt); if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, String.format("config/%S.nbt", getRegistryName()))); + CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, + String.format("config/%S.nbt", getRegistryName()))); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for {}", getRegistryName(), e); @@ -250,7 +258,8 @@ protected void saveLocalConfig(Consumer writer) { * Fired when you open this app or terminal's size updated. (maximize) */ public void onOSSizeUpdate(int width, int height) { - setSelfPosition(Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); + setSelfPosition( + Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); } public boolean canLaunchConcurrently(AbstractApplication application) { diff --git a/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java b/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java index 6e529bc3725..c3cf0733e93 100644 --- a/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java +++ b/src/main/java/gregtech/api/terminal/gui/CustomTabListRenderer.java @@ -5,17 +5,19 @@ import gregtech.api.gui.widgets.tab.ITabInfo; import gregtech.api.gui.widgets.tab.TabListRenderer; import gregtech.api.util.Position; + import net.minecraft.client.renderer.GlStateManager; import java.util.List; public class CustomTabListRenderer extends TabListRenderer { + private final IGuiTexture unSelected; private final IGuiTexture selected; private final int width; private final int height; - public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int width, int height){ + public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int width, int height) { this.unSelected = unSelected; this.selected = selected; this.width = width; @@ -23,24 +25,27 @@ public CustomTabListRenderer(IGuiTexture unSelected, IGuiTexture selected, int w } @Override - public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) { + public void renderTabs(ModularUI gui, Position offset, List tabInfos, int guiWidth, int guiHeight, + int selectedTabIndex) { int y = offset.y - height; GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); for (int i = 0; i < tabInfos.size(); i++) { int x = offset.x + i * width; if (selectedTabIndex == i && selected != null) { tabInfos.get(i).renderTab(selected, x, y, width, height, true); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } if (selectedTabIndex != i && unSelected != null) { tabInfos.get(i).renderTab(unSelected, x, y, width, height, false); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } } } @Override public int[] getTabPos(int guiWidth, int guiHeight, int tabIndex) { - return new int[]{width * guiWidth, -height, width, height}; + return new int[] { width * guiWidth, -height, width, height }; } } diff --git a/src/main/java/gregtech/api/terminal/gui/IDraggable.java b/src/main/java/gregtech/api/terminal/gui/IDraggable.java index 5366276a536..33b6cf41719 100644 --- a/src/main/java/gregtech/api/terminal/gui/IDraggable.java +++ b/src/main/java/gregtech/api/terminal/gui/IDraggable.java @@ -1,8 +1,14 @@ package gregtech.api.terminal.gui; public interface IDraggable { + boolean allowDrag(int mouseX, int mouseY, int button); + default void startDrag(int mouseX, int mouseY) {} - default boolean dragging(int mouseX, int mouseY, int deltaX, int deltaY) {return true;} + + default boolean dragging(int mouseX, int mouseY, int deltaX, int deltaY) { + return true; + } + default void endDrag(int mouseX, int mouseY) {} } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java index 0083a6c5313..acd2a58bed4 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/AnimaWidgetGroup.java @@ -6,6 +6,7 @@ import gregtech.api.util.Size; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -13,6 +14,7 @@ import java.util.function.Consumer; public abstract class AnimaWidgetGroup extends WidgetGroup { + @SideOnly(Side.CLIENT) protected Interpolator interpolator; protected float scale = 1; @@ -38,8 +40,8 @@ public final void maximizeWidget(Consumer callback) { this.scale = 0; setVisible(true); interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, - value-> scale = value.floatValue(), - value-> { + value -> scale = value.floatValue(), + value -> { interpolator = null; if (callback != null) { callback.accept(this); @@ -52,8 +54,8 @@ public final void maximizeWidget(Consumer callback) { public final void minimizeWidget(Consumer callback) { this.scale = 1; interpolator = new Interpolator(1, 0, 10, Eases.LINEAR, - value-> scale = value.floatValue(), - value-> { + value -> scale = value.floatValue(), + value -> { setVisible(false); interpolator = null; if (callback != null) { @@ -77,7 +79,8 @@ protected void hookDrawInForeground(int mouseX, int mouseY) { public final void drawInForeground(int mouseX, int mouseY) { if (scale == 0) { return; - } if (scale != 1) { + } + if (scale != 1) { GlStateManager.pushMatrix(); GlStateManager.translate((this.gui.getScreenWidth() - this.gui.getScreenWidth() * scale) / 2, (this.gui.getScreenHeight() - this.gui.getScreenHeight() * scale) / 2, 0); @@ -93,7 +96,8 @@ public final void drawInForeground(int mouseX, int mouseY) { public final void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { if (scale == 0) { return; - }if (scale != 1) { + } + if (scale != 1) { GlStateManager.pushMatrix(); GlStateManager.translate((this.gui.getScreenWidth() - this.gui.getScreenWidth() * scale) / 2, (this.gui.getScreenHeight() - this.gui.getScreenHeight() * scale) / 2, 0); diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java index d6908dd4419..98d6b27b5ab 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/CircleButtonWidget.java @@ -5,9 +5,11 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; + import org.lwjgl.input.Mouse; import java.awt.*; @@ -16,6 +18,7 @@ import java.util.stream.Collectors; public class CircleButtonWidget extends Widget { + protected int border; protected int hoverTick; protected boolean isHover; @@ -119,7 +122,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public void drawInForeground(int mouseX, int mouseY) { if (hoverText != null && hoverText.length > 0 && this.isMouseOverElement(mouseX, mouseY)) { - this.drawHoveringText(ItemStack.EMPTY, Arrays.stream(hoverText).map(I18n::format).collect(Collectors.toList()), 300, mouseX, mouseY); + this.drawHoveringText(ItemStack.EMPTY, + Arrays.stream(hoverText).map(I18n::format).collect(Collectors.toList()), 300, mouseX, mouseY); } } @@ -146,5 +150,4 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } } - } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java index 66286bdc2de..673c049b5f6 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/ColorWidget.java @@ -8,6 +8,7 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; @@ -15,6 +16,7 @@ import java.util.function.Supplier; public class ColorWidget extends WidgetGroup { + private int red = 255; private int green = 255; private int blue = 255; @@ -46,44 +48,50 @@ public ColorWidget(int x, int y, int barWidth, int barHeight) { }, true) .setTextSupplier(() -> Integer.toString(red), true) .setValidator(ColorWidget::checkValid); - TextFieldWidget greenField = new TextFieldWidget(barWidth + 5, barHeight + 5, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setGreen(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(green), true) - .setValidator(ColorWidget::checkValid); - TextFieldWidget blueField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 2, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setBlue(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(blue), true) - .setValidator(ColorWidget::checkValid); - TextFieldWidget alphaField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 3, 30, barHeight, textFieldBackground, null, null) - .setTextResponder((t) -> { - setAlpha(t.isEmpty() ? 0 : Integer.parseInt(t)); - if (onColorChanged != null) { - onColorChanged.accept(getColor()); - } - writeClientAction(2, buffer -> buffer.writeInt(getColor())); - }, true) - .setTextSupplier(() -> Integer.toString(alpha), true) - .setValidator(ColorWidget::checkValid); + TextFieldWidget greenField = new TextFieldWidget(barWidth + 5, barHeight + 5, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setGreen(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(green), true) + .setValidator(ColorWidget::checkValid); + TextFieldWidget blueField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 2, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setBlue(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(blue), true) + .setValidator(ColorWidget::checkValid); + TextFieldWidget alphaField = new TextFieldWidget(barWidth + 5, (barHeight + 5) * 3, 30, barHeight, + textFieldBackground, null, null) + .setTextResponder((t) -> { + setAlpha(t.isEmpty() ? 0 : Integer.parseInt(t)); + if (onColorChanged != null) { + onColorChanged.accept(getColor()); + } + writeClientAction(2, buffer -> buffer.writeInt(getColor())); + }, true) + .setTextSupplier(() -> Integer.toString(alpha), true) + .setValidator(ColorWidget::checkValid); this.addWidget(redField); this.addWidget(greenField); this.addWidget(blueField); this.addWidget(alphaField); redButton = new CircleButtonWidget(barWidth, barHeight / 2, 4, 1, 0).setFill(0xffff0000).setStrokeAnima(-1); - greenButton = new CircleButtonWidget(barWidth, barHeight / 2 + barHeight + 5, 4, 1, 0).setFill(0xff00ff00).setStrokeAnima(-1); - blueButton = new CircleButtonWidget(barWidth, barHeight / 2 + 2 * (barHeight + 5), 4, 1, 0).setFill(0xff0000ff).setStrokeAnima(-1); - alphaButton = new CircleButtonWidget(barWidth, barHeight / 2 + 3 * (barHeight + 5), 4, 1, 0).setFill(-1).setStrokeAnima(-1); + greenButton = new CircleButtonWidget(barWidth, barHeight / 2 + barHeight + 5, 4, 1, 0).setFill(0xff00ff00) + .setStrokeAnima(-1); + blueButton = new CircleButtonWidget(barWidth, barHeight / 2 + 2 * (barHeight + 5), 4, 1, 0).setFill(0xff0000ff) + .setStrokeAnima(-1); + alphaButton = new CircleButtonWidget(barWidth, barHeight / 2 + 3 * (barHeight + 5), 4, 1, 0).setFill(-1) + .setStrokeAnima(-1); this.addWidget(redButton); this.addWidget(greenButton); this.addWidget(blueButton); @@ -226,10 +234,14 @@ private static boolean checkValid(String input) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { int x = getPosition().x; int y = getPosition().y; - drawGradientRect(x, y + 2, barWidth, 5, (255 << 24) | (0) | (green << 8) | (blue), (255 << 24) | (255 << 16) | (green << 8) | (blue), true); - drawGradientRect(x, y + barHeight + 5 + 2, barWidth, 5, (255 << 24) | (red << 16) | (0) | (blue), (255 << 24) | (red << 16) | (255 << 8) | (blue), true); - drawGradientRect(x, y + 2 * (barHeight + 5) + 2, barWidth, 5, (255 << 24) | (red << 16) | (green << 8) | (0), (255 << 24) | (red << 16) | (green << 8) | (255), true); - drawGradientRect(x, y + 3 * (barHeight + 5) + 2, barWidth, 5, (0) | (red << 16) | (green << 8) | (blue), (255 << 24) | (red << 16) | (green << 8) | (blue), true); + drawGradientRect(x, y + 2, barWidth, 5, (255 << 24) | (0) | (green << 8) | (blue), + (255 << 24) | (255 << 16) | (green << 8) | (blue), true); + drawGradientRect(x, y + barHeight + 5 + 2, barWidth, 5, (255 << 24) | (red << 16) | (0) | (blue), + (255 << 24) | (red << 16) | (255 << 8) | (blue), true); + drawGradientRect(x, y + 2 * (barHeight + 5) + 2, barWidth, 5, (255 << 24) | (red << 16) | (green << 8) | (0), + (255 << 24) | (red << 16) | (green << 8) | (255), true); + drawGradientRect(x, y + 3 * (barHeight + 5) + 2, barWidth, 5, (0) | (red << 16) | (green << 8) | (blue), + (255 << 24) | (red << 16) | (green << 8) | (blue), true); super.drawInBackground(mouseX, mouseY, partialTicks, context); } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java index 8de8f36477e..a499d12ebb0 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/CustomPositionSizeWidget.java @@ -9,6 +9,7 @@ import java.util.function.BiConsumer; public class CustomPositionSizeWidget extends Widget implements IDraggable { + private Widget controlled; private final int borderColor; private final int hoverColor; @@ -21,7 +22,6 @@ public class CustomPositionSizeWidget extends Widget implements IDraggable { private BiConsumer onUpdated; - public CustomPositionSizeWidget(Widget controlled, int borderColor, int hoverColor, int border) { super(controlled.getSelfPosition(), controlled.getSize()); this.controlled = controlled; @@ -128,20 +128,26 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } // UP drawSolidRect(x, y, width / 5, border, hoverUp && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 2 / 5, y, width / 5, border, hoverUp && !hoverLeft && !hoverRight ? hoverColor : borderColor); + drawSolidRect(x + width * 2 / 5, y, width / 5, border, + hoverUp && !hoverLeft && !hoverRight ? hoverColor : borderColor); drawSolidRect(x + width * 4 / 5, y, width / 5, border, hoverUp && !hoverLeft ? hoverColor : borderColor); // DOWN drawSolidRect(x, y + height - border, width / 5, border, hoverDown && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 2 / 5, y + height - border, width / 5, border, hoverDown && !hoverLeft && !hoverRight ? hoverColor : borderColor); - drawSolidRect(x + width * 4 / 5, y + height - border, width / 5, border, hoverDown && !hoverLeft ? hoverColor : borderColor); + drawSolidRect(x + width * 2 / 5, y + height - border, width / 5, border, + hoverDown && !hoverLeft && !hoverRight ? hoverColor : borderColor); + drawSolidRect(x + width * 4 / 5, y + height - border, width / 5, border, + hoverDown && !hoverLeft ? hoverColor : borderColor); // LEFT drawSolidRect(x, y, border, height / 5, hoverLeft && !hoverDown ? hoverColor : borderColor); - drawSolidRect(x, y + height * 2 / 5, border, height / 5, hoverLeft && !hoverDown && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x, y + height * 2 / 5, border, height / 5, + hoverLeft && !hoverDown && !hoverUp ? hoverColor : borderColor); drawSolidRect(x, y + height * 4 / 5, border, height / 5, hoverLeft && !hoverUp ? hoverColor : borderColor); // RIGHT drawSolidRect(x + width - border, y, border, height / 5, hoverRight && !hoverDown ? hoverColor : borderColor); - drawSolidRect(x + width - border, y + height * 2 / 5, border, height / 5, hoverRight && !hoverDown && !hoverUp ? hoverColor : borderColor); - drawSolidRect(x + width - border, y + height * 4 / 5, border, height / 5, hoverRight && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x + width - border, y + height * 2 / 5, border, height / 5, + hoverRight && !hoverDown && !hoverUp ? hoverColor : borderColor); + drawSolidRect(x + width - border, y + height * 4 / 5, border, height / 5, + hoverRight && !hoverUp ? hoverColor : borderColor); } @Override diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java b/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java index b2bf0549497..7adb35a9e56 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/DraggableScrollableWidgetGroup.java @@ -6,12 +6,14 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.gui.IDraggable; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.util.math.MathHelper; public class DraggableScrollableWidgetGroup extends WidgetGroup { + protected int scrollXOffset; protected int scrollYOffset; protected int xBarHeight; @@ -34,7 +36,6 @@ public class DraggableScrollableWidgetGroup extends WidgetGroup { private boolean draggedOnXScrollBar; private boolean draggedOnYScrollBar; - public DraggableScrollableWidgetGroup(int x, int y, int width, int height) { super(new Position(x, y), new Size(width, height)); maxHeight = height; @@ -90,7 +91,7 @@ public int getScrollXOffset() { public void addWidget(Widget widget) { maxHeight = Math.max(maxHeight, widget.getSize().height + widget.getSelfPosition().y); maxWidth = Math.max(maxWidth, widget.getSize().width + widget.getSelfPosition().x); - Position newPos = widget.addSelfPosition(- scrollXOffset, - scrollYOffset); + Position newPos = widget.addSelfPosition(-scrollXOffset, -scrollYOffset); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); widget.setVisible(newPos.y < getSize().height - xBarHeight && newPos.y + widget.getSize().height > 0); super.addWidget(widget); @@ -116,7 +117,7 @@ public void setSize(Size size) { super.setSize(size); maxHeight = Math.max(size.height, maxHeight); maxWidth = Math.max(size.width, maxWidth); -// computeMax(); + // computeMax(); for (Widget widget : widgets) { Position newPos = widget.getSelfPosition(); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); @@ -155,7 +156,7 @@ public void computeMax() { offsetX = scrollXOffset; } scrollXOffset -= offsetX; - }else if (mw < getSize().width) { + } else if (mw < getSize().width) { offsetX = maxWidth - getSize().width; maxWidth = getSize().width; if (scrollXOffset - offsetX < 0) { @@ -193,7 +194,7 @@ protected void setScrollXOffset(int scrollXOffset) { int offset = scrollXOffset - this.scrollXOffset; this.scrollXOffset = scrollXOffset; for (Widget widget : widgets) { - Position newPos = widget.addSelfPosition( - offset, 0); + Position newPos = widget.addSelfPosition(-offset, 0); widget.setVisible(newPos.x < getSize().width - yBarWidth && newPos.x + widget.getSize().width > 0); } } @@ -204,7 +205,7 @@ protected void setScrollYOffset(int scrollYOffset) { int offset = scrollYOffset - this.scrollYOffset; this.scrollYOffset = scrollYOffset; for (Widget widget : widgets) { - Position newPos = widget.addSelfPosition(0, - offset); + Position newPos = widget.addSelfPosition(0, -offset); widget.setVisible(newPos.y < getSize().height - xBarHeight && newPos.y + widget.getSize().height > 0); } } @@ -235,13 +236,13 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender background.draw(x, y, width, height); } if (useScissor) { - RenderUtil.useScissor(x, y, width - yBarWidth, height - xBarHeight, ()->{ - if(!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { + RenderUtil.useScissor(x, y, width - yBarWidth, height - xBarHeight, () -> { + if (!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { super.drawInBackground(mouseX, mouseY, partialTicks, context); } }); } else { - if(!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { + if (!hookDrawInBackground(mouseX, mouseY, partialTicks, context)) { super.drawInBackground(mouseX, mouseY, partialTicks, context); } } @@ -252,16 +253,18 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } if (xBarF != null) { int barWidth = (int) (width * 1.0f / getMaxWidth() * width); - xBarF.draw(x + scrollXOffset * width * 1.0f / getMaxWidth(), y + height - xBarHeight, barWidth, xBarHeight); + xBarF.draw(x + scrollXOffset * width * 1.0f / getMaxWidth(), y + height - xBarHeight, barWidth, + xBarHeight); } } if (yBarWidth > 0) { if (yBarB != null) { - yBarB.draw(x + width - yBarWidth, y, yBarWidth, height); + yBarB.draw(x + width - yBarWidth, y, yBarWidth, height); } if (yBarF != null) { int barHeight = (int) (height * 1.0f / getMaxHeight() * height); - yBarF.draw(x + width - yBarWidth, y + scrollYOffset * height * 1.0f / getMaxHeight(), yBarWidth, barHeight); + yBarF.draw(x + width - yBarWidth, y + scrollYOffset * height * 1.0f / getMaxHeight(), yBarWidth, + barHeight); } } } @@ -274,12 +277,11 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { this.draggedOnXScrollBar = true; focus = true; return true; - } - else if (yBarWidth > 0 && isOnYScrollPane(mouseX, mouseY)) { + } else if (yBarWidth > 0 && isOnYScrollPane(mouseX, mouseY)) { this.draggedOnYScrollBar = true; focus = true; return true; - } else if(isMouseOverElement(mouseX, mouseY)){ + } else if (isMouseOverElement(mouseX, mouseY)) { focus = true; if (checkClickedDragged(mouseX, mouseY, button)) { return true; @@ -300,8 +302,8 @@ protected boolean checkClickedDragged(int mouseX, int mouseY, int button) { draggedWidget = null; for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); - if(widget.isVisible()) { - if(widget.mouseClicked(mouseX, mouseY, button)) { + if (widget.isVisible()) { + if (widget.mouseClicked(mouseX, mouseY, button)) { return true; } else if (widget instanceof IDraggable && ((IDraggable) widget).allowDrag(mouseX, mouseY, button)) { draggedWidget = widget; @@ -335,23 +337,30 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged int deltaY = mouseY - lastMouseY; lastMouseX = mouseX; lastMouseY = mouseY; - if (draggedOnXScrollBar && (getMaxWidth() - getSize().width > 0 || scrollYOffset > getMaxWidth() - getSize().width)) { - setScrollXOffset(MathHelper.clamp(scrollXOffset + deltaX * getMaxWidth() / getSize().width, 0, getMaxWidth() - getSize().width)); + if (draggedOnXScrollBar && + (getMaxWidth() - getSize().width > 0 || scrollYOffset > getMaxWidth() - getSize().width)) { + setScrollXOffset(MathHelper.clamp(scrollXOffset + deltaX * getMaxWidth() / getSize().width, 0, + getMaxWidth() - getSize().width)); return true; - } else if (draggedOnYScrollBar && (getMaxHeight() - getSize().height > 0 || scrollYOffset > getMaxHeight() - getSize().height)) { - setScrollYOffset(MathHelper.clamp(scrollYOffset + deltaY * getMaxHeight() / getSize().height, 0, getMaxHeight() - getSize().height)); - return true; - } else if (draggedWidget != null) { - if (((IDraggable)draggedWidget).dragging(mouseX, mouseY, deltaX, deltaY)) { - draggedWidget.addSelfPosition(deltaX, deltaY); + } else if (draggedOnYScrollBar && + (getMaxHeight() - getSize().height > 0 || scrollYOffset > getMaxHeight() - getSize().height)) { + setScrollYOffset(MathHelper.clamp(scrollYOffset + deltaY * getMaxHeight() / getSize().height, 0, + getMaxHeight() - getSize().height)); + return true; + } else + if (draggedWidget != null) { + if (((IDraggable) draggedWidget).dragging(mouseX, mouseY, deltaX, deltaY)) { + draggedWidget.addSelfPosition(deltaX, deltaY); + } + computeMax(); + return true; + } else if (draggedPanel) { + setScrollXOffset(MathHelper.clamp(scrollXOffset - deltaX, 0, + Math.max(getMaxWidth() - yBarWidth - getSize().width, 0))); + setScrollYOffset(MathHelper.clamp(scrollYOffset - deltaY, 0, + Math.max(getMaxHeight() - xBarHeight - getSize().height, 0))); + return true; } - computeMax(); - return true; - } else if (draggedPanel) { - setScrollXOffset(MathHelper.clamp(scrollXOffset - deltaX, 0, Math.max(getMaxWidth() - yBarWidth - getSize().width, 0))); - setScrollYOffset(MathHelper.clamp(scrollYOffset - deltaY, 0, Math.max(getMaxHeight() - xBarHeight - getSize().height, 0))); - return true; - } return super.mouseDragged(mouseX, mouseY, button, timeDragged); } @@ -362,7 +371,7 @@ public boolean mouseReleased(int mouseX, int mouseY, int button) { } else if (draggedOnYScrollBar) { draggedOnYScrollBar = false; } else if (draggedWidget != null) { - ((IDraggable)draggedWidget).endDrag(mouseX, mouseY); + ((IDraggable) draggedWidget).endDrag(mouseX, mouseY); draggedWidget = null; } else if (draggedPanel) { draggedPanel = false; diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java index d1cee57bb46..43fceb358f9 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/MachineSceneWidget.java @@ -14,6 +14,7 @@ import gregtech.client.renderer.scene.FBOWorldSceneRenderer; import gregtech.client.renderer.scene.WorldSceneRenderer; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; @@ -28,16 +29,18 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; -import javax.vecmath.Vector3f; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -46,6 +49,7 @@ * @Description: */ public class MachineSceneWidget extends WidgetGroup { + private static FBOWorldSceneRenderer worldSceneRenderer; private boolean dragging; private int lastMouseX; @@ -79,8 +83,8 @@ public MachineSceneWidget(int x, int y, int width, int height, BlockPos pos) { this.addWidget(new ScrollBarWidget(5, height - 13, width - 50, 8, 0, 1, 0.05f) .setOnChanged(value -> alpha = value, true).setInitValue(1f)); this.addWidget(new RectButtonWidget(width - 40, height - 15, 35, 12, 1) - .setToggleButton(new TextTexture("COLOR", -1), (c, b)->blendColor=b) - .setValueSupplier(true, ()->blendColor) + .setToggleButton(new TextTexture("COLOR", -1), (c, b) -> blendColor = b) + .setValueSupplier(true, () -> blendColor) .setColors(TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_F_1.getColor(), 0) .setIcon(new TextTexture("ALPHA", -1))); if (worldSceneRenderer != null) { @@ -154,12 +158,15 @@ private void renderBlockOverLay(WorldSceneRenderer renderer) { GlStateManager.popMatrix(); } GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); } private static void drawFacingBorder(FacingPos posFace, int color) { GlStateManager.pushMatrix(); - RenderUtil.moveToFace(posFace.getPos().getX(), posFace.getPos().getY(), posFace.getPos().getZ(), posFace.getFacing()); + RenderUtil.moveToFace(posFace.getPos().getX(), posFace.getPos().getY(), posFace.getPos().getZ(), + posFace.getFacing()); RenderUtil.rotateToFace(posFace.getFacing(), null); GlStateManager.scale(1f / 16, 1f / 16, 0); GlStateManager.translate(-8, -8, 0); @@ -173,7 +180,8 @@ public void updateScreen() { if (mte == null) { World world = this.gui.entityPlayer.world; TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() != null) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() != null) { mte = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); updateScene(); } @@ -199,7 +207,8 @@ private void updateScene() { PatternMatchContext context = multi.structurePattern.checkPatternFastAt( world, pos, mte.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), multi.allowsFlip()); if (context != null) { - List validPos = multi.structurePattern.cache.keySet().stream().map(BlockPos::fromLong).collect(Collectors.toList()); + List validPos = multi.structurePattern.cache.keySet().stream().map(BlockPos::fromLong) + .collect(Collectors.toList()); Set parts = context.getOrCreate("MultiblockParts", HashSet::new); for (IMultiblockPart part : parts) { if (part instanceof MetaTileEntity) { @@ -207,7 +216,7 @@ private void updateScene() { } } for (EnumFacing facing : EnumFacing.VALUES) { - cores.forEach(pos->around.add(pos.offset(facing))); + cores.forEach(pos -> around.add(pos.offset(facing))); } int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; @@ -283,7 +292,8 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { if (isMouseOverElement(mouseX, mouseY)) { zoom = (float) MathHelper.clamp(zoom + (wheelDelta < 0 ? 0.5 : -0.5), 3, 999); if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } return super.mouseWheelMove(mouseX, mouseY, wheelDelta); @@ -298,7 +308,8 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged lastMouseY = mouseY; lastMouseX = mouseX; if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } return true; } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java index 1c2bbd2e8d3..d49b5a3c25d 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/RectButtonWidget.java @@ -4,23 +4,25 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; + import org.lwjgl.input.Mouse; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; -public class RectButtonWidget extends CircleButtonWidget{ +public class RectButtonWidget extends CircleButtonWidget { + private IGuiTexture pressedIcon; private BiConsumer onPressed; private boolean isPressed; private Supplier supplier; private boolean isClient; - public RectButtonWidget(int x, int y, int width, int height) { - this(x, y, width, height,2); + this(x, y, width, height, 2); } public RectButtonWidget(int x, int y, int width, int height, int border) { @@ -38,7 +40,7 @@ public RectButtonWidget setToggleButton(IGuiTexture pressedIcon, BiConsumer onPressed) { this.pressedIcon = pressedIcon; - this.onPressed = onPressed != null ? (c, p)-> onPressed.accept(p) : null; + this.onPressed = onPressed != null ? (c, p) -> onPressed.accept(p) : null; return this; } @@ -64,7 +66,7 @@ public void updateScreen() { @Override public void detectAndSendChanges() { if (!isClient && supplier != null) { - if(supplier.get() != isPressed) { + if (supplier.get() != isPressed) { isPressed = !isPressed; writeUpdateInfo(1, buffer -> buffer.writeBoolean(isPressed)); } @@ -123,7 +125,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawBorder(x + border, y + border, width - 2 * border, height - 2 * border, colors[0], border); isHover = this.isMouseOverElement(mouseX, mouseY); if (isHover || hoverTick != 0) { - float per = Math. min ((hoverTick + partialTicks) / 8, 1); + float per = Math.min((hoverTick + partialTicks) / 8, 1); drawSolidRect(x, y, (int) (width * per), border, colors[1]); drawSolidRect(x + width - border, y, border, (int) (height * per), colors[1]); drawSolidRect((int) ((1 - per) * width) + x, y + height - border, (int) (width * per), border, colors[1]); diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java index 273738e2ac2..619fd1cbd6d 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/ScrollBarWidget.java @@ -7,12 +7,14 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.MathHelper; import java.util.function.Consumer; public class ScrollBarWidget extends Widget { + protected final float min; protected final float max; protected final float dur; @@ -25,7 +27,6 @@ public class ScrollBarWidget extends Widget { protected Consumer onChanged; protected boolean isClient; - public ScrollBarWidget(int x, int y, int width, int height, float min, float max, float dur) { super(new Position(x, y), new Size(width, height)); this.max = max; @@ -85,13 +86,15 @@ private boolean isOnScrollPane(int mouseX, int mouseY) { } private float getValue() { - return (float) (min + Math.floor((max - min) * xOffset * 1.0f / (this.getSize().width - buttonWidth) / dur) * dur) ; + return (float) (min + + Math.floor((max - min) * xOffset * 1.0f / (this.getSize().width - buttonWidth) / dur) * dur); } @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (this.isOnScrollPane(mouseX, mouseY)) { - this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, this.getSize().width - buttonWidth); + this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, + this.getSize().width - buttonWidth); this.draggedOnScrollBar = true; } return this.isMouseOverElement(mouseX, mouseY); @@ -100,7 +103,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { @Override public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged) { if (draggedOnScrollBar) { - this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, this.getSize().width - buttonWidth); + this.xOffset = MathHelper.clamp(mouseX - this.getPosition().x - buttonWidth / 2, 0, + this.getSize().width - buttonWidth); if (onChanged != null) { onChanged.accept(getValue()); } @@ -111,7 +115,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged @Override public boolean mouseReleased(int mouseX, int mouseY, int button) { - if(this.draggedOnScrollBar) { + if (this.draggedOnScrollBar) { if (!isClient) { this.writeClientAction(2, packetBuffer -> packetBuffer.writeFloat(getValue())); } @@ -125,7 +129,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { float value = buffer.readFloat(); - if(this.onChanged != null) { + if (this.onChanged != null) { onChanged.accept(value); } } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java index 020a44ff8e8..c5f35429f01 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/SelectorWidget.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -15,6 +16,7 @@ import java.util.function.Supplier; public class SelectorWidget extends WidgetGroup { + protected RectButtonWidget button; protected List candidates; protected boolean isShow; @@ -24,13 +26,14 @@ public class SelectorWidget extends WidgetGroup { private boolean isUp; private final int fontColor; - public SelectorWidget(int x, int y, int width, int height, List candidates, int fontColor, Supplier supplier, boolean isClient) { + public SelectorWidget(int x, int y, int width, int height, List candidates, int fontColor, + Supplier supplier, boolean isClient) { super(new Position(x, y), new Size(width, height)); - this.button = new RectButtonWidget(0,0,width,height); + this.button = new RectButtonWidget(0, 0, width, height); this.candidates = candidates; this.fontColor = fontColor; button.setClickListener(d -> { - if(onShowChange != null) { + if (onShowChange != null) { onShowChange.accept(!isShow); } isShow = !isShow; @@ -81,7 +84,7 @@ public void hide() { @Override public void drawInForeground(int mouseX, int mouseY) { super.drawInForeground(mouseX, mouseY); - if(isShow) { + if (isShow) { int x = getPosition().x; int width = getSize().width; int height = getSize().height; @@ -93,7 +96,8 @@ public void drawInForeground(int mouseX, int mouseY) { } else { drawSolidRect(x, y, width, height, 0xAA000000); } - fontRenderer.drawString(I18n.format(candidate), x + 4, y + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, fontColor); + fontRenderer.drawString(I18n.format(candidate), x + 4, y + (height - fontRenderer.FONT_HEIGHT) / 2 + 1, + fontColor); y += height; } y = (isUp ? -candidates.size() : 1) * height + getPosition().y; @@ -132,9 +136,9 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { - if (onChanged != null) { - onChanged.accept(buffer.readString(Short.MAX_VALUE)); - } + if (onChanged != null) { + onChanged.accept(buffer.readString(Short.MAX_VALUE)); + } } } } diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java index 255a3641c22..4837420bcc5 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/TextEditorWidget.java @@ -8,6 +8,7 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; @@ -23,22 +24,29 @@ import java.util.regex.Pattern; public class TextEditorWidget extends WidgetGroup { + private static final TextureArea PALETTE = TextureArea.fullImage("textures/gui/widget/palette.png"); private static final TextureArea STYLE = TextureArea.fullImage("textures/gui/widget/formatting.png"); private final TextPanelWidget textPanelWidget; private static final Pattern COMMENT = Pattern.compile("(//.*|/\\*[\\s\\S]*?\\*/)|(#.*)"); - private static final Pattern STRING = Pattern.compile("(\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"|'(?:[^'\\\\]|\\\\[\\s\\S])*')"); + private static final Pattern STRING = Pattern + .compile("(\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"|'(?:[^'\\\\]|\\\\[\\s\\S])*')"); private static final Pattern BOOL = Pattern.compile("\\b(true|false|null|undefined|NaN)\\b"); - private static final Pattern KEYWORD = Pattern.compile("\\b(import|var|for|if|else|return|this|while|new|function|switch|case|typeof|do|in|throw|try|catch|finally|with|instance|delete|void|break|continue)\\b"); - private static final Pattern KEYWORD_2 = Pattern.compile("\\b(String|int|long|boolean|float|double|byte|short|document|Date|Math|window|Object|location|navigator|Array|Number|Boolean|Function|RegExp)\\b"); + private static final Pattern KEYWORD = Pattern.compile( + "\\b(import|var|for|if|else|return|this|while|new|function|switch|case|typeof|do|in|throw|try|catch|finally|with|instance|delete|void|break|continue)\\b"); + private static final Pattern KEYWORD_2 = Pattern.compile( + "\\b(String|int|long|boolean|float|double|byte|short|document|Date|Math|window|Object|location|navigator|Array|Number|Boolean|Function|RegExp)\\b"); private static final Pattern VARIABLE = Pattern.compile("(?:[^\\W\\d]|\\$)[\\$\\w]*"); - private static final Pattern NUMBER = Pattern.compile("(0[xX][0-9a-fA-F]+|\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|\\.\\d+(?:[eE][+-]?\\d+)?)"); + private static final Pattern NUMBER = Pattern + .compile("(0[xX][0-9a-fA-F]+|\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|\\.\\d+(?:[eE][+-]?\\d+)?)"); private static final Pattern ANY = Pattern.compile("[\\s\\S]"); - public TextEditorWidget(int x, int y, int width, int height,Consumer stringUpdate, boolean allowToolBox) { - super(new Position(x, y), new Size(Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height))); - textPanelWidget = new TextPanelWidget(0, 32, Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height) - 32, stringUpdate); + public TextEditorWidget(int x, int y, int width, int height, Consumer stringUpdate, boolean allowToolBox) { + super(new Position(x, y), + new Size(Math.max(width, allowToolBox ? 80 : width), Math.max(height, allowToolBox ? 32 : height))); + textPanelWidget = new TextPanelWidget(0, 32, Math.max(width, allowToolBox ? 80 : width), + Math.max(height, allowToolBox ? 32 : height) - 32, stringUpdate); this.addWidget(textPanelWidget); if (allowToolBox) { initToolBox(); @@ -89,33 +97,38 @@ private void initToolBox() { if (styleFormatting == TextFormatting.RESET) break; this.addWidget(new RectButtonWidget(x * 16 + 32, y * 16, 16, 16, 1) .setToggleButton(STYLE.getSubArea(0.5 + x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5), - (cd, pressed)-> { + (cd, pressed) -> { if (pressed) { textPanelWidget.addFormatting(styleFormatting); } else { textPanelWidget.removeFormatting(styleFormatting); } }) - .setValueSupplier(true, ()-> textPanelWidget.getFrontStyleFormatting().contains(styleFormatting)) + .setValueSupplier(true, + () -> textPanelWidget.getFrontStyleFormatting().contains(styleFormatting)) .setIcon(STYLE.getSubArea(x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5)) .setColors(0, -1, 0) .setHoverText(styleFormatting.getFriendlyName())); } } this.addWidget(new RectButtonWidget(3 * 16 + 32, 0, 16, 16, 3) - .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p)-> textPanelWidget.allowMarkdown = !p) + .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), + (c, p) -> textPanelWidget.allowMarkdown = !p) .setValueSupplier(true, () -> !textPanelWidget.allowMarkdown) - .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) + .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), + TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())) .setHoverText("Check Markdown when Ctrl+V")); this.addWidget(new RectButtonWidget(3 * 16 + 32, 16, 16, 16, 3) .setClickListener(clickData -> textPanelWidget.pageSetCurrent("")) - .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) + .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), + TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())) .setHoverText("Clean Up")); } private static class TextPanelWidget extends DraggableScrollableWidgetGroup { + public final static int SPACE = 0; public int updateCount; public String content; @@ -134,7 +147,6 @@ private static class TextPanelWidget extends DraggableScrollableWidgetGroup { @SideOnly(Side.CLIENT) private static final Pattern COLOR_CODE_PATTERN = Pattern.compile("(?i)" + SECTION_SIGN + "[0-9A-F]"); - public TextPanelWidget(int x, int y, int width, int height, Consumer stringUpdate) { super(x, y, width, height); this.stringUpdate = stringUpdate; @@ -160,12 +172,13 @@ public void updateScreen() { @Override public boolean keyTyped(char typedChar, int keyCode) { - if(!focus || !isActive()) return false; + if (!focus || !isActive()) return false; if (GuiScreen.isKeyComboCtrlV(keyCode)) { - this.pageInsertIntoCurrent(allowMarkdown ? formatFromMarkdown(GuiScreen.getClipboardString()) : GuiScreen.getClipboardString()); + this.pageInsertIntoCurrent(allowMarkdown ? formatFromMarkdown(GuiScreen.getClipboardString()) : + GuiScreen.getClipboardString()); findFrontFormatting(); } else { - switch(keyCode) { + switch (keyCode) { case 14: if (!content.isEmpty()) { this.pageSetCurrent(content.substring(0, content.length() - 1)); @@ -194,7 +207,7 @@ private static String formatFromMarkdown(String markdown) { Deque stack = new ArrayDeque<>(); int[] chars = markdown.chars().toArray(); for (int i = 0; i < chars.length; i++) { - if (chars[i] == '\\' && i + 1 < chars.length){ + if (chars[i] == '\\' && i + 1 < chars.length) { if (chars[i + 1] == '*' || chars[i + 1] == '_' || chars[i + 1] == '~' || chars[i + 1] == '`') { builder.append(chars[i + 1]); i++; @@ -202,54 +215,57 @@ private static String formatFromMarkdown(String markdown) { builder.append('\\'); } } else if (chars[i] == '*' && i + 1 < chars.length && chars[i + 1] == ' ') { // SUBLINE - builder.append(' ').append(TextFormatting.BOLD).append('*').append(TextFormatting.RESET).append(' '); + builder.append(' ').append(TextFormatting.BOLD).append('*').append(TextFormatting.RESET) + .append(' '); i++; } else if (chars[i] == '*' && i + 1 < chars.length && chars[i + 1] == '*') { // BOLD checkTextFormatting(builder, TextFormatting.BOLD, stack); i++; - } else if (chars[i] == '_'){ - if (i - 1 == -1 || !Character.isLetterOrDigit(chars[i-1])) { // ITALIC + } else if (chars[i] == '_') { + if (i - 1 == -1 || !Character.isLetterOrDigit(chars[i - 1])) { // ITALIC checkTextFormatting(builder, TextFormatting.ITALIC, stack); - } else if (i + 1 == chars.length || !Character.isLetterOrDigit(chars[i+1])) { + } else if (i + 1 == chars.length || !Character.isLetterOrDigit(chars[i + 1])) { checkTextFormatting(builder, TextFormatting.ITALIC, stack); } else { builder.append('_'); } } else if (chars[i] == '~') { // STRIKETHROUGH checkTextFormatting(builder, TextFormatting.STRIKETHROUGH, stack); - } else if (chars[i] == '`' && i + 1 < chars.length && chars[i + 1] == '`' && i + 2 < chars.length && chars[i + 2] == '`') { // code - boolean find = false; - for (int j = i + 3; j < chars.length - 2; j++) { - if (chars[j] == '`' && chars[j + 1] == '`' && chars[j + 2] == '`') { - find = true; - builder.append(checkCode(markdown.substring(i + 3, j))); - i += j - i; - } - } - if (!find) { - builder.append("```"); + } else if (chars[i] == '`' && i + 1 < chars.length && chars[i + 1] == '`' && i + 2 < chars.length && + chars[i + 2] == '`') { // code + boolean find = false; + for (int j = i + 3; j < chars.length - 2; j++) { + if (chars[j] == '`' && chars[j + 1] == '`' && chars[j + 2] == '`') { + find = true; + builder.append(checkCode(markdown.substring(i + 3, j))); + i += j - i; + } + } + if (!find) { + builder.append("```"); + } + i += 2; + } else + if (chars[i] == '`') { + checkTextFormatting(builder, TextFormatting.UNDERLINE, stack); + } else { + builder.append((char) chars[i]); } - i += 2; - } else if (chars[i] == '`') { - checkTextFormatting(builder, TextFormatting.UNDERLINE, stack); - } else { - builder.append((char) chars[i]); - } } return builder.toString(); } private static String checkCode(String code) { - Pattern[] patterns = new Pattern[]{COMMENT, STRING, BOOL, KEYWORD, KEYWORD_2, VARIABLE, NUMBER, ANY}; - TextFormatting[] colors = new TextFormatting[]{ + Pattern[] patterns = new Pattern[] { COMMENT, STRING, BOOL, KEYWORD, KEYWORD_2, VARIABLE, NUMBER, ANY }; + TextFormatting[] colors = new TextFormatting[] { TextFormatting.DARK_GRAY, // comment - TextFormatting.DARK_GREEN, //string + TextFormatting.DARK_GREEN, // string TextFormatting.RED, // value TextFormatting.BLUE, // keyword TextFormatting.LIGHT_PURPLE, // keyword2 TextFormatting.BLACK, // variable TextFormatting.RED, // variable - TextFormatting.DARK_PURPLE}; // else + TextFormatting.DARK_PURPLE }; // else StringBuilder builder = new StringBuilder(); while (code.length() > 0) { boolean find = false; @@ -270,7 +286,8 @@ private static String checkCode(String code) { return builder.toString(); } - private static void checkTextFormatting(StringBuilder builder, TextFormatting formatting, Deque stack) { + private static void checkTextFormatting(StringBuilder builder, TextFormatting formatting, + Deque stack) { if (!stack.isEmpty() && stack.peek() == formatting) { builder.append(TextFormatting.RESET); stack.pop(); @@ -286,9 +303,9 @@ private static void checkTextFormatting(StringBuilder builder, TextFormatting fo private static TextFormatting lookAheadChars(final String content, int index) { if (index > 1 && content.charAt(index - 2) == SECTION_SIGN) { int t = content.charAt(index - 1); - if ('0' <= t && t <= '9'){ + if ('0' <= t && t <= '9') { return TextFormatting.values()[t - '0']; - } else if ('a' <= t && t <= 'f'){ + } else if ('a' <= t && t <= 'f') { return TextFormatting.values()[t - 'a' + 10]; } else if ('k' <= t && t <= 'o') { return TextFormatting.values()[t - 'k' + 16]; @@ -301,8 +318,8 @@ private static TextFormatting lookAheadChars(final String content, int index) { public static String cleanUpFormatting(final String content) { Set removed = new HashSet<>(); - Matcher marcher = R_CODE_PATTERN.matcher(content); - while (marcher.find()) { + Matcher marcher = R_CODE_PATTERN.matcher(content); + while (marcher.find()) { int index = marcher.start(); while (index > 1) { TextFormatting ahead = lookAheadChars(content, index); @@ -321,7 +338,7 @@ public static String cleanUpFormatting(final String content) { TextFormatting ahead = lookAheadChars(content, index); if (ahead == null) { break; - } else if (TextFormatting.RESET != ahead){ + } else if (TextFormatting.RESET != ahead) { if (!removed.add(index - 2)) { break; } @@ -333,7 +350,7 @@ public static String cleanUpFormatting(final String content) { } StringBuilder builder = new StringBuilder(); AtomicInteger start = new AtomicInteger(); - removed.stream().sorted().forEach(remove->{ + removed.stream().sorted().forEach(remove -> { builder.append(content, start.get(), remove); start.set(remove + 2); }); @@ -368,7 +385,7 @@ public void addFormatting(TextFormatting formatting) { for (TextFormatting style : frontStyle) { pageInsertIntoCurrent(style.toString()); } - } else if (formatting.isFancyStyling()){ + } else if (formatting.isFancyStyling()) { if (frontStyle.contains(formatting)) { return; } @@ -381,14 +398,14 @@ public void removeFormatting(TextFormatting formatting) { if (formatting.isColor()) { frontColor = null; pageInsertIntoCurrent(TextFormatting.RESET.toString()); - frontStyle.forEach(style->pageInsertIntoCurrent(style.toString())); + frontStyle.forEach(style -> pageInsertIntoCurrent(style.toString())); } else if (formatting.isFancyStyling()) { pageInsertIntoCurrent(TextFormatting.RESET.toString()); if (frontColor != null) { pageInsertIntoCurrent(frontColor.toString()); } frontStyle.remove(formatting); - frontStyle.forEach(style->pageInsertIntoCurrent(style.toString())); + frontStyle.forEach(style -> pageInsertIntoCurrent(style.toString())); } } @@ -404,19 +421,21 @@ public void pageSetCurrent(String string) { if (!content.equals(string)) { content = cleanUpFormatting(string); findFrontFormatting(); - if(stringUpdate != null) { + if (stringUpdate != null) { stringUpdate.accept(content); } - textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", this.getSize().width - yBarWidth); + textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", + this.getSize().width - yBarWidth); } } public void pageInsertIntoCurrent(String string) { content = cleanUpFormatting(content + string); - if(stringUpdate != null) { + if (stringUpdate != null) { stringUpdate.accept(content); } - textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", this.getSize().width - yBarWidth); + textHeight = this.fontRenderer.getWordWrappedHeight(content + TextFormatting.BLACK + "_", + this.getSize().width - yBarWidth); } @Override @@ -433,7 +452,8 @@ public boolean hookDrawInBackground(int mouseX, int mouseY, float partialTicks, } int x = getPosition().x - scrollXOffset; int y = getPosition().y + SPACE - scrollYOffset; - for (String textLine : this.fontRenderer.listFormattedStringToWidth(contentString, getSize().width - yBarWidth)) { + for (String textLine : this.fontRenderer.listFormattedStringToWidth(contentString, + getSize().width - yBarWidth)) { fontRenderer.drawString(textLine, x, y, 0xff000000, false); y += fontRenderer.FONT_HEIGHT; } @@ -441,5 +461,3 @@ public boolean hookDrawInBackground(int mouseX, int mouseY, float partialTicks, } } } - - diff --git a/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java b/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java index 661769fbe8c..45e5c12d55e 100644 --- a/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java +++ b/src/main/java/gregtech/api/terminal/gui/widgets/TreeListWidget.java @@ -5,8 +5,9 @@ import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.terminal.util.TreeNode; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -19,6 +20,7 @@ import java.util.function.Function; public class TreeListWidget extends Widget { + private static final int ITEM_HEIGHT = 11; protected int scrollOffset; protected List> list; @@ -94,7 +96,8 @@ public void updateScreen() { public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { if (this.isMouseOverElement(mouseX, mouseY)) { int moveDelta = -MathHelper.clamp(wheelDelta, -1, 1) * 5; - this.scrollOffset = MathHelper.clamp(scrollOffset + moveDelta, 0, Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); + this.scrollOffset = MathHelper.clamp(scrollOffset + moveDelta, 0, + Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); return true; } return false; @@ -111,12 +114,12 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } else { drawGradientRect(x, y, width, height, 0x8f000000, 0x8f000000); } - RenderUtil.useScissor(x, y, width, height, ()->{ + RenderUtil.useScissor(x, y, width, height, () -> { FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int minToRender = scrollOffset / ITEM_HEIGHT; int maxToRender = Math.min(list.size(), height / ITEM_HEIGHT + 2 + minToRender); for (int i = minToRender; i < maxToRender; i++) { - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); TreeNode node = list.get(i); int sX = x + 10 * node.dimension; int sY = y - scrollOffset + i * ITEM_HEIGHT; @@ -128,9 +131,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawSolidRect(x, sY, width, ITEM_HEIGHT, 0xffff0000); } if (node.getContent() != null) { - String nameS = contentNameSupplier == null ? null : contentNameSupplier.apply(node.getContent()); + String nameS = contentNameSupplier == null ? null : + contentNameSupplier.apply(node.getContent()); name = nameS == null ? name : nameS; - IGuiTexture icon = contentIconSupplier == null ? null : contentIconSupplier.apply(node.getContent()); + IGuiTexture icon = contentIconSupplier == null ? null : + contentIconSupplier.apply(node.getContent()); if (icon != null) { icon.draw(sX - 9, sY + 1, 8, 8); } @@ -157,11 +162,11 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } }); GlStateManager.enableBlend(); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); } public TreeNode jumpTo(List path) { - list.removeIf(node->node.dimension != 1); + list.removeIf(node -> node.dimension != 1); this.selected = null; int dim = 1; int index = 0; @@ -173,8 +178,8 @@ public TreeNode jumpTo(List path) { node = list.get(i); if (node.dimension != dim) { return null; - } else if (node.getKey().equals(key)) { //expand - if(!node.isLeaf() && path.size() > dim) { + } else if (node.getKey().equals(key)) { // expand + if (!node.isLeaf() && path.size() > dim) { for (int j = 0; j < node.getChildren().size(); j++) { list.add(index + 1 + j, node.getChildren().get(j)); } @@ -191,7 +196,8 @@ public TreeNode jumpTo(List path) { } if (flag) { this.selected = node; - this.scrollOffset = MathHelper.clamp(ITEM_HEIGHT * (index - 1), 0, Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); + this.scrollOffset = MathHelper.clamp(ITEM_HEIGHT * (index - 1), 0, + Math.max(list.size() * ITEM_HEIGHT - getSize().height, 0)); return this.selected; } return null; @@ -206,17 +212,17 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { if (node.isLeaf()) { if (node != this.selected) { this.selected = node; - if (onSelected != null){ + if (onSelected != null) { onSelected.accept(node); } } } else { if (canSelectNode && this.selected != node) { this.selected = node; - if (onSelected != null){ + if (onSelected != null) { onSelected.accept(node); } - } else if (node.getChildren().size() > 0 && list.contains(node.getChildren().get(0))){ + } else if (node.getChildren().size() > 0 && list.contains(node.getChildren().get(0))) { removeNode(node); } else { for (int i = 0; i < node.getChildren().size(); i++) { @@ -232,7 +238,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } private void removeNode(TreeNode node) { - if(node.isLeaf()) return; + if (node.isLeaf()) return; for (TreeNode child : node.getChildren()) { list.remove(child); removeNode(child); diff --git a/src/main/java/gregtech/api/terminal/hardware/Hardware.java b/src/main/java/gregtech/api/terminal/hardware/Hardware.java index e2ba69db547..6a34ff4de48 100644 --- a/src/main/java/gregtech/api/terminal/hardware/Hardware.java +++ b/src/main/java/gregtech/api/terminal/hardware/Hardware.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.IGuiTexture; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -15,7 +16,8 @@ * @Date: 2021/08/27 * @Description: Hardware */ -public abstract class Hardware { +public abstract class Hardware { + protected HardwareProvider provider; public abstract String getRegistryName(); @@ -58,12 +60,13 @@ public final NBTTagCompound getNBT() { /** * Check whether the terminal is in creative mode. */ - public final boolean isCreative(){ + public final boolean isCreative() { return provider != null && provider.isCreative(); } /** * information added to tooltips + * * @return null->nothing added. */ @SideOnly(Side.CLIENT) @@ -73,6 +76,7 @@ public String addInformation() { /** * Create the hardware instance, NOTE!!! do not check nbt or anything here. Terminal has not been initialized here. + * * @param itemStack terminal * @return instance */ @@ -80,12 +84,14 @@ public String addInformation() { /** * Use the item to install this hardware. + * * @return The NBT of the hardware is returned if the item is valid, otherwise NULL is returned */ public abstract NBTTagCompound acceptItemStack(ItemStack itemStack); /** * Called when the hardware is removed and back to the player inventory. + * * @param itemStack (original one) * @return result */ diff --git a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java index 72a9e7d2b7e..b385e0051e8 100644 --- a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java +++ b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java @@ -4,17 +4,19 @@ import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; import gregtech.api.terminal.TerminalRegistry; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Created with IntelliJ IDEA. * @@ -23,16 +25,14 @@ * @Description: */ public class HardwareProvider implements ICapabilityProvider, IItemCapabilityProvider { + private Map providers; private Map itemCache; private Boolean isCreative; private ItemStack itemStack; private NBTTagCompound tag; - - public HardwareProvider() { - - } + public HardwareProvider() {} public void cleanCache(String name) { itemCache.remove(name); @@ -68,11 +68,13 @@ public List getHardware() { if (TerminalBehaviour.isCreative(itemStack)) { return new ArrayList<>(providers.values()); } - return getOrCreateHardwareCompound().getKeySet().stream().map(providers::get).filter(Objects::nonNull).collect(Collectors.toList()); + return getOrCreateHardwareCompound().getKeySet().stream().map(providers::get).filter(Objects::nonNull) + .collect(Collectors.toList()); } public boolean hasHardware(String name) { - return itemStack != null && (TerminalBehaviour.isCreative(getItemStack()) || getOrCreateHardwareCompound().hasKey(name)); + return itemStack != null && + (TerminalBehaviour.isCreative(getItemStack()) || getOrCreateHardwareCompound().hasKey(name)); } public NBTTagCompound getHardwareNBT(String name) { @@ -135,6 +137,7 @@ public T getCapability(@Nonnull Capability capability, @Nullable EnumFaci } } } - return capability == GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER ? GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER.cast(this) : null; + return capability == GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER ? + GregtechCapabilities.CAPABILITY_HARDWARE_PROVIDER.cast(this) : null; } } diff --git a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java index 2ef7c4b1732..ed9a1027614 100644 --- a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java +++ b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public interface IHardwareCapability { + default boolean hasCapability(@Nonnull Capability capability) { return getCapability(capability) != null; } diff --git a/src/main/java/gregtech/api/terminal/os/SystemCall.java b/src/main/java/gregtech/api/terminal/os/SystemCall.java index dc5a14f0ea9..2110775b5db 100644 --- a/src/main/java/gregtech/api/terminal/os/SystemCall.java +++ b/src/main/java/gregtech/api/terminal/os/SystemCall.java @@ -5,12 +5,13 @@ import gregtech.api.util.function.TriConsumer; public enum SystemCall { - CALL_MENU("call_menu", 0, (os, side, args)->os.callMenu(side)), - FULL_SCREEN("full_screen", 1, (os, side, args)->os.maximize(side)), - MINIMIZE_FOCUS_APP("minimize_focus_app", 2, (os, side, args)->os.minimizeApplication(os.getFocusApp(), side)), - CLOSE_FOCUS_APP("close_focus_app", 3, (os, side, args)->os.closeApplication(os.getFocusApp(), side)), - SHUT_DOWN("shutdown", 4, (os, side, args)->os.shutdown(side)), - OPEN_APP("open_app", 5, (os, side, args)->{ + + CALL_MENU("call_menu", 0, (os, side, args) -> os.callMenu(side)), + FULL_SCREEN("full_screen", 1, (os, side, args) -> os.maximize(side)), + MINIMIZE_FOCUS_APP("minimize_focus_app", 2, (os, side, args) -> os.minimizeApplication(os.getFocusApp(), side)), + CLOSE_FOCUS_APP("close_focus_app", 3, (os, side, args) -> os.closeApplication(os.getFocusApp(), side)), + SHUT_DOWN("shutdown", 4, (os, side, args) -> os.shutdown(side)), + OPEN_APP("open_app", 5, (os, side, args) -> { if (args.length > 0 && args[0] != null) { AbstractApplication app = TerminalRegistry.getApplication(args[0]); if (app != null) { @@ -19,12 +20,11 @@ public enum SystemCall { } }); - TriConsumer action; String name; int index; - SystemCall(String name, int index, TriConsumer action){ + SystemCall(String name, int index, TriConsumer action) { this.action = action; this.name = name; this.index = index; @@ -32,7 +32,6 @@ public enum SystemCall { public void call(TerminalOSWidget os, boolean isClient, String... args) { action.accept(os, isClient, args); - } public String getTranslateKey() { @@ -43,7 +42,7 @@ public static SystemCall getFromName(String name) { for (SystemCall value : SystemCall.values()) { if (value.name.equalsIgnoreCase(name)) { return value; - } else if(value.getTranslateKey().equals(name)) { + } else if (value.getTranslateKey().equals(name)) { return value; } } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java index 30db199c216..19ad7f969b2 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalDesktopWidget.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -13,6 +14,7 @@ import java.util.List; public class TerminalDesktopWidget extends WidgetGroup { + private final TerminalOSWidget os; private final WidgetGroup appDiv; private final List topWidgets; @@ -26,12 +28,12 @@ public TerminalDesktopWidget(Position position, Size size, TerminalOSWidget os) this.topWidgets = new LinkedList<>(); } - public void installApplication(AbstractApplication application){ + public void installApplication(AbstractApplication application) { int r = 12; int index = appDiv.widgets.size(); int x = this.getSize().width / 2 + (3 * r) * (index % rowCount - rowCount / 2); int y = (index / rowCount) * (3 * r) + 40; - CircleButtonWidget button = new CircleButtonWidget(x,y) + CircleButtonWidget button = new CircleButtonWidget(x, y) .setColors(TerminalTheme.COLOR_B_2.getColor(), application.getThemeColor(), TerminalTheme.COLOR_B_2.getColor()) diff --git a/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java index 04960c6cec9..30cd7ee1150 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalDialogWidget.java @@ -15,6 +15,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.inventory.IInventory; @@ -31,13 +32,18 @@ import java.util.function.Predicate; public class TerminalDialogWidget extends AnimaWidgetGroup { - private static final IGuiTexture DIALOG_BACKGROUND = TextureArea.fullImage("textures/gui/terminal/terminal_dialog.png"); + + private static final IGuiTexture DIALOG_BACKGROUND = TextureArea + .fullImage("textures/gui/terminal/terminal_dialog.png"); private static final IGuiTexture OK_NORMAL = TextureArea.fullImage("textures/gui/terminal/icon/ok_normal.png"); private static final IGuiTexture OK_HOVER = TextureArea.fullImage("textures/gui/terminal/icon/ok_hover.png"); -// private static final IGuiTexture OK_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/ok_disable.png"); - private static final IGuiTexture CANCEL_NORMAL = TextureArea.fullImage("textures/gui/terminal/icon/cancel_normal.png"); - private static final IGuiTexture CANCEL_HOVER = TextureArea.fullImage("textures/gui/terminal/icon/cancel_hover.png"); -// private static final IGuiTexture CANCEL_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/cancel_disable.png"); + // private static final IGuiTexture OK_DISABLE = TextureArea.fullImage("textures/gui/terminal/icon/ok_disable.png"); + private static final IGuiTexture CANCEL_NORMAL = TextureArea + .fullImage("textures/gui/terminal/icon/cancel_normal.png"); + private static final IGuiTexture CANCEL_HOVER = TextureArea + .fullImage("textures/gui/terminal/icon/cancel_hover.png"); + // private static final IGuiTexture CANCEL_DISABLE = + // TextureArea.fullImage("textures/gui/terminal/icon/cancel_disable.png"); private static final int HEIGHT = 128; private static final int WIDTH = 184; @@ -131,16 +137,19 @@ public TerminalDialogWidget addTitle(String title) { } public TerminalDialogWidget addInfo(String info) { - this.addWidget(new LabelWidget(WIDTH / 2, HEIGHT / 2, info, -1).setWidth(WIDTH - 16).setYCentered(true).setXCentered(true)); + this.addWidget(new LabelWidget(WIDTH / 2, HEIGHT / 2, info, -1).setWidth(WIDTH - 16).setYCentered(true) + .setXCentered(true)); return this; } public static TerminalDialogWidget createEmptyTemplate(TerminalOSWidget os) { Size size = os.getSize(); - return new TerminalDialogWidget(os, (size.width - WIDTH) / 2, (size.height - HEIGHT) / 2, WIDTH, HEIGHT).setBackground(DIALOG_BACKGROUND); + return new TerminalDialogWidget(os, (size.width - WIDTH) / 2, (size.height - HEIGHT) / 2, WIDTH, HEIGHT) + .setBackground(DIALOG_BACKGROUND); } - public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String title, String info, Runnable callback) { + public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String title, String info, + Runnable callback) { return createEmptyTemplate(os).addTitle(title).addInfo(info).addOkButton(callback); } @@ -148,12 +157,15 @@ public static TerminalDialogWidget showInfoDialog(TerminalOSWidget os, String ti return createEmptyTemplate(os).addTitle(title).addInfo(info).addOkButton(null); } - public static TerminalDialogWidget showConfirmDialog(TerminalOSWidget os, String title, String info, Consumer result) { + public static TerminalDialogWidget showConfirmDialog(TerminalOSWidget os, String title, String info, + Consumer result) { return createEmptyTemplate(os).addConfirmButton(result).addTitle(title).addInfo(info); } - public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, String title, Predicate validator, Consumer result) { - TextFieldWidget textFieldWidget = new TextFieldWidget(WIDTH / 2 - 50, HEIGHT / 2 - 15, 100, 20, new ColorRectTexture(0x2fffffff), null, null).setValidator(validator); + public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, String title, + Predicate validator, Consumer result) { + TextFieldWidget textFieldWidget = new TextFieldWidget(WIDTH / 2 - 50, HEIGHT / 2 - 15, 100, 20, + new ColorRectTexture(0x2fffffff), null, null).setValidator(validator); TerminalDialogWidget dialog = createEmptyTemplate(os).addTitle(title).addConfirmButton(b -> { if (b) { if (result != null) @@ -169,9 +181,11 @@ public static TerminalDialogWidget showTextFieldDialog(TerminalOSWidget os, Stri /** * Show Color Dialog + * * @return color (rgba) */ - public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String title, Consumer result, int startColor) { + public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String title, Consumer result, + int startColor) { TerminalDialogWidget dialog = createEmptyTemplate(os).addTitle(title); ColorWidget colorWidget = new ColorWidget(WIDTH / 2 - 60, HEIGHT / 2 - 35, 80, 10); colorWidget.setStartColor(startColor); @@ -190,11 +204,13 @@ public static TerminalDialogWidget showColorDialog(TerminalOSWidget os, String t /** * Show FileDialog - * @param dir root directory + * + * @param dir root directory * @param isSelector select a file or save a file - * @param result selected file or (saved) + * @param result selected file or (saved) */ - public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String title, File dir, boolean isSelector, Consumer result) { + public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String title, File dir, boolean isSelector, + Consumer result) { Size size = os.getSize(); TerminalDialogWidget dialog = new TerminalDialogWidget(os, 0, 0, size.width, size.height) .setBackground(new ColorRectTexture(0x4f000000)); @@ -205,9 +221,11 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti } AtomicReference selected = new AtomicReference<>(); selected.set(dir); - dialog.addWidget(new TreeListWidget<>(0, 0, 130, size.height, new FileTree(dir), node -> selected.set(node.getKey())).setNodeTexture(GuiTextures.BORDERED_BACKGROUND) - .canSelectNode(true) - .setLeafTexture(GuiTextures.SLOT_DARKENED)); + dialog.addWidget( + new TreeListWidget<>(0, 0, 130, size.height, new FileTree(dir), node -> selected.set(node.getKey())) + .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) + .canSelectNode(true) + .setLeafTexture(GuiTextures.SLOT_DARKENED)); int x = 130 + (size.width - 133 - WIDTH) / 2; int y = (size.height - HEIGHT) / 2; dialog.addWidget(new ImageWidget(x, y, WIDTH, HEIGHT, DIALOG_BACKGROUND)); @@ -237,25 +255,26 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti return "terminal.dialog.no_file_selected"; }, true).setWidth(WIDTH - 16)); } else { - dialog.addWidget(new TextFieldWidget(x + WIDTH / 2 - 38, y + HEIGHT / 2 - 10, 76, 20, new ColorRectTexture(0x4f000000), null, null) - .setTextResponder(res->{ - File file = selected.get(); - if (file == null) return; - if (file.isDirectory()) { - selected.set(new File(file, res)); - } else { - selected.set(new File(file.getParent(), res)); - } - },true) - .setTextSupplier(()->{ - File file = selected.get(); - if (file != null && !file.isDirectory()) { - return selected.get().getName(); - } - return ""; - }, true) - .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true)); + dialog.addWidget(new TextFieldWidget(x + WIDTH / 2 - 38, y + HEIGHT / 2 - 10, 76, 20, + new ColorRectTexture(0x4f000000), null, null) + .setTextResponder(res -> { + File file = selected.get(); + if (file == null) return; + if (file.isDirectory()) { + selected.set(new File(file, res)); + } else { + selected.set(new File(file.getParent(), res)); + } + }, true) + .setTextSupplier(() -> { + File file = selected.get(); + if (file != null && !file.isDirectory()) { + return selected.get().getName(); + } + return ""; + }, true) + .setMaxStringLength(Integer.MAX_VALUE) + .setValidator(s -> true)); } dialog.addWidget(new CircleButtonWidget(x + 17, y + 15, 10, 1, 16) .setClickListener(cd -> { @@ -278,7 +297,8 @@ public static TerminalDialogWidget showFileDialog(TerminalOSWidget os, String ti return dialog.setClientSide(); } - public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String title, boolean cost, Predicate filter, Consumer result) { + public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String title, boolean cost, + Predicate filter, Consumer result) { TerminalDialogWidget dialog = createEmptyTemplate(os); dialog.addWidget(new LabelWidget(WIDTH / 2, -7, title, -1).setShadow(true).setXCentered(true)); IInventory inventoryPlayer = os.getModularUI().entityPlayer.inventory; @@ -287,11 +307,13 @@ public static TerminalDialogWidget showItemSelector(TerminalOSWidget os, String } int x = 11; int y = 30; - final SlotWidget[] selected = {null}; + final SlotWidget[] selected = { null }; for (int row = 0; row < 4; row++) { for (int col = 0; col < 9; col++) { boolean pass = filter == null || filter.test(inventoryPlayer.getStackInSlot(col + row * 9)); - SlotWidget slotWidget = new SlotWidget(inventoryPlayer, col + row * 9, x + col * 18, (int) (y + (row == 0 ? -1.2 : (row - 1)) * 18), false, false) { + SlotWidget slotWidget = new SlotWidget(inventoryPlayer, col + row * 9, x + col * 18, + (int) (y + (row == 0 ? -1.2 : (row - 1)) * 18), false, false) { + @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); @@ -329,7 +351,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { dialog.iNativeWidgets.add(slotWidget); } } - dialog.addConfirmButton(confirm->{ + dialog.addConfirmButton(confirm -> { if (result != null && confirm && selected[0] != null && !selected[0].getHandle().getStack().isEmpty()) { ItemStack stack = selected[0].getHandle().getStack().copy(); if (cost) { @@ -357,7 +379,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); if (widget.isVisible()) { - if(widget.mouseClicked(mouseX, mouseY, button)){ + if (widget.mouseClicked(mouseX, mouseY, button)) { return true; } } @@ -393,6 +415,7 @@ public boolean keyTyped(char charTyped, int keyCode) { } public void onOSSizeUpdate(int width, int height) { - setSelfPosition(Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); + setSelfPosition( + Position.ORIGIN.add(new Position((width - getSize().width) / 2, (height - getSize().height) / 2))); } } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java index 79c785bd7d4..0b9c7683e4c 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalHomeButtonWidget.java @@ -3,10 +3,12 @@ import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.util.GTLog; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.FMLCommonHandler; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -14,6 +16,7 @@ import java.io.IOException; public class TerminalHomeButtonWidget extends CircleButtonWidget { + private final TerminalOSWidget os; private int mouseClickTime = -1; private final Pair[] actions; @@ -37,7 +40,8 @@ public TerminalHomeButtonWidget(TerminalOSWidget os) { for (int i = 0; i < actions.length; i++) { if (nbt.hasKey(String.valueOf(i))) { NBTTagCompound tag = nbt.getCompoundTag(String.valueOf(i)); - actions[i] = new MutablePair<>(SystemCall.getFromIndex(tag.getInteger("action")), tag.hasKey("arg") ? tag.getString("arg") : null); + actions[i] = new MutablePair<>(SystemCall.getFromIndex(tag.getInteger("action")), + tag.hasKey("arg") ? tag.getString("arg") : null); } } } @@ -67,7 +71,8 @@ public void saveConfig() { } try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, "config/home_button.nbt")); + CompressedStreamTools.safeWrite(nbt, + new File(TerminalRegistry.TERMINAL_PATH, "config/home_button.nbt")); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for the home button", e); @@ -127,7 +132,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void sendToServer(Pair pair) { if (pair != null) { String[] args = pair.getValue() == null ? new String[0] : pair.getValue().split(" "); - writeClientAction(1, buffer->{ + writeClientAction(1, buffer -> { buffer.writeVarInt(pair.getKey().index); buffer.writeVarInt(args.length); for (String arg : args) { @@ -137,5 +142,4 @@ private void sendToServer(Pair pair) { click(pair.getKey().index, true, args); } } - } diff --git a/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java b/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java index 187e5fd7c16..518609c585a 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalOSWidget.java @@ -21,6 +21,7 @@ import gregtech.common.terminal.app.settings.widgets.OsSettings; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -38,6 +39,7 @@ import java.util.stream.Collectors; public class TerminalOSWidget extends AbstractWidgetGroup { + public static final TextureArea TERMINAL_FRAME = TextureArea.fullImage("textures/gui/terminal/terminal_frame.png"); public static final TextureArea TERMINAL_HOME = TextureArea.fullImage("textures/gui/terminal/terminal_home.png"); public static final int DEFAULT_WIDTH = 333; @@ -65,7 +67,8 @@ public TerminalOSWidget(int xPosition, int yPosition, ItemStack itemStack) { this.openedApps = new ArrayList<>(); this.installedApps = new ArrayList<>(); this.desktop = new TerminalDesktopWidget(Position.ORIGIN, new Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), this); - this.menu = new TerminalMenuWidget(Position.ORIGIN, new Size(31, DEFAULT_HEIGHT), this).setBackground(TerminalTheme.COLOR_B_2); + this.menu = new TerminalMenuWidget(Position.ORIGIN, new Size(31, DEFAULT_HEIGHT), this) + .setBackground(TerminalTheme.COLOR_B_2); this.home = new TerminalHomeButtonWidget(this); this.addWidget(desktop); this.addWidget(menu); @@ -116,7 +119,8 @@ public List getHardware() { } public List getHardware(Class clazz) { - return getHardware().stream().filter(hw -> hw.getClass() == clazz).map(hw -> (T) hw).collect(Collectors.toList()); + return getHardware().stream().filter(hw -> hw.getClass() == clazz).map(hw -> (T) hw) + .collect(Collectors.toList()); } public void installApplication(AbstractApplication application) { @@ -128,8 +132,11 @@ public void openApplication(AbstractApplication application, boolean isClient) { desktop.removeAllDialogs(); NBTTagCompound nbt = tabletNBT.getCompoundTag(application.getRegistryName()); if (!TerminalBehaviour.isCreative(itemStack)) { - List hwDemand = TerminalRegistry.getAppHardwareDemand(application.getRegistryName(), Math.min(nbt.getInteger("_tier"), application.getMaxTier())); - List unMatch = hwDemand.stream().filter(demand -> getHardware().stream().noneMatch(hw -> hw.isHardwareAdequate(demand))).collect(Collectors.toList()); + List hwDemand = TerminalRegistry.getAppHardwareDemand(application.getRegistryName(), + Math.min(nbt.getInteger("_tier"), application.getMaxTier())); + List unMatch = hwDemand.stream() + .filter(demand -> getHardware().stream().noneMatch(hw -> hw.isHardwareAdequate(demand))) + .collect(Collectors.toList()); if (unMatch.size() > 0) { if (isClient) { StringBuilder tooltips = new StringBuilder("\n"); @@ -139,7 +146,8 @@ public void openApplication(AbstractApplication application, boolean isClient) { if (info == null) { tooltips.append(name); } else if (match instanceof BatteryHardware) { - IElectricItem energyItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem energyItem = itemStack + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (energyItem != null && energyItem.getCharge() <= 0) { tooltips.append(I18n.format("terminal.battery.low_energy")); } else { @@ -261,15 +269,15 @@ public void shutdown(boolean isClient) { NBTTagCompound synced = openedApp.closeApp(); if (synced != null && !synced.isEmpty()) { tabletNBT.setTag(appName, synced); - if (openedApp.isClientSideApp()) {//if its a clientSideApp and the nbt not null, meaning this nbt should be synced to the server side. + if (openedApp.isClientSideApp()) {// if its a clientSideApp and the nbt not null, meaning this nbt + // should be synced to the server side. nbt.setTag(appName, synced); } } } writeClientAction(-1, buffer -> buffer.writeCompoundTag(nbt)); - } else { //request shutdown from the server side - writeUpdateInfo(-2, packetBuffer -> { - }); + } else { // request shutdown from the server side + writeUpdateInfo(-2, packetBuffer -> {}); } } @@ -293,7 +301,7 @@ protected void closeDialog(TerminalDialogWidget widget) { @Override public void handleClientAction(int id, PacketBuffer buffer) { - if (id == -1) { //shutdown + if (id == -1) { // shutdown NBTTagCompound nbt = null; try { nbt = buffer.readCompoundTag(); @@ -344,7 +352,8 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { for (AbstractApplication close : toClosed) { this.closeApplication(close, true); } - TerminalDialogWidget.showInfoDialog(this, "terminal.component.warning", "terminal.battery.low_energy").setClientSide().open(); + TerminalDialogWidget.showInfoDialog(this, "terminal.component.warning", "terminal.battery.low_energy") + .setClientSide().open(); } } else if (id == -2) { // shutdown shutdown(true); @@ -376,7 +385,8 @@ public void detectAndSendChanges() { } private long disCharge() { - IElectricItem electricItem = hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null && !TerminalBehaviour.isCreative(itemStack)) { AtomicLong costs = new AtomicLong(0); List charged = new ArrayList<>(); @@ -409,15 +419,17 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender Size size = getSize(); // show menu when mouse near the left edge - if ((focusApp == null || focusApp.canOpenMenuOnEdge()) && isMouseOver(position.x, position.y, 7, size.height, mouseX, mouseY)) { + if ((focusApp == null || focusApp.canOpenMenuOnEdge()) && + isMouseOver(position.x, position.y, 7, size.height, mouseX, mouseY)) { if (menu.isHide && !showMenuHover) { menu.showMenu(); showMenuHover = true; } - } else if (!menu.isHide && showMenuHover && !isMouseOver(position.x - 10, position.y, 41, size.height, mouseX, mouseY)) { - menu.hideMenu(); - showMenuHover = false; - } + } else if (!menu.isHide && showMenuHover && + !isMouseOver(position.x - 10, position.y, 41, size.height, mouseX, mouseY)) { + menu.hideMenu(); + showMenuHover = false; + } if (background != null) { background.draw(position.x, position.y, size.width, size.height); @@ -445,26 +457,31 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public boolean keyTyped(char charTyped, int keyCode) { - if (waitShutdown && (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode))) { + if (waitShutdown && + (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode))) { shutdown(true); return true; } if (super.keyTyped(charTyped, keyCode)) { return true; } - if (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode)) { // hook esc and e + if (keyCode == 1 || Minecraft.getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(keyCode)) { // hook + // esc + // and + // e waitShutdown = true; if (!OsSettings.DOUBLE_CHECK) { shutdown(true); return true; } - TerminalDialogWidget.showConfirmDialog(this, "terminal.component.warning", "terminal.os.shutdown_confirm", result -> { - if (result) { - shutdown(true); - } else { - waitShutdown = false; - } - }).setClientSide().open(); + TerminalDialogWidget + .showConfirmDialog(this, "terminal.component.warning", "terminal.os.shutdown_confirm", result -> { + if (result) { + shutdown(true); + } else { + waitShutdown = false; + } + }).setClientSide().open(); return true; } waitShutdown = false; @@ -490,7 +507,9 @@ private void updateOSSize() { this.setSize(new Size(osWidth, osHeight)); this.desktop.setSize(new Size(osWidth, osHeight)); this.menu.setSize(new Size(31, osHeight)); - this.home.setSelfPosition(this.maximize ? new Position((osWidth - this.home.getSize().width) / 2, osHeight - this.home.getSize().height - 10) : new Position(340, 104)); + this.home.setSelfPosition(this.maximize ? + new Position((osWidth - this.home.getSize().width) / 2, osHeight - this.home.getSize().height - 10) : + new Position(340, 104)); this.home.setIcon(this.maximize ? TERMINAL_HOME : null); gui.setSize(this.maximize ? osWidth : 380, this.maximize ? osHeight : 256); if (this.focusApp != null) { diff --git a/src/main/java/gregtech/api/terminal/os/TerminalTheme.java b/src/main/java/gregtech/api/terminal/os/TerminalTheme.java index ff46a6b9e1b..66bf68c5bfd 100644 --- a/src/main/java/gregtech/api/terminal/os/TerminalTheme.java +++ b/src/main/java/gregtech/api/terminal/os/TerminalTheme.java @@ -1,19 +1,22 @@ package gregtech.api.terminal.os; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.ModifyGuiTexture; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.FileUtility; + import net.minecraftforge.fml.common.FMLCommonHandler; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.awt.*; import java.io.File; import static gregtech.api.terminal.TerminalRegistry.TERMINAL_PATH; public class TerminalTheme { + private static final String FILE_PATH = "config/theme.json"; public static final ColorRectTexture COLOR_1 = new ColorRectTexture(new Color(144, 243, 116)); public static final ColorRectTexture COLOR_2 = new ColorRectTexture(new Color(243, 208, 116)); @@ -30,7 +33,8 @@ public class TerminalTheme { public static final ColorRectTexture COLOR_B_2 = new ColorRectTexture(new Color(0, 0, 0, 160)); public static final ColorRectTexture COLOR_B_3 = new ColorRectTexture(new Color(246, 120, 120, 160)); - public static final ModifyGuiTexture WALL_PAPER = new ModifyGuiTexture(TextureArea.fullImage("textures/gui/terminal/terminal_background.png")); + public static final ModifyGuiTexture WALL_PAPER = new ModifyGuiTexture( + TextureArea.fullImage("textures/gui/terminal/terminal_background.png")); static { if (FMLCommonHandler.instance().getSide().isClient()) { @@ -39,19 +43,45 @@ public class TerminalTheme { saveConfig(); } else { JsonObject config = element.getAsJsonObject(); - if (config.has("COLOR_1")) { COLOR_1.setColor(config.get("COLOR_1").getAsInt()); } - if (config.has("COLOR_2")) { COLOR_2.setColor(config.get("COLOR_2").getAsInt()); } - if (config.has("COLOR_3")) { COLOR_3.setColor(config.get("COLOR_3").getAsInt()); } - if (config.has("COLOR_4")) { COLOR_4.setColor(config.get("COLOR_4").getAsInt()); } - if (config.has("COLOR_5")) { COLOR_5.setColor(config.get("COLOR_5").getAsInt()); } - if (config.has("COLOR_6")) { COLOR_6.setColor(config.get("COLOR_6").getAsInt()); } - if (config.has("COLOR_7")) { COLOR_7.setColor(config.get("COLOR_7").getAsInt()); } - if (config.has("COLOR_F_1")) { COLOR_F_1.setColor(config.get("COLOR_F_1").getAsInt()); } - if (config.has("COLOR_F_2")) { COLOR_F_2.setColor(config.get("COLOR_F_2").getAsInt()); } - if (config.has("COLOR_B_1")) { COLOR_B_1.setColor(config.get("COLOR_B_1").getAsInt()); } - if (config.has("COLOR_B_2")) { COLOR_B_2.setColor(config.get("COLOR_B_2").getAsInt()); } - if (config.has("COLOR_B_3")) { COLOR_B_3.setColor(config.get("COLOR_B_3").getAsInt()); } - if (config.has("WALL_PAPER")) { WALL_PAPER.loadConfig(config.get("WALL_PAPER").getAsJsonObject()); } + if (config.has("COLOR_1")) { + COLOR_1.setColor(config.get("COLOR_1").getAsInt()); + } + if (config.has("COLOR_2")) { + COLOR_2.setColor(config.get("COLOR_2").getAsInt()); + } + if (config.has("COLOR_3")) { + COLOR_3.setColor(config.get("COLOR_3").getAsInt()); + } + if (config.has("COLOR_4")) { + COLOR_4.setColor(config.get("COLOR_4").getAsInt()); + } + if (config.has("COLOR_5")) { + COLOR_5.setColor(config.get("COLOR_5").getAsInt()); + } + if (config.has("COLOR_6")) { + COLOR_6.setColor(config.get("COLOR_6").getAsInt()); + } + if (config.has("COLOR_7")) { + COLOR_7.setColor(config.get("COLOR_7").getAsInt()); + } + if (config.has("COLOR_F_1")) { + COLOR_F_1.setColor(config.get("COLOR_F_1").getAsInt()); + } + if (config.has("COLOR_F_2")) { + COLOR_F_2.setColor(config.get("COLOR_F_2").getAsInt()); + } + if (config.has("COLOR_B_1")) { + COLOR_B_1.setColor(config.get("COLOR_B_1").getAsInt()); + } + if (config.has("COLOR_B_2")) { + COLOR_B_2.setColor(config.get("COLOR_B_2").getAsInt()); + } + if (config.has("COLOR_B_3")) { + COLOR_B_3.setColor(config.get("COLOR_B_3").getAsInt()); + } + if (config.has("WALL_PAPER")) { + WALL_PAPER.loadConfig(config.get("WALL_PAPER").getAsJsonObject()); + } } } } diff --git a/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java b/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java index 9af2f88f693..519d09b2231 100644 --- a/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java +++ b/src/main/java/gregtech/api/terminal/os/menu/IMenuComponent.java @@ -5,6 +5,7 @@ import gregtech.api.gui.resources.IGuiTexture; public interface IMenuComponent { + /** * Component Icon */ @@ -22,5 +23,5 @@ default String hoverText() { /** * Click Event. Side see {@link Widget.ClickData#isClient} */ - default void click(Widget.ClickData clickData){} + default void click(Widget.ClickData clickData) {} } diff --git a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java index 75ea235e1a4..daeaf572d4e 100644 --- a/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java +++ b/src/main/java/gregtech/api/terminal/os/menu/TerminalMenuWidget.java @@ -13,6 +13,7 @@ import gregtech.api.util.Size; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.Tuple; import net.minecraftforge.fml.relauncher.Side; @@ -21,8 +22,8 @@ import java.util.ArrayList; import java.util.List; - public class TerminalMenuWidget extends WidgetGroup { + @SideOnly(Side.CLIENT) private Interpolator interpolator; private IGuiTexture background; @@ -30,10 +31,9 @@ public class TerminalMenuWidget extends WidgetGroup { private final List> components; public boolean isHide; - public TerminalMenuWidget(Position position, Size size, TerminalOSWidget os) { super(position, size); - addSelfPosition( -size.width, 0); + addSelfPosition(-size.width, 0); setVisible(false); isHide = true; this.os = os; @@ -83,25 +83,25 @@ public void addComponent(IMenuComponent component) { .setColors(0, 0xFFFFFFFF, 0) .setHoverText(component.hoverText()) .setIcon(component.buttonIcon()); - button.setClickListener(c->{ - components.forEach(tuple -> { - if (tuple.getFirst() instanceof Widget && tuple.getFirst() != component){ - ((Widget) tuple.getFirst()).setActive(false); - ((Widget) tuple.getFirst()).setVisible(false); - ((CircleButtonWidget) tuple.getSecond().widgets.get(0)).setFill(0); - } - }); - if (component instanceof Widget) { - Widget widget = (Widget)component; - widget.setVisible(!widget.isVisible()); - widget.setActive(!widget.isActive()); - button.setFill(widget.isVisible() ? 0xFF94E2C1 : 0); - } - component.click(c); - }); + button.setClickListener(c -> { + components.forEach(tuple -> { + if (tuple.getFirst() instanceof Widget && tuple.getFirst() != component) { + ((Widget) tuple.getFirst()).setActive(false); + ((Widget) tuple.getFirst()).setVisible(false); + ((CircleButtonWidget) tuple.getSecond().widgets.get(0)).setFill(0); + } + }); + if (component instanceof Widget) { + Widget widget = (Widget) component; + widget.setVisible(!widget.isVisible()); + widget.setActive(!widget.isActive()); + button.setFill(widget.isVisible() ? 0xFF94E2C1 : 0); + } + component.click(c); + }); group.addWidget(button); if (component instanceof Widget) { - Widget widget = (Widget)component; + Widget widget = (Widget) component; widget.setSelfPosition(new Position(x + 20, 0)); widget.setVisible(false); widget.setActive(false); @@ -119,7 +119,7 @@ public void loadComponents(AbstractApplication app) { } public void removeComponents() { - components.forEach(component->this.removeWidget(component.getSecond())); + components.forEach(component -> this.removeWidget(component.getSecond())); components.clear(); } @@ -128,8 +128,8 @@ public void hideMenu() { if (!isHide && interpolator == null) { int y = getSelfPosition().y; interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x - getSize().width, 6, Eases.LINEAR, - value-> setSelfPosition(new Position(value.intValue(), y)), - value-> { + value -> setSelfPosition(new Position(value.intValue(), y)), + value -> { setVisible(false); interpolator = null; isHide = true; @@ -145,8 +145,8 @@ public void showMenu() { setVisible(true); int y = getSelfPosition().y; interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x + getSize().width, 6, Eases.LINEAR, - value-> setSelfPosition(new Position(value.intValue(), y)), - value-> { + value -> setSelfPosition(new Position(value.intValue(), y)), + value -> { interpolator = null; isHide = false; }); @@ -157,19 +157,20 @@ public void showMenu() { @Override public void updateScreenOnFrame() { - if(interpolator != null) interpolator.update(); + if (interpolator != null) interpolator.update(); super.updateScreenOnFrame(); } @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - GlStateManager.color(1,1,1,0.5f); - if( background != null) { + GlStateManager.color(1, 1, 1, 0.5f); + if (background != null) { background.draw(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height); } else { - drawGradientRect(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, 0xff000000, 0xff000000); + drawGradientRect(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, + 0xff000000, 0xff000000); } - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); super.drawInBackground(mouseX, mouseY, partialTicks, context); } diff --git a/src/main/java/gregtech/api/terminal/util/FileTree.java b/src/main/java/gregtech/api/terminal/util/FileTree.java index 34e57cbe175..5097c478aff 100644 --- a/src/main/java/gregtech/api/terminal/util/FileTree.java +++ b/src/main/java/gregtech/api/terminal/util/FileTree.java @@ -7,7 +7,7 @@ public class FileTree extends TreeNode { - public FileTree(File dir){ + public FileTree(File dir) { this(0, dir); } diff --git a/src/main/java/gregtech/api/terminal/util/ISearch.java b/src/main/java/gregtech/api/terminal/util/ISearch.java index eaa8e0abd85..2ae8c26569b 100644 --- a/src/main/java/gregtech/api/terminal/util/ISearch.java +++ b/src/main/java/gregtech/api/terminal/util/ISearch.java @@ -3,6 +3,10 @@ import java.util.function.Consumer; public interface ISearch { - default boolean isManualInterrupt() {return false;} + + default boolean isManualInterrupt() { + return false; + } + void search(String word, Consumer find); } diff --git a/src/main/java/gregtech/api/terminal/util/SearchEngine.java b/src/main/java/gregtech/api/terminal/util/SearchEngine.java index 1cfe7a28bb1..316aba3ce6d 100644 --- a/src/main/java/gregtech/api/terminal/util/SearchEngine.java +++ b/src/main/java/gregtech/api/terminal/util/SearchEngine.java @@ -1,21 +1,23 @@ package gregtech.api.terminal.util; -import javax.annotation.Nonnull; import java.util.function.Consumer; -public class SearchEngine { +import javax.annotation.Nonnull; + +public class SearchEngine { + private final ISearch search; private final Consumer result; private Thread thread; - public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result){ + public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result) { this.search = search; this.result = result; } public void searchWord(String word) { dispose(); - thread = new Thread(()-> search.search(word, result)); + thread = new Thread(() -> search.search(word, result)); thread.start(); } @@ -33,5 +35,4 @@ public void dispose() { } thread = null; } - } diff --git a/src/main/java/gregtech/api/terminal/util/TreeNode.java b/src/main/java/gregtech/api/terminal/util/TreeNode.java index d54b56d9925..7f99ac830ae 100644 --- a/src/main/java/gregtech/api/terminal/util/TreeNode.java +++ b/src/main/java/gregtech/api/terminal/util/TreeNode.java @@ -1,34 +1,34 @@ package gregtech.api.terminal.util; - import java.util.ArrayList; import java.util.List; /*** * Tree + * * @param key * @param leaf */ public class TreeNode { + public final int dimension; protected final T key; protected K content; protected List> children; - public TreeNode(int dimension, T key) { this.dimension = dimension; this.key = key; } - public boolean isLeaf(){ + public boolean isLeaf() { return getChildren() == null || getChildren().isEmpty(); } - public TreeNode getOrCreateChild (T childKey) { + public TreeNode getOrCreateChild(T childKey) { TreeNode result; if (getChildren() != null) { - result = getChildren().stream().filter(child->child.key.equals(childKey)).findFirst().orElseGet(()->{ + result = getChildren().stream().filter(child -> child.key.equals(childKey)).findFirst().orElseGet(() -> { TreeNode newNode = new TreeNode<>(dimension + 1, childKey); getChildren().add(newNode); return newNode; @@ -52,7 +52,7 @@ public TreeNode getChild(T key) { return null; } - public void addContent (T key, K content) { + public void addContent(T key, K content) { getOrCreateChild(key).content = content; } diff --git a/src/main/java/gregtech/api/unification/Element.java b/src/main/java/gregtech/api/unification/Element.java index 607d56862aa..2826212ecc0 100644 --- a/src/main/java/gregtech/api/unification/Element.java +++ b/src/main/java/gregtech/api/unification/Element.java @@ -27,13 +27,15 @@ public class Element { /** * @param protons Amount of Protons - * @param neutrons Amount of Neutrons (I could have made mistakes with the Neutron amount calculation, please tell me if I did something wrong) + * @param neutrons Amount of Neutrons (I could have made mistakes with the Neutron amount calculation, please + * tell me if I did something wrong) * @param halfLifeSeconds Amount of Half Life this Material has in Seconds. -1 for stable Materials * @param decayTo String representing the Elements it decays to. Separated by an '&' Character * @param name Name of the Element * @param symbol Symbol of the Element */ - public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, + boolean isIsotope) { this.protons = protons; this.neutrons = neutrons; this.halfLifeSeconds = halfLifeSeconds; diff --git a/src/main/java/gregtech/api/unification/Elements.java b/src/main/java/gregtech/api/unification/Elements.java index 7b4232048ce..d49203d32f6 100644 --- a/src/main/java/gregtech/api/unification/Elements.java +++ b/src/main/java/gregtech/api/unification/Elements.java @@ -13,8 +13,7 @@ public class Elements { private static final Map elements = new HashMap<>(); - private Elements() { - } + private Elements() {} public static final Element H = add(1, 0, -1, null, "Hydrogen", "H", false); public static final Element D = add(1, 1, -1, "H", "Deuterium", "D", true); @@ -142,7 +141,7 @@ private Elements() { public static final Element Ts = add(117, 177, -1, null, "Tennessine", "Ts", false); public static final Element Og = add(118, 176, -1, null, "Oganesson", "Og", false); - //fantasy todo Naquadah element names + // fantasy todo Naquadah element names public static final Element Tr = add(119, 178, -1, null, "Tritanium", "Tr", false); public static final Element Dr = add(120, 180, -1, null, "Duranium", "Dr", false); public static final Element Ke = add(125, 198, -1, null, "Trinium", "Ke", false); @@ -156,13 +155,13 @@ private Elements() { // TODO Cosmic Neutronium, other Gregicality Elements @ZenMethod - public static Element add(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public static Element add(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, + String symbol, boolean isIsotope) { Element element = new Element(protons, neutrons, halfLifeSeconds, decayTo, name, symbol, isIsotope); elements.put(name, element); return element; } - public static List getAllElements() { return Collections.unmodifiableList(new ArrayList<>(elements.values())); } diff --git a/src/main/java/gregtech/api/unification/FluidUnifier.java b/src/main/java/gregtech/api/unification/FluidUnifier.java index 5d8dcfd4b59..ffc916c4237 100644 --- a/src/main/java/gregtech/api/unification/FluidUnifier.java +++ b/src/main/java/gregtech/api/unification/FluidUnifier.java @@ -1,9 +1,11 @@ package gregtech.api.unification; import gregtech.api.unification.material.Material; + +import net.minecraftforge.fluids.Fluid; + import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import net.minecraftforge.fluids.Fluid; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -20,24 +22,26 @@ @ApiStatus.Experimental public final class FluidUnifier { - private static final Map fluidToMaterial = new Object2ObjectOpenCustomHashMap<>(new Hash.Strategy<>() { + private static final Map fluidToMaterial = new Object2ObjectOpenCustomHashMap<>( + new Hash.Strategy<>() { - @Override - public int hashCode(@Nullable Fluid o) { - return o == null ? 0 : o.getName().hashCode(); - } + @Override + public int hashCode(@Nullable Fluid o) { + return o == null ? 0 : o.getName().hashCode(); + } - @Override - public boolean equals(@Nullable Fluid a, @Nullable Fluid b) { - return Objects.equals(a == null ? null : a.getName(), b == null ? null : b.getName()); - } - }); + @Override + public boolean equals(@Nullable Fluid a, @Nullable Fluid b) { + return Objects.equals(a == null ? null : a.getName(), b == null ? null : b.getName()); + } + }); private FluidUnifier() {} /** * Register a material to associate with a fluid. Will overwrite existing associations. - * @param fluid the fluid + * + * @param fluid the fluid * @param material the material to associate */ @ApiStatus.Experimental diff --git a/src/main/java/gregtech/api/unification/OreDictUnifier.java b/src/main/java/gregtech/api/unification/OreDictUnifier.java index 1759c89c270..82a63335b70 100644 --- a/src/main/java/gregtech/api/unification/OreDictUnifier.java +++ b/src/main/java/gregtech/api/unification/OreDictUnifier.java @@ -1,7 +1,5 @@ package gregtech.api.unification; -import com.google.common.base.Joiner; -import com.google.common.collect.Sets; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; @@ -12,8 +10,7 @@ import gregtech.api.util.CustomModPriorityComparator; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; @@ -22,14 +19,20 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.AbstractMap.SimpleEntry; +import com.google.common.base.Joiner; +import com.google.common.collect.Sets; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; +import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.M; public class OreDictUnifier { @@ -49,7 +52,7 @@ public static Comparator getSimpleItemStackComparator() { if (stackComparator == null) { List modPriorities = Arrays.asList(ConfigHolder.compat.modPriorities); if (modPriorities.isEmpty()) { - //noinspection ConstantConditions + // noinspection ConstantConditions Function modIdExtractor = stack -> stack.item.getRegistryName().getNamespace(); stackComparator = Comparator.comparing(modIdExtractor); } else { @@ -96,7 +99,7 @@ public static void init() { @SubscribeEvent public static void onItemRegistration(OreRegisterEvent event) { String oreName = event.getName(); - //cache this registration by name + // cache this registration by name ItemVariantMap.Mutable> entry = stackOreDictName.computeIfAbsent(event.getOre().getItem(), item -> item.getHasSubtypes() ? new MultiItemVariantMap<>() : new SingleItemVariantMap<>()); Set set = entry.get(event.getOre()); @@ -105,15 +108,16 @@ public static void onItemRegistration(OreRegisterEvent event) { entry.put(event.getOre(), set); } set.add(oreName); - List itemStackListForOreDictName = oreDictNameStacks.computeIfAbsent(oreName, k -> new ArrayList<>()); + List itemStackListForOreDictName = oreDictNameStacks.computeIfAbsent(oreName, + k -> new ArrayList<>()); addAndSort(itemStackListForOreDictName, event.getOre().copy(), getItemStackComparator()); - //and try to transform registration name into OrePrefix + Material pair + // and try to transform registration name into OrePrefix + Material pair OrePrefix orePrefix = OrePrefix.getPrefix(oreName); Material material = null; if (orePrefix == null) { - //split ore dict name to parts - //oreBasalticMineralSand -> ore, Basaltic, Mineral, Sand + // split ore dict name to parts + // oreBasalticMineralSand -> ore, Basaltic, Mineral, Sand ArrayList splits = new ArrayList<>(); StringBuilder builder = new StringBuilder(); for (char character : oreName.toCharArray()) { @@ -128,17 +132,17 @@ public static void onItemRegistration(OreRegisterEvent event) { splits.add(builder.toString()); } for (MaterialRegistry registry : GregTechAPI.materialManager.getRegistries()) { - //try to combine in different manners - //oreBasaltic MineralSand , ore BasalticMineralSand + // try to combine in different manners + // oreBasaltic MineralSand , ore BasalticMineralSand StringBuilder buffer = new StringBuilder(); for (int i = 0; i < splits.size(); i++) { buffer.append(splits.get(i)); - OrePrefix maybePrefix = OrePrefix.getPrefix(buffer.toString()); //ore -> OrePrefix.ore - String possibleMaterialName = Joiner.on("").join(splits.subList(i + 1, splits.size())); //BasalticMineralSand - String underscoreName = GTUtility.toLowerCaseUnderscore(possibleMaterialName); //basaltic_mineral_sand - Material possibleMaterial = registry.getObject(underscoreName); //Materials.BasalticSand + OrePrefix maybePrefix = OrePrefix.getPrefix(buffer.toString()); // ore -> OrePrefix.ore + String possibleMaterialName = Joiner.on("").join(splits.subList(i + 1, splits.size())); // BasalticMineralSand + String underscoreName = GTUtility.toLowerCaseUnderscore(possibleMaterialName); // basaltic_mineral_sand + Material possibleMaterial = registry.getObject(underscoreName); // Materials.BasalticSand if (possibleMaterial == null) { - //if we didn't find real material, try using marker material registry + // if we didn't find real material, try using marker material registry possibleMaterial = GregTechAPI.markerMaterialRegistry.getMarkerMaterial(underscoreName); } if (maybePrefix != null && possibleMaterial != null) { @@ -151,11 +155,12 @@ public static void onItemRegistration(OreRegisterEvent event) { } } - //finally register item + // finally register item if (orePrefix != null && (material != null || orePrefix.isSelfReferencing)) { ItemAndMetadata key = new ItemAndMetadata(event.getOre()); UnificationEntry unificationEntry = new UnificationEntry(orePrefix, material); - ArrayList itemListForUnifiedEntry = stackUnificationItems.computeIfAbsent(unificationEntry, p -> new ArrayList<>()); + ArrayList itemListForUnifiedEntry = stackUnificationItems.computeIfAbsent(unificationEntry, + p -> new ArrayList<>()); addAndSort(itemListForUnifiedEntry, key, getSimpleItemStackComparator()); if (!unificationEntry.orePrefix.isMarkerPrefix()) { @@ -259,7 +264,8 @@ public static UnificationEntry getUnificationEntry(ItemStack itemStack) { public static ItemStack getUnificated(ItemStack itemStack) { if (itemStack.isEmpty()) return ItemStack.EMPTY; UnificationEntry unificationEntry = getUnificationEntry(itemStack); - if (unificationEntry == null || !stackUnificationItems.containsKey(unificationEntry) || !unificationEntry.orePrefix.isUnificationEnabled) + if (unificationEntry == null || !stackUnificationItems.containsKey(unificationEntry) || + !unificationEntry.orePrefix.isUnificationEnabled) return itemStack; ArrayList keys = stackUnificationItems.get(unificationEntry); return keys.size() > 0 ? keys.get(0).toItemStack(itemStack.getCount()) : itemStack; @@ -347,9 +353,8 @@ public static ItemStack getIngotOrDust(MaterialStack materialStack) { } public static ItemStack getGem(MaterialStack materialStack) { - if (materialStack.material.hasProperty(PropertyKey.GEM) - && !OrePrefix.gem.isIgnored(materialStack.material) - && materialStack.amount == OrePrefix.gem.getMaterialAmount(materialStack.material)) { + if (materialStack.material.hasProperty(PropertyKey.GEM) && !OrePrefix.gem.isIgnored(materialStack.material) && + materialStack.amount == OrePrefix.gem.getMaterialAmount(materialStack.material)) { return get(OrePrefix.gem, materialStack.material, (int) (materialStack.amount / M)); } return getDust(materialStack); diff --git a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java index f6ceebf45d8..aa5c8045a52 100644 --- a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java +++ b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.util.GTUtility; + import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -9,7 +10,8 @@ /** * MarkerMaterial is type of material used for generic things like material re-registration and use in recipes * Marker material cannot be used to generate any meta items - * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in recipes or in getting items + * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in + * recipes or in getting items * Marker material is not presented in material registry and cannot be used for persistence */ public final class MarkerMaterial extends Material { @@ -30,10 +32,8 @@ private MarkerMaterial(@Nonnull String name) { } @Override - protected void registerMaterial() { - } + protected void registerMaterial() {} @Override - public void verifyMaterial() { - } + public void verifyMaterial() {} } diff --git a/src/main/java/gregtech/api/unification/material/MarkerMaterials.java b/src/main/java/gregtech/api/unification/material/MarkerMaterials.java index bd5d4ee839e..566ad41f840 100644 --- a/src/main/java/gregtech/api/unification/material/MarkerMaterials.java +++ b/src/main/java/gregtech/api/unification/material/MarkerMaterials.java @@ -1,9 +1,11 @@ package gregtech.api.unification.material; -import com.google.common.collect.HashBiMap; import gregtech.api.GTValues; + import net.minecraft.item.EnumDyeColor; +import com.google.common.collect.HashBiMap; + public class MarkerMaterials { @SuppressWarnings("ResultOfMethodCallIgnored") @@ -51,7 +53,8 @@ public static class Color { * Arrays containing all possible color values (without Colorless!) */ public static final MarkerMaterial[] VALUES = { - White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black + White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, + Green, Red, Black }; /** @@ -77,13 +80,13 @@ public static MarkerMaterial valueOf(String string) { COLORS.put(color, Color.valueOf(color.getName())); } } - } /** * Circuitry, batteries and other technical things */ public static class Tier { + public static final Material ULV = MarkerMaterial.create(GTValues.VN[GTValues.ULV].toLowerCase()); public static final Material LV = MarkerMaterial.create(GTValues.VN[GTValues.LV].toLowerCase()); public static final Material MV = MarkerMaterial.create(GTValues.VN[GTValues.MV].toLowerCase()); @@ -103,11 +106,11 @@ public static class Tier { } public static class Component { + public static final Material Resistor = MarkerMaterial.create("resistor"); public static final Material Transistor = MarkerMaterial.create("transistor"); public static final Material Capacitor = MarkerMaterial.create("capacitor"); public static final Material Diode = MarkerMaterial.create("diode"); public static final Material Inductor = MarkerMaterial.create("inductor"); } - } diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index 56c6b9e1a54..3b02e0e3ddd 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -1,8 +1,5 @@ package gregtech.api.unification.material; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GregTechAPI; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; @@ -19,18 +16,24 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.LocalizationUtils; import gregtech.api.util.SmallDigits; + import net.minecraft.enchantment.Enchantment; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import crafttweaker.annotations.ZenRegister; import org.jetbrains.annotations.ApiStatus; import stanhebben.zenscript.annotations.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.function.UnaryOperator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.material.Material") @ZenRegister public class Material implements Comparable { @@ -111,7 +114,8 @@ public MaterialStack[] getMaterialComponentsCt() { return getMaterialComponents().toArray(new MaterialStack[0]); } - private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties properties, @Nonnull MaterialFlags flags) { + private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties properties, + @Nonnull MaterialFlags flags) { this.materialInfo = materialInfo; this.properties = properties; this.flags = flags; @@ -177,7 +181,7 @@ protected void calculateDecompositionType() { Material material = materialStack.material; onlyMetalMaterials &= material.hasProperty(PropertyKey.INGOT); } - //allow centrifuging of alloy materials only + // allow centrifuging of alloy materials only if (onlyMetalMaterials) { flags.addFlags(MaterialFlags.DECOMPOSITION_BY_CENTRIFUGING); } else { @@ -190,6 +194,7 @@ protected void calculateDecompositionType() { * Retrieves a fluid from the material. * Attempts to retrieve with {@link FluidProperty#getPrimaryKey()}, {@link FluidStorageKeys#LIQUID} and * {@link FluidStorageKeys#GAS}. + * * @return the fluid * @see #getFluid(FluidStorageKey) */ @@ -235,7 +240,7 @@ public FluidStack getFluid(int amount) { /** * - * @param key the key for the fluid + * @param key the key for the fluid * @param amount the amount the FluidStack should have * @return a FluidStack with the fluid and amount */ @@ -245,7 +250,8 @@ public FluidStack getFluid(@Nonnull FluidStorageKey key, int amount) { public int getBlockHarvestLevel() { if (!hasProperty(PropertyKey.DUST)) { - throw new IllegalArgumentException("Material " + getResourceLocation() + " does not have a harvest level! Is probably a Fluid"); + throw new IllegalArgumentException( + "Material " + getResourceLocation() + " does not have a harvest level! Is probably a Fluid"); } int harvestLevel = getProperty(PropertyKey.DUST).getHarvestLevel(); return harvestLevel > 0 ? harvestLevel - 1 : harvestLevel; @@ -253,7 +259,8 @@ public int getBlockHarvestLevel() { public int getToolHarvestLevel() { if (!hasProperty(PropertyKey.TOOL)) { - throw new IllegalArgumentException("Material " + getResourceLocation() + " does not have a tool harvest level! Is probably not a Tool Material"); + throw new IllegalArgumentException("Material " + getResourceLocation() + + " does not have a tool harvest level! Is probably not a Tool Material"); } return getProperty(PropertyKey.TOOL).getToolHarvestLevel(); } @@ -313,7 +320,6 @@ public long getNeutrons() { return totalNeutrons / totalAmount; } - @ZenGetter("mass") public long getMass() { if (materialInfo.element != null) @@ -338,7 +344,7 @@ public FluidStack getPlasma(int amount) { return getFluid(FluidStorageKeys.PLASMA, amount); } - //TODO clean up the name-related methods + // TODO clean up the name-related methods @ZenGetter("name") @Nonnull public String getName() { @@ -515,6 +521,7 @@ public Builder fluid(@Nonnull FluidStorageKey key, @Nonnull FluidBuilder builder /** * Add a liquid for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder liquid() { @@ -523,6 +530,7 @@ public Builder liquid() { /** * Add a liquid for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder liquid(@Nonnull FluidBuilder builder) { @@ -531,6 +539,7 @@ public Builder liquid(@Nonnull FluidBuilder builder) { /** * Add a plasma for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder plasma() { @@ -539,6 +548,7 @@ public Builder plasma() { /** * Add a plasma for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder plasma(@Nonnull FluidBuilder builder) { @@ -547,6 +557,7 @@ public Builder plasma(@Nonnull FluidBuilder builder) { /** * Add a gas for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder gas() { @@ -555,6 +566,7 @@ public Builder gas() { /** * Add a gas for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder gas(@Nonnull FluidBuilder builder) { @@ -652,7 +664,8 @@ public Builder ingot() { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @throws IllegalArgumentException If an {@link IngotProperty} has already been added to this Material. */ @@ -666,7 +679,8 @@ public Builder ingot(int harvestLevel) { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.
* If this Material already had a Burn Time defined, it will be overridden. @@ -794,9 +808,9 @@ public Builder colorAverage() { * Set the {@link MaterialIconSet} of this Material.
* Defaults vary depending on if the Material has a:
*

    - *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} - *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} - *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} + *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} + *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} + *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} *
* Default will be determined by first-found Property in this order, unless specified. * @@ -810,18 +824,16 @@ public Builder iconSet(MaterialIconSet iconSet) { public Builder components(Object... components) { Preconditions.checkArgument( components.length % 2 == 0, - "Material Components list malformed!" - ); + "Material Components list malformed!"); for (int i = 0; i < components.length; i += 2) { if (components[i] == null) { - throw new IllegalArgumentException("Material in Components List is null for Material " - + this.materialInfo.resourceLocation); + throw new IllegalArgumentException( + "Material in Components List is null for Material " + this.materialInfo.resourceLocation); } composition.add(new MaterialStack( (Material) components[i], - (Integer) components[i + 1] - )); + (Integer) components[i + 1])); } return this; } @@ -851,8 +863,10 @@ public Builder flags(MaterialFlag... flags) { * Dependent Flags (for example, {@link MaterialFlags#GENERATE_LONG_ROD} requiring * {@link MaterialFlags#GENERATE_ROD}) will be automatically applied. * - * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be applied. - * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use {@link Builder#flags(MaterialFlag...)}. + * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be + * applied. + * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use + * {@link Builder#flags(MaterialFlag...)}. */ public Builder flags(Collection f1, MaterialFlag... f2) { this.flags.addFlags(f1.toArray(new MaterialFlag[0])); @@ -906,12 +920,12 @@ public Builder blastTemp(int temp, BlastProperty.GasTier gasTier, int eutOverrid public Builder blastTemp(int temp, BlastProperty.GasTier gasTier, int eutOverride, int durationOverride) { return blast(b -> b.temp(temp, gasTier).blastStats(eutOverride, durationOverride)); } - + public Builder blast(int temp) { properties.setProperty(PropertyKey.BLAST, new BlastProperty(temp)); return this; } - + public Builder blast(int temp, BlastProperty.GasTier gasTier) { properties.setProperty(PropertyKey.BLAST, new BlastProperty(temp, gasTier)); return this; @@ -1006,8 +1020,10 @@ public Builder cableProperties(long voltage, int amperage, int loss, boolean isS return this; } - public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, int criticalTemperature) { - properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); + public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, + int criticalTemperature) { + properties.setProperty(PropertyKey.WIRE, + new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); return this; } @@ -1015,8 +1031,10 @@ public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof return fluidPipeProperties(maxTemp, throughput, gasProof, false, false, false); } - public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { - properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); + public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { + properties.setProperty(PropertyKey.FLUID_PIPE, + new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); return this; } @@ -1045,6 +1063,7 @@ public Material build() { * Holds the basic info for a Material, like the name, color, id, etc.. */ private static class MaterialInfo { + /** * The modid and unlocalized name of this Material. *

@@ -1093,24 +1112,26 @@ private MaterialInfo(int metaItemSubId, @Nonnull ResourceLocation resourceLocati this.metaItemSubId = metaItemSubId; String name = resourceLocation.getPath(); if (!GTUtility.toLowerCaseUnderscore(GTUtility.lowerUnderscoreToUpperCamel(name)).equals(name)) { - throw new IllegalArgumentException("Cannot add materials with names like 'materialnumber'! Use 'material_number' instead."); + throw new IllegalArgumentException( + "Cannot add materials with names like 'materialnumber'! Use 'material_number' instead."); } this.resourceLocation = resourceLocation; } private void verifyInfo(MaterialProperties p, boolean averageRGB) { - // Verify IconSet if (iconSet == null) { if (p.hasProperty(PropertyKey.GEM)) { iconSet = MaterialIconSet.GEM_VERTICAL; - } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || p.hasProperty(PropertyKey.POLYMER)) { - iconSet = MaterialIconSet.DULL; - } else if (p.hasProperty(PropertyKey.FLUID)) { - iconSet = MaterialIconSet.FLUID; - } else { - iconSet = MaterialIconSet.DULL; - } + } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || + p.hasProperty(PropertyKey.POLYMER)) { + iconSet = MaterialIconSet.DULL; + } else + if (p.hasProperty(PropertyKey.FLUID)) { + iconSet = MaterialIconSet.FLUID; + } else { + iconSet = MaterialIconSet.DULL; + } } // Verify MaterialRGB diff --git a/src/main/java/gregtech/api/unification/material/Materials.java b/src/main/java/gregtech/api/unification/material/Materials.java index 3a8767bb383..d2d65e81f72 100644 --- a/src/main/java/gregtech/api/unification/material/Materials.java +++ b/src/main/java/gregtech/api/unification/material/Materials.java @@ -17,14 +17,14 @@ * All Material Builders should follow this general formatting: *

* material = new MaterialBuilder(id, name) - * .ingot().fluid().ore() <--- types - * .color().iconSet() <--- appearance - * .flags() <--- special generation - * .element() / .components() <--- composition - * .toolStats() <--- - * .oreByProducts() | additional properties - * ... <--- - * .blastTemp() <--- blast temperature + * .ingot().fluid().ore() <--- types + * .color().iconSet() <--- appearance + * .flags() <--- special generation + * .element() / .components() <--- composition + * .toolStats() <--- + * .oreByProducts() | additional properties + * ... <--- + * .blastTemp() <--- blast temperature * .build(); *

* Use defaults to your advantage! Some defaults: @@ -99,7 +99,7 @@ public static void register() { * - Reserved for CraftTweaker: 32000-32767 */ - CHEMICAL_DYES = new Material[]{ + CHEMICAL_DYES = new Material[] { Materials.DyeWhite, Materials.DyeOrange, Materials.DyeMagenta, Materials.DyeLightBlue, Materials.DyeYellow, Materials.DyeLime, @@ -340,7 +340,6 @@ public static void register() { public static Material Tantalite; public static Material Coke; - public static Material SolderingAlloy; public static Material Spessartine; public static Material Sphalerite; diff --git a/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java b/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java index 8bef5861255..71476090916 100644 --- a/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/MaterialEvent.java @@ -1,6 +1,7 @@ package gregtech.api.unification.material.event; import gregtech.api.unification.material.Material; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java b/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java index 3aee4e72004..1989347a1b3 100644 --- a/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/MaterialRegistryEvent.java @@ -1,7 +1,8 @@ package gregtech.api.unification.material.event; -import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.material.registry.IMaterialRegistryManager; +import gregtech.api.unification.material.registry.MaterialRegistry; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java b/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java index 82172d8ae6a..23a501a69ab 100644 --- a/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java +++ b/src/main/java/gregtech/api/unification/material/event/PostMaterialEvent.java @@ -1,6 +1,7 @@ package gregtech.api.unification.material.event; import gregtech.api.unification.material.Material; + import net.minecraftforge.fml.common.eventhandler.GenericEvent; /** diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java b/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java index 098fbe0b8e0..dffbd6d29b9 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialFlag.java @@ -3,6 +3,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTLog; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.Arrays; @@ -30,7 +31,8 @@ private MaterialFlag(String name, Set requiredFlags, Set verifyFlag(Material material) { requiredProperties.forEach(key -> { if (!material.hasProperty(key)) { - GTLog.logger.warn("Material {} does not have required property {} for flag {}!", material.getUnlocalizedName(), key.toString(), this.name); + GTLog.logger.warn("Material {} does not have required property {} for flag {}!", + material.getUnlocalizedName(), key.toString(), this.name); } }); diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java index cf6bdf14075..2bed36b06a4 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialFlags.java @@ -37,7 +37,7 @@ public String toString() { } ///////////////// - // GENERIC // + // GENERIC // ///////////////// /** @@ -48,12 +48,14 @@ public String toString() { /** * Enables electrolyzer decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder("decomposition_by_electrolyzing").build(); + public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder( + "decomposition_by_electrolyzing").build(); /** * Enables centrifuge decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder("decomposition_by_centrifuging").build(); + public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder( + "decomposition_by_centrifuging").build(); /** * Disables decomposition recipe generation for this material @@ -81,7 +83,7 @@ public String toString() { public static final MaterialFlag GLOWING = new MaterialFlag.Builder("glowing").build(); ////////////////// - // DUST // + // DUST // ////////////////// /** @@ -136,28 +138,32 @@ public String toString() { * This will prevent material from creating Shapeless recipes for dust to block and vice versa * Also preventing extruding and alloy smelting recipes via SHAPE_EXTRUDING/MOLD_BLOCK */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_recipes") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_recipes") + .requireProps(PropertyKey.DUST) + .build(); - public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder("exclude_plate_compressor_recipe") - .requireFlags(GENERATE_PLATE) - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder( + "exclude_plate_compressor_recipe") + .requireFlags(GENERATE_PLATE) + .requireProps(PropertyKey.DUST) + .build(); /** * This will prevent material from creating Shapeless recipes for dust to block and vice versa */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_by_hand_recipes") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_by_hand_recipes") + .requireProps(PropertyKey.DUST) + .build(); public static final MaterialFlag MORTAR_GRINDABLE = new MaterialFlag.Builder("mortar_grindable") .requireProps(PropertyKey.DUST) .build(); /** - * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated Materials. + * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated + * Materials. */ public static final MaterialFlag NO_WORKING = new MaterialFlag.Builder("no_working") .requireProps(PropertyKey.DUST) @@ -178,19 +184,22 @@ public String toString() { .build(); /** - * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already listed are: + * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already + * listed are: * Iron, Pyrite, PigIron, WroughtIron. */ - public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder("blast_furnace_calcite_double") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder( + "blast_furnace_calcite_double") + .requireProps(PropertyKey.DUST) + .build(); - public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder("blast_furnace_calcite_triple") - .requireProps(PropertyKey.DUST) - .build(); + public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder( + "blast_furnace_calcite_triple") + .requireProps(PropertyKey.DUST) + .build(); ///////////////// - // FLUID // + // FLUID // ///////////////// public static final MaterialFlag SOLDER_MATERIAL = new MaterialFlag.Builder("solder_material") @@ -206,7 +215,7 @@ public String toString() { .build(); ///////////////// - // INGOT // + // INGOT // ///////////////// public static final MaterialFlag GENERATE_FOIL = new MaterialFlag.Builder("generate_foil") @@ -256,7 +265,7 @@ public String toString() { .build(); ///////////////// - // GEM // + // GEM // ///////////////// /** @@ -272,7 +281,7 @@ public String toString() { .build(); ///////////////// - // ORE // + // ORE // ///////////////// public static final MaterialFlag HIGH_SIFTER_OUTPUT = new MaterialFlag.Builder("high_sifter_output") diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java index feb46381865..7f9626e7c12 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java @@ -6,12 +6,13 @@ import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.material.MaterialIconSet") @ZenRegister public class MaterialIconSet { @@ -77,13 +78,15 @@ public MaterialIconSet(@Nonnull String name, @Nonnull MaterialIconSet parentIcon /** * Create a new MaterialIconSet which is a root + * * @param name the name of the iconset * @param parentIconset the parent iconset, should be null if this should be a root iconset * @param isRootIconset true if this should be a root iconset, otherwise false */ public MaterialIconSet(@Nonnull String name, @Nullable MaterialIconSet parentIconset, boolean isRootIconset) { this.name = name.toLowerCase(Locale.ENGLISH); - Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), "MaterialIconSet " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), + "MaterialIconSet " + this.name + " already registered!"); this.id = idCounter++; this.isRootIconset = isRootIconset; this.parentIconset = parentIconset; diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java index a825319df7c..8f749b587cc 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java @@ -1,18 +1,21 @@ package gregtech.api.unification.material.info; -import com.google.common.base.CaseFormat; -import com.google.common.base.Preconditions; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import gregtech.api.gui.resources.ResourceHelper; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; -import javax.annotation.Nonnull; +import com.google.common.base.CaseFormat; +import com.google.common.base.Preconditions; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; + import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + public class MaterialIconType { public static final Map ICON_TYPES = new HashMap<>(); @@ -99,9 +102,12 @@ public class MaterialIconType { public static final MaterialIconType crop = new MaterialIconType("crop"); public static final MaterialIconType essence = new MaterialIconType("essence"); - private static final Table ITEM_MODEL_CACHE = HashBasedTable.create(); - private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable.create(); - private static final Table BLOCK_MODEL_CACHE = HashBasedTable.create(); + private static final Table ITEM_MODEL_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_MODEL_CACHE = HashBasedTable + .create(); private static final String BLOCK_TEXTURE_PATH_FULL = "textures/blocks/material_sets/%s/%s.png"; private static final String BLOCK_TEXTURE_PATH = "blocks/material_sets/%s/%s"; @@ -117,7 +123,8 @@ public class MaterialIconType { public MaterialIconType(String name) { this.name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name); - Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), "MaterialIconType " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), + "MaterialIconType " + this.name + " already registered!"); this.id = idCounter++; ICON_TYPES.put(this.name, this); } diff --git a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java index 79d24e8d3a1..f199f2c5a3d 100644 --- a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java @@ -297,7 +297,8 @@ public static void register() { .ore() .color(0xFFE650).iconSet(SHINY) .flags(EXT2_METAL, GENERATE_RING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, - GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL, GENERATE_DOUBLE_PLATE) + GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL, + GENERATE_DOUBLE_PLATE) .element(Elements.Au) .cableProperties(V[HV], 3, 2) .fluidPipeProperties(1671, 25, true, true, false, false) @@ -377,7 +378,9 @@ public static void register() { .plasma() .ore() .color(0xC8C8C8).iconSet(METALLIC) - .flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, BLAST_FURNACE_CALCITE_TRIPLE) + .flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, + GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + BLAST_FURNACE_CALCITE_TRIPLE) .element(Elements.Fe) .toolStats(ToolProperty.Builder.of(2.0F, 2.0F, 256, 2) .enchantability(14).build()) @@ -820,10 +823,12 @@ public static void register() { .itemPipeProperties(4096, 0.5f) .build(); - Titanium = new Material.Builder(113, gregtechId("titanium")) // todo Ore? Look at EBF recipe here if we do Ti ores + Titanium = new Material.Builder(113, gregtechId("titanium")) // todo Ore? Look at EBF recipe here if we do Ti + // ores .ingot(3).fluid() .color(0xDCA0F0).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_DOUBLE_PLATE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, GENERATE_FRAME) + .flags(EXT2_METAL, GENERATE_DOUBLE_PLATE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, + GENERATE_FRAME) .element(Elements.Ti) .toolStats(ToolProperty.Builder.of(8.0F, 6.0F, 1536, 3) .enchantability(14).build()) @@ -846,7 +851,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().temperature(3695)) .color(0x323232).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_DOUBLE_PLATE) + .flags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, + GENERATE_DOUBLE_PLATE) .element(Elements.W) .rotorStats(7.0f, 3.0f, 2560) .cableProperties(V[IV], 2, 2) @@ -916,7 +922,8 @@ public static void register() { .liquid(new FluidBuilder().customStill()) .ore() .color(0x323232).iconSet(METALLIC) - .flags(EXT_METAL, GENERATE_FOIL, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW, GENERATE_DOUBLE_PLATE) + .flags(EXT_METAL, GENERATE_FOIL, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW, + GENERATE_DOUBLE_PLATE) .element(Elements.Nq) .rotorStats(6.0f, 4.0f, 1280) .cableProperties(V[ZPM], 2, 2) @@ -943,7 +950,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().customStill()) .color(0x1E1E1E).iconSet(SHINY) - .flags(EXT_METAL, GENERATE_DOUBLE_PLATE, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW) + .flags(EXT_METAL, GENERATE_DOUBLE_PLATE, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FINE_WIRE, + GENERATE_BOLT_SCREW) .element(Elements.Nq2) .blast(b -> b .temp(9000, GasTier.HIGH) @@ -955,7 +963,8 @@ public static void register() { .ingot(6) .liquid(new FluidBuilder().temperature(100_000)) .color(0xFAFAFA) - .flags(EXT_METAL, GENERATE_BOLT_SCREW, GENERATE_FRAME, GENERATE_GEAR, GENERATE_LONG_ROD, GENERATE_DOUBLE_PLATE) + .flags(EXT_METAL, GENERATE_BOLT_SCREW, GENERATE_FRAME, GENERATE_GEAR, GENERATE_LONG_ROD, + GENERATE_DOUBLE_PLATE) .element(Elements.Nt) .toolStats(ToolProperty.Builder.of(180.0F, 100.0F, 65535, 6) .attackSpeed(0.5F).enchantability(33).magnetic().unbreakable().build()) @@ -967,7 +976,8 @@ public static void register() { .ingot(6) .liquid(new FluidBuilder().temperature(25_000)) .color(0x600000).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, GENERATE_FOIL, + GENERATE_FINE_WIRE, GENERATE_GEAR) .element(Elements.Tr) .cableProperties(V[UV], 1, 8) .rotorStats(20.0f, 6.0f, 10240) @@ -995,6 +1005,5 @@ public static void register() { .blastStats(VA[LuV], 1500) .vacuumStats(VA[IV], 300)) .build(); - } } diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index d9df7df44fc..61aec7180c3 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -7,6 +7,7 @@ import gregtech.api.unification.material.properties.BlastProperty.GasTier; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.ToolProperty; + import net.minecraft.init.Enchantments; import static gregtech.api.GTValues.*; @@ -136,7 +137,7 @@ public static void register() { .build(); Charcoal = new Material.Builder(266, gregtechId("charcoal")) - .gem(1, 1600) //default charcoal burn time in vanilla + .gem(1, 1600) // default charcoal burn time in vanilla .color(0x644646).iconSet(FINE) .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE) .components(Carbon, 1) @@ -165,9 +166,10 @@ public static void register() { // FREE ID 270 Coal = new Material.Builder(271, gregtechId("coal")) - .gem(1, 1600).ore(2, 1) //default coal burn time in vanilla + .gem(1, 1600).ore(2, 1) // default coal burn time in vanilla .color(0x464646).iconSet(LIGNITE) - .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Carbon, 1) .build(); @@ -223,7 +225,8 @@ public static void register() { Emerald = new Material.Builder(278, gregtechId("emerald")) .gem().ore(2, 1) .color(0x50FF50).iconSet(EMERALD) - .flags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_LENS) + .flags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + GENERATE_LENS) .components(Beryllium, 3, Aluminium, 2, Silicon, 6, Oxygen, 18) .build(); @@ -310,7 +313,8 @@ public static void register() { Lazurite = new Material.Builder(289, gregtechId("lazurite")) .gem(1).ore(6, 4) .color(0x6478FF).iconSet(LAPIS) - .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 6, Silicon, 6, Calcium, 8, Sodium, 8) .build(); @@ -537,7 +541,8 @@ public static void register() { Sodalite = new Material.Builder(316, gregtechId("sodalite")) .gem(1).ore(6, 4) .color(0x1414FF).iconSet(LAPIS) - .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 3, Silicon, 3, Sodium, 4, Chlorine, 1) .build(); @@ -720,7 +725,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(1799)) .color(0x504046).iconSet(METALLIC) - .flags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_BOLT_SCREW) + .flags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, + GENERATE_BOLT_SCREW) .components(Yttrium, 1, Barium, 2, Copper, 3, Oxygen, 7) .cableProperties(V[UV], 4, 4) .blast(b -> b @@ -732,7 +738,8 @@ public static void register() { NetherQuartz = new Material.Builder(339, gregtechId("nether_quartz")) .gem(1).ore(2, 1) .color(0xE6D2D2).iconSet(QUARTZ) - .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Silicon, 1, Oxygen, 2) .build(); @@ -1385,31 +1392,33 @@ public static void register() { .build() .setFormula("URhNq2", true); - EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder(431, gregtechId("enriched_naquadah_trinium_europium_duranide")) - .ingot() - .liquid(new FluidBuilder().temperature(5930)) - .color(0x7D9673).iconSet(METALLIC) - .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) - .components(NaquadahEnriched, 4, Trinium, 3, Europium, 2, Duranium, 1) - .cableProperties(GTValues.V[GTValues.UV], 16, 0, true, 3) - .blast(b -> b - .temp(9900, GasTier.HIGH) - .blastStats(VA[LuV], 1200) - .vacuumStats(VA[UV], 200)) - .build(); - - RutheniumTriniumAmericiumNeutronate = new Material.Builder(432, gregtechId("ruthenium_trinium_americium_neutronate")) - .ingot() - .liquid(new FluidBuilder().temperature(23691)) - .color(0xFFFFFF).iconSet(BRIGHT) - .flags(DECOMPOSITION_BY_ELECTROLYZING) - .components(Ruthenium, 1, Trinium, 2, Americium, 1, Neutronium, 2, Oxygen, 8) - .cableProperties(GTValues.V[GTValues.UHV], 24, 0, true, 3) - .blast(b -> b - .temp(10800, GasTier.HIGHER) - .blastStats(VA[ZPM], 1000) - .vacuumStats(VA[UHV], 200)) - .build(); + EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder(431, + gregtechId("enriched_naquadah_trinium_europium_duranide")) + .ingot() + .liquid(new FluidBuilder().temperature(5930)) + .color(0x7D9673).iconSet(METALLIC) + .flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE) + .components(NaquadahEnriched, 4, Trinium, 3, Europium, 2, Duranium, 1) + .cableProperties(GTValues.V[GTValues.UV], 16, 0, true, 3) + .blast(b -> b + .temp(9900, GasTier.HIGH) + .blastStats(VA[LuV], 1200) + .vacuumStats(VA[UV], 200)) + .build(); + + RutheniumTriniumAmericiumNeutronate = new Material.Builder(432, + gregtechId("ruthenium_trinium_americium_neutronate")) + .ingot() + .liquid(new FluidBuilder().temperature(23691)) + .color(0xFFFFFF).iconSet(BRIGHT) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Ruthenium, 1, Trinium, 2, Americium, 1, Neutronium, 2, Oxygen, 8) + .cableProperties(GTValues.V[GTValues.UHV], 24, 0, true, 3) + .blast(b -> b + .temp(10800, GasTier.HIGHER) + .blastStats(VA[ZPM], 1000) + .vacuumStats(VA[UHV], 200)) + .build(); InertMetalMixture = new Material.Builder(433, gregtechId("inert_metal_mixture")) .dust() diff --git a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java index c3d3fb064d7..eae825e44d3 100644 --- a/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/HigherDegreeMaterials.java @@ -15,7 +15,6 @@ public class HigherDegreeMaterials { public static void register() { - Electrotine = new Material.Builder(2507, gregtechId("electrotine")) .dust().ore(5, 1, true) .color(0x3CB4C8).iconSet(SHINY) @@ -86,7 +85,8 @@ public static void register() { HSSG = new Material.Builder(2516, gregtechId("hssg")) .ingot(3).fluid() .color(0x999900).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_FOIL, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, + GENERATE_FOIL, GENERATE_GEAR) .components(TungstenSteel, 5, Chrome, 1, Molybdenum, 2, Vanadium, 1) .rotorStats(10.0f, 5.5f, 4000) .cableProperties(V[LuV], 4, 2) @@ -129,7 +129,8 @@ public static void register() { HSSS = new Material.Builder(2520, gregtechId("hsss")) .ingot(4).fluid() .color(0x660033).iconSet(METALLIC) - .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_GEAR) + .flags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, GENERATE_ROUND, + GENERATE_FOIL, GENERATE_GEAR) .components(HSSG, 6, Iridium, 2, Osmium, 1) .rotorStats(15.0f, 7.0f, 3000) .blast(b -> b diff --git a/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java b/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java index 138d27bbc1d..8dbb3b48c6d 100644 --- a/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java +++ b/src/main/java/gregtech/api/unification/material/materials/MaterialFlagAddition.java @@ -40,12 +40,12 @@ public static void register() { oreProp = Molybdenum.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Molybdenum); - //oreProp = Magnesium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Olivine); + // oreProp = Magnesium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Olivine); - //oreProp = Manganese.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Chrome, Iron); - //oreProp.setSeparatedInto(Iron); + // oreProp = Manganese.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Chrome, Iron); + // oreProp.setSeparatedInto(Iron); oreProp = Neodymium.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(RareEarth); @@ -62,8 +62,8 @@ public static void register() { oreProp = Plutonium239.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Uraninite, Lead, Uraninite); - //oreProp = Silicon.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(SiliconDioxide); + // oreProp = Silicon.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(SiliconDioxide); oreProp = Silver.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Lead, Sulfur, Sulfur, Gold); @@ -80,11 +80,11 @@ public static void register() { oreProp.setSeparatedInto(Iron); oreProp.setWashedIn(SodiumPersulfate); - //oreProp = Titanium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Almandine); + // oreProp = Titanium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Almandine); - //oreProp = Tungsten.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Manganese, Molybdenum); + // oreProp = Tungsten.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Manganese, Molybdenum); oreProp = Naquadah.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Sulfur, Barite, NaquadahEnriched); diff --git a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java index 0c36894670f..729df027e64 100644 --- a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java @@ -10,6 +10,7 @@ import static gregtech.api.util.GTUtility.gregtechId; public class OrganicChemistryMaterials { + /** * ID RANGE: 1000-1068 (incl.) */ @@ -109,7 +110,7 @@ public static void register() { .build() .setFormula("Si(CH3)2O", true); - Polyethylene = new Material.Builder(1012, gregtechId("plastic")) //todo add polyethylene oredicts + Polyethylene = new Material.Builder(1012, gregtechId("plastic")) // todo add polyethylene oredicts .polymer(1) .liquid(new FluidBuilder().temperature(408)) .color(0xC8C8C8) diff --git a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java index 1fa0d004596..cd24317b9bf 100644 --- a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java @@ -1,12 +1,12 @@ package gregtech.api.unification.material.materials; -import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.attribute.FluidAttributes; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.BlastProperty.GasTier; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.ToolProperty; + import net.minecraft.init.Enchantments; import static gregtech.api.GTValues.*; @@ -18,7 +18,6 @@ public class SecondDegreeMaterials { public static void register() { - Glass = new Material.Builder(2000, gregtechId("glass")) .gem(0) .liquid(new FluidBuilder().temperature(1200).customStill()) @@ -70,7 +69,8 @@ public static void register() { Lapis = new Material.Builder(2007, gregtechId("lapis")) .gem(1).ore(6, 4) .color(0x4646DC).iconSet(LAPIS) - .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, + EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_PLATE, GENERATE_ROD) .components(Lazurite, 12, Sodalite, 2, Pyrite, 1, Calcite, 1) .build(); @@ -79,7 +79,7 @@ public static void register() { .dust(1) .liquid(new FluidBuilder().temperature(4000).customStill()) .color(0xFFC800).iconSet(FINE) - .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) //todo burning flag + .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) // todo burning flag .components(DarkAsh, 1, Sulfur, 1) .build(); @@ -415,7 +415,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(58)) .color(0x4C3434) .flags(DISABLE_DECOMPOSITION) - .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, 1, Ash, 1) + .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, + 1, Ash, 1) .build(); EnderAir = new Material.Builder(2054, gregtechId("ender_air")) @@ -429,7 +430,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(36)) .color(0x283454) .flags(DISABLE_DECOMPOSITION) - .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, 1, EnderPearl, 1) + .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, + 1, EnderPearl, 1) .build(); AquaRegia = new Material.Builder(2056, gregtechId("aqua_regia")) diff --git a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java index 009dafa37e4..f26fc316290 100644 --- a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java @@ -12,7 +12,6 @@ public class UnknownCompositionMaterials { public static void register() { - WoodGas = new Material.Builder(1500, gregtechId("wood_gas")) .gas().color(0xDECD87).build(); @@ -328,7 +327,7 @@ public static void register() { .flags(FLAMMABLE) .build(); - //Free IDs 1560-1575 + // Free IDs 1560-1575 LPG = new Material.Builder(1576, gregtechId("lpg")) .liquid(new FluidBuilder().customStill()) @@ -513,7 +512,8 @@ public static void register() { Wood = new Material.Builder(1617, gregtechId("wood")) .wood() .color(0x896727).iconSet(WOOD) - .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, GENERATE_GEAR, GENERATE_FRAME) + .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, GENERATE_GEAR, + GENERATE_FRAME) .fluidPipeProperties(340, 5, false) .build(); diff --git a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java index 188357b0939..74d0834eb27 100644 --- a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java @@ -60,7 +60,8 @@ public BlastProperty(int blastTemperature, GasTier gasTier) { this.gasTier = gasTier; } - private BlastProperty(int blastTemperature, GasTier gasTier, int eutOverride, int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { + private BlastProperty(int blastTemperature, GasTier gasTier, int eutOverride, int durationOverride, + int vacuumEUtOverride, int vacuumDurationOverride) { this.blastTemperature = blastTemperature; this.gasTier = gasTier; this.eutOverride = eutOverride; @@ -140,16 +141,21 @@ public static GasTier validateGasTier(String gasTierName) { else { String message = "Gas Tier must be either \"LOW\", \"MID\", \"HIGH\", \"HIGHER\", or \"HIGHEST\""; CraftTweakerAPI.logError(message); - throw new IllegalArgumentException("Could not find valid gas tier for name: " + gasTierName + ". " + message); + throw new IllegalArgumentException( + "Could not find valid gas tier for name: " + gasTierName + ". " + message); } } public enum GasTier { + // Tiers used by GTCEu - LOW, MID, HIGH, + LOW, + MID, + HIGH, // Tiers reserved for addons - HIGHER, HIGHEST; + HIGHER, + HIGHEST; public static final GasTier[] VALUES = values(); } @@ -199,7 +205,8 @@ public Builder vacuumStats(int eutOverride, int durationOverride) { } public BlastProperty build() { - return new BlastProperty(temp, gasTier, eutOverride, durationOverride, vacuumEUtOverride, vacuumDurationOverride); + return new BlastProperty(temp, gasTier, eutOverride, durationOverride, vacuumEUtOverride, + vacuumDurationOverride); } } } diff --git a/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java b/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java index d5abed168ba..5bd1ce7e1ec 100644 --- a/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/FluidPipeProperties.java @@ -4,6 +4,7 @@ import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.attribute.FluidAttributes; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import org.jetbrains.annotations.NotNull; @@ -24,14 +25,17 @@ public class FluidPipeProperties implements IMaterialProperty, IPropertyFluidFil private boolean cryoProof; private boolean plasmaProof; - public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { this(maxFluidTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, 1); } /** - * Should only be called from {@link gregtech.common.pipelike.fluidpipe.FluidPipeType#modifyProperties(FluidPipeProperties)} + * Should only be called from + * {@link gregtech.common.pipelike.fluidpipe.FluidPipeType#modifyProperties(FluidPipeProperties)} */ - public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof, int tanks) { + public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof, int tanks) { this.maxFluidTemperature = maxFluidTemperature; this.throughput = throughput; this.gasProof = gasProof; @@ -149,7 +153,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(getThroughput(), getTanks(), getMaxFluidTemperature(), gasProof, cryoProof, plasmaProof, containmentPredicate); + return Objects.hash(getThroughput(), getTanks(), getMaxFluidTemperature(), gasProof, cryoProof, plasmaProof, + containmentPredicate); } @Override diff --git a/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java b/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java index c8000bd0fac..48f92084252 100644 --- a/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/FluidProperty.java @@ -2,6 +2,7 @@ import gregtech.api.fluids.store.FluidStorage; import gregtech.api.fluids.store.FluidStorageKey; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java b/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java index 66f16401195..b3ea19b4c8b 100644 --- a/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/MaterialProperties.java @@ -10,8 +10,7 @@ public class MaterialProperties { private static final Set> baseTypes = new HashSet<>(Arrays.asList( PropertyKey.FLUID, PropertyKey.DUST, - PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY - )); + PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY)); @SuppressWarnings("unused") public static void addBaseType(PropertyKey baseTypeKey) { @@ -70,7 +69,8 @@ public void verify() { GTLog.logger.debug("Creating empty placeholder Material {}", material); } propertyMap.put(PropertyKey.EMPTY, PropertyKey.EMPTY.constructDefault()); - } else throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); + } else + throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); } } diff --git a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java index 2d064d0d47a..d48d3fd78f5 100644 --- a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java @@ -1,16 +1,19 @@ package gregtech.api.unification.material.properties; import gregtech.api.unification.material.Material; + import net.minecraft.util.math.MathHelper; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class OreProperty implements IMaterialProperty { /** @@ -18,7 +21,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: none, meaning only this property's Material. */ - //@ZenProperty + // @ZenProperty private final List oreByProducts = new ArrayList<>(); /** @@ -26,7 +29,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - //@ZenProperty + // @ZenProperty private int oreMultiplier; /** @@ -34,7 +37,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - //@ZenProperty + // @ZenProperty private int byProductMultiplier; /** @@ -42,7 +45,7 @@ public class OreProperty implements IMaterialProperty { *

* Default: false. */ - //@ZenProperty + // @ZenProperty private boolean emissive; /** @@ -51,7 +54,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Dust Property. * Default: none. */ - //@ZenProperty + // @ZenProperty @Nullable private Material directSmeltResult; @@ -61,7 +64,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Fluid Property. * Default: none. */ - //@ZenProperty + // @ZenProperty @Nullable private Material washedIn; @@ -81,7 +84,7 @@ public class OreProperty implements IMaterialProperty { * Material will have a Dust Property. * Default: none. */ - //@ZenProperty + // @ZenProperty private final List separatedInto = new ArrayList<>(); public OreProperty(int oreMultiplier, int byProductMultiplier) { diff --git a/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java b/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java index 1ec5d57e886..c2878b6e3f9 100644 --- a/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/PolymerProperty.java @@ -6,11 +6,10 @@ public class PolymerProperty implements IMaterialProperty { @Override public void verifyProperty(MaterialProperties properties) { - properties.ensureSet(PropertyKey.DUST, true); properties.ensureSet(PropertyKey.INGOT, true); - properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, MaterialFlags.DISABLE_DECOMPOSITION); - + properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, + MaterialFlags.DISABLE_DECOMPOSITION); } } diff --git a/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java b/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java index 2f60e41bcfb..5dc2234a40e 100644 --- a/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java +++ b/src/main/java/gregtech/api/unification/material/properties/PropertyKey.java @@ -4,12 +4,14 @@ public class PropertyKey { public static final PropertyKey BLAST = new PropertyKey<>("blast", BlastProperty.class); public static final PropertyKey DUST = new PropertyKey<>("dust", DustProperty.class); - public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", FluidPipeProperties.class); + public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", + FluidPipeProperties.class); public static final PropertyKey FLUID = new PropertyKey<>("fluid", FluidProperty.class); public static final PropertyKey GEM = new PropertyKey<>("gem", GemProperty.class); public static final PropertyKey INGOT = new PropertyKey<>("ingot", IngotProperty.class); public static final PropertyKey POLYMER = new PropertyKey<>("polymer", PolymerProperty.class); - public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", ItemPipeProperties.class); + public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", + ItemPipeProperties.class); public static final PropertyKey ORE = new PropertyKey<>("ore", OreProperty.class); public static final PropertyKey TOOL = new PropertyKey<>("tool", ToolProperty.class); public static final PropertyKey ROTOR = new PropertyKey<>("rotor", RotorProperty.class); diff --git a/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java b/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java index aa29410aa75..99264c592e4 100644 --- a/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/ToolProperty.java @@ -1,9 +1,11 @@ package gregtech.api.unification.material.properties; import gregtech.api.items.toolitem.EnchantmentLevel; + +import net.minecraft.enchantment.Enchantment; + import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import net.minecraft.enchantment.Enchantment; public class ToolProperty implements IMaterialProperty { diff --git a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java index e93e0a32e76..7335be2e0c7 100644 --- a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java @@ -23,7 +23,8 @@ public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean i this(voltage, baseAmperage, lossPerBlock, isSuperCon, 0); } - public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, int criticalTemperature) { + public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, + int criticalTemperature) { this.voltage = voltage; this.amperage = baseAmperage; this.lossPerBlock = isSuperCon ? 0 : lossPerBlock; @@ -111,11 +112,12 @@ public void setSuperconductor(boolean isSuperconductor) { } /** - * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase transition happens) + * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase + * transition happens) * * @return Critical temperature of the material */ - public int getSuperconductorCriticalTemperature(){ + public int getSuperconductorCriticalTemperature() { return superconductorCriticalTemperature; } @@ -124,7 +126,7 @@ public int getSuperconductorCriticalTemperature(){ * * @param criticalTemperature The new critical temperature */ - public void setSuperconductorCriticalTemperature(int criticalTemperature){ + public void setSuperconductorCriticalTemperature(int criticalTemperature) { this.superconductorCriticalTemperature = this.isSuperconductor ? criticalTemperature : 0; } diff --git a/src/main/java/gregtech/api/unification/material/properties/package-info.java b/src/main/java/gregtech/api/unification/material/properties/package-info.java index c3d9b752f5b..038d52336be 100644 --- a/src/main/java/gregtech/api/unification/material/properties/package-info.java +++ b/src/main/java/gregtech/api/unification/material/properties/package-info.java @@ -1,9 +1,12 @@ /** * Material Properties are a replacement for the old nested hierarchy of Material Types - * (IngotMaterial, DustMaterial, etc.).

+ * (IngotMaterial, DustMaterial, etc.).
+ *
*

* To create your own Material Property, it should follow this general structure: - *

{@code
+ * 
+ * 
+ * {@code
  *     public class MyProperty extends IMaterialProperty {
  *
  *         ... private, non-final fields ...
@@ -38,10 +41,16 @@
  *             // Like above, ensure you call "ensureSet(Key, true)" to re-verify.
  *         }
  *     }
- * }


+ * } + *
+ * + *
+ *
*

* You must also create a new {@link gregtech.api.unification.material.properties.PropertyKey} Object, like: - *

{@code
+ * 
+ * 
+ * {@code
  *     public static final PropertyKey MY_PROPERTY = new PropertyKey<>("my_property", MyProperty.class);
  * }
  *
diff --git a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
index 6b9e6e1fe8d..9ca2c54314b 100644
--- a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
+++ b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java
@@ -3,9 +3,10 @@
 import gregtech.api.GTValues;
 import gregtech.api.unification.material.Material;
 
-import javax.annotation.Nonnull;
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 public interface IMaterialRegistryManager {
 
     /**
diff --git a/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java b/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
index 77bdd9f9949..25b58fe74b5 100644
--- a/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
+++ b/src/main/java/gregtech/api/unification/material/registry/MarkerMaterialRegistry.java
@@ -1,6 +1,7 @@
 package gregtech.api.unification.material.registry;
 
 import gregtech.api.unification.material.MarkerMaterial;
+
 import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
index 988f892d61a..9f441dabea6 100644
--- a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
+++ b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java
@@ -3,9 +3,10 @@
 import gregtech.api.unification.material.Material;
 import gregtech.api.util.GTControlledRegistry;
 
-import javax.annotation.Nonnull;
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 public abstract class MaterialRegistry extends GTControlledRegistry {
 
     public MaterialRegistry() {
diff --git a/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java b/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
index 4479d5d3715..be4acc37f92 100644
--- a/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
+++ b/src/main/java/gregtech/api/unification/ore/IOreRegistrationHandler.java
@@ -6,5 +6,4 @@
 public interface IOreRegistrationHandler {
 
     void processMaterial(OrePrefix orePrefix, Material material);
-
 }
diff --git a/src/main/java/gregtech/api/unification/ore/OrePrefix.java b/src/main/java/gregtech/api/unification/ore/OrePrefix.java
index 345e8c9be78..64eb11cd7fa 100644
--- a/src/main/java/gregtech/api/unification/ore/OrePrefix.java
+++ b/src/main/java/gregtech/api/unification/ore/OrePrefix.java
@@ -1,7 +1,5 @@
 package gregtech.api.unification.ore;
 
-import com.google.common.base.Preconditions;
-import crafttweaker.annotations.ZenRegister;
 import gregtech.api.unification.material.MarkerMaterials;
 import gregtech.api.unification.material.Material;
 import gregtech.api.unification.material.Materials;
@@ -12,9 +10,13 @@
 import gregtech.api.util.LocalizationUtils;
 import gregtech.api.util.function.TriConsumer;
 import gregtech.common.ConfigHolder;
+
+import net.minecraft.client.resources.I18n;
+
+import com.google.common.base.Preconditions;
+import crafttweaker.annotations.ZenRegister;
 import it.unimi.dsi.fastutil.objects.Object2FloatMap;
 import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
-import net.minecraft.client.resources.I18n;
 import org.apache.commons.lang3.Validate;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -40,27 +42,43 @@ public class OrePrefix {
     private final static AtomicInteger idCounter = new AtomicInteger(0);
 
     // Regular Ore Prefix. Ore -> Material is a Oneway Operation! Introduced by Eloraam
-    public static final OrePrefix ore = new OrePrefix("ore", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreGranite = new OrePrefix("oreGranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreDiorite = new OrePrefix("oreDiorite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreAndesite = new OrePrefix("oreAndesite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreBlackgranite = new OrePrefix("oreBlackgranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreRedgranite = new OrePrefix("oreRedgranite", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreMarble = new OrePrefix("oreMarble", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix oreBasalt = new OrePrefix("oreBasalt", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix ore = new OrePrefix("ore", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION,
+            hasOreProperty);
+    public static final OrePrefix oreGranite = new OrePrefix("oreGranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreDiorite = new OrePrefix("oreDiorite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreAndesite = new OrePrefix("oreAndesite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreBlackgranite = new OrePrefix("oreBlackgranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreRedgranite = new OrePrefix("oreRedgranite", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreMarble = new OrePrefix("oreMarble", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreBasalt = new OrePrefix("oreBasalt", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
 
     // In case of an Sand-Ores Mod. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreSand = new OrePrefix("oreSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, null);
-    public static final OrePrefix oreRedSand = new OrePrefix("oreRedSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, null);
+    public static final OrePrefix oreSand = new OrePrefix("oreSand", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix oreRedSand = new OrePrefix("oreRedSand", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, null);
 
     // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreNetherrack = new OrePrefix("oreNetherrack", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreNetherrack = new OrePrefix("oreNetherrack", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
     // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation!
-    public static final OrePrefix oreEndstone = new OrePrefix("oreEndstone", -1, null, MaterialIconType.ore, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix oreEndstone = new OrePrefix("oreEndstone", -1, null, MaterialIconType.ore,
+            ENABLE_UNIFICATION, hasOreProperty);
 
-    public static final OrePrefix crushedCentrifuged = new OrePrefix("crushedCentrifuged", -1, null, MaterialIconType.crushedCentrifuged, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix crushedPurified = new OrePrefix("crushedPurified", -1, null, MaterialIconType.crushedPurified, ENABLE_UNIFICATION, hasOreProperty);
-    public static final OrePrefix crushed = new OrePrefix("crushed", -1, null, MaterialIconType.crushed, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.crushed.tooltip.purify")));
+    public static final OrePrefix crushedCentrifuged = new OrePrefix("crushedCentrifuged", -1, null,
+            MaterialIconType.crushedCentrifuged, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix crushedPurified = new OrePrefix("crushedPurified", -1, null,
+            MaterialIconType.crushedPurified, ENABLE_UNIFICATION, hasOreProperty);
+    public static final OrePrefix crushed = new OrePrefix("crushed", -1, null, MaterialIconType.crushed,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.crushed.tooltip.purify")));
 
     // Introduced by Mekanism
     public static final OrePrefix shard = new OrePrefix("shard", -1, null, null, ENABLE_UNIFICATION, null);
@@ -72,89 +90,138 @@ public class OrePrefix {
     public static final OrePrefix dirtyGravel = new OrePrefix("dirtyGravel", -1, null, null, ENABLE_UNIFICATION, null);
 
     // A hot Ingot, which has to be cooled down by a Vacuum Freezer.
-    public static final OrePrefix ingotHot = new OrePrefix("ingotHot", M, null, MaterialIconType.ingotHot, ENABLE_UNIFICATION, hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750));
+    public static final OrePrefix ingotHot = new OrePrefix("ingotHot", M, null, MaterialIconType.ingotHot,
+            ENABLE_UNIFICATION,
+            hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750));
     // A regular Ingot. Introduced by Eloraam
-    public static final OrePrefix ingot = new OrePrefix("ingot", M, null, MaterialIconType.ingot, ENABLE_UNIFICATION, hasIngotProperty);
+    public static final OrePrefix ingot = new OrePrefix("ingot", M, null, MaterialIconType.ingot, ENABLE_UNIFICATION,
+            hasIngotProperty);
 
     // A regular Gem worth one Dust. Introduced by Eloraam
-    public static final OrePrefix gem = new OrePrefix("gem", M, null, MaterialIconType.gem, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gem = new OrePrefix("gem", M, null, MaterialIconType.gem, ENABLE_UNIFICATION,
+            hasGemProperty);
     // A regular Gem worth one small Dust. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemChipped = new OrePrefix("gemChipped", M / 4, null, MaterialIconType.gemChipped, ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
+    public static final OrePrefix gemChipped = new OrePrefix("gemChipped", M / 4, null, MaterialIconType.gemChipped,
+            ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
     // A regular Gem worth two small Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemFlawed = new OrePrefix("gemFlawed", M / 2, null, MaterialIconType.gemFlawed, ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
+    public static final OrePrefix gemFlawed = new OrePrefix("gemFlawed", M / 2, null, MaterialIconType.gemFlawed,
+            ENABLE_UNIFICATION, hasGemProperty.and(unused -> ConfigHolder.recipes.generateLowQualityGems));
     // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemFlawless = new OrePrefix("gemFlawless", M * 2, null, MaterialIconType.gemFlawless, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gemFlawless = new OrePrefix("gemFlawless", M * 2, null, MaterialIconType.gemFlawless,
+            ENABLE_UNIFICATION, hasGemProperty);
     // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft
-    public static final OrePrefix gemExquisite = new OrePrefix("gemExquisite", M * 4, null, MaterialIconType.gemExquisite, ENABLE_UNIFICATION, hasGemProperty);
+    public static final OrePrefix gemExquisite = new OrePrefix("gemExquisite", M * 4, null,
+            MaterialIconType.gemExquisite, ENABLE_UNIFICATION, hasGemProperty);
 
     // 1/4th of a Dust.
-    public static final OrePrefix dustSmall = new OrePrefix("dustSmall", M / 4, null, MaterialIconType.dustSmall, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustSmall = new OrePrefix("dustSmall", M / 4, null, MaterialIconType.dustSmall,
+            ENABLE_UNIFICATION, hasDustProperty);
     // 1/9th of a Dust.
-    public static final OrePrefix dustTiny = new OrePrefix("dustTiny", M / 9, null, MaterialIconType.dustTiny, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustTiny = new OrePrefix("dustTiny", M / 9, null, MaterialIconType.dustTiny,
+            ENABLE_UNIFICATION, hasDustProperty);
     // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material
-    public static final OrePrefix dustImpure = new OrePrefix("dustImpure", M, null, MaterialIconType.dustImpure, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
+    public static final OrePrefix dustImpure = new OrePrefix("dustImpure", M, null, MaterialIconType.dustImpure,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
     // Pure Dust worth of one Ingot or Gem. Introduced by Alblaka.
-    public static final OrePrefix dustPure = new OrePrefix("dustPure", M, null, MaterialIconType.dustPure, ENABLE_UNIFICATION, hasOreProperty, mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
-    public static final OrePrefix dust = new OrePrefix("dust", M, null, MaterialIconType.dust, ENABLE_UNIFICATION, hasDustProperty);
+    public static final OrePrefix dustPure = new OrePrefix("dustPure", M, null, MaterialIconType.dustPure,
+            ENABLE_UNIFICATION, hasOreProperty,
+            mat -> Collections.singletonList(I18n.format("metaitem.dust.tooltip.purify")));
+    public static final OrePrefix dust = new OrePrefix("dust", M, null, MaterialIconType.dust, ENABLE_UNIFICATION,
+            hasDustProperty);
 
     // A Nugget. Introduced by Eloraam
-    public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget, ENABLE_UNIFICATION, hasIngotProperty);
+    public static final OrePrefix nugget = new OrePrefix("nugget", M / 9, null, MaterialIconType.nugget,
+            ENABLE_UNIFICATION, hasIngotProperty);
 
     // 9 Plates combined in one Item.
-    public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE));
+    public static final OrePrefix plateDense = new OrePrefix("plateDense", M * 9, null, MaterialIconType.plateDense,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_DENSE));
     // 2 Plates combined in one Item
-    public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble, ENABLE_UNIFICATION, hasIngotProperty.and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
+    public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble,
+            ENABLE_UNIFICATION, hasIngotProperty
+                    .and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
     // Regular Plate made of one Ingot/Dust. Introduced by Calclavia
-    public static final OrePrefix plate = new OrePrefix("plate", M, null, MaterialIconType.plate, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_PLATE));
+    public static final OrePrefix plate = new OrePrefix("plate", M, null, MaterialIconType.plate, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_PLATE));
 
     // Round made of 1 Nugget
-    public static final OrePrefix round = new OrePrefix("round", M / 9, null, MaterialIconType.round, OrePrefix.Flags.ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROUND));
+    public static final OrePrefix round = new OrePrefix("round", M / 9, null, MaterialIconType.round,
+            OrePrefix.Flags.ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROUND));
     // Foil made of 1/4 Ingot/Dust.
-    public static final OrePrefix foil = new OrePrefix("foil", M / 4, null, MaterialIconType.foil, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FOIL));
+    public static final OrePrefix foil = new OrePrefix("foil", M / 4, null, MaterialIconType.foil, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_FOIL));
 
     // Stick made of an Ingot.
-    public static final OrePrefix stickLong = new OrePrefix("stickLong", M, null, MaterialIconType.stickLong, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LONG_ROD));
+    public static final OrePrefix stickLong = new OrePrefix("stickLong", M, null, MaterialIconType.stickLong,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LONG_ROD));
     // Stick made of half an Ingot. Introduced by Eloraam
-    public static final OrePrefix stick = new OrePrefix("stick", M / 2, null, MaterialIconType.stick, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROD));
+    public static final OrePrefix stick = new OrePrefix("stick", M / 2, null, MaterialIconType.stick,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROD));
 
     // consisting out of 1/8 Ingot or 1/4 Stick.
-    public static final OrePrefix bolt = new OrePrefix("bolt", M / 8, null, MaterialIconType.bolt, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
+    public static final OrePrefix bolt = new OrePrefix("bolt", M / 8, null, MaterialIconType.bolt, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
     // consisting out of 1/9 Ingot.
-    public static final OrePrefix screw = new OrePrefix("screw", M / 9, null, MaterialIconType.screw, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
+    public static final OrePrefix screw = new OrePrefix("screw", M / 9, null, MaterialIconType.screw,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_BOLT_SCREW));
     // consisting out of 1/2 Stick.
-    public static final OrePrefix ring = new OrePrefix("ring", M / 4, null, MaterialIconType.ring, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_RING));
+    public static final OrePrefix ring = new OrePrefix("ring", M / 4, null, MaterialIconType.ring, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_RING));
     // consisting out of 1 Fine Wire.
-    public static final OrePrefix springSmall = new OrePrefix("springSmall", M / 4, null, MaterialIconType.springSmall, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING_SMALL) && !mat.hasFlag(NO_SMASHING));
+    public static final OrePrefix springSmall = new OrePrefix("springSmall", M / 4, null, MaterialIconType.springSmall,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING_SMALL) && !mat.hasFlag(NO_SMASHING));
     // consisting out of 2 Sticks.
-    public static final OrePrefix spring = new OrePrefix("spring", M, null, MaterialIconType.spring, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SPRING) && !mat.hasFlag(NO_SMASHING));
+    public static final OrePrefix spring = new OrePrefix("spring", M, null, MaterialIconType.spring, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_SPRING) && !mat.hasFlag(NO_SMASHING));
     // consisting out of 1/8 Ingot or 1/4 Wire.
-    public static final OrePrefix wireFine = new OrePrefix("wireFine", M / 8, null, MaterialIconType.wireFine, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FINE_WIRE));
+    public static final OrePrefix wireFine = new OrePrefix("wireFine", M / 8, null, MaterialIconType.wireFine,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_FINE_WIRE));
     // consisting out of 4 Plates, 1 Ring and 1 Screw.
-    public static final OrePrefix rotor = new OrePrefix("rotor", M * 4, null, MaterialIconType.rotor, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROTOR));
-    public static final OrePrefix gearSmall = new OrePrefix("gearSmall", M, null, MaterialIconType.gearSmall, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SMALL_GEAR));
+    public static final OrePrefix rotor = new OrePrefix("rotor", M * 4, null, MaterialIconType.rotor,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_ROTOR));
+    public static final OrePrefix gearSmall = new OrePrefix("gearSmall", M, null, MaterialIconType.gearSmall,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_SMALL_GEAR));
     // Introduced by me because BuildCraft has ruined the gear Prefix...
-    public static final OrePrefix gear = new OrePrefix("gear", M * 4, null, MaterialIconType.gear, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_GEAR));
+    public static final OrePrefix gear = new OrePrefix("gear", M * 4, null, MaterialIconType.gear, ENABLE_UNIFICATION,
+            mat -> mat.hasFlag(GENERATE_GEAR));
     // 3/4 of a Plate or Gem used to shape a Lens. Normally only used on Transparent Materials.
-    public static final OrePrefix lens = new OrePrefix("lens", (M * 3) / 4, null, MaterialIconType.lens, ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LENS));
+    public static final OrePrefix lens = new OrePrefix("lens", (M * 3) / 4, null, MaterialIconType.lens,
+            ENABLE_UNIFICATION, mat -> mat.hasFlag(GENERATE_LENS));
 
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadBuzzSaw = new OrePrefix("toolHeadBuzzSaw", M * 4, null, MaterialIconType.toolHeadBuzzSaw, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadBuzzSaw = new OrePrefix("toolHeadBuzzSaw", M * 4, null,
+            MaterialIconType.toolHeadBuzzSaw, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 1 Ingots.
-    public static final OrePrefix toolHeadScrewdriver = new OrePrefix("toolHeadScrewdriver", M, null, MaterialIconType.toolHeadScrewdriver, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_LONG_ROD)));
+    public static final OrePrefix toolHeadScrewdriver = new OrePrefix("toolHeadScrewdriver", M, null,
+            MaterialIconType.toolHeadScrewdriver, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_LONG_ROD)));
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadDrill = new OrePrefix("toolHeadDrill", M * 4, null, MaterialIconType.toolHeadDrill, ENABLE_UNIFICATION, hasToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadDrill = new OrePrefix("toolHeadDrill", M * 4, null,
+            MaterialIconType.toolHeadDrill, ENABLE_UNIFICATION,
+            hasToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 2 Ingots.
-    public static final OrePrefix toolHeadChainsaw = new OrePrefix("toolHeadChainsaw", M * 2, null, MaterialIconType.toolHeadChainsaw, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadChainsaw = new OrePrefix("toolHeadChainsaw", M * 2, null,
+            MaterialIconType.toolHeadChainsaw, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 4 Ingots.
-    public static final OrePrefix toolHeadWrench = new OrePrefix("toolHeadWrench", M * 4, null, MaterialIconType.toolHeadWrench, ENABLE_UNIFICATION, hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
+    public static final OrePrefix toolHeadWrench = new OrePrefix("toolHeadWrench", M * 4, null,
+            MaterialIconType.toolHeadWrench, ENABLE_UNIFICATION,
+            hasNoCraftingToolProperty.and(mat -> mat.hasFlag(GENERATE_PLATE)));
     // made of 5 Ingots.
-    public static final OrePrefix turbineBlade = new OrePrefix("turbineBlade", M * 10, null, MaterialIconType.turbineBlade, ENABLE_UNIFICATION, hasRotorProperty.and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));
+    public static final OrePrefix turbineBlade = new OrePrefix("turbineBlade", M * 10, null,
+            MaterialIconType.turbineBlade, ENABLE_UNIFICATION, hasRotorProperty
+                    .and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));
 
-    public static final OrePrefix paneGlass = new OrePrefix("paneGlass", -1, MarkerMaterials.Color.Colorless, null, SELF_REFERENCING, null);
-    public static final OrePrefix blockGlass = new OrePrefix("blockGlass", -1, MarkerMaterials.Color.Colorless, null, SELF_REFERENCING, null);
+    public static final OrePrefix paneGlass = new OrePrefix("paneGlass", -1, MarkerMaterials.Color.Colorless, null,
+            SELF_REFERENCING, null);
+    public static final OrePrefix blockGlass = new OrePrefix("blockGlass", -1, MarkerMaterials.Color.Colorless, null,
+            SELF_REFERENCING, null);
 
     // Storage Block consisting out of 9 Ingots/Gems/Dusts. Introduced by CovertJaguar
-    public static final OrePrefix block = new OrePrefix("block", M * 9, null, MaterialIconType.block, ENABLE_UNIFICATION, null);
+    public static final OrePrefix block = new OrePrefix("block", M * 9, null, MaterialIconType.block,
+            ENABLE_UNIFICATION, null);
 
     // Prefix used for Logs. Usually as "logWood". Introduced by Eloraam
     public static final OrePrefix log = new OrePrefix("log", -1, null, null, 0, null);
@@ -177,38 +244,62 @@ public class OrePrefix {
     // Prefix to determine which kind of Rock this is.
     public static final OrePrefix stone = new OrePrefix("stone", -1, Materials.Stone, null, SELF_REFERENCING, null);
 
-    public static final OrePrefix frameGt = new OrePrefix("frameGt", M * 2, null, null, ENABLE_UNIFICATION, material -> material.hasFlag(GENERATE_FRAME));
-
-    public static final OrePrefix pipeTinyFluid = new OrePrefix("pipeTinyFluid", M / 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeSmallFluid = new OrePrefix("pipeSmallFluid", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalFluid = new OrePrefix("pipeNormalFluid", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeFluid = new OrePrefix("pipeLargeFluid", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeFluid = new OrePrefix("pipeHugeFluid", M * 12, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeQuadrupleFluid = new OrePrefix("pipeQuadrupleFluid", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNonupleFluid = new OrePrefix("pipeNonupleFluid", M * 9, null, null, ENABLE_UNIFICATION, null);
-
-    public static final OrePrefix pipeTinyItem = new OrePrefix("pipeTinyItem", M / 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeSmallItem = new OrePrefix("pipeSmallItem", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalItem = new OrePrefix("pipeNormalItem", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeItem = new OrePrefix("pipeLargeItem", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeItem = new OrePrefix("pipeHugeItem", M * 12, null, null, ENABLE_UNIFICATION, null);
-
-    public static final OrePrefix pipeSmallRestrictive = new OrePrefix("pipeSmallRestrictive", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeNormalRestrictive = new OrePrefix("pipeNormalRestrictive", M * 3, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeLargeRestrictive = new OrePrefix("pipeLargeRestrictive", M * 6, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix pipeHugeRestrictive = new OrePrefix("pipeHugeRestrictive", M * 12, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix frameGt = new OrePrefix("frameGt", M * 2, null, null, ENABLE_UNIFICATION,
+            material -> material.hasFlag(GENERATE_FRAME));
+
+    public static final OrePrefix pipeTinyFluid = new OrePrefix("pipeTinyFluid", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeSmallFluid = new OrePrefix("pipeSmallFluid", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeNormalFluid = new OrePrefix("pipeNormalFluid", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeFluid = new OrePrefix("pipeLargeFluid", M * 6, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeHugeFluid = new OrePrefix("pipeHugeFluid", M * 12, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeQuadrupleFluid = new OrePrefix("pipeQuadrupleFluid", M * 4, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeNonupleFluid = new OrePrefix("pipeNonupleFluid", M * 9, null, null,
+            ENABLE_UNIFICATION, null);
+
+    public static final OrePrefix pipeTinyItem = new OrePrefix("pipeTinyItem", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeSmallItem = new OrePrefix("pipeSmallItem", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeNormalItem = new OrePrefix("pipeNormalItem", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeItem = new OrePrefix("pipeLargeItem", M * 6, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix pipeHugeItem = new OrePrefix("pipeHugeItem", M * 12, null, null, ENABLE_UNIFICATION,
+            null);
+
+    public static final OrePrefix pipeSmallRestrictive = new OrePrefix("pipeSmallRestrictive", M, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeNormalRestrictive = new OrePrefix("pipeNormalRestrictive", M * 3, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeLargeRestrictive = new OrePrefix("pipeLargeRestrictive", M * 6, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix pipeHugeRestrictive = new OrePrefix("pipeHugeRestrictive", M * 12, null, null,
+            ENABLE_UNIFICATION, null);
 
     public static final OrePrefix wireGtHex = new OrePrefix("wireGtHex", M * 8, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtOctal = new OrePrefix("wireGtOctal", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtQuadruple = new OrePrefix("wireGtQuadruple", M * 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix wireGtOctal = new OrePrefix("wireGtOctal", M * 4, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix wireGtQuadruple = new OrePrefix("wireGtQuadruple", M * 2, null, null,
+            ENABLE_UNIFICATION, null);
     public static final OrePrefix wireGtDouble = new OrePrefix("wireGtDouble", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix wireGtSingle = new OrePrefix("wireGtSingle", M / 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix wireGtSingle = new OrePrefix("wireGtSingle", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
 
     public static final OrePrefix cableGtHex = new OrePrefix("cableGtHex", M * 8, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtOctal = new OrePrefix("cableGtOctal", M * 4, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtQuadruple = new OrePrefix("cableGtQuadruple", M * 2, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtDouble = new OrePrefix("cableGtDouble", M, null, null, ENABLE_UNIFICATION, null);
-    public static final OrePrefix cableGtSingle = new OrePrefix("cableGtSingle", M / 2, null, null, ENABLE_UNIFICATION, null);
+    public static final OrePrefix cableGtOctal = new OrePrefix("cableGtOctal", M * 4, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix cableGtQuadruple = new OrePrefix("cableGtQuadruple", M * 2, null, null,
+            ENABLE_UNIFICATION, null);
+    public static final OrePrefix cableGtDouble = new OrePrefix("cableGtDouble", M, null, null, ENABLE_UNIFICATION,
+            null);
+    public static final OrePrefix cableGtSingle = new OrePrefix("cableGtSingle", M / 2, null, null, ENABLE_UNIFICATION,
+            null);
 
     // Special Prefix used mainly for the Crafting Handler.
     public static final OrePrefix craftingLens = new OrePrefix("craftingLens", -1, null, null, 0, null);
@@ -227,13 +318,16 @@ public class OrePrefix {
     public static final OrePrefix component = new OrePrefix("component", -1, null, null, ENABLE_UNIFICATION, null);
 
     public static class Flags {
+
         public static final long ENABLE_UNIFICATION = 1;
         public static final long SELF_REFERENCING = 1 << 1;
     }
 
     public static class Conditions {
+
         public static final Predicate hasToolProperty = mat -> mat.hasProperty(PropertyKey.TOOL);
-        public static final Predicate hasNoCraftingToolProperty = hasToolProperty.and(mat -> !mat.getProperty(PropertyKey.TOOL).getShouldIgnoreCraftingTools());
+        public static final Predicate hasNoCraftingToolProperty = hasToolProperty
+                .and(mat -> !mat.getProperty(PropertyKey.TOOL).getShouldIgnoreCraftingTools());
         public static final Predicate hasOreProperty = mat -> mat.hasProperty(PropertyKey.ORE);
         public static final Predicate hasGemProperty = mat -> mat.hasProperty(PropertyKey.GEM);
         public static final Predicate hasDustProperty = mat -> mat.hasProperty(PropertyKey.DUST);
@@ -349,8 +443,10 @@ public static void init() {
         crushed.addSecondaryMaterial(new MaterialStack(Materials.Stone, dust.materialAmount));
 
         toolHeadDrill.addSecondaryMaterial(new MaterialStack(Materials.Steel, plate.materialAmount * 4));
-        toolHeadChainsaw.addSecondaryMaterial(new MaterialStack(Materials.Steel, plate.materialAmount * 4 + ring.materialAmount * 2));
-        toolHeadWrench.addSecondaryMaterial(new MaterialStack(Materials.Steel, ring.materialAmount + screw.materialAmount * 2));
+        toolHeadChainsaw.addSecondaryMaterial(
+                new MaterialStack(Materials.Steel, plate.materialAmount * 4 + ring.materialAmount * 2));
+        toolHeadWrench.addSecondaryMaterial(
+                new MaterialStack(Materials.Steel, ring.materialAmount + screw.materialAmount * 2));
 
         pipeSmallRestrictive.addSecondaryMaterial(new MaterialStack(Materials.Iron, ring.materialAmount * 2));
         pipeNormalRestrictive.addSecondaryMaterial(new MaterialStack(Materials.Iron, ring.materialAmount * 2));
@@ -400,10 +496,8 @@ private static void excludeAllGemsButNormal(Material material) {
     public final boolean isUnificationEnabled;
     public final boolean isSelfReferencing;
 
-    private @Nullable
-    Predicate generationCondition;
-    public final @Nullable
-    MaterialIconType materialIconType;
+    private @Nullable Predicate generationCondition;
+    public final @Nullable MaterialIconType materialIconType;
 
     private final long materialAmount;
 
@@ -413,8 +507,7 @@ private static void excludeAllGemsButNormal(Material material) {
      * 

* NOTE: Ore registrations with self-referencing OrePrefix still can occur with other materials */ - public @Nullable - Material materialType; + public @Nullable Material materialType; private final List oreProcessingHandlers = new ArrayList<>(); private final Set ignoredMaterials = new HashSet<>(); @@ -429,11 +522,14 @@ private static void excludeAllGemsButNormal(Material material) { private String alternativeOreName = null; - public OrePrefix(String name, long materialAmount, @Nullable Material material, @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition) { + public OrePrefix(String name, long materialAmount, @Nullable Material material, + @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition) { this(name, materialAmount, material, materialIconType, flags, condition, null); } - public OrePrefix(String name, long materialAmount, @Nullable Material material, @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition, @Nullable Function> tooltipFunc) { + public OrePrefix(String name, long materialAmount, @Nullable Material material, + @Nullable MaterialIconType materialIconType, long flags, @Nullable Predicate condition, + @Nullable Function> tooltipFunc) { Preconditions.checkArgument(!PREFIXES.containsKey(name), "OrePrefix " + name + " already registered!"); this.name = name; this.id = idCounter.getAndIncrement(); @@ -480,7 +576,8 @@ public static OrePrefix getPrefix(String prefixName, @Nullable OrePrefix replace } public boolean doGenerateItem(Material material) { - return !isSelfReferencing && !isIgnored(material) && (generationCondition == null || generationCondition.test(material)); + return !isSelfReferencing && !isIgnored(material) && + (generationCondition == null || generationCondition.test(material)); } public void setGenerationCondition(@Nullable Predicate in) { @@ -493,7 +590,8 @@ public boolean addProcessingHandler(IOreRegistrationHandler... processingHandler return oreProcessingHandlers.addAll(Arrays.asList(processingHandler)); } - public void addProcessingHandler(PropertyKey propertyKey, TriConsumer handler) { + public void addProcessingHandler(PropertyKey propertyKey, + TriConsumer handler) { addProcessingHandler((orePrefix, material) -> { if (material.hasProperty(propertyKey) && !material.hasFlag(NO_UNIFICATION)) { handler.accept(orePrefix, material, material.getProperty(propertyKey)); @@ -503,7 +601,7 @@ public void addProcessingHandler(PropertyKey pr public void processOreRegistration(@Nullable Material material) { if (this.isSelfReferencing && material == null) { - material = materialType; //append default material for self-referencing OrePrefix + material = materialType; // append default material for self-referencing OrePrefix } if (material != null) generatedMaterials.add(material); } @@ -534,7 +632,7 @@ private void runGeneratedMaterialHandlers() { } currentMaterial.set(null); } - //clear generated materials for next pass + // clear generated materials for next pass generatedMaterials.clear(); currentProcessingPrefix.set(null); } diff --git a/src/main/java/gregtech/api/unification/ore/StoneType.java b/src/main/java/gregtech/api/unification/ore/StoneType.java index 4e2519bd325..60751e660a9 100644 --- a/src/main/java/gregtech/api/unification/ore/StoneType.java +++ b/src/main/java/gregtech/api/unification/ore/StoneType.java @@ -1,22 +1,25 @@ package gregtech.api.unification.ore; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.GTControlledRegistry; import gregtech.common.ConfigHolder; import gregtech.integration.jei.basic.OreByProduct; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.Loader; -import javax.annotation.Nonnull; +import com.google.common.base.Preconditions; + import java.util.function.Predicate; import java.util.function.Supplier; +import javax.annotation.Nonnull; + /** * For ore generation */ @@ -28,18 +31,18 @@ public class StoneType implements Comparable { public final Material stoneMaterial; public final Supplier stone; public final SoundType soundType; - //we are using guava predicate because isReplaceableOreGen uses it + // we are using guava predicate because isReplaceableOreGen uses it @SuppressWarnings("Guava") private final com.google.common.base.Predicate predicate; public final boolean shouldBeDroppedAsItem; public static final GTControlledRegistry STONE_TYPE_REGISTRY = new GTControlledRegistry<>(128); - public StoneType(int id, String name, SoundType soundType, OrePrefix processingPrefix, Material stoneMaterial, Supplier stone, Predicate predicate, boolean shouldBeDroppedAsItem) { + public StoneType(int id, String name, SoundType soundType, OrePrefix processingPrefix, Material stoneMaterial, + Supplier stone, Predicate predicate, boolean shouldBeDroppedAsItem) { Preconditions.checkArgument( stoneMaterial.hasProperty(PropertyKey.DUST), - "Stone type must be made with a Material with the Dust Property!" - ); + "Stone type must be made with a Material with the Dust Property!"); this.name = name; this.soundType = soundType; this.processingPrefix = processingPrefix; @@ -65,7 +68,7 @@ public int compareTo(@Nonnull StoneType stoneType) { }; public static void init() { - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored StoneTypes.STONE.name.getBytes(); } @@ -84,7 +87,8 @@ public static StoneType computeStoneType(IBlockState state, IBlockAccess world, } } } else if (dummy$isReplaceableOreGen) { - // It is not considered, but the test still returned true (this means the impl was probably very lazily done) + // It is not considered, but the test still returned true (this means the impl was probably very lazily + // done) // We have to test against the IBlockState ourselves to see if there's a suitable StoneType for (StoneType stoneType : STONE_TYPE_REGISTRY) { if (stoneType.predicate.test(state)) { diff --git a/src/main/java/gregtech/api/unification/ore/StoneTypes.java b/src/main/java/gregtech/api/unification/ore/StoneTypes.java index d8f7a4cdd87..bbfae9e9c80 100755 --- a/src/main/java/gregtech/api/unification/ore/StoneTypes.java +++ b/src/main/java/gregtech/api/unification/ore/StoneTypes.java @@ -4,6 +4,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.StoneVariantBlock; import gregtech.common.blocks.StoneVariantBlock.StoneVariant; + import net.minecraft.block.BlockRedSandstone; import net.minecraft.block.BlockSandStone; import net.minecraft.block.BlockStone; @@ -18,44 +19,62 @@ public class StoneTypes { public static final StoneType STONE = new StoneType(0, "stone", SoundType.STONE, OrePrefix.ore, Materials.Stone, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.STONE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == BlockStone.EnumType.STONE, true); + state -> state.getBlock() instanceof BlockStone && + state.getValue(BlockStone.VARIANT) == BlockStone.EnumType.STONE, + true); - public static StoneType NETHERRACK = new StoneType(1, "netherrack", SoundType.STONE, OrePrefix.oreNetherrack, Materials.Netherrack, + public static StoneType NETHERRACK = new StoneType(1, "netherrack", SoundType.STONE, OrePrefix.oreNetherrack, + Materials.Netherrack, Blocks.NETHERRACK::getDefaultState, state -> state.getBlock() == Blocks.NETHERRACK, true); - public static StoneType ENDSTONE = new StoneType(2, "endstone", SoundType.STONE, OrePrefix.oreEndstone, Materials.Endstone, + public static StoneType ENDSTONE = new StoneType(2, "endstone", SoundType.STONE, OrePrefix.oreEndstone, + Materials.Endstone, Blocks.END_STONE::getDefaultState, state -> state.getBlock() == Blocks.END_STONE, true); - // Dummy Types used for better world generation - public static StoneType SANDSTONE = new StoneType(3, "sandstone", SoundType.STONE, OrePrefix.oreSand, Materials.SiliconDioxide, + public static StoneType SANDSTONE = new StoneType(3, "sandstone", SoundType.STONE, OrePrefix.oreSand, + Materials.SiliconDioxide, () -> Blocks.SANDSTONE.getDefaultState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT), - state -> state.getBlock() instanceof BlockSandStone && state.getValue(BlockSandStone.TYPE) == BlockSandStone.EnumType.DEFAULT, false); - - public static StoneType RED_SANDSTONE = new StoneType(4, "red_sandstone", SoundType.STONE, OrePrefix.oreRedSand, Materials.SiliconDioxide, - () -> Blocks.RED_SANDSTONE.getDefaultState().withProperty(BlockRedSandstone.TYPE, BlockRedSandstone.EnumType.DEFAULT), - state -> state.getBlock() instanceof BlockRedSandstone && state.getValue(BlockRedSandstone.TYPE) == BlockRedSandstone.EnumType.DEFAULT, false); - - public static StoneType GRANITE = new StoneType(5, "granite", SoundType.STONE, OrePrefix.oreGranite, Materials.Granite, + state -> state.getBlock() instanceof BlockSandStone && + state.getValue(BlockSandStone.TYPE) == BlockSandStone.EnumType.DEFAULT, + false); + + public static StoneType RED_SANDSTONE = new StoneType(4, "red_sandstone", SoundType.STONE, OrePrefix.oreRedSand, + Materials.SiliconDioxide, + () -> Blocks.RED_SANDSTONE.getDefaultState().withProperty(BlockRedSandstone.TYPE, + BlockRedSandstone.EnumType.DEFAULT), + state -> state.getBlock() instanceof BlockRedSandstone && + state.getValue(BlockRedSandstone.TYPE) == BlockRedSandstone.EnumType.DEFAULT, + false); + + public static StoneType GRANITE = new StoneType(5, "granite", SoundType.STONE, OrePrefix.oreGranite, + Materials.Granite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.GRANITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.GRANITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.GRANITE, + false); - public static StoneType DIORITE = new StoneType(6, "diorite", SoundType.STONE, OrePrefix.oreDiorite, Materials.Diorite, + public static StoneType DIORITE = new StoneType(6, "diorite", SoundType.STONE, OrePrefix.oreDiorite, + Materials.Diorite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, EnumType.DIORITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.DIORITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.DIORITE, + false); - public static StoneType ANDESITE = new StoneType(7, "andesite", SoundType.STONE, OrePrefix.oreAndesite, Materials.Andesite, + public static StoneType ANDESITE = new StoneType(7, "andesite", SoundType.STONE, OrePrefix.oreAndesite, + Materials.Andesite, () -> Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), - state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.ANDESITE, false); + state -> state.getBlock() instanceof BlockStone && state.getValue(BlockStone.VARIANT) == EnumType.ANDESITE, + false); - public static StoneType BLACK_GRANITE = new StoneType(8, "black_granite", SoundType.STONE, OrePrefix.oreBlackgranite, Materials.GraniteBlack, + public static StoneType BLACK_GRANITE = new StoneType(8, "black_granite", SoundType.STONE, + OrePrefix.oreBlackgranite, Materials.GraniteBlack, () -> gtStoneState(StoneVariantBlock.StoneType.BLACK_GRANITE), state -> gtStonePredicate(state, StoneVariantBlock.StoneType.BLACK_GRANITE), false); - public static StoneType RED_GRANITE = new StoneType(9, "red_granite", SoundType.STONE, OrePrefix.oreRedgranite, Materials.GraniteRed, + public static StoneType RED_GRANITE = new StoneType(9, "red_granite", SoundType.STONE, OrePrefix.oreRedgranite, + Materials.GraniteRed, () -> gtStoneState(StoneVariantBlock.StoneType.RED_GRANITE), state -> gtStonePredicate(state, StoneVariantBlock.StoneType.RED_GRANITE), false); diff --git a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java index 22880b79cca..287f5c42d72 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java +++ b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java @@ -1,6 +1,7 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java index d817737ac4e..bad615f0888 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java @@ -1,11 +1,13 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import net.minecraft.item.ItemStack; +import java.util.Set; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Set; /** * An abstraction of dictionary-like collection with each item variant as keys. @@ -23,7 +25,7 @@ public interface ItemVariantMap { /** * @return {@code true} if there's any nonnull value associated with some item - * metadata, excluding metadata value of {@link GTValues#W} {@code (32767)}. + * metadata, excluding metadata value of {@link GTValues#W} {@code (32767)}. * @see #hasWildcardEntry() */ boolean hasNonWildcardEntry(); @@ -31,7 +33,7 @@ public interface ItemVariantMap { /** * @param meta item metadata * @return {@code true} if there's a nonnull value associated with given item - * metadata, {@code false} otherwise. + * metadata, {@code false} otherwise. */ boolean has(short meta); @@ -42,7 +44,7 @@ public interface ItemVariantMap { * * @param meta item metadata * @return value associated with given item metadata, or {@code null} if there's no - * values associated. + * values associated. */ @Nullable E get(short meta); @@ -56,7 +58,7 @@ default boolean isEmpty() { /** * @return {@code true} if there's a nonnull value associated with item - * metadata {@link GTValues#W} {@code (32767)}. + * metadata {@link GTValues#W} {@code (32767)}. * @see #hasNonWildcardEntry() */ default boolean hasWildcardEntry() { @@ -66,7 +68,7 @@ default boolean hasWildcardEntry() { /** * @param stack item stack * @return {@code true} if there's a nonnull value associated with item damage of - * the item, {@code false} otherwise. + * the item, {@code false} otherwise. */ default boolean has(@Nonnull ItemStack stack) { return has((short) stack.getItemDamage()); @@ -79,7 +81,7 @@ default boolean has(@Nonnull ItemStack stack) { * * @param stack item stack * @return value associated with item damage of the item, or {@code null} if there's - * no values associated. + * no values associated. */ @Nullable default E get(@Nonnull ItemStack stack) { @@ -129,7 +131,7 @@ interface Mutable extends ItemVariantMap { * @param meta item metadata * @param e new value, or {@code null} for entry removal * @return previous value associated with given item metadata, or {@code null} if - * there was no such value. + * there was no such value. */ @Nullable E put(short meta, @Nullable E e); @@ -142,7 +144,7 @@ interface Mutable extends ItemVariantMap { * @param stack item stack * @param e new value, or {@code null} for entry removal * @return previous value associated with given item metadata, or {@code null} if - * there was no such value. + * there was no such value. */ @Nullable default E put(@Nonnull ItemStack stack, @Nullable E e) { diff --git a/src/main/java/gregtech/api/unification/stack/MaterialStack.java b/src/main/java/gregtech/api/unification/stack/MaterialStack.java index bdb4611e330..8398d4361be 100644 --- a/src/main/java/gregtech/api/unification/stack/MaterialStack.java +++ b/src/main/java/gregtech/api/unification/stack/MaterialStack.java @@ -1,8 +1,9 @@ package gregtech.api.unification.stack; -import crafttweaker.annotations.ZenRegister; import gregtech.api.unification.material.Material; import gregtech.api.util.SmallDigits; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenProperty; diff --git a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java index 77630397bd9..714984b0cd3 100644 --- a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java @@ -1,6 +1,7 @@ package gregtech.api.unification.stack; import gregtech.api.GTValues; + import it.unimi.dsi.fastutil.shorts.Short2ObjectMap; import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap; diff --git a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java index d290fa91483..70e5193490b 100644 --- a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java +++ b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java @@ -3,9 +3,10 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; -import javax.annotation.Nullable; import java.util.Objects; +import javax.annotation.Nullable; + public class UnificationEntry { public final OrePrefix orePrefix; @@ -44,5 +45,4 @@ public int hashCode() { public String toString() { return orePrefix.name() + (material != null ? material.toCamelCaseString() : ""); } - } diff --git a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java index cf4acd9d223..09f5400347b 100644 --- a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java @@ -1,10 +1,11 @@ package gregtech.api.unification.stack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Unmodifiable view of another {@link ItemVariantMap} with {@link Set} of elements as values. * diff --git a/src/main/java/gregtech/api/util/AssemblyLineManager.java b/src/main/java/gregtech/api/util/AssemblyLineManager.java index ae1459842db..5275d23e690 100644 --- a/src/main/java/gregtech/api/util/AssemblyLineManager.java +++ b/src/main/java/gregtech/api/util/AssemblyLineManager.java @@ -14,17 +14,20 @@ import gregtech.api.recipes.recipeproperties.ScanProperty; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class AssemblyLineManager { public static final String RESEARCH_NBT_TAG = "assemblylineResearch"; @@ -80,7 +83,7 @@ public static String readResearchId(@Nonnull ItemStack stack) { * @return if the stack is a data item */ public static boolean isStackDataItem(@Nonnull ItemStack stack, boolean isDataBank) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { MetaItem.MetaValueItem valueItem = metaItem.getItem(stack); if (valueItem == null) return false; for (IItemBehaviour behaviour : valueItem.getBehaviours()) { @@ -102,7 +105,7 @@ public static boolean hasResearchTag(@Nonnull ItemStack stack) { /** * @param compound the compound to check - * @return if the tag has the research NBTTagCompound + * @return if the tag has the research NBTTagCompound */ private static boolean hasResearchTag(@Nullable NBTTagCompound compound) { if (compound == null || compound.isEmpty()) return false; @@ -118,11 +121,13 @@ public static void createDefaultResearchRecipe(@Nonnull AssemblyLineRecipeBuilde if (!ConfigHolder.machines.enableResearch) return; for (AssemblyLineRecipeBuilder.ResearchRecipeEntry entry : builder.getRecipeEntries()) { - createDefaultResearchRecipe(entry.getResearchId(), entry.getResearchStack(), entry.getDataStack(), entry.getDuration(), entry.getEUt(), entry.getCWUt()); + createDefaultResearchRecipe(entry.getResearchId(), entry.getResearchStack(), entry.getDataStack(), + entry.getDuration(), entry.getEUt(), entry.getCWUt()); } } - public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonnull ItemStack researchItem, @Nonnull ItemStack dataItem, int duration, int EUt, int CWUt) { + public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonnull ItemStack researchItem, + @Nonnull ItemStack dataItem, int duration, int EUt, int CWUt) { if (!ConfigHolder.machines.enableResearch) return; NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(dataItem); @@ -155,7 +160,8 @@ public static class DataStickCopyScannerLogic implements IScannerRecipeMap.ICust private static final int DURATION = 100; @Override - public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { if (inputs.size() > 1) { // try the data recipe both ways, prioritizing overwriting the first Recipe recipe = createDataRecipe(inputs.get(0), inputs.get(1)); diff --git a/src/main/java/gregtech/api/util/BaseCreativeTab.java b/src/main/java/gregtech/api/util/BaseCreativeTab.java index 22d02449fc3..17ef48931f8 100644 --- a/src/main/java/gregtech/api/util/BaseCreativeTab.java +++ b/src/main/java/gregtech/api/util/BaseCreativeTab.java @@ -4,9 +4,10 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class BaseCreativeTab extends CreativeTabs { private final boolean hasSearchBar; diff --git a/src/main/java/gregtech/api/util/BlockInfo.java b/src/main/java/gregtech/api/util/BlockInfo.java index 49150b02ca1..2f2340db46d 100644 --- a/src/main/java/gregtech/api/util/BlockInfo.java +++ b/src/main/java/gregtech/api/util/BlockInfo.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.google.common.base.Preconditions; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -8,6 +7,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import com.google.common.base.Preconditions; + /** * BlockInfo represents immutable information for block in world * This includes block state and tile entity, and needed for complete representation diff --git a/src/main/java/gregtech/api/util/BlockUtility.java b/src/main/java/gregtech/api/util/BlockUtility.java index 70a75f0c0dd..2e9854ebc42 100644 --- a/src/main/java/gregtech/api/util/BlockUtility.java +++ b/src/main/java/gregtech/api/util/BlockUtility.java @@ -31,5 +31,4 @@ public static void startCaptureDrops() { public static NonNullList stopCaptureDrops() { return WRAPPER.captureDrops(false); } - } diff --git a/src/main/java/gregtech/api/util/CapesRegistry.java b/src/main/java/gregtech/api/util/CapesRegistry.java index 2f92b017ea6..50972a56236 100644 --- a/src/main/java/gregtech/api/util/CapesRegistry.java +++ b/src/main/java/gregtech/api/util/CapesRegistry.java @@ -1,10 +1,10 @@ package gregtech.api.util; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.client.renderer.texture.Textures; import gregtech.core.network.packets.PacketNotifyCapeChange; + import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementManager; import net.minecraft.entity.player.EntityPlayer; @@ -22,6 +22,8 @@ import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -98,7 +100,8 @@ public static void save() { } comp.setTag("WornCapesValList", wornCapesTag); try { - CompressedStreamTools.safeWrite(comp, new File(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); + CompressedStreamTools.safeWrite(comp, new File(FMLCommonHandler.instance().getMinecraftServerInstance() + .getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); } catch (IOException exception) { GTLog.logger.error(exception); } @@ -107,7 +110,8 @@ public static void save() { public static void load() { NBTTagCompound comp = null; try { - comp = CompressedStreamTools.read(new File(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); + comp = CompressedStreamTools.read(new File(FMLCommonHandler.instance().getMinecraftServerInstance() + .getWorld(0).getSaveHandler().getWorldDirectory(), "gregtech_cape.dat")); } catch (IOException exception) { GTLog.logger.error(exception); } @@ -145,9 +149,11 @@ public static void load() { } public static void checkAdvancements(World world) { - registerCape(GTUtility.gregtechId("ultimate_voltage/74_wetware_mainframe"), Textures.GREGTECH_CAPE_TEXTURE, world); + registerCape(GTUtility.gregtechId("ultimate_voltage/74_wetware_mainframe"), Textures.GREGTECH_CAPE_TEXTURE, + world); registerCape(GTUtility.gregtechId("steam/12_electronic_circuit"), Textures.RED_CAPE_TEXTURE, world); - registerCape(GTUtility.gregtechId("high_voltage/82_large_chemical_reactor"), Textures.YELLOW_CAPE_TEXTURE, world); + registerCape(GTUtility.gregtechId("high_voltage/82_large_chemical_reactor"), Textures.YELLOW_CAPE_TEXTURE, + world); registerCape(GTUtility.gregtechId("ludicrous_voltage/60_fusion"), Textures.GREEN_CAPE_TEXTURE, world); for (Tuple tuple : ctRegisterCapes) { registerCape(tuple.getFirst(), tuple.getSecond(), world); @@ -169,6 +175,7 @@ public static void checkAdvancements(World world) { /** * Allows one to check what capes a specific player has unlocked through CapesRegistry. + * * @param uuid The player data used to get what capes the player has through internal maps. * @return A list of ResourceLocations containing the cape textures that the player has unlocked. */ @@ -176,17 +183,18 @@ public static List getUnlockedCapes(UUID uuid) { return UNLOCKED_CAPES.getOrDefault(uuid, Collections.emptyList()); } - /** * Links an advancement with a cape, which allows a player to unlock it when they receive the advancement. * This should only be called on world load, since advancements are only accessible then. + * * @param advancement A ResourceLocation pointing to the advancement that is to be used for getting a cape. * @param cape The ResourceLocation that points to the cape that can be unlocked through the advancement. * @param world The world that may contain the advancement used for getting a cape. */ public static void registerCape(ResourceLocation advancement, ResourceLocation cape, World world) { if (!world.isRemote) { - AdvancementManager advManager = ObfuscationReflectionHelper.getPrivateValue(World.class, world, "field_191951_C"); + AdvancementManager advManager = ObfuscationReflectionHelper.getPrivateValue(World.class, world, + "field_191951_C"); Advancement advObject = advManager.getAdvancement(advancement); if (advObject != null) { CAPE_ADVANCEMENTS.put(advObject, cape); @@ -196,6 +204,7 @@ public static void registerCape(ResourceLocation advancement, ResourceLocation c /** * Adds a cape that will always be unlocked for all players. + * * @param cape A ResourceLocation pointing to the cape texture. */ public static void addFreeCape(ResourceLocation cape) { @@ -220,6 +229,7 @@ public static void registerFreeCape(String cape) { /** * Automatically gives a cape to a player, which may be used for a reward for something other than an advancement * DOES NOT SAVE AUTOMATICALLY; PLEASE CALL SAVE AFTER THIS FUNCTION IS USED IF THIS DATA IS MEANT TO PERSIST. + * * @param uuid The UUID of the player to be given the cape. * @param cape The ResourceLocation that holds the cape used here. */ @@ -261,10 +271,13 @@ public static void giveCape(UUID uuid, ResourceLocation cape) { public static void loadWornCapeOnLogin(EntityPlayer player) { if (player instanceof EntityPlayerMP) { UUID uuid = player.getPersistentID(); - GregTechAPI.networkHandler.sendToAll(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid))); // sync to others - for (EntityPlayerMP otherPlayer : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers()) { // sync to login + GregTechAPI.networkHandler.sendToAll(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid))); // sync to + // others + for (EntityPlayerMP otherPlayer : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList() + .getPlayers()) { // sync to login uuid = otherPlayer.getPersistentID(); - GregTechAPI.networkHandler.sendTo(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid)), (EntityPlayerMP) player); + GregTechAPI.networkHandler.sendTo(new PacketNotifyCapeChange(uuid, WORN_CAPES.get(uuid)), + (EntityPlayerMP) player); } } } @@ -273,12 +286,14 @@ public static void loadWornCapeOnLogin(EntityPlayer player) { public static void detectNewCapes(EntityPlayer player) { if (player instanceof EntityPlayerMP) { for (Map.Entry capeEntry : CAPE_ADVANCEMENTS.entrySet()) { - if ((UNLOCKED_CAPES.get(player.getPersistentID()) == null || !UNLOCKED_CAPES.get(player.getPersistentID()).contains(capeEntry.getValue())) && + if ((UNLOCKED_CAPES.get(player.getPersistentID()) == null || + !UNLOCKED_CAPES.get(player.getPersistentID()).contains(capeEntry.getValue())) && ((EntityPlayerMP) player).getAdvancements().getProgress(capeEntry.getKey()).isDone()) { unlockCapeOnAdvancement(player, capeEntry.getKey()); } } - if (UNLOCKED_CAPES.get(player.getPersistentID()) == null || !new HashSet<>(UNLOCKED_CAPES.get(player.getPersistentID())).containsAll(FREE_CAPES)) { + if (UNLOCKED_CAPES.get(player.getPersistentID()) == null || + !new HashSet<>(UNLOCKED_CAPES.get(player.getPersistentID())).containsAll(FREE_CAPES)) { for (ResourceLocation cape : FREE_CAPES) { unlockCape(player.getPersistentID(), cape); } @@ -286,5 +301,4 @@ public static void detectNewCapes(EntityPlayer player) { } } } - } diff --git a/src/main/java/gregtech/api/util/ClipboardUtil.java b/src/main/java/gregtech/api/util/ClipboardUtil.java index 31215ca1508..07736bd68e2 100755 --- a/src/main/java/gregtech/api/util/ClipboardUtil.java +++ b/src/main/java/gregtech/api/util/ClipboardUtil.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.core.network.packets.PacketClipboard; + import net.minecraft.entity.player.EntityPlayerMP; import java.awt.*; diff --git a/src/main/java/gregtech/api/util/CustomModPriorityComparator.java b/src/main/java/gregtech/api/util/CustomModPriorityComparator.java index 5424a8e2605..6bc173b2754 100644 --- a/src/main/java/gregtech/api/util/CustomModPriorityComparator.java +++ b/src/main/java/gregtech/api/util/CustomModPriorityComparator.java @@ -22,19 +22,18 @@ public int compare(ItemAndMetadata first, ItemAndMetadata second) { int firstModIndex = modPriorityList.indexOf(firstModId); int secondModIndex = modPriorityList.indexOf(secondModId); if (firstModIndex == -1 && secondModIndex == -1) { - //if both mod ids are not in mod priority list, compare them alphabetically + // if both mod ids are not in mod priority list, compare them alphabetically return firstModId.compareTo(secondModId); } else if (firstModIndex == -1) { - //if first mod is not in priority list, it has lower priority than second + // if first mod is not in priority list, it has lower priority than second return -1; } else if (secondModIndex == -1) { - //if second mod is not in priority list, it has lower priority than first + // if second mod is not in priority list, it has lower priority than first return 1; } else { - //otherwise, both mods are in priority list, so compare their indexes - //we invert compare arguments, because lower index should have higher priority + // otherwise, both mods are in priority list, so compare their indexes + // we invert compare arguments, because lower index should have higher priority return Integer.compare(secondModIndex, firstModIndex); } } - } diff --git a/src/main/java/gregtech/api/util/DummyContainer.java b/src/main/java/gregtech/api/util/DummyContainer.java index 1f2f4fa66d7..5b523937c90 100644 --- a/src/main/java/gregtech/api/util/DummyContainer.java +++ b/src/main/java/gregtech/api/util/DummyContainer.java @@ -7,16 +7,13 @@ public class DummyContainer extends Container { - public DummyContainer() { - } + public DummyContainer() {} @Override - public void detectAndSendChanges() { - } + public void detectAndSendChanges() {} @Override public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { return true; } - } diff --git a/src/main/java/gregtech/api/util/DyeUtil.java b/src/main/java/gregtech/api/util/DyeUtil.java index 5573c840a45..372ef625b18 100644 --- a/src/main/java/gregtech/api/util/DyeUtil.java +++ b/src/main/java/gregtech/api/util/DyeUtil.java @@ -36,23 +36,40 @@ public static EnumDyeColor determineDyeColor(int rgbColor) { @Nonnull public static String getOredictColorName(@Nonnull EnumDyeColor dyeColor) { switch (dyeColor) { - case WHITE: return "dyeWhite"; - case ORANGE: return "dyeOrange"; - case MAGENTA: return "dyeMagenta"; - case LIGHT_BLUE: return "dyeLightBlue"; - case YELLOW: return "dyeYellow"; - case LIME: return "dyeLime"; - case PINK: return "dyePink"; - case GRAY: return "dyeGray"; - case SILVER: return "dyeLightGray"; - case CYAN: return "dyeCyan"; - case PURPLE: return "dyePurple"; - case BLUE: return "dyeBlue"; - case BROWN: return "dyeBrown"; - case GREEN: return "dyeGreen"; - case RED: return "dyeRed"; - case BLACK: return "dyeBlack"; - default: throw new IllegalStateException("Unreachable"); + case WHITE: + return "dyeWhite"; + case ORANGE: + return "dyeOrange"; + case MAGENTA: + return "dyeMagenta"; + case LIGHT_BLUE: + return "dyeLightBlue"; + case YELLOW: + return "dyeYellow"; + case LIME: + return "dyeLime"; + case PINK: + return "dyePink"; + case GRAY: + return "dyeGray"; + case SILVER: + return "dyeLightGray"; + case CYAN: + return "dyeCyan"; + case PURPLE: + return "dyePurple"; + case BLUE: + return "dyeBlue"; + case BROWN: + return "dyeBrown"; + case GREEN: + return "dyeGreen"; + case RED: + return "dyeRed"; + case BLACK: + return "dyeBlack"; + default: + throw new IllegalStateException("Unreachable"); } } } diff --git a/src/main/java/gregtech/api/util/EntityDamageUtil.java b/src/main/java/gregtech/api/util/EntityDamageUtil.java index 9263e39e572..48322611ece 100644 --- a/src/main/java/gregtech/api/util/EntityDamageUtil.java +++ b/src/main/java/gregtech/api/util/EntityDamageUtil.java @@ -2,6 +2,7 @@ import gregtech.api.damagesources.DamageSources; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.monster.*; @@ -25,7 +26,8 @@ public class EntityDamageUtil { * @param multiplier the multiplier on the damage taken * @param maximum the maximum damage to apply to the entity, use -1 for no maximum */ - public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int temperature, float multiplier, int maximum) { + public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int temperature, float multiplier, + int maximum) { if (temperature > 320) { int damage = (int) ((multiplier * (temperature - 300)) / 50.0F); if (maximum > 0) { @@ -50,7 +52,8 @@ public static void applyHeatDamage(@Nonnull EntityLivingBase entity, int damage) if (damage <= 0) return; if (!entity.isEntityAlive()) return; // fire/lava mobs cannot be burned - if (entity instanceof EntityBlaze || entity instanceof EntityMagmaCube || entity instanceof EntityWitherSkeleton || entity instanceof EntityWither) + if (entity instanceof EntityBlaze || entity instanceof EntityMagmaCube || + entity instanceof EntityWitherSkeleton || entity instanceof EntityWither) return; // fire resistance entities cannot be burned if (entity.getActivePotionEffect(MobEffects.FIRE_RESISTANCE) != null) return; diff --git a/src/main/java/gregtech/api/util/FileUtility.java b/src/main/java/gregtech/api/util/FileUtility.java index 7f6e82d2ede..f9015755416 100644 --- a/src/main/java/gregtech/api/util/FileUtility.java +++ b/src/main/java/gregtech/api/util/FileUtility.java @@ -1,8 +1,9 @@ package gregtech.api.util; +import gregtech.api.worldgen.config.WorldGenRegistry; + import com.google.gson.*; import com.google.gson.stream.JsonReader; -import gregtech.api.worldgen.config.WorldGenRegistry; import org.apache.commons.io.IOUtils; import java.io.*; @@ -10,8 +11,8 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.nio.file.FileSystem; import java.nio.file.*; +import java.nio.file.FileSystem; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; @@ -20,12 +21,12 @@ import java.util.stream.Stream; public class FileUtility { + public static final JsonParser jsonParser = new JsonParser(); public static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); private static final Pattern UNDERSCORE_REGEX = Pattern.compile("_"); - private FileUtility() { - } + private FileUtility() {} public static String readInputStream(InputStream inputStream) throws IOException { byte[] streamData = IOUtils.toByteArray(inputStream); @@ -73,7 +74,7 @@ public static JsonElement loadJson(File file) { public static boolean saveJson(File file, JsonElement element) { try { if (!file.getParentFile().isDirectory()) { - if (!file.getParentFile().mkdirs()){ + if (!file.getParentFile().mkdirs()) { GTLog.logger.error("Failed to create file dirs on path {}", file); } } @@ -87,7 +88,7 @@ public static boolean saveJson(File file, JsonElement element) { return false; } - public static void extractJarFiles(String resource, File targetPath, boolean replace) { //terminal/guide + public static void extractJarFiles(String resource, File targetPath, boolean replace) { // terminal/guide FileSystem zipFileSystem = null; try { URL sampleUrl = WorldGenRegistry.class.getResource("/assets/gregtech/.gtassetsroot"); @@ -127,17 +128,14 @@ public static void extractJarFiles(String resource, File targetPath, boolean rep throw new RuntimeException(impossible); } catch (IOException exception) { GTLog.logger.error("error while extracting jar files: {} {}", resource, targetPath, exception); - } - finally { + } finally { if (zipFileSystem != null) { - //close zip file system to avoid issues + // close zip file system to avoid issues IOUtils.closeQuietly(zipFileSystem); } } - } - /** * Takes a file path to a json file and trims the path down to the actual file name * Replaces all _ in the file name with spaces and capitalizes the file name @@ -149,17 +147,17 @@ public static String trimFileName(String name) { // this method is passed deposit names, which need to be converted first name = slashToNativeSep(name); - //Remove the leading "folderName\" + // Remove the leading "folderName\" String[] tempName = name.split(Matcher.quoteReplacement(File.separator)); - //Take the last entry in case of nested folders + // Take the last entry in case of nested folders String newName = tempName[tempName.length - 1]; - //Remove the ".json" + // Remove the ".json" tempName = newName.split("\\."); - //Take the first entry + // Take the first entry newName = tempName[0]; - //Replace all "_" with a space + // Replace all "_" with a space newName = UNDERSCORE_REGEX.matcher(newName).replaceAll(" "); - //Capitalize the first letter + // Capitalize the first letter newName = newName.substring(0, 1).toUpperCase() + newName.substring(1); return newName; diff --git a/src/main/java/gregtech/api/util/FluidTooltipUtil.java b/src/main/java/gregtech/api/util/FluidTooltipUtil.java index 7def7126b70..b73b335e162 100644 --- a/src/main/java/gregtech/api/util/FluidTooltipUtil.java +++ b/src/main/java/gregtech/api/util/FluidTooltipUtil.java @@ -2,11 +2,13 @@ import gregtech.api.fluids.GTFluid; import gregtech.api.unification.material.Material; + import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import java.util.*; diff --git a/src/main/java/gregtech/api/util/GTControlledRegistry.java b/src/main/java/gregtech/api/util/GTControlledRegistry.java index 0495b4ffb0f..5c605758e97 100644 --- a/src/main/java/gregtech/api/util/GTControlledRegistry.java +++ b/src/main/java/gregtech/api/util/GTControlledRegistry.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.GTValues; + import net.minecraft.util.registry.RegistryNamespaced; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -58,8 +59,9 @@ public void register(int id, @Nonnull K key, @Nonnull V value) { V objectWithId = getObjectById(id); if (objectWithId != null) { - throw new IllegalArgumentException(String.format("Tried to reassign id %d to %s (%s), but it is already assigned to %s (%s)!", - id, value, key, objectWithId, getNameForObject(objectWithId))); + throw new IllegalArgumentException( + String.format("Tried to reassign id %d to %s (%s), but it is already assigned to %s (%s)!", + id, value, key, objectWithId, getNameForObject(objectWithId))); } underlyingIntegerMap.put(value, id); } diff --git a/src/main/java/gregtech/api/util/GTHashMaps.java b/src/main/java/gregtech/api/util/GTHashMaps.java index 430e2ad8439..32f4a49185c 100644 --- a/src/main/java/gregtech/api/util/GTHashMaps.java +++ b/src/main/java/gregtech/api/util/GTHashMaps.java @@ -1,20 +1,23 @@ package gregtech.api.util; import gregtech.api.recipes.FluidKey; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import java.util.Collection; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; + public final class GTHashMaps { private GTHashMaps() {} @@ -54,7 +57,8 @@ public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inp } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory @@ -65,14 +69,16 @@ public static Object2IntMap fromItemStackCollection(@Nonnull Iterable } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @param linked If the Map should be a Linked Map to preserve insertion order * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ @Nonnull - public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs, boolean linked) { + public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs, + boolean linked) { final Object2IntMap map = createItemStackMap(linked); // Create a single stack of the combined count for each item @@ -96,7 +102,8 @@ private static Object2IntMap createItemStackMap(boolean linked) { * Maps all fluids in the {@link IFluidHandler} into a {@link FluidKey}, {@link Integer} value as amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidHandler} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidHandler(IFluidHandler fluidInputs) { final Object2IntMap map = new Object2IntLinkedOpenHashMap<>(); @@ -115,10 +122,12 @@ public static Map fromFluidHandler(IFluidHandler fluidInputs) } /** - * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as amount + * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as + * amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidHandler} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidCollection(Collection fluidInputs) { final Object2IntMap map = new Object2IntLinkedOpenHashMap<>(); diff --git a/src/main/java/gregtech/api/util/GTLog.java b/src/main/java/gregtech/api/util/GTLog.java index b2611c23a81..56a003fde5b 100644 --- a/src/main/java/gregtech/api/util/GTLog.java +++ b/src/main/java/gregtech/api/util/GTLog.java @@ -11,6 +11,5 @@ public class GTLog { public static Logger logger = LogManager.getLogger("GregTech"); - private GTLog() { - } + private GTLog() {} } diff --git a/src/main/java/gregtech/api/util/GTStringUtils.java b/src/main/java/gregtech/api/util/GTStringUtils.java index 01cf73fc942..615bd9704c5 100644 --- a/src/main/java/gregtech/api/util/GTStringUtils.java +++ b/src/main/java/gregtech/api/util/GTStringUtils.java @@ -11,6 +11,7 @@ import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; import gregtech.common.items.MetaItems; + import net.minecraft.block.Block; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; @@ -30,7 +31,8 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { if (metaItem instanceof MetaPrefixItem metaPrefixItem) { Material material = metaPrefixItem.getMaterial(stack); OrePrefix orePrefix = metaPrefixItem.getOrePrefix(); - return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + stack.getCount(); + return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + + stack.getCount(); } } else { if (MetaItems.INTEGRATED_CIRCUIT.isItemEqual(stack)) { @@ -61,8 +63,9 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { return "(MetaBlock) " + id + " * " + stack.getCount(); } } - //noinspection ConstantConditions - return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + stack.getItemDamage() + ")"; + // noinspection ConstantConditions + return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + + stack.getItemDamage() + ")"; } /** @@ -89,7 +92,7 @@ public static String ticksToElapsedTime(int ticks) { int seconds = ticks / 20; int minutes = seconds / 60; seconds = seconds % 60; - //noinspection StringConcatenationMissingWhitespace + // noinspection StringConcatenationMissingWhitespace return seconds < 10 ? minutes + ":0" + seconds : minutes + ":" + seconds; } @@ -102,13 +105,12 @@ public static String ticksToElapsedTime(int ticks) { * @param maxLength The maximum width of the String */ public static void drawCenteredStringWithCutoff(String stringToDraw, FontRenderer fontRenderer, int maxLength) { - - //Account for really long names + // Account for really long names if (fontRenderer.getStringWidth(stringToDraw) > maxLength) { stringToDraw = fontRenderer.trimStringToWidth(stringToDraw, maxLength - 3, false) + "..."; } - //Ensure that the string is centered + // Ensure that the string is centered int startPosition = (maxLength - fontRenderer.getStringWidth(stringToDraw)) / 2; fontRenderer.drawString(stringToDraw, startPosition, 1, 0x111111); diff --git a/src/main/java/gregtech/api/util/GTTeleporter.java b/src/main/java/gregtech/api/util/GTTeleporter.java index 3520bcb3d36..02ac311bd40 100644 --- a/src/main/java/gregtech/api/util/GTTeleporter.java +++ b/src/main/java/gregtech/api/util/GTTeleporter.java @@ -6,6 +6,7 @@ import net.minecraft.world.WorldServer; public class GTTeleporter extends Teleporter { + private final WorldServer worldServerInstance; private final double x, y, z; diff --git a/src/main/java/gregtech/api/util/GTTransferUtils.java b/src/main/java/gregtech/api/util/GTTransferUtils.java index eec4eefdeda..cc5fc6b8b10 100644 --- a/src/main/java/gregtech/api/util/GTTransferUtils.java +++ b/src/main/java/gregtech/api/util/GTTransferUtils.java @@ -1,9 +1,7 @@ package gregtech.api.util; import gregtech.api.capability.IMultipleTankHandler; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidActionResult; import net.minecraftforge.fluids.FluidStack; @@ -14,21 +12,28 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class GTTransferUtils { public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler) { return transferFluids(sourceHandler, destHandler, Integer.MAX_VALUE, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, int transferLimit) { + public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, + int transferLimit) { return transferFluids(sourceHandler, destHandler, transferLimit, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, int transferLimit, @Nonnull Predicate fluidFilter) { + public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, + int transferLimit, @Nonnull Predicate fluidFilter) { int fluidLeftToTransfer = transferLimit; for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { @@ -60,7 +65,8 @@ public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull return transferLimit - fluidLeftToTransfer; } - public static boolean transferExactFluidStack(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, FluidStack fluidStack) { + public static boolean transferExactFluidStack(@Nonnull IFluidHandler sourceHandler, + @Nonnull IFluidHandler destHandler, FluidStack fluidStack) { int amount = fluidStack.amount; FluidStack sourceFluid = sourceHandler.drain(fluidStack, false); if (sourceFluid == null || sourceFluid.amount != amount) { @@ -94,7 +100,8 @@ public static void moveInventoryItems(IItemHandler sourceInventory, IItemHandler /** * Simulates the insertion of items into a target inventory, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -130,7 +137,8 @@ public static boolean addItemsToItemHandler(final IItemHandler handler, /** * Simulates the insertion of fluid into a target fluid handler, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -217,15 +225,18 @@ public static ItemStack insertToEmpty(IItemHandler handler, ItemStack stack, boo } // TODO try to remove this one day - public static void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler, IItemHandlerModifiable itemHandler, int inputSlot, int outputSlot) { + public static void fillInternalTankFromFluidContainer(IFluidHandler fluidHandler, + IItemHandlerModifiable itemHandler, int inputSlot, + int outputSlot) { ItemStack inputContainerStack = itemHandler.extractItem(inputSlot, 1, true); - FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, + null, false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (ItemStack.areItemStacksEqual(inputContainerStack, remainingItem)) - return; //do not fill if item stacks match + return; // do not fill if item stacks match if (!remainingItem.isEmpty() && !itemHandler.insertItem(outputSlot, remainingItem, true).isEmpty()) - return; //do not fill if can't put remaining item + return; // do not fill if can't put remaining item FluidUtil.tryEmptyContainer(inputContainerStack, fluidHandler, Integer.MAX_VALUE, null, true); itemHandler.extractItem(inputSlot, 1, false); itemHandler.insertItem(outputSlot, remainingItem, false); diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index b5daa38c18c..2db721ce4af 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.MachineItemBlock; @@ -18,7 +17,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; + import net.minecraft.block.BlockRedstoneWire; import net.minecraft.block.BlockSnow; import net.minecraft.block.material.MapColor; @@ -52,18 +51,22 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.function.BooleanSupplier; import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.V; public class GTUtility { @@ -76,8 +79,8 @@ public static String[] mapToString(T[] array, Function mapper) { return result; } - //just because CCL uses a different color format - //0xRRGGBBAA + // just because CCL uses a different color format + // 0xRRGGBBAA public static int convertRGBtoOpaqueRGBA_CL(int colorValue) { return convertRGBtoRGBA_CL(colorValue, 255); } @@ -90,7 +93,7 @@ public static int convertOpaqueRGBA_CLtoRGB(int colorAlpha) { return colorAlpha >>> 8; } - //0xAARRGGBB + // 0xAARRGGBB public static int convertRGBtoOpaqueRGBA_MC(int colorValue) { return convertRGBtoOpaqueRGBA_MC(colorValue, 255); } @@ -119,24 +122,25 @@ public static int convertRGBtoARGB(int colorValue, int opacity) { */ public static boolean mergeItemStack(ItemStack itemStack, List slots, boolean simulate) { if (itemStack.isEmpty()) - return false; //if we are merging empty stack, return + return false; // if we are merging empty stack, return boolean merged = false; - //iterate non-empty slots first - //to try to insert stack into them + // iterate non-empty slots first + // to try to insert stack into them for (Slot slot : slots) { if (!slot.isItemValid(itemStack)) - continue; //if itemstack cannot be placed into that slot, continue + continue; // if itemstack cannot be placed into that slot, continue ItemStack stackInSlot = slot.getStack(); if (!ItemStack.areItemsEqual(itemStack, stackInSlot) || !ItemStack.areItemStackTagsEqual(itemStack, stackInSlot)) - continue; //if itemstacks don't match, continue + continue; // if itemstacks don't match, continue int slotMaxStackSize = Math.min(stackInSlot.getMaxStackSize(), slot.getItemStackLimit(stackInSlot)); int amountToInsert = Math.min(itemStack.getCount(), slotMaxStackSize - stackInSlot.getCount()); - // Need to check <= 0 for the PA, which could have this value negative due to slot limits in the Machine Access Interface + // Need to check <= 0 for the PA, which could have this value negative due to slot limits in the Machine + // Access Interface if (amountToInsert <= 0) - continue; //if we can't insert anything, continue - //shrink our stack, grow slot's stack and mark slot as changed + continue; // if we can't insert anything, continue + // shrink our stack, grow slot's stack and mark slot as changed if (!simulate) { stackInSlot.grow(amountToInsert); } @@ -144,27 +148,27 @@ public static boolean mergeItemStack(ItemStack itemStack, List slots, bool slot.onSlotChanged(); merged = true; if (itemStack.isEmpty()) - return true; //if we inserted all items, return + return true; // if we inserted all items, return } - //then try to insert itemstack into empty slots - //breaking it into pieces if needed + // then try to insert itemstack into empty slots + // breaking it into pieces if needed for (Slot slot : slots) { if (!slot.isItemValid(itemStack)) - continue; //if itemstack cannot be placed into that slot, continue + continue; // if itemstack cannot be placed into that slot, continue if (slot.getHasStack()) - continue; //if slot contains something, continue + continue; // if slot contains something, continue int amountToInsert = Math.min(itemStack.getCount(), slot.getItemStackLimit(itemStack)); if (amountToInsert == 0) - continue; //if we can't insert anything, continue - //split our stack and put result in slot + continue; // if we can't insert anything, continue + // split our stack and put result in slot ItemStack stackInSlot = itemStack.splitStack(amountToInsert); if (!simulate) { slot.putStack(stackInSlot); } merged = true; if (itemStack.isEmpty()) - return true; //if we inserted all items, return + return true; // if we inserted all items, return } return merged; } @@ -202,7 +206,7 @@ public static void readItems(IItemHandlerModifiable handler, String tagName, NBT * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser or equal than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { int low = 0, high = array.length - 1; @@ -222,7 +226,7 @@ public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesser(@Nonnull long[] array, long value) { int low = 0, high = array.length - 1; @@ -240,8 +244,8 @@ public static int nearestLesser(@Nonnull long[] array, long value) { /** * @return Lowest tier of the voltage that can handle {@code voltage}; that is, - * a voltage with value greater than equal than {@code voltage}. If there's no - * tier that can handle it, {@code MAX} is returned. + * a voltage with value greater than equal than {@code voltage}. If there's no + * tier that can handle it, {@code MAX} is returned. */ public static byte getTierByVoltage(long voltage) { return (byte) Math.min(GTValues.MAX, nearestLesser(V, voltage) + 1); @@ -251,7 +255,7 @@ public static byte getTierByVoltage(long voltage) { * Ex: This method turns both 1024 and 512 into HV. * * @return the highest voltage tier with value below or equal to {@code voltage}, or - * {@code ULV} if there's no tier below + * {@code ULV} if there's no tier below */ public static byte getFloorTierByVoltage(long voltage) { return (byte) Math.max(GTValues.ULV, nearestLesserOrEqual(V, voltage)); @@ -259,7 +263,8 @@ public static byte getFloorTierByVoltage(long voltage) { @SuppressWarnings("deprecation") public static BiomeDictionary.Type getBiomeTypeTagByName(String name) { - Map byName = ReflectionHelper.getPrivateValue(BiomeDictionary.Type.class, null, "byName"); + Map byName = ReflectionHelper.getPrivateValue(BiomeDictionary.Type.class, null, + "byName"); return byName.get(name); } @@ -370,10 +375,11 @@ public static EnumFacing getFacingToNeighbor(@NotNull BlockPos main, @NotNull Bl /** * @return a list of itemstack linked with given item handler - * modifications in list will reflect on item handler and wise-versa + * modifications in list will reflect on item handler and wise-versa */ public static List itemHandlerToList(IItemHandlerModifiable inputs) { return new AbstractList() { + @Override public ItemStack set(int index, ItemStack element) { ItemStack oldStack = inputs.getStackInSlot(index); @@ -395,11 +401,12 @@ public int size() { /** * @return a list of fluidstack linked with given fluid handler - * modifications in list will reflect on fluid handler and wise-versa + * modifications in list will reflect on fluid handler and wise-versa */ public static List fluidHandlerToList(IMultipleTankHandler fluidInputs) { List backedList = fluidInputs.getFluidTanks(); return new AbstractList() { + @Override public FluidStack set(int index, FluidStack element) { IFluidTank fluidTank = backedList.get(index).getDelegate(); @@ -533,7 +540,8 @@ public static boolean arePosEqual(BlockPos pos1, BlockPos pos2) { return pos1.getX() == pos2.getX() & pos1.getY() == pos2.getY() & pos1.getZ() == pos2.getZ(); } - public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, @Nullable Predicate canPlaceCover) { + public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, + @Nullable Predicate canPlaceCover) { Item item = itemStack.getItem(); if (item instanceof MetaItem) { MetaItem metaItem = (MetaItem) itemStack.getItem(); @@ -602,9 +610,11 @@ public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable Boolean *

* This function is meant for use with generators */ - public static final Function steamGeneratorTankSizeFunction = tier -> Math.min(16000 * (1 << (tier - 1)), 64000); + public static final Function steamGeneratorTankSizeFunction = tier -> Math + .min(16000 * (1 << (tier - 1)), 64000); - public static final Function genericGeneratorTankSizeFunction = tier -> Math.min(4000 * (1 << (tier - 1)), 16000); + public static final Function genericGeneratorTankSizeFunction = tier -> Math + .min(4000 * (1 << (tier - 1)), 16000); public static ItemStack toItem(IBlockState state) { return toItem(state, 1); @@ -640,16 +650,18 @@ public static boolean isMachineValidForMachineHatch(ItemStack machineStack, Stri } /** - * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and numbers. + * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maragingSteel300" -> "maraging_steel_300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maragingSteel300" -> "maraging_steel_300" */ public static String toLowerCaseUnderscore(String string) { StringBuilder result = new StringBuilder(); for (int i = 0; i < string.length(); i++) { - if (i != 0 && (Character.isUpperCase(string.charAt(i)) || ( - Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) + if (i != 0 && (Character.isUpperCase(string.charAt(i)) || + (Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) result.append("_"); result.append(Character.toLowerCase(string.charAt(i))); } @@ -657,10 +669,12 @@ public static String toLowerCaseUnderscore(String string) { } /** - * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before numbers. + * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maraging_steel_300" -> "maragingSteel300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maraging_steel_300" -> "maragingSteel300" */ public static String lowerUnderscoreToUpperCamel(String string) { StringBuilder result = new StringBuilder(); @@ -749,7 +763,8 @@ public static boolean isBlockSnow(@Nonnull IBlockState blockState) { * * @return true if the passed IBlockState was valid snow block */ - public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean playSound) { + public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, + boolean playSound) { boolean success = false; if (state.getBlock() == Blocks.SNOW) { world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, 7)); @@ -759,13 +774,15 @@ public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, if (layers == 1) { world.destroyBlock(pos, false); } else { - world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, layers - 1)); + world.setBlockState(pos, + Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, layers - 1)); } success = true; } if (success && playSound) { - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_LAVA_EXTINGUISH, + SoundCategory.BLOCKS, 1.0f, 1.0f); } return success; @@ -806,7 +823,8 @@ public static FluidStack getFluidFromContainer(Object ingredient) { return (FluidStack) ingredient; } else if (ingredient instanceof ItemStack) { ItemStack itemStack = (ItemStack) ingredient; - IFluidHandlerItem fluidHandler = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandler = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandler != null) return fluidHandler.drain(Integer.MAX_VALUE, false); } diff --git a/src/main/java/gregtech/api/util/GradientUtil.java b/src/main/java/gregtech/api/util/GradientUtil.java index 35dba0b6665..def37c80c42 100644 --- a/src/main/java/gregtech/api/util/GradientUtil.java +++ b/src/main/java/gregtech/api/util/GradientUtil.java @@ -6,8 +6,7 @@ public class GradientUtil { - private GradientUtil() { - } + private GradientUtil() {} public static Pair getGradient(Color rgb, int luminanceDifference) { float[] hsl = RGBtoHSL(rgb); @@ -64,7 +63,7 @@ public static float[] RGBtoHSL(Color rgbColor) { s = (max - min) / (2 - max - min); } - return new float[] {h, s * 100, l * 100}; + return new float[] { h, s * 100, l * 100 }; } public static Color toRGB(float[] hsv) { @@ -109,10 +108,10 @@ private static float hueToRGB(float p, float q, float h) { return p + ((q - p) * 6 * h); } if (2 * h < 1) { - return q; + return q; } if (3 * h < 2) { - return p + ( (q - p) * 6 * ((2.0F / 3.0F) - h) ); + return p + ((q - p) * 6 * ((2.0F / 3.0F) - h)); } return p; } diff --git a/src/main/java/gregtech/api/util/GregFakePlayer.java b/src/main/java/gregtech/api/util/GregFakePlayer.java index fc903ccc85b..672f8be98dc 100644 --- a/src/main/java/gregtech/api/util/GregFakePlayer.java +++ b/src/main/java/gregtech/api/util/GregFakePlayer.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import com.mojang.authlib.GameProfile; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -16,12 +15,15 @@ import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.common.FMLCommonHandler; +import com.mojang.authlib.GameProfile; + import java.lang.ref.WeakReference; import java.util.UUID; public class GregFakePlayer extends EntityPlayer { - private static final GameProfile GREGTECH = new GameProfile(UUID.fromString("518FDF18-EC2A-4322-832A-58ED1721309B"), "[GregTech]"); + private static final GameProfile GREGTECH = new GameProfile(UUID.fromString("518FDF18-EC2A-4322-832A-58ED1721309B"), + "[GregTech]"); private static WeakReference GREGTECH_PLAYER = null; public static FakePlayer get(WorldServer world) { @@ -58,20 +60,16 @@ public boolean canUseCommand(int i, String s) { } @Override - public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar) { - } + public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar) {} @Override - public void sendMessage(ITextComponent component) { - } + public void sendMessage(ITextComponent component) {} @Override - public void addStat(StatBase par1StatBase, int par2) { - } + public void addStat(StatBase par1StatBase, int par2) {} @Override - public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { - } + public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) {} @Override public boolean isEntityInvulnerable(DamageSource source) { @@ -100,5 +98,5 @@ public MinecraftServer getServer() { } @Override - protected void playEquipSound(ItemStack stack) { } + protected void playEquipSound(ItemStack stack) {} } diff --git a/src/main/java/gregtech/api/util/IBlockOre.java b/src/main/java/gregtech/api/util/IBlockOre.java index 5e3eb65b67c..936a31d3569 100644 --- a/src/main/java/gregtech/api/util/IBlockOre.java +++ b/src/main/java/gregtech/api/util/IBlockOre.java @@ -1,10 +1,10 @@ package gregtech.api.util; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.state.IBlockState; public interface IBlockOre { IBlockState getOreBlock(StoneType stoneType); - } diff --git a/src/main/java/gregtech/api/util/IDirtyNotifiable.java b/src/main/java/gregtech/api/util/IDirtyNotifiable.java index 98164a0b11c..cdb6b4299c9 100644 --- a/src/main/java/gregtech/api/util/IDirtyNotifiable.java +++ b/src/main/java/gregtech/api/util/IDirtyNotifiable.java @@ -1,5 +1,6 @@ package gregtech.api.util; public interface IDirtyNotifiable { + void markAsDirty(); } diff --git a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java index d2124ee7ca8..ab6e355007f 100644 --- a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java +++ b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java @@ -1,16 +1,19 @@ package gregtech.api.util; -import it.unimi.dsi.fastutil.Hash; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.Hash; + import java.util.Objects; +import javax.annotation.Nonnull; + public interface IFluidTankPropertiesHashStrategy extends Hash.Strategy { @Nonnull static IFluidTankPropertiesHashStrategy create() { return new IFluidTankPropertiesHashStrategy() { + @Override public int hashCode(IFluidTankProperties o) { int result = 17; @@ -27,7 +30,6 @@ public boolean equals(IFluidTankProperties a, IFluidTankProperties b) { if (b == null || a.getClass() != b.getClass()) return false; return a.getCapacity() == b.getCapacity() && a.canFill() == b.canFill() && a.canDrain() == b.canDrain() && Objects.equals(a.getContents(), b.getContents()); - } }; } diff --git a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java index d84e94bdc9d..69adc4575a3 100644 --- a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java +++ b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java @@ -1,16 +1,19 @@ package gregtech.api.util; -import it.unimi.dsi.fastutil.Hash; import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.Hash; + import java.util.Objects; +import javax.annotation.Nullable; + /** * A configurable generator of hashing strategies, allowing for consideration of select properties of ItemStacks when * considering equality. */ public interface ItemStackHashStrategy extends Hash.Strategy { + /** * @return a builder object for producing a custom ItemStackHashStrategy. */ @@ -55,6 +58,7 @@ static ItemStackHashStrategy comparingItemDamageCount() { * Builder pattern class for generating customized ItemStackHashStrategy */ class ItemStackHashStrategyBuilder { + private boolean item, count, damage, tag; /** @@ -106,14 +110,14 @@ public ItemStackHashStrategyBuilder compareTag(boolean choice) { */ public ItemStackHashStrategy build() { return new ItemStackHashStrategy() { + @Override public int hashCode(@Nullable ItemStack o) { return o == null || o.isEmpty() ? 0 : Objects.hash( item ? o.getItem() : null, count ? o.getCount() : null, damage ? o.getItemDamage() : null, - tag ? o.getTagCompound() : null - ); + tag ? o.getTagCompound() : null); } @Override diff --git a/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java b/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java index ac5dd55c5c9..9c440fd7d03 100644 --- a/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java +++ b/src/main/java/gregtech/api/util/LargeStackSizeItemStackHandler.java @@ -28,7 +28,7 @@ public NBTTagCompound serializeNBT() { NBTTagCompound stackSizes = new NBTTagCompound(); NBTTagList items = tagCompound.getTagList(ITEM_LIST_TAG_KEY, 10); - //save big stack size data + // save big stack size data for (int i = 0; i < stacks.size(); i++) { ItemStack itemStack = stacks.get(i); @@ -38,7 +38,7 @@ public NBTTagCompound serializeNBT() { } tagCompound.setTag(BIG_STACK_SIZE_TAG_KEY, stackSizes); - //fix size overflow of existing item tags + // fix size overflow of existing item tags for (NBTBase itemBase : items) { NBTTagCompound item = (NBTTagCompound) itemBase; diff --git a/src/main/java/gregtech/api/util/LocalizationUtils.java b/src/main/java/gregtech/api/util/LocalizationUtils.java index e87d2437873..b4fd853c813 100644 --- a/src/main/java/gregtech/api/util/LocalizationUtils.java +++ b/src/main/java/gregtech/api/util/LocalizationUtils.java @@ -3,9 +3,10 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.util.regex.Pattern; +import javax.annotation.Nonnull; + @SuppressWarnings("deprecation") public class LocalizationUtils { @@ -13,12 +14,16 @@ public class LocalizationUtils { /** * This function calls {@link net.minecraft.client.resources.I18n#format(String, Object...)} when called on client - * or {@link net.minecraft.util.text.translation.I18n#translateToLocalFormatted(String, Object...)} when called on server. + * or {@link net.minecraft.util.text.translation.I18n#translateToLocalFormatted(String, Object...)} when called on + * server. *

    - *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the client.
  • - *
  • For setting up translations on the server you should use {@link net.minecraft.util.text.TextComponentTranslation}.
  • - *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • - *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • + *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the + * client.
  • + *
  • For setting up translations on the server you should use + * {@link net.minecraft.util.text.TextComponentTranslation}.
  • + *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and + * there is no client/player in context.
  • + *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • *
* * @param key the localization key passed to the underlying hasKey function @@ -36,10 +41,13 @@ public static String format(String key, Object... format) { * This function calls {@link net.minecraft.client.resources.I18n#hasKey(String)} when called on client * or {@link net.minecraft.util.text.translation.I18n#canTranslate(String)} when called on server. *
    - *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the client.
  • - *
  • For setting up translations on the server you should use {@link net.minecraft.util.text.TextComponentTranslation}.
  • - *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and there is no client/player in context.
  • - *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • + *
  • It is intended that translations should be done using {@link net.minecraft.client.resources.I18n} on the + * client.
  • + *
  • For setting up translations on the server you should use + * {@link net.minecraft.util.text.TextComponentTranslation}.
  • + *
  • {@code LocalizationUtils} is only for cases where some kind of translation is required on the server and + * there is no client/player in context.
  • + *
  • {@code LocalizationUtils} is "best effort" and will probably only work properly with {@code en-us}.
  • *
* * @param key the localization key passed to the underlying hasKey function diff --git a/src/main/java/gregtech/api/util/MCGuiUtil.java b/src/main/java/gregtech/api/util/MCGuiUtil.java index 3b75ddd7bdd..5a7e53549b2 100644 --- a/src/main/java/gregtech/api/util/MCGuiUtil.java +++ b/src/main/java/gregtech/api/util/MCGuiUtil.java @@ -2,24 +2,25 @@ import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; -import javax.annotation.Nonnull; import java.util.function.Consumer; +import javax.annotation.Nonnull; + /** - * This class exists to avoid java always trying to load client classes when loading {@link gregtech.api.gui.widgets.TextFieldWidget}. + * This class exists to avoid java always trying to load client classes when loading + * {@link gregtech.api.gui.widgets.TextFieldWidget}. * Do not remove */ public class MCGuiUtil { public static GuiResponder createTextFieldResponder(Consumer onChanged) { return new GuiResponder() { + @Override - public void setEntryValue(int id, boolean value) { - } + public void setEntryValue(int id, boolean value) {} @Override - public void setEntryValue(int id, float value) { - } + public void setEntryValue(int id, float value) {} @Override public void setEntryValue(int id, @Nonnull String value) { @@ -27,6 +28,4 @@ public void setEntryValue(int id, @Nonnull String value) { } }; } - - } diff --git a/src/main/java/gregtech/api/util/ModCompatibility.java b/src/main/java/gregtech/api/util/ModCompatibility.java index df1f9900360..9881948147d 100644 --- a/src/main/java/gregtech/api/util/ModCompatibility.java +++ b/src/main/java/gregtech/api/util/ModCompatibility.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.util.world.DummyWorld; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -36,11 +37,13 @@ public static ItemStack getRealItemStack(ItemStack itemStack) { } private static class RefinedStorage { + private final Method getPatternFromCacheMethod; private final Method getOutputsMethod; public RefinedStorage(Class itemPatternClass) throws ReflectiveOperationException { - this.getPatternFromCacheMethod = itemPatternClass.getMethod("getPatternFromCache", World.class, ItemStack.class); + this.getPatternFromCacheMethod = itemPatternClass.getMethod("getPatternFromCache", World.class, + ItemStack.class); this.getOutputsMethod = getPatternFromCacheMethod.getReturnType().getMethod("getOutputs"); } diff --git a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java index 309371a0286..408117c3740 100644 --- a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java @@ -2,15 +2,17 @@ import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.IMultipleTankHandler.MultiFluidTankEntry; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Simulates consecutive fills to {@link IMultipleTankHandler} instance. */ diff --git a/src/main/java/gregtech/api/util/OverlayedItemHandler.java b/src/main/java/gregtech/api/util/OverlayedItemHandler.java index f930d5359b0..af322e9bcf3 100644 --- a/src/main/java/gregtech/api/util/OverlayedItemHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedItemHandler.java @@ -6,6 +6,7 @@ import javax.annotation.Nonnull; public class OverlayedItemHandler { + private final OverlayedItemHandlerSlot[] originalSlots; private final OverlayedItemHandlerSlot[] slots; private final IItemHandler overlayedHandler; @@ -38,7 +39,6 @@ public int getSlots() { * @param slot the slot to populate */ - private void initSlot(int slot) { if (this.originalSlots[slot] == null) { ItemStack stackToMirror = overlayedHandler.getStackInSlot(slot); @@ -48,17 +48,16 @@ private void initSlot(int slot) { } } - public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) { int lastKnownPopulatedSlot = 0; - //loop through all slots, looking for ones matching the key + // loop through all slots, looking for ones matching the key for (int i = 0; i < this.slots.length; i++) { - //populate the slot if it's not already populated + // populate the slot if it's not already populated initSlot(i); // if it's the same item or there is no item in the slot ItemStack slotKey = this.slots[i].getItemStack(); if (slotKey.isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(slotKey, stack)) { - //if the slot is not full + // if the slot is not full int canInsertUpTo = this.slots[i].getSlotLimit() - this.slots[i].getCount(); if (canInsertUpTo > 0) { int insertedAmount = Math.min(canInsertUpTo, amountToInsert); @@ -77,10 +76,10 @@ public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) // if the amountToInsert is still greater than 0, we need to insert it into a new slot if (amountToInsert > 0) { - //loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. + // loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. for (int i = lastKnownPopulatedSlot + 1; i < this.slots.length; i++) { OverlayedItemHandlerSlot slot = this.slots[i]; - //if the slot is empty + // if the slot is empty if (slot.getItemStack().isEmpty()) { int canInsertUpTo = Math.min(stack.getMaxStackSize(), slot.getSlotLimit()); if (canInsertUpTo > 0) { @@ -95,11 +94,12 @@ public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) } } } - //return the amount that wasn't inserted + // return the amount that wasn't inserted return amountToInsert; } private static class OverlayedItemHandlerSlot { + private ItemStack itemStack = ItemStack.EMPTY; private int count = 0; private int slotLimit; @@ -130,6 +130,7 @@ public int getCount() { /** * Storage of this ItemStack elsewhere will require copying it + * * @return the stored ItemStack */ @Nonnull diff --git a/src/main/java/gregtech/api/util/ParticleHandlerUtil.java b/src/main/java/gregtech/api/util/ParticleHandlerUtil.java index b143c2b3ba9..a747455456c 100644 --- a/src/main/java/gregtech/api/util/ParticleHandlerUtil.java +++ b/src/main/java/gregtech/api/util/ParticleHandlerUtil.java @@ -1,10 +1,7 @@ package gregtech.api.util; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.particle.DigIconParticle; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; import gregtech.api.GTValues; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.ParticleManager; @@ -18,10 +15,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.particle.DigIconParticle; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; + @SideOnly(Side.CLIENT) public class ParticleHandlerUtil { - public static void addBlockRunningEffects(World worldObj, Entity entity, TextureAtlasSprite atlasSprite, int spriteColor) { + public static void addBlockRunningEffects(World worldObj, Entity entity, TextureAtlasSprite atlasSprite, + int spriteColor) { if (atlasSprite == null) return; double posX = entity.posX + (GTValues.RNG.nextFloat() - 0.5) * entity.width; double posY = entity.getEntityBoundingBox().minY + 0.1; @@ -32,12 +35,14 @@ public static void addBlockRunningEffects(World worldObj, Entity entity, Texture float green = (spriteColor >> 8 & 255) / 255.0F; float blue = (spriteColor & 255) / 255.0F; - DigIconParticle digIconParticle = new DigIconParticle(worldObj, posX, posY, posZ, -entity.motionX * 4.0, 1.5, -entity.motionZ * 4.0, atlasSprite); + DigIconParticle digIconParticle = new DigIconParticle(worldObj, posX, posY, posZ, -entity.motionX * 4.0, 1.5, + -entity.motionZ * 4.0, atlasSprite); digIconParticle.setRBGColorF(red, green, blue); manager.addEffect(digIconParticle); } - public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager, int numParticles) { + public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, TextureAtlasSprite atlasSprite, + int spriteColor, ParticleManager manager, int numParticles) { if (atlasSprite == null) return; Vector3 start = entityPos.copy(); Vector3 end = start.copy().add(Vector3.down.copy().multiply(4)); @@ -53,27 +58,34 @@ public static void addBlockLandingEffects(World worldObj, Vector3 entityPos, Tex double mX = GTValues.RNG.nextGaussian() * speed; double mY = GTValues.RNG.nextGaussian() * speed; double mZ = GTValues.RNG.nextGaussian() * speed; - DigIconParticle digIconParticle = DigIconParticle.newLandingParticle(worldObj, entityPos.x, entityPos.y, entityPos.z, mX, mY, mZ, atlasSprite); + DigIconParticle digIconParticle = DigIconParticle.newLandingParticle(worldObj, entityPos.x, entityPos.y, + entityPos.z, mX, mY, mZ, atlasSprite); digIconParticle.setRBGColorF(red, green, blue); manager.addEffect(digIconParticle); } } } - public static void addBlockDestroyEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addBlockDestroyEffects(World worldObj, CuboidRayTraceResult result, + TextureAtlasSprite atlasSprite, int spriteColor, + ParticleManager manager) { addBlockDestroyEffects(worldObj, result.cuboid6, atlasSprite, spriteColor, manager); } - public static void addBlockDestroyEffects(IBlockState blockState, World worldObj, BlockPos blockPos, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addBlockDestroyEffects(IBlockState blockState, World worldObj, BlockPos blockPos, + TextureAtlasSprite atlasSprite, int spriteColor, + ParticleManager manager) { Cuboid6 cuboid6 = new Cuboid6(blockState.getBoundingBox(worldObj, blockPos)).add(blockPos); addBlockDestroyEffects(worldObj, cuboid6, atlasSprite, spriteColor, manager); } - public static void addHitEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addHitEffects(World worldObj, CuboidRayTraceResult result, TextureAtlasSprite atlasSprite, + int spriteColor, ParticleManager manager) { addBlockHitEffects(worldObj, result.cuboid6, result.sideHit, atlasSprite, spriteColor, manager); } - public static void addHitEffects(IBlockState blockState, World worldObj, RayTraceResult target, TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { + public static void addHitEffects(IBlockState blockState, World worldObj, RayTraceResult target, + TextureAtlasSprite atlasSprite, int spriteColor, ParticleManager manager) { Cuboid6 cuboid6 = getBoundingBox(blockState, worldObj, target); addBlockHitEffects(worldObj, cuboid6, target.sideHit, atlasSprite, spriteColor, manager); } @@ -86,9 +98,10 @@ private static Cuboid6 getBoundingBox(IBlockState blockState, World world, RayTr return new Cuboid6(blockState.getBoundingBox(world, blockPos)).add(blockPos); } - //Straight copied from CustomParticleHandler with color parameter added + // Straight copied from CustomParticleHandler with color parameter added - public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, int spriteColor, ParticleManager particleManager) { + public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, + int spriteColor, ParticleManager particleManager) { if (icon == null) return; float border = 0.1F; Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); @@ -127,7 +140,8 @@ public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing si particleManager.addEffect(digIconParticle); } - public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite icon, int spriteColor, ParticleManager particleManager) { + public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite icon, int spriteColor, + ParticleManager particleManager) { if (icon == null) return; Vector3 diff = bounds.max.copy().subtract(bounds.min); Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5); @@ -143,7 +157,8 @@ public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAt double x = bounds.min.x + (i + 0.5) * diff.x / density.x; double y = bounds.min.y + (j + 0.5) * diff.y / density.y; double z = bounds.min.z + (k + 0.5) * diff.z / density.z; - DigIconParticle digIconParticle = new DigIconParticle(world, x, y, z, x - center.x, y - center.y, z - center.z, icon); + DigIconParticle digIconParticle = new DigIconParticle(world, x, y, z, x - center.x, y - center.y, + z - center.z, icon); digIconParticle.setRBGColorF(red, green, blue); particleManager.addEffect(digIconParticle); } diff --git a/src/main/java/gregtech/api/util/PerTickIntCounter.java b/src/main/java/gregtech/api/util/PerTickIntCounter.java index d2041074c4e..86e08839b72 100644 --- a/src/main/java/gregtech/api/util/PerTickIntCounter.java +++ b/src/main/java/gregtech/api/util/PerTickIntCounter.java @@ -21,11 +21,11 @@ private void checkValueState(World world) { long currentWorldTime = world.getTotalWorldTime(); if (currentWorldTime != lastUpdatedWorldTime) { if (currentWorldTime == lastUpdatedWorldTime + 1) { - //last updated time is 1 tick ago, so we can move current value to last - //before resetting it to default value + // last updated time is 1 tick ago, so we can move current value to last + // before resetting it to default value this.lastValue = currentValue; } else { - //otherwise, set last value as default value + // otherwise, set last value as default value this.lastValue = defaultValue; } this.lastUpdatedWorldTime = currentWorldTime; diff --git a/src/main/java/gregtech/api/util/PositionedRect.java b/src/main/java/gregtech/api/util/PositionedRect.java index d76cec88be6..a8a7fd50cc7 100644 --- a/src/main/java/gregtech/api/util/PositionedRect.java +++ b/src/main/java/gregtech/api/util/PositionedRect.java @@ -5,6 +5,7 @@ import java.util.Objects; public class PositionedRect { + public final Position position; public final Size size; diff --git a/src/main/java/gregtech/api/util/RandomPotionEffect.java b/src/main/java/gregtech/api/util/RandomPotionEffect.java index 1b0ba5e37d7..1724a2f1816 100644 --- a/src/main/java/gregtech/api/util/RandomPotionEffect.java +++ b/src/main/java/gregtech/api/util/RandomPotionEffect.java @@ -34,5 +34,4 @@ public int hashCode() { result = 31 * result + chance; return result; } - } diff --git a/src/main/java/gregtech/api/util/RedstoneUtil.java b/src/main/java/gregtech/api/util/RedstoneUtil.java index 3341f89af61..f952e29aec9 100644 --- a/src/main/java/gregtech/api/util/RedstoneUtil.java +++ b/src/main/java/gregtech/api/util/RedstoneUtil.java @@ -9,7 +9,8 @@ public class RedstoneUtil { * @param maxValue the max that the value can be * @param minValue the min that the value can be * @param isInverted whether to invert the logic of this method - * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min and max + * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min + * and max */ public static int computeRedstoneBetweenValues(int value, float maxValue, float minValue, boolean isInverted) { if (value >= maxValue) { @@ -37,7 +38,8 @@ public static int computeRedstoneBetweenValues(int value, float maxValue, float * @param output the output value the function modifies * @return returns the modified output value */ - public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, boolean isInverted, int output) { + public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, + boolean isInverted, int output) { if (value >= maxValue) { output = !isInverted ? 0 : 15; // value above maxValue should normally be 0, otherwise 15 } else if (value <= minValue) { diff --git a/src/main/java/gregtech/api/util/RelativeDirection.java b/src/main/java/gregtech/api/util/RelativeDirection.java index 8879e39da97..1e4b2102761 100644 --- a/src/main/java/gregtech/api/util/RelativeDirection.java +++ b/src/main/java/gregtech/api/util/RelativeDirection.java @@ -124,7 +124,8 @@ public Function getSorter(EnumFacing frontFacing, EnumFacing * * @return Returns the new upwards facing. */ - public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFacing oldFrontFacing, EnumFacing upwardsFacing) { + public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFacing oldFrontFacing, + EnumFacing upwardsFacing) { if (newFrontFacing == oldFrontFacing) return upwardsFacing; EnumFacing.Axis newAxis = newFrontFacing.getAxis(); @@ -141,7 +142,8 @@ public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFac case EAST -> oldFrontFacing.rotateYCCW(); default -> oldFrontFacing.rotateY(); // WEST }; - return newFrontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == Axis.Z ? newUpwardsFacing.getOpposite() : newUpwardsFacing; + return newFrontFacing == EnumFacing.DOWN && upwardsFacing.getAxis() == Axis.Z ? + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else if (newAxis != Axis.Y) { // going from vertical to horizontal axis EnumFacing newUpwardsFacing; @@ -154,7 +156,8 @@ public static EnumFacing simulateAxisRotation(EnumFacing newFrontFacing, EnumFac } else { // rotateYCCW newUpwardsFacing = EnumFacing.EAST; } - return oldFrontFacing == EnumFacing.DOWN && newUpwardsFacing.getAxis() == Axis.Z ? newUpwardsFacing.getOpposite() : newUpwardsFacing; + return oldFrontFacing == EnumFacing.DOWN && newUpwardsFacing.getAxis() == Axis.Z ? + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else { // was on vertical axis and still is. Must have flipped from up to down or vice versa return upwardsFacing.getOpposite(); diff --git a/src/main/java/gregtech/api/util/TaskScheduler.java b/src/main/java/gregtech/api/util/TaskScheduler.java index 9b25eac1952..dfd28cf120d 100644 --- a/src/main/java/gregtech/api/util/TaskScheduler.java +++ b/src/main/java/gregtech/api/util/TaskScheduler.java @@ -2,18 +2,20 @@ import gregtech.api.GTValues; import gregtech.api.util.function.Task; + import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + @EventBusSubscriber(modid = GTValues.MODID) public class TaskScheduler { diff --git a/src/main/java/gregtech/api/util/TeleportHandler.java b/src/main/java/gregtech/api/util/TeleportHandler.java index 83aba235b38..1a5d1f4fce3 100644 --- a/src/main/java/gregtech/api/util/TeleportHandler.java +++ b/src/main/java/gregtech/api/util/TeleportHandler.java @@ -8,12 +8,11 @@ import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.common.FMLCommonHandler; -//Uses code from: -//github.com/CleanroomMC/Airlock/blob/master/src/main/java/com/cleanroommc/airlock/common/util/TeleportUtil.java +// Uses code from: +// github.com/CleanroomMC/Airlock/blob/master/src/main/java/com/cleanroommc/airlock/common/util/TeleportUtil.java public class TeleportHandler { - private TeleportHandler() { - } + private TeleportHandler() {} public static WorldServer getWorldByDimensionID(int id) { WorldServer world = DimensionManager.getWorld(id); @@ -53,7 +52,8 @@ public static void teleport(Entity teleporter, int dimension, BlockPos teleportT * @param teleportToY y position that the entity is teleporting to * @param teleportToZ z position that the entity is teleporting to */ - public static void teleport(Entity teleporter, int dimension, double teleportToX, double teleportToY, double teleportToZ) { + public static void teleport(Entity teleporter, int dimension, double teleportToX, double teleportToY, + double teleportToZ) { if (teleporter.world.isRemote || teleporter.isDead) { return; } @@ -85,7 +85,8 @@ public static void teleport(Entity teleporter, int dimension, double teleportToX * @param teleportToY y position that the entity is teleporting to * @param teleportToZ z position that the entity is teleporting to */ - public static void teleport(Entity teleporter, int dimension, ITeleporter customTeleporter, double teleportToX, double teleportToY, double teleportToZ) { + public static void teleport(Entity teleporter, int dimension, ITeleporter customTeleporter, double teleportToX, + double teleportToY, double teleportToZ) { if (teleporter.world.isRemote || teleporter.isDead) { return; } diff --git a/src/main/java/gregtech/api/util/TextFormattingUtil.java b/src/main/java/gregtech/api/util/TextFormattingUtil.java index d2e4ad4595a..00a1f5f0aea 100644 --- a/src/main/java/gregtech/api/util/TextFormattingUtil.java +++ b/src/main/java/gregtech/api/util/TextFormattingUtil.java @@ -26,7 +26,7 @@ public static String formatLongToCompactString(long value, int precision) { StringBuilder stb = new StringBuilder(); if (value < 0) { stb.append('-'); - //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here + // Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here value = value == Long.MIN_VALUE ? Long.MAX_VALUE : -value; } @@ -61,8 +61,10 @@ public static String formatNumbers(Object number) { } /** - * Formats a string to multiple lines, attempting to place a new line at the closest space from "maxLength" characters away. - * @param toFormat the string to be formatted to multiple lines. + * Formats a string to multiple lines, attempting to place a new line at the closest space from "maxLength" + * characters away. + * + * @param toFormat the string to be formatted to multiple lines. * @param maxLength the length where a newline should be placed in the nearest space. * @return a string formatted with newlines. */ diff --git a/src/main/java/gregtech/api/util/ValidationResult.java b/src/main/java/gregtech/api/util/ValidationResult.java index d60b2740421..2441dd10c02 100644 --- a/src/main/java/gregtech/api/util/ValidationResult.java +++ b/src/main/java/gregtech/api/util/ValidationResult.java @@ -1,6 +1,7 @@ package gregtech.api.util; public class ValidationResult { + private final EnumValidationResult type; private final T result; diff --git a/src/main/java/gregtech/api/util/VirtualTankRegistry.java b/src/main/java/gregtech/api/util/VirtualTankRegistry.java index 70b44ab9ac1..5fb7b52f6b0 100644 --- a/src/main/java/gregtech/api/util/VirtualTankRegistry.java +++ b/src/main/java/gregtech/api/util/VirtualTankRegistry.java @@ -1,6 +1,7 @@ package gregtech.api.util; import gregtech.api.GTValues; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.storage.MapStorage; @@ -11,15 +12,16 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class VirtualTankRegistry extends WorldSavedData { - private static final int DEFAULT_CAPACITY = 64000; //64B + private static final int DEFAULT_CAPACITY = 64000; // 64B private static final String DATA_ID = GTValues.MODID + ".vtank_data"; protected static Map> tankMap = new HashMap<>(); @@ -36,7 +38,8 @@ public VirtualTankRegistry(String name) { /** * Retrieves a tank from the registry - * @param key The name of the tank + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @return The tank object */ @@ -46,7 +49,7 @@ public static IFluidTank getTank(String key, UUID uuid) { /** * @return the internal Map of tanks. - * Do not use to modify the map! + * Do not use to modify the map! */ public static Map> getTankMap() { return tankMap; @@ -54,8 +57,9 @@ public static Map> getTankMap() { /** * Retrieves a tank from the registry, creating it if it does not exist - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param capacity The initial capacity of the tank * @return The tank object */ @@ -67,8 +71,10 @@ public static IFluidTank getTankCreate(String key, UUID uuid, int capacity) { } /** - * Retrieves a tank from the registry, creating it with {@link #DEFAULT_CAPACITY the default capacity} if it does not exist - * @param key The name of the tank + * Retrieves a tank from the registry, creating it with {@link #DEFAULT_CAPACITY the default capacity} if it does + * not exist + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @return The tank object */ @@ -78,13 +84,15 @@ public static IFluidTank getTankCreate(String key, UUID uuid) { /** * Adds a tank to the registry - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param capacity The initial capacity of the tank */ public static void addTank(String key, UUID uuid, int capacity) { - if(tankMap.containsKey(uuid) && tankMap.get(uuid).containsKey(key)) { - GTLog.logger.warn("Overwriting virtual tank " + key + "/" + (uuid == null ? "null" :uuid.toString()) + ", this might cause fluid loss!"); + if (tankMap.containsKey(uuid) && tankMap.get(uuid).containsKey(key)) { + GTLog.logger.warn("Overwriting virtual tank " + key + "/" + (uuid == null ? "null" : uuid.toString()) + + ", this might cause fluid loss!"); } else if (!tankMap.containsKey(uuid)) { tankMap.put(uuid, new HashMap<>()); } @@ -93,7 +101,8 @@ public static void addTank(String key, UUID uuid, int capacity) { /** * Adds a tank to the registry with {@link #DEFAULT_CAPACITY the default capacity} - * @param key The name of the tank + * + * @param key The name of the tank * @param uuid The uuid of the player the tank is private to, or null if the tank is public */ public static void addTank(String key, UUID uuid) { @@ -102,8 +111,9 @@ public static void addTank(String key, UUID uuid) { /** * Removes a tank from the registry. Use with caution! - * @param key The name of the tank - * @param uuid The uuid of the player the tank is private to, or null if the tank is public + * + * @param key The name of the tank + * @param uuid The uuid of the player the tank is private to, or null if the tank is public * @param removeFluid Whether to remove the tank if it has fluid in it */ public static void delTank(String key, UUID uuid, boolean removeFluid) { @@ -115,7 +125,8 @@ public static void delTank(String key, UUID uuid, boolean removeFluid) { } } } else { - GTLog.logger.warn("Attempted to delete tank " + key + "/" + (uuid == null ? "null" :uuid.toString()) + ", which does not exist!"); + GTLog.logger.warn("Attempted to delete tank " + key + "/" + (uuid == null ? "null" : uuid.toString()) + + ", which does not exist!"); } } @@ -147,7 +158,8 @@ public void readFromNBT(NBTTagCompound nbt) { NBTTagCompound tankCompound = privateTanks.getCompoundTag(key); VirtualTankRegistry.addTank(key, uuid, tankCompound.getInteger("Capacity")); if (!tankCompound.hasKey("Empty")) { - VirtualTankRegistry.getTank(key, uuid).fill(FluidStack.loadFluidStackFromNBT(tankCompound), true); + VirtualTankRegistry.getTank(key, uuid).fill(FluidStack.loadFluidStackFromNBT(tankCompound), + true); } } } @@ -158,9 +170,9 @@ public void readFromNBT(NBTTagCompound nbt) { @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setTag("Private", new NBTTagCompound()); - tankMap.forEach( (uuid, map) -> { + tankMap.forEach((uuid, map) -> { NBTTagCompound mapCompound = new NBTTagCompound(); - map.forEach( (key, tank) -> { + map.forEach((key, tank) -> { if (tank.getFluid() != null || tank.getCapacity() != DEFAULT_CAPACITY) { NBTTagCompound tankCompound = new NBTTagCompound(); tankCompound.setInteger("Capacity", tank.getCapacity()); @@ -237,14 +249,15 @@ public FluidTankInfo getInfo() { @Override public IFluidTankProperties[] getTankProperties() { if (this.tankProperties == null) { - this.tankProperties = new IFluidTankProperties[]{ new VirtualTankProperties(this) }; + this.tankProperties = new IFluidTankProperties[] { new VirtualTankProperties(this) }; } return this.tankProperties; } @Override public int fill(FluidStack fluidStack, boolean doFill) { - if (fluidStack == null || fluidStack.amount <= 0 || (this.fluid != null && !fluidStack.isFluidEqual(this.fluid))) + if (fluidStack == null || fluidStack.amount <= 0 || + (this.fluid != null && !fluidStack.isFluidEqual(this.fluid))) return 0; int fillAmt = Math.min(fluidStack.amount, this.capacity - this.getFluidAmount()); diff --git a/src/main/java/gregtech/api/util/XSTR.java b/src/main/java/gregtech/api/util/XSTR.java index 9bce78e74ce..cea25a4ced5 100644 --- a/src/main/java/gregtech/api/util/XSTR.java +++ b/src/main/java/gregtech/api/util/XSTR.java @@ -1,4 +1,5 @@ package gregtech.api.util; + /** * A subclass of java.util.random that implements the Xorshift random number * generator @@ -18,10 +19,10 @@ * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html * * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs - * http://www.elmenreich.tk - *

- * This code is released under the GNU Lesser General Public License Version 3 - * http://www.gnu.org/licenses/lgpl-3.0.txt + * http://www.elmenreich.tk + *

+ * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt */ import java.util.Random; @@ -36,12 +37,12 @@ public class XSTR extends Random { private static final long serialVersionUID = 6208727693524452904L; private long seed; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) /* - MODIFIED BY: Robotia - Modification: Implemented Random class seed generator + * MODIFIED BY: Robotia + * Modification: Implemented Random class seed generator */ /** @@ -53,13 +54,12 @@ public XSTR() { this(seedUniquifier() ^ System.nanoTime()); } - private static final AtomicLong seedUniquifier - = new AtomicLong(8682522807148012L); + private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); private static long seedUniquifier() { // L'Ecuyer, "Tables of Linear Congruential Generators of // Different Sizes and Good Lattice Structure", 1999 - for (; ; ) { + for (;;) { long current = seedUniquifier.get(); long next = current * 181783497276652981L; if (seedUniquifier.compareAndSet(current, next)) { @@ -160,7 +160,9 @@ synchronized public double nextGaussian() { * produced with (approximately) equal probability. The method * {@code nextInt(int bound)} is implemented by class {@code Random} as if * by: - *

 {@code
+     * 
+     * 
+     *  {@code
      * public int nextInt(int bound) {
      *   if (bound <= 0)
      *     throw new IllegalArgumentException("bound must be positive");
@@ -174,9 +176,11 @@ synchronized public double nextGaussian() {
      *       val = bits % bound;
      *   } while (bits - val + (bound-1) < 0);
      *   return val;
-     * }}
+ * }} + *
* - *

The hedge "approx + *

+ * The hedge "approx * imately" is used in the foregoing description only because the next * method is only approximately an unbiased source of independently chosen * bits. If it were a perfect source of randomly chosen bits, then the @@ -201,8 +205,8 @@ synchronized public double nextGaussian() { * * @param bound the upper bound (exclusive). Must be positive. * @return the next pseudorandom, uniformly distributed {@code int} value - * between zero (inclusive) and {@code bound} (exclusive) from this random - * number generator's sequence + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence * @throws IllegalArgumentException if bound is not positive * @since 1.2 */ @@ -229,10 +233,9 @@ public long nextLong() { } public void nextBytes(byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) + for (int iba = 0, lenba = bytes_arr.length; iba < lenba;) for (int rndba = nextInt(), - nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); - nba-- > 0; rndba >>= Byte.SIZE) + nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); nba-- > 0; rndba >>= Byte.SIZE) bytes_arr[iba++] = (byte) rndba; } } diff --git a/src/main/java/gregtech/api/util/function/FloatConsumer.java b/src/main/java/gregtech/api/util/function/FloatConsumer.java index 0fec67f89df..edd172332d7 100644 --- a/src/main/java/gregtech/api/util/function/FloatConsumer.java +++ b/src/main/java/gregtech/api/util/function/FloatConsumer.java @@ -4,5 +4,4 @@ public interface FloatConsumer { void apply(float value); - } diff --git a/src/main/java/gregtech/api/util/function/Task.java b/src/main/java/gregtech/api/util/function/Task.java index 906d1acab3d..d8a352542b3 100644 --- a/src/main/java/gregtech/api/util/function/Task.java +++ b/src/main/java/gregtech/api/util/function/Task.java @@ -9,5 +9,4 @@ public interface Task { * @return {@code true} if the task should be run again, otherwise {@code false} */ boolean run(); - } diff --git a/src/main/java/gregtech/api/util/function/TriConsumer.java b/src/main/java/gregtech/api/util/function/TriConsumer.java index c6787cfa328..7a240998797 100644 --- a/src/main/java/gregtech/api/util/function/TriConsumer.java +++ b/src/main/java/gregtech/api/util/function/TriConsumer.java @@ -2,5 +2,6 @@ @FunctionalInterface public interface TriConsumer { + void accept(T t, U u, S s); } diff --git a/src/main/java/gregtech/api/util/input/KeyBind.java b/src/main/java/gregtech/api/util/input/KeyBind.java index 1ef2edcfd9f..309a4d28c1c 100644 --- a/src/main/java/gregtech/api/util/input/KeyBind.java +++ b/src/main/java/gregtech/api/util/input/KeyBind.java @@ -1,8 +1,9 @@ package gregtech.api.util.input; import gregtech.api.GregTechAPI; -import gregtech.core.network.packets.PacketKeysPressed; import gregtech.api.util.GTLog; +import gregtech.core.network.packets.PacketKeysPressed; + import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; @@ -11,12 +12,12 @@ import net.minecraftforge.client.settings.KeyConflictContext; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; - import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.MutablePair; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -152,5 +153,4 @@ public boolean isKeyDown(EntityPlayer player) { return pair != null && pair.right; } } - } diff --git a/src/main/java/gregtech/api/util/interpolate/Eases.java b/src/main/java/gregtech/api/util/interpolate/Eases.java index a631c47ab13..e3c3a7f4a0a 100644 --- a/src/main/java/gregtech/api/util/interpolate/Eases.java +++ b/src/main/java/gregtech/api/util/interpolate/Eases.java @@ -3,19 +3,23 @@ import org.jetbrains.annotations.ApiStatus; public enum Eases implements IEase { + LINEAR { + @Override public float getInterpolation(float t) { return t; } }, QUAD_IN { + @Override public float getInterpolation(float t) { return t * t; } }, QUAD_IN_OUT { + @Override public float getInterpolation(float t) { if (t <= 0.5f) return 2f * t * t; @@ -24,6 +28,7 @@ public float getInterpolation(float t) { } }, QUAD_OUT { + @Override public float getInterpolation(float t) { return -t * (t - 2); diff --git a/src/main/java/gregtech/api/util/interpolate/IEase.java b/src/main/java/gregtech/api/util/interpolate/IEase.java index 86ff5a06a46..8d7b511c841 100644 --- a/src/main/java/gregtech/api/util/interpolate/IEase.java +++ b/src/main/java/gregtech/api/util/interpolate/IEase.java @@ -1,12 +1,15 @@ package gregtech.api.util.interpolate; /** - * Object representation of an easing function.

+ * Object representation of an easing function. + *

* Easing functions describe numerical change rate of values, on a timescale of {@code 0 ~ 1}. + * * @see Eases */ @FunctionalInterface public interface IEase { + /** * Get change rate of values on specific time {@code t}. * diff --git a/src/main/java/gregtech/api/util/interpolate/Interpolator.java b/src/main/java/gregtech/api/util/interpolate/Interpolator.java index 2938d381f9c..676f8413538 100644 --- a/src/main/java/gregtech/api/util/interpolate/Interpolator.java +++ b/src/main/java/gregtech/api/util/interpolate/Interpolator.java @@ -5,6 +5,7 @@ import java.util.function.Consumer; public class Interpolator implements ITickable { + private final float from; private final float to; private final int duration; @@ -18,7 +19,8 @@ public Interpolator(float from, float to, int duration, IEase ease, Consumer interpolate, Consumer callback) { + public Interpolator(float from, float to, int duration, IEase ease, Consumer interpolate, + Consumer callback) { this.from = from; this.to = to; this.duration = duration; @@ -36,7 +38,7 @@ public Interpolator start() { return this; } - public boolean isFinish(){ + public boolean isFinish() { return tick == duration; } diff --git a/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java b/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java index d12a86c8dfc..356d8a98d53 100644 --- a/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java +++ b/src/main/java/gregtech/api/util/interpolate/RGBInterpolator.java @@ -1,9 +1,11 @@ package gregtech.api.util.interpolate; import gregtech.api.util.function.TriConsumer; + import net.minecraft.util.ITickable; public class RGBInterpolator implements ITickable { + private final int speed; private float r = 255; private float g = 0; @@ -12,7 +14,8 @@ public class RGBInterpolator implements ITickable { private final TriConsumer callback; private boolean isOn = false; - public RGBInterpolator(int speed, TriConsumer interpolate, TriConsumer callback) { + public RGBInterpolator(int speed, TriConsumer interpolate, + TriConsumer callback) { this.speed = speed; this.interpolate = interpolate; this.callback = callback; diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlob.java b/src/main/java/gregtech/api/util/oreglob/OreGlob.java index 0d3470faf1c..d9138e18da8 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlob.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlob.java @@ -1,14 +1,17 @@ package gregtech.api.util.oreglob; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; + import org.jetbrains.annotations.ApiStatus; -import javax.annotation.Nonnull; import java.util.List; import java.util.Set; import java.util.function.Function; +import javax.annotation.Nonnull; + /** * Glob-like string matcher language designed for ore dictionary matching. *

@@ -80,7 +83,7 @@ public final boolean matches(@Nonnull ItemStack stack) { } /** - * Visualize this instance with standard Minecraft text formatting. Two spaces (' ') will + * Visualize this instance with standard Minecraft text formatting. Two spaces (' ') will * be used as indentation. * * @return Formatted visualization diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java index adc4b760df6..bd617fa541b 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java @@ -1,11 +1,12 @@ package gregtech.api.util.oreglob; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; +import javax.annotation.Nonnull; + /** * Builder for OreGlob instance visualization. */ @@ -54,5 +55,4 @@ public List getLines() { finishLine(); return Collections.unmodifiableList(finishedLines); } - } diff --git a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java index ddfb01ee396..71497bb8892 100644 --- a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java +++ b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java @@ -1,12 +1,13 @@ package gregtech.api.util.world; -import io.netty.util.collection.LongObjectHashMap; -import io.netty.util.collection.LongObjectMap; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; +import io.netty.util.collection.LongObjectHashMap; +import io.netty.util.collection.LongObjectMap; + import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/api/util/world/DummySaveHandler.java b/src/main/java/gregtech/api/util/world/DummySaveHandler.java index 974a1e5a5d4..f4090b7b4ec 100644 --- a/src/main/java/gregtech/api/util/world/DummySaveHandler.java +++ b/src/main/java/gregtech/api/util/world/DummySaveHandler.java @@ -12,9 +12,10 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; +import java.io.File; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.File; public class DummySaveHandler implements ISaveHandler, IPlayerFileData, IChunkLoader { @@ -25,8 +26,7 @@ public WorldInfo loadWorldInfo() { } @Override - public void checkSessionLock() { - } + public void checkSessionLock() {} @Nonnull @Override @@ -40,7 +40,6 @@ public IPlayerFileData getPlayerNBTManager() { return this; } - @Nonnull @Override public TemplateManager getStructureTemplateManager() { @@ -48,12 +47,10 @@ public TemplateManager getStructureTemplateManager() { } @Override - public void saveWorldInfoWithPlayer(@Nonnull WorldInfo worldInformation, @Nonnull NBTTagCompound tagCompound) { - } + public void saveWorldInfoWithPlayer(@Nonnull WorldInfo worldInformation, @Nonnull NBTTagCompound tagCompound) {} @Override - public void saveWorldInfo(@Nonnull WorldInfo worldInformation) { - } + public void saveWorldInfo(@Nonnull WorldInfo worldInformation) {} @Nonnull @Override @@ -67,7 +64,6 @@ public File getMapFileFromName(@Nonnull String mapName) { return null; } - @Nullable @Override public Chunk loadChunk(@Nonnull World worldIn, int x, int z) { @@ -75,20 +71,16 @@ public Chunk loadChunk(@Nonnull World worldIn, int x, int z) { } @Override - public void saveChunk(@Nonnull World worldIn, @Nonnull Chunk chunkIn) { - } + public void saveChunk(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} @Override - public void saveExtraChunkData(@Nonnull World worldIn, @Nonnull Chunk chunkIn) { - } + public void saveExtraChunkData(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} @Override - public void chunkTick() { - } + public void chunkTick() {} @Override - public void flush() { - } + public void flush() {} @Override public boolean isChunkGeneratedAt(int x, int z) { @@ -96,8 +88,7 @@ public boolean isChunkGeneratedAt(int x, int z) { } @Override - public void writePlayerData(@Nonnull EntityPlayer player) { - } + public void writePlayerData(@Nonnull EntityPlayer player) {} @Nullable @Override diff --git a/src/main/java/gregtech/api/util/world/DummyWorld.java b/src/main/java/gregtech/api/util/world/DummyWorld.java index c34e122cd3d..c59234e5141 100644 --- a/src/main/java/gregtech/api/util/world/DummyWorld.java +++ b/src/main/java/gregtech/api/util/world/DummyWorld.java @@ -23,7 +23,8 @@ public class DummyWorld extends World { public static final DummyWorld INSTANCE = new DummyWorld(); public DummyWorld() { - super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), new Profiler(), false); + super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), + new Profiler(), false); // Guarantee the dimension ID was not reset by the provider this.provider.setDimension(Integer.MAX_VALUE); int providerDim = this.provider.getDimension(); @@ -40,39 +41,38 @@ public DummyWorld() { @Override public void notifyNeighborsRespectDebug(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean p_175722_3_) { - //NOOP - do not trigger forge events + // NOOP - do not trigger forge events } @Override public void notifyNeighborsOfStateChange(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean updateObservers) { - //NOOP - do not trigger forge events + // NOOP - do not trigger forge events } @Override - public void notifyNeighborsOfStateExcept(@Nonnull BlockPos pos, @Nonnull Block blockType, @Nonnull EnumFacing skipSide) { - //NOOP - do not trigger forge events + public void notifyNeighborsOfStateExcept(@Nonnull BlockPos pos, @Nonnull Block blockType, + @Nonnull EnumFacing skipSide) { + // NOOP - do not trigger forge events } @Override - public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, @Nonnull IBlockState newState, int flags) { - //NOOP - do not trigger forge events + public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, + @Nonnull IBlockState newState, int flags) { + // NOOP - do not trigger forge events } @Override - public void notifyBlockUpdate(@Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, int flags) { - } + public void notifyBlockUpdate(@Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, + int flags) {} @Override - public void markBlockRangeForRenderUpdate(@Nonnull BlockPos rangeMin, @Nonnull BlockPos rangeMax) { - } + public void markBlockRangeForRenderUpdate(@Nonnull BlockPos rangeMin, @Nonnull BlockPos rangeMax) {} @Override - public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { - } + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {} @Override - public void updateObservingBlocksAt(@Nonnull BlockPos pos, @Nonnull Block blockType) { - } + public void updateObservingBlocksAt(@Nonnull BlockPos pos, @Nonnull Block blockType) {} @Nonnull @Override diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java index ea12d93dc30..377838891ef 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java @@ -7,6 +7,7 @@ import gregtech.api.util.XSTR; import gregtech.api.worldgen.config.BedrockFluidDepositDefinition; import gregtech.core.network.packets.PacketFluidVeinList; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -16,13 +17,14 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BedrockFluidVeinHandler { public final static LinkedHashMap veinList = new LinkedHashMap<>(); @@ -36,7 +38,6 @@ public class BedrockFluidVeinHandler { */ public static int saveDataVersion; - public static final int MAX_FLUID_SAVE_DATA_VERSION = 2; public static final int VEIN_CHUNK_SIZE = 8; // veins are 8x8 chunk squares @@ -56,7 +57,8 @@ public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, i if (world.isRemote) return null; - ChunkPosDimension coords = new ChunkPosDimension(world.provider.getDimension(), getVeinCoord(chunkX), getVeinCoord(chunkZ)); + ChunkPosDimension coords = new ChunkPosDimension(world.provider.getDimension(), getVeinCoord(chunkX), + getVeinCoord(chunkZ)); FluidVeinWorldEntry worldEntry = veinCache.get(coords); if (worldEntry == null) { @@ -87,7 +89,8 @@ public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, i if (definition.getMaximumYield() - definition.getMinimumYield() <= 0) { maximumYield = definition.getMinimumYield(); } else { - maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + definition.getMinimumYield(); + maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + + definition.getMinimumYield(); } maximumYield = Math.min(maximumYield, definition.getMaximumYield()); } @@ -147,7 +150,8 @@ public static void recalculateChances(boolean mutePackets) { totalWeightMap.clear(); if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && !mutePackets) { HashMap packetMap = new HashMap<>(); - for (Map.Entry entry : BedrockFluidVeinHandler.veinCache.entrySet()) { + for (Map.Entry entry : BedrockFluidVeinHandler.veinCache + .entrySet()) { if (entry.getKey() != null && entry.getValue() != null) packetMap.put(entry.getValue(), entry.getValue().getDefinition().getWeight()); } @@ -250,6 +254,7 @@ public static int getVeinCoord(int chunkCoord) { } public static class FluidVeinWorldEntry { + private BedrockFluidDepositDefinition vein; private int fluidYield; private int operationsRemaining; @@ -260,9 +265,7 @@ public FluidVeinWorldEntry(BedrockFluidDepositDefinition vein, int fluidYield, i this.operationsRemaining = operationsRemaining; } - private FluidVeinWorldEntry() { - - } + private FluidVeinWorldEntry() {} public BedrockFluidDepositDefinition getDefinition() { return this.vein; diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java index 2dfd92ff3c4..40d1e7539d2 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java @@ -1,15 +1,17 @@ package gregtech.api.worldgen.bedrockFluids; import gregtech.api.GTValues; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.util.Map; +import javax.annotation.Nonnull; + public class BedrockFluidVeinSaveData extends WorldSavedData { private static BedrockFluidVeinSaveData INSTANCE; @@ -27,7 +29,8 @@ public void readFromNBT(NBTTagCompound nbt) { NBTTagCompound tag = veinList.getCompoundTagAt(i); ChunkPosDimension coords = ChunkPosDimension.readFromNBT(tag); if (coords != null) { - BedrockFluidVeinHandler.FluidVeinWorldEntry info = BedrockFluidVeinHandler.FluidVeinWorldEntry.readFromNBT(tag.getCompoundTag("info")); + BedrockFluidVeinHandler.FluidVeinWorldEntry info = BedrockFluidVeinHandler.FluidVeinWorldEntry + .readFromNBT(tag.getCompoundTag("info")); BedrockFluidVeinHandler.veinCache.put(coords, info); } } @@ -44,10 +47,10 @@ public void readFromNBT(NBTTagCompound nbt) { } @Override - public @Nonnull - NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { + public @Nonnull NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { NBTTagList oilList = new NBTTagList(); - for (Map.Entry e : BedrockFluidVeinHandler.veinCache.entrySet()) { + for (Map.Entry e : BedrockFluidVeinHandler.veinCache + .entrySet()) { if (e.getKey() != null && e.getValue() != null) { NBTTagCompound tag = e.getKey().writeToNBT(); tag.setTag("info", e.getValue().writeToNBT()); @@ -60,7 +63,6 @@ NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { return nbt; } - public static void setDirty() { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && INSTANCE != null) INSTANCE.markDirty(); diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java index 3f24a0d3829..2527ede40bb 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java @@ -6,6 +6,7 @@ import javax.annotation.Nonnull; public class ChunkPosDimension extends ChunkPos { + public int dimension; public ChunkPosDimension(int dimension, int x, int z) { diff --git a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java index 0fd7ad18398..e7e199e4c9e 100644 --- a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java @@ -1,18 +1,21 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonObject; import gregtech.api.util.GTLog; import gregtech.api.util.LocalizationUtils; import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; + import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; + import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class BedrockFluidDepositDefinition implements IWorldgenDefinition { private final String depositName; @@ -27,8 +30,10 @@ public class BedrockFluidDepositDefinition implements IWorldgenDefinition { private Fluid storedFluid; // the fluid which the vein contains - private Function biomeWeightModifier = OreDepositDefinition.NO_BIOME_INFLUENCE; // weighting of biomes - private Predicate dimensionFilter = OreDepositDefinition.PREDICATE_SURFACE_WORLD; // filtering of dimensions + private Function biomeWeightModifier = OreDepositDefinition.NO_BIOME_INFLUENCE; // weighting of + // biomes + private Predicate dimensionFilter = OreDepositDefinition.PREDICATE_SURFACE_WORLD; // filtering of + // dimensions public BedrockFluidDepositDefinition(String depositName) { this.depositName = depositName; @@ -44,14 +49,16 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { // amount of fluid the vein gets depleted by this.depletionAmount = configRoot.get("depletion").getAsJsonObject().get("amount").getAsInt(); // the chance [0, 100] that the vein will deplete by depletionAmount - this.depletionChance = Math.max(0, Math.min(100, configRoot.get("depletion").getAsJsonObject().get("chance").getAsInt())); + this.depletionChance = Math.max(0, + Math.min(100, configRoot.get("depletion").getAsJsonObject().get("chance").getAsInt())); // the fluid which the vein contains Fluid fluid = FluidRegistry.getFluid(configRoot.get("fluid").getAsString()); if (fluid != null) { this.storedFluid = fluid; } else { - GTLog.logger.error("Bedrock Fluid Vein {} cannot have a null fluid!", this.depositName, new RuntimeException()); + GTLog.logger.error("Bedrock Fluid Vein {} cannot have a null fluid!", this.depositName, + new RuntimeException()); return false; } // vein name for JEI display @@ -156,21 +163,25 @@ public boolean equals(Object obj) { return false; if ((this.assignedName == null && objDeposit.getAssignedName() != null) || (this.assignedName != null && objDeposit.getAssignedName() == null) || - (this.assignedName != null && objDeposit.getAssignedName() != null && !this.assignedName.equals(objDeposit.getAssignedName()))) + (this.assignedName != null && objDeposit.getAssignedName() != null && + !this.assignedName.equals(objDeposit.getAssignedName()))) return false; if ((this.description == null && objDeposit.getDescription() != null) || (this.description != null && objDeposit.getDescription() == null) || - (this.description != null && objDeposit.getDescription() != null && !this.description.equals(objDeposit.getDescription()))) + (this.description != null && objDeposit.getDescription() != null && + !this.description.equals(objDeposit.getDescription()))) return false; if (this.depletedYield != objDeposit.getDepletedYield()) return false; if ((this.biomeWeightModifier == null && objDeposit.getBiomeWeightModifier() != null) || (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() == null) || - (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) + (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && + !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) return false; if ((this.dimensionFilter == null && objDeposit.getDimensionFilter() != null) || (this.dimensionFilter != null && objDeposit.getDimensionFilter() == null) || - (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) + (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && + !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) return false; return super.equals(obj); diff --git a/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java index fb1370300e6..f8cbb3b69d4 100644 --- a/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/FillerConfigUtils.java @@ -1,17 +1,11 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; import gregtech.api.unification.ore.StoneType; import gregtech.api.unification.ore.StoneTypes; import gregtech.api.util.GTUtility; import gregtech.api.util.WorldBlockPredicate; import gregtech.api.worldgen.filler.FillerEntry; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -19,6 +13,14 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; import org.apache.commons.lang3.tuple.Pair; import java.util.*; @@ -83,9 +85,11 @@ private static FillerEntry createStateMatchFiller(JsonObject object) { ArrayList> matchers = new ArrayList<>(); for (JsonElement valueDefinition : valuesArray) { - Preconditions.checkArgument(valueDefinition.isJsonObject(), "Found invalid value definition: %s", valueDefinition.toString()); + Preconditions.checkArgument(valueDefinition.isJsonObject(), "Found invalid value definition: %s", + valueDefinition.toString()); JsonObject valueObject = valueDefinition.getAsJsonObject(); - WorldBlockPredicate predicate = PredicateConfigUtils.createBlockStatePredicate(valueObject.get("predicate")); + WorldBlockPredicate predicate = PredicateConfigUtils + .createBlockStatePredicate(valueObject.get("predicate")); FillerEntry filler = createBlockStateFiller(valueObject.get("value")); matchers.add(Pair.of(predicate, filler)); } @@ -119,14 +123,14 @@ private static FillerEntry createWeightRandomStateFiller(JsonObject object) { public static LayeredFillerEntry createLayeredFiller(JsonObject object) { JsonArray values = object.get("values").getAsJsonArray(); - Preconditions.checkArgument(values.size() == 4, "Invalid number of ores in a Layered vein (should be 4, is actually %d", values.size()); + Preconditions.checkArgument(values.size() == 4, + "Invalid number of ores in a Layered vein (should be 4, is actually %d", values.size()); return new LayeredFillerEntry( readLayerFiller(values.get(0).getAsJsonObject(), "primary"), readLayerFiller(values.get(1).getAsJsonObject(), "secondary"), readLayerFiller(values.get(2).getAsJsonObject(), "between"), - createBlockStateFiller(values.get(3).getAsJsonObject().get("sporadic")) - ); + createBlockStateFiller(values.get(3).getAsJsonObject().get("sporadic"))); } private static Pair readLayerFiller(JsonObject object, String layerType) { @@ -147,7 +151,8 @@ private static class OreFilterEntry implements FillerEntry { public OreFilterEntry(Map blockStateMap) { this.blockStateMap = blockStateMap; - this.defaultValue = blockStateMap.containsKey(StoneTypes.STONE) ? StoneTypes.STONE : blockStateMap.keySet().iterator().next(); + this.defaultValue = blockStateMap.containsKey(StoneTypes.STONE) ? StoneTypes.STONE : + blockStateMap.keySet().iterator().next(); this.allowedStates = ImmutableSet.copyOf(blockStateMap.values()); } @@ -243,7 +248,8 @@ public static class LayeredFillerEntry implements FillerEntry { private final ImmutableList blockStates; - public LayeredFillerEntry(Pair primary, Pair secondary, Pair between, FillerEntry sporadic) { + public LayeredFillerEntry(Pair primary, Pair secondary, + Pair between, FillerEntry sporadic) { this.primary = primary.getLeft(); this.secondary = secondary.getLeft(); this.between = between.getLeft(); @@ -275,7 +281,8 @@ public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos return apply(source, blockAccess, blockPos, 1.0, new Random(), 0); } - public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos, double density, Random random, int layer) { + public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos, double density, + Random random, int layer) { // First try to spawn "between" if (layer >= startBetween && layer - startBetween + 1 <= betweenLayers) { if (random.nextFloat() <= density / 2) { diff --git a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java index 4a7765ec4fc..b401ae97d34 100644 --- a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java @@ -6,7 +6,7 @@ public interface IWorldgenDefinition { - //This is the file name + // This is the file name /** * Must be converted using {@link gregtech.api.util.FileUtility#slashToNativeSep(String)} * before it can be used as a file path diff --git a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java index b0fc836d83b..7e604d891e6 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java @@ -1,8 +1,5 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; @@ -10,6 +7,7 @@ import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -17,13 +15,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; -import javax.annotation.Nonnull; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class OreConfigUtils { @SuppressWarnings("deprecation") @@ -93,15 +96,15 @@ public static int[] getIntRange(JsonElement element) { JsonArray dataArray = element.getAsJsonArray(); int max = dataArray.get(1).getAsInt(); int min = Math.min(max, dataArray.get(0).getAsInt()); - return new int[]{min, max}; + return new int[] { min, max }; } else if (element.isJsonObject()) { JsonObject dataObject = element.getAsJsonObject(); int max = dataObject.get("max").getAsInt(); int min = Math.min(max, dataObject.get("min").getAsInt()); - return new int[]{min, max}; + return new int[] { min, max }; } else if (element.isJsonPrimitive()) { int size = element.getAsInt(); - return new int[]{size, size}; + return new int[] { size, size }; } else { throw new IllegalArgumentException("size range not defined"); } diff --git a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java index dd1da1463f2..efdc8e8f8ee 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java @@ -1,24 +1,28 @@ package gregtech.api.worldgen.config; -import com.google.gson.JsonObject; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.LocalizationUtils; import gregtech.api.util.WorldBlockPredicate; import gregtech.api.worldgen.filler.BlockFiller; import gregtech.api.worldgen.populator.IVeinPopulator; import gregtech.api.worldgen.shape.ShapeGenerator; + import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; + import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class OreDepositDefinition implements IWorldgenDefinition { public static final Function NO_BIOME_INFLUENCE = biome -> 0; public static final Predicate PREDICATE_SURFACE_WORLD = WorldProvider::isSurfaceWorld; - public static final WorldBlockPredicate PREDICATE_STONE_TYPE = (state, world, pos) -> StoneType.computeStoneType(state, world, pos) != null; + public static final WorldBlockPredicate PREDICATE_STONE_TYPE = (state, world, pos) -> StoneType + .computeStoneType(state, world, pos) != null; private final String depositName; @@ -27,7 +31,7 @@ public class OreDepositDefinition implements IWorldgenDefinition { private float density; private String assignedName; private String description; - private final int[] heightLimit = new int[]{Integer.MIN_VALUE, Integer.MAX_VALUE}; + private final int[] heightLimit = new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE }; private boolean countAsVein = true; private Function biomeWeightModifier = NO_BIOME_INFLUENCE; @@ -71,14 +75,16 @@ public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { this.dimensionFilter = WorldConfigUtils.createWorldPredicate(configRoot.get("dimension_filter")); } if (configRoot.has("generation_predicate")) { - this.generationPredicate = PredicateConfigUtils.createBlockStatePredicate(configRoot.get("generation_predicate")); + this.generationPredicate = PredicateConfigUtils + .createBlockStatePredicate(configRoot.get("generation_predicate")); } if (configRoot.has("vein_populator")) { JsonObject object = configRoot.get("vein_populator").getAsJsonObject(); this.veinPopulator = WorldGenRegistry.INSTANCE.createVeinPopulator(object); } this.blockFiller = WorldGenRegistry.INSTANCE.createBlockFiller(configRoot.get("filler").getAsJsonObject()); - this.shapeGenerator = WorldGenRegistry.INSTANCE.createShapeGenerator(configRoot.get("generator").getAsJsonObject()); + this.shapeGenerator = WorldGenRegistry.INSTANCE + .createShapeGenerator(configRoot.get("generator").getAsJsonObject()); if (veinPopulator != null) { veinPopulator.initializeForVein(this); @@ -179,27 +185,33 @@ public boolean equals(Object obj) { return false; if ((this.assignedName == null && objDeposit.getAssignedName() != null) || (this.assignedName != null && objDeposit.getAssignedName() == null) || - (this.assignedName != null && objDeposit.getAssignedName() != null && !this.assignedName.equals(objDeposit.getAssignedName()))) + (this.assignedName != null && objDeposit.getAssignedName() != null && + !this.assignedName.equals(objDeposit.getAssignedName()))) return false; if ((this.description == null && objDeposit.getDescription() != null) || (this.description != null && objDeposit.getDescription() == null) || - (this.description != null && objDeposit.getDescription() != null && !this.description.equals(objDeposit.getDescription()))) + (this.description != null && objDeposit.getDescription() != null && + !this.description.equals(objDeposit.getDescription()))) return false; if ((this.biomeWeightModifier == null && objDeposit.getBiomeWeightModifier() != null) || (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() == null) || - (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) + (this.biomeWeightModifier != null && objDeposit.getBiomeWeightModifier() != null && + !this.biomeWeightModifier.equals(objDeposit.getBiomeWeightModifier()))) return false; if ((this.dimensionFilter == null && objDeposit.getDimensionFilter() != null) || (this.dimensionFilter != null && objDeposit.getDimensionFilter() == null) || - (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) + (this.dimensionFilter != null && objDeposit.getDimensionFilter() != null && + !this.dimensionFilter.equals(objDeposit.getDimensionFilter()))) return false; if ((this.generationPredicate == null && objDeposit.getGenerationPredicate() != null) || (this.generationPredicate != null && objDeposit.getGenerationPredicate() == null) || - (this.generationPredicate != null && objDeposit.getGenerationPredicate() != null && !this.generationPredicate.equals(objDeposit.getGenerationPredicate()))) + (this.generationPredicate != null && objDeposit.getGenerationPredicate() != null && + !this.generationPredicate.equals(objDeposit.getGenerationPredicate()))) return false; if ((this.veinPopulator == null && objDeposit.getVeinPopulator() != null) || (this.veinPopulator != null && objDeposit.getVeinPopulator() == null) || - (this.veinPopulator != null && objDeposit.getVeinPopulator() != null && !this.veinPopulator.equals(objDeposit.getVeinPopulator()))) + (this.veinPopulator != null && objDeposit.getVeinPopulator() != null && + !this.veinPopulator.equals(objDeposit.getVeinPopulator()))) return false; return super.equals(obj); diff --git a/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java index 38c43ed4316..2c7ce8effcb 100644 --- a/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/PredicateConfigUtils.java @@ -1,16 +1,18 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Optional; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.WorldBlockPredicate; + import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; +import com.google.common.base.Optional; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,13 +31,14 @@ public static IBlockState parseBlockStateDefinition(JsonObject object) { String stringValue = valueElement.getAsString(); Optional parsedValue = property.parseValue(stringValue); if (!parsedValue.isPresent()) { - throw new IllegalArgumentException("Couldn't parse property " + property.getName() + " value " + valueElement); + throw new IllegalArgumentException( + "Couldn't parse property " + property.getName() + " value " + valueElement); } // idk what this is @SuppressWarnings("UnnecessaryLocalVariable") IProperty propertyVar = property; Comparable comparableVar = (Comparable) parsedValue.get(); - //noinspection unchecked + // noinspection unchecked blockState = blockState.withProperty(propertyVar, comparableVar); } } @@ -114,7 +117,8 @@ private static Predicate parseBlockStatePropertyPredicate(JsonObjec } Optional parsedValue = property.parseValue(elementValue); if (!parsedValue.isPresent()) { - throw new IllegalArgumentException("Couldn't parse property " + property.getName() + " value " + valueElement); + throw new IllegalArgumentException( + "Couldn't parse property " + property.getName() + " value " + valueElement); } allValues.add(parsedValue.get()); } @@ -130,7 +134,7 @@ private static Predicate parseBlockStatePropertyPredicate(JsonObjec return blockState -> { for (IProperty property : blockState.getPropertyKeys()) { if (!allowedValues.containsKey(property)) - continue; //do not check unspecified properties + continue; // do not check unspecified properties Object propertyValue = blockState.getValue(property); if (!allowedValues.get(property).contains(propertyValue)) return false; diff --git a/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java index 3f28de19eac..9718a0d29bf 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldConfigUtils.java @@ -1,10 +1,7 @@ package gregtech.api.worldgen.config; -import com.google.common.base.Preconditions; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; @@ -13,6 +10,11 @@ import net.minecraftforge.common.BiomeDictionary.Type; import net.minecraftforge.fml.common.registry.GameRegistry; +import com.google.common.base.Preconditions; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; @@ -45,9 +47,12 @@ public static Predicate createWorldPredicate(JsonElement element) } else { int indexOf = filterValue.indexOf(':'); int indexOfExclusive = indexOf + 1; - int minDimensionId = indexOf == 0 ? -Integer.MAX_VALUE : Integer.parseInt(filterValue.substring(0, indexOf)); - int maxDimensionId = indexOfExclusive == filterValue.length() ? Integer.MAX_VALUE : Integer.parseInt(filterValue.substring(indexOfExclusive)); - allPredicates.add(provider -> provider.getDimension() >= minDimensionId && provider.getDimension() <= maxDimensionId); + int minDimensionId = indexOf == 0 ? -Integer.MAX_VALUE : + Integer.parseInt(filterValue.substring(0, indexOf)); + int maxDimensionId = indexOfExclusive == filterValue.length() ? Integer.MAX_VALUE : + Integer.parseInt(filterValue.substring(indexOfExclusive)); + allPredicates.add(provider -> provider.getDimension() >= minDimensionId && + provider.getDimension() <= maxDimensionId); } } else if (stringValue.startsWith("name:")) { stringSupplier = provider -> provider.getDimensionType().getName(); @@ -64,7 +69,8 @@ public static Predicate createWorldPredicate(JsonElement element) } else { String finalStringValue = stringValue; Function finalStringSupplier1 = stringSupplier; - allPredicates.add(provider -> finalStringValue.equalsIgnoreCase(finalStringSupplier1.apply(provider))); + allPredicates + .add(provider -> finalStringValue.equalsIgnoreCase(finalStringSupplier1.apply(provider))); } } } @@ -82,7 +88,7 @@ public static Function createBiomeWeightModifier(JsonElement ele case "biome_map": { HashMap backedMap = new HashMap<>(); for (Entry elementEntry : object.entrySet()) { - if (elementEntry.getKey().equals("type")) continue; //skip type + if (elementEntry.getKey().equals("type")) continue; // skip type ResourceLocation biomeName = new ResourceLocation(elementEntry.getKey()); Biome biome = GameRegistry.findRegistry(Biome.class).getValue(biomeName); if (biome == null) @@ -94,7 +100,7 @@ public static Function createBiomeWeightModifier(JsonElement ele case "biome_dictionary": { HashMap backedMap = new HashMap<>(); for (Entry elementEntry : object.entrySet()) { - if (elementEntry.getKey().equals("type")) continue; //skip type + if (elementEntry.getKey().equals("type")) continue; // skip type String tagName = elementEntry.getKey().toUpperCase(); Type type = GTUtility.getBiomeTypeTagByName(tagName); if (type == null) diff --git a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java index ae548cf1239..5c324f8598b 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java @@ -1,9 +1,5 @@ package gregtech.api.worldgen.config; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GTValues; import gregtech.api.util.FileUtility; import gregtech.api.util.GTLog; @@ -17,8 +13,7 @@ import gregtech.api.worldgen.populator.SurfaceBlockPopulator; import gregtech.api.worldgen.populator.SurfaceRockPopulator; import gregtech.api.worldgen.shape.*; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.init.Blocks; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.Biome; @@ -26,9 +21,15 @@ import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.registry.GameRegistry; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.io.IOUtils; -import javax.annotation.Nonnull; import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.Field; @@ -36,13 +37,15 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.file.*; -import java.util.AbstractMap.SimpleEntry; import java.util.*; +import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nonnull; + public class WorldGenRegistry { public static final WorldGenRegistry INSTANCE = new WorldGenRegistry(); @@ -52,9 +55,11 @@ public class WorldGenRegistry { private WorldGenRegistry() {} - private final Map> shapeGeneratorRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + private final Map> shapeGeneratorRegistry = new TreeMap<>( + String.CASE_INSENSITIVE_ORDER); private final Map> blockFillerRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - private final Map> veinPopulatorRegistry = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + private final Map> veinPopulatorRegistry = new TreeMap<>( + String.CASE_INSENSITIVE_ORDER); private final Int2ObjectMap namedDimensions = new Int2ObjectOpenHashMap<>(); private final List registeredVeinDefinitions = new ArrayList<>(); @@ -66,6 +71,7 @@ private WorldGenRegistry() {} private final Map oreVeinCache = new WeakHashMap<>(); private class WorldOreVeinCache { + private final List worldVeins; private final Map>> biomeVeins = new HashMap<>(); @@ -105,7 +111,8 @@ public void initializeRegistry() { registerShapeGenerator("layered", LayeredGenerator::new); registerBlockFiller("simple", SimpleBlockFiller::new); registerBlockFiller("layered", LayeredBlockFiller::new); - registerBlockFiller("ignore_bedrock", () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState()))); + registerBlockFiller("ignore_bedrock", + () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState()))); registerVeinPopulator("surface_rock", SurfaceRockPopulator::new); registerVeinPopulator("fluid_spring", FluidSpringPopulator::new); registerVeinPopulator("surface_block", SurfaceBlockPopulator::new); @@ -120,9 +127,11 @@ public void initializeRegistry() { if (Loader.isModLoaded("galacticraftcore")) { try { Class transformerHooksClass = Class.forName("micdoodle8.mods.galacticraft.core.TransformerHooks"); - Field otherModGeneratorsWhitelistField = transformerHooksClass.getDeclaredField("otherModGeneratorsWhitelist"); + Field otherModGeneratorsWhitelistField = transformerHooksClass + .getDeclaredField("otherModGeneratorsWhitelist"); otherModGeneratorsWhitelistField.setAccessible(true); - List otherModGeneratorsWhitelist = (List) otherModGeneratorsWhitelistField.get(null); + List otherModGeneratorsWhitelist = (List) otherModGeneratorsWhitelistField + .get(null); otherModGeneratorsWhitelist.add(WorldGeneratorImpl.INSTANCE); } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { GTLog.logger.fatal("Failed to inject world generator into Galacticraft's whitelist.", e); @@ -204,7 +213,7 @@ public void reinitializeRegisteredVeins() throws IOException { extractJarVeinDefinitions(configPath, jarFileExtractLock); } - //attempt extraction if worldgen root directory is empty + // attempt extraction if worldgen root directory is empty boolean shouldExtract; try (Stream stream = Files.list(worldgenRootPath.resolve(veinPath))) { shouldExtract = !stream.findFirst().isPresent(); @@ -252,13 +261,15 @@ public void reinitializeRegisteredVeins() throws IOException { String depositName = FileUtility.nativeSepToSlash(veinPath.relativize(worldgenDefinition).toString()); try { - // Creates the deposit definition and initializes various components based on the json entries in the file + // Creates the deposit definition and initializes various components based on the json entries in the + // file OreDepositDefinition deposit = new OreDepositDefinition(depositName); deposit.initializeFromConfig(element); // Adds the registered definition to the list of all registered definitions registeredVeinDefinitions.add(deposit); } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, exception); + GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, + exception); } } GTLog.logger.info("Loaded {} vein worldgen definitions", registeredVeinDefinitions.size()); @@ -280,17 +291,20 @@ public void reinitializeRegisteredVeins() throws IOException { } // Finds the file name to create the Definition with, using a consistent separator character - String depositName = FileUtility.nativeSepToSlash(bedrockVeinPath.relativize(worldgenDefinition).toString()); + String depositName = FileUtility + .nativeSepToSlash(bedrockVeinPath.relativize(worldgenDefinition).toString()); try { - // Creates the deposit definition and initializes various components based on the json entries in the file + // Creates the deposit definition and initializes various components based on the json entries in the + // file BedrockFluidDepositDefinition deposit = new BedrockFluidDepositDefinition(depositName); // Adds the registered definition to the list of all registered definitions if (deposit.initializeFromConfig(element)) { registeredBedrockVeinDefinitions.add(deposit); } } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, exception); + GTLog.logger.error("Failed to parse worldgen definition {} on path {}", depositName, worldgenDefinition, + exception); } } @@ -299,9 +313,10 @@ public void reinitializeRegisteredVeins() throws IOException { GTLog.logger.info("Loaded {} bedrock worldgen definitions", registeredBedrockVeinDefinitions.size()); GTLog.logger.info("Loaded {} worldgen definitions from addon mods", addonRegisteredDefinitions.size()); - GTLog.logger.info("Loaded {} bedrock worldgen definitions from addon mods", addonRegisteredBedrockVeinDefinitions.size()); - GTLog.logger.info("Loaded {} total worldgen definitions", registeredVeinDefinitions.size() + registeredBedrockVeinDefinitions.size()); - + GTLog.logger.info("Loaded {} bedrock worldgen definitions from addon mods", + addonRegisteredBedrockVeinDefinitions.size()); + GTLog.logger.info("Loaded {} total worldgen definitions", + registeredVeinDefinitions.size() + registeredBedrockVeinDefinitions.size()); } /** @@ -327,11 +342,14 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) URL sampleUrl = WorldGenRegistry.class.getResource("/assets/gregtech/.gtassetsroot"); if (sampleUrl == null) throw new FileNotFoundException("Could not find .gtassetsroot"); URI sampleUri = sampleUrl.toURI(); - // The Path for representing the worldgen folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the worldgen folder in the assets folder in the Gregtech resources folder in + // the jar Path worldgenJarRootPath; - // The Path for representing the vein folder in the vein folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the vein folder in the vein folder in the assets folder in the Gregtech + // resources folder in the jar Path oreVeinJarRootPath; - // The Path for representing the fluid folder in the vein folder in the assets folder in the Gregtech resources folder in the jar + // The Path for representing the fluid folder in the vein folder in the assets folder in the Gregtech + // resources folder in the jar Path bedrockFluidJarRootPath; if (sampleUri.getScheme().equals("jar") || sampleUri.getScheme().equals("zip")) { zipFileSystem = FileSystems.newFileSystem(sampleUri, Collections.emptyMap()); @@ -351,7 +369,8 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) if (url == null) throw new FileNotFoundException("Could not find /assets/gregtech/worldgen/fluid"); bedrockFluidJarRootPath = Paths.get(url.toURI()); } else { - throw new IllegalStateException("Unable to locate absolute path to worldgen root directory: " + sampleUri); + throw new IllegalStateException( + "Unable to locate absolute path to worldgen root directory: " + sampleUri); } // Attempts to extract the worldgen definition jsons @@ -382,11 +401,13 @@ private static void extractJarVeinDefinitions(Path configPath, Path targetPath) // Replaces or creates the default worldgen files for (Path jarFile : jarFiles) { - Path worldgenPath = bedrockFluidVeinRootPath.resolve(bedrockFluidJarRootPath.relativize(jarFile).toString()); + Path worldgenPath = bedrockFluidVeinRootPath + .resolve(bedrockFluidJarRootPath.relativize(jarFile).toString()); Files.createDirectories(worldgenPath.getParent()); Files.copy(jarFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); } - GTLog.logger.info("Extracted {} builtin worldgen bedrock fluid definitions into fluid folder", jarFiles.size()); + GTLog.logger.info("Extracted {} builtin worldgen bedrock fluid definitions into fluid folder", + jarFiles.size()); } // Attempts to extract the named dimensions json folder else if (targetPath.compareTo(dimensionsRootPath) == 0) { @@ -395,7 +416,8 @@ else if (targetPath.compareTo(dimensionsRootPath) == 0) { Path dimensionFile = worldgenJarRootPath.resolve("dimensions.json"); - Path worldgenPath = dimensionsRootPath.resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); + Path worldgenPath = dimensionsRootPath + .resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); Files.copy(dimensionFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); GTLog.logger.info("Extracted builtin dimension definitions into worldgen folder"); @@ -404,18 +426,19 @@ else if (targetPath.compareTo(dimensionsRootPath) == 0) { else if (targetPath.compareTo(extractLockPath) == 0) { Path extractLockFile = worldgenJarRootPath.resolve("worldgen_extracted.json"); - Path worldgenPath = extractLockPath.resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); + Path worldgenPath = extractLockPath + .resolve(worldgenJarRootPath.relativize(worldgenJarRootPath).toString()); Files.copy(extractLockFile, worldgenPath, StandardCopyOption.REPLACE_EXISTING); GTLog.logger.info("Extracted jar lock file into worldgen folder"); } } catch (URISyntaxException impossible) { - //this is impossible, since getResource always returns valid URI + // this is impossible, since getResource always returns valid URI throw new RuntimeException(impossible); } finally { if (zipFileSystem != null) { - //close zip file system to avoid issues + // close zip file system to avoid issues IOUtils.closeQuietly(zipFileSystem); } } @@ -436,12 +459,14 @@ private static void removeExistingFiles(Path root, @Nonnull List void addAddonFiles(Path root, @Nonnull List definitions, @Nonnull List registeredDefinitions) { + private static void addAddonFiles(Path root, @Nonnull List definitions, + @Nonnull List registeredDefinitions) { Iterator it = definitions.iterator(); while (it.hasNext()) { T definition = it.next(); - JsonObject element = FileUtility.tryExtractFromFile(root.resolve(FileUtility.slashToNativeSep(definition.getDepositName()))); + JsonObject element = FileUtility + .tryExtractFromFile(root.resolve(FileUtility.slashToNativeSep(definition.getDepositName()))); if (element == null) { GTLog.logger.error("Addon mod tried to register bad ore definition at {}", definition.getDepositName()); @@ -453,7 +478,8 @@ private static void addAddonFiles(Path root, @No definition.initializeFromConfig(element); registeredDefinitions.add(definition); } catch (RuntimeException exception) { - GTLog.logger.error("Failed to parse addon worldgen definition {}", definition.getDepositName(), exception); + GTLog.logger.error("Failed to parse addon worldgen definition {}", definition.getDepositName(), + exception); } } } @@ -472,7 +498,8 @@ private void gatherNamedDimensions(Path dimensionsFile) { try { JsonArray dims = element.getAsJsonArray("dims"); for (JsonElement dim : dims) { - namedDimensions.put(dim.getAsJsonObject().get("dimID").getAsInt(), dim.getAsJsonObject().get("dimName").getAsString()); + namedDimensions.put(dim.getAsJsonObject().get("dimID").getAsInt(), + dim.getAsJsonObject().get("dimName").getAsString()); } } catch (RuntimeException exception) { GTLog.logger.error("Failed to parse named dimensions", exception); @@ -483,7 +510,8 @@ private void gatherNamedDimensions(Path dimensionsFile) { * Called to remove veins from the list of registered vein definitions * Can fail if called on default veins when the veins have been modified by modpack makers *

- * After removing all desired veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to delete the existing files + * After removing all desired veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to delete the + * existing files * * @param definition The {@link OreDepositDefinition} to remove */ @@ -495,14 +523,18 @@ public void removeVeinDefinitions(IWorldgenDefinition definition) { registeredVeinDefinitions.remove(definition); removedVeinDefinitions.add((OreDepositDefinition) definition); } else { - GTLog.logger.error("Failed to remove OreDepositDefinition at {}. Deposit was not in list of registered veins.", definition.getDepositName()); + GTLog.logger.error( + "Failed to remove OreDepositDefinition at {}. Deposit was not in list of registered veins.", + definition.getDepositName()); } } else if (definition instanceof BedrockFluidDepositDefinition) { if (registeredBedrockVeinDefinitions.contains(definition)) { registeredBedrockVeinDefinitions.remove(definition); removedBedrockVeinDefinitions.add((BedrockFluidDepositDefinition) definition); } else { - GTLog.logger.error("Failed to remove BedrockFluidDepositDefinition at {}. Deposit was not in list of registered veins.", definition.getDepositName()); + GTLog.logger.error( + "Failed to remove BedrockFluidDepositDefinition at {}. Deposit was not in list of registered veins.", + definition.getDepositName()); } } @@ -513,7 +545,8 @@ public void removeVeinDefinitions(IWorldgenDefinition definition) { * Will not create an entry if a file already exists for the provided definition *

* After adding all veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to initialize the new veins - * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded with the + * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded + * with the * default veins * * @param definition The OreDepositDefinition to add to the list of registered veins @@ -523,7 +556,8 @@ public void addVeinDefinitions(OreDepositDefinition definition) { if (!registeredVeinDefinitions.contains(definition)) { addonRegisteredDefinitions.add(definition); } else { - GTLog.logger.error("Failed to add ore vein definition at {}. Definition already exists", definition.getDepositName()); + GTLog.logger.error("Failed to add ore vein definition at {}. Definition already exists", + definition.getDepositName()); } } @@ -532,7 +566,8 @@ public void addVeinDefinitions(OreDepositDefinition definition) { * Will not create an entry if a file already exists for the provided definition *

* After adding all veins, call {@link WorldGenRegistry#reinitializeRegisteredVeins()} to initialize the new veins - * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded with the + * Or, register veins before {@link WorldGenRegistry#initializeRegistry()} is called, and the veins will be loaded + * with the * default veins * * @param definition The BedrockFluidDepositDefinition to add to the list of registered veins @@ -542,7 +577,8 @@ public void addVeinDefinitions(BedrockFluidDepositDefinition definition) { if (!addonRegisteredBedrockVeinDefinitions.contains(definition)) { addonRegisteredBedrockVeinDefinitions.add(definition); } else { - GTLog.logger.error("Failed to add bedrock fluid deposit definition at {}. Definition already exists", definition.getDepositName()); + GTLog.logger.error("Failed to add bedrock fluid deposit definition at {}. Definition already exists", + definition.getDepositName()); } } diff --git a/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java index 572d2cfc789..8b17f6baaad 100644 --- a/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/BlacklistedBlockFiller.java @@ -1,11 +1,13 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -34,7 +36,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { for (IBlockState blockState : blacklist) { if (blockState == currentState) { return currentState; diff --git a/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java index 5590faca7b6..10fa5238693 100644 --- a/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/BlockFiller.java @@ -1,10 +1,11 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.List; import java.util.Random; @@ -12,7 +13,9 @@ public abstract class BlockFiller { public abstract void loadFromConfig(JsonObject object); - public abstract IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer); + public abstract IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, + int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, + int layer); public abstract List getAllPossibleStates(); } diff --git a/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java b/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java index 6eb0765f967..de5465b3b47 100644 --- a/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java +++ b/src/main/java/gregtech/api/worldgen/filler/FillerEntry.java @@ -1,9 +1,10 @@ package gregtech.api.worldgen.filler; -import com.google.common.collect.ImmutableList; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; + +import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -23,6 +24,7 @@ default List> getEntries() { static FillerEntry createSimpleFiller(IBlockState blockState) { List possibleResults = ImmutableList.of(blockState); return new FillerEntry() { + @Override public IBlockState apply(IBlockState source, IBlockAccess blockAccess, BlockPos blockPos) { return blockState; diff --git a/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java index 2f1b9127c3d..25bfc2ac805 100644 --- a/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/LayeredBlockFiller.java @@ -1,12 +1,14 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; import gregtech.api.worldgen.config.FillerConfigUtils.LayeredFillerEntry; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -15,8 +17,7 @@ public class LayeredBlockFiller extends BlockFiller { private LayeredFillerEntry fillerEntry; - public LayeredBlockFiller() { - } + public LayeredBlockFiller() {} @Override public void loadFromConfig(JsonObject object) { @@ -24,7 +25,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { return fillerEntry.apply(currentState, blockAccess, blockPos, density, gridRandom, layer); } diff --git a/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java b/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java index c9f0f569574..c9cb3574d77 100644 --- a/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java +++ b/src/main/java/gregtech/api/worldgen/filler/SimpleBlockFiller.java @@ -1,11 +1,13 @@ package gregtech.api.worldgen.filler; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.FillerConfigUtils; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.Random; @@ -14,8 +16,7 @@ public class SimpleBlockFiller extends BlockFiller { private FillerEntry fillerEntry; - public SimpleBlockFiller() { - } + public SimpleBlockFiller() {} public SimpleBlockFiller(FillerEntry blockStateFiller) { this.fillerEntry = blockStateFiller; @@ -27,7 +28,8 @@ public void loadFromConfig(JsonObject object) { } @Override - public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, int relativeY, int relativeZ, double density, Random gridRandom, int layer) { + public IBlockState apply(IBlockState currentState, IBlockAccess blockAccess, BlockPos blockPos, int relativeX, + int relativeY, int relativeZ, double density, Random gridRandom, int layer) { return fillerEntry.apply(currentState, blockAccess, blockPos); } diff --git a/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java b/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java index 7bce5bff734..8fe39b4ceaf 100644 --- a/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java +++ b/src/main/java/gregtech/api/worldgen/generator/CachedGridEntry.java @@ -1,7 +1,5 @@ package gregtech.api.worldgen.generator; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import gregtech.api.util.GTUtility; import gregtech.api.util.XSTR; import gregtech.api.worldgen.config.OreDepositDefinition; @@ -12,8 +10,7 @@ import gregtech.api.worldgen.populator.VeinChunkPopulator; import gregtech.api.worldgen.shape.IBlockGeneratorAccess; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.longs.*; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -21,6 +18,11 @@ import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import it.unimi.dsi.fastutil.longs.*; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.tuple.MutablePair; import java.util.*; @@ -31,7 +33,8 @@ public class CachedGridEntry implements GridEntryInfo, IBlockGeneratorAccess, IB private static final Map> gridEntryCache = new WeakHashMap<>(); - public static CachedGridEntry getOrCreateEntry(World world, int gridX, int gridZ, int primerChunkX, int primerChunkZ) { + public static CachedGridEntry getOrCreateEntry(World world, int gridX, int gridZ, int primerChunkX, + int primerChunkZ) { Cache currentValue = gridEntryCache.get(world); if (currentValue == null) { currentValue = createGridCache(); @@ -54,7 +57,8 @@ private static Cache createGridCache() { } private final Long2ObjectMap dataByChunkPos = new Long2ObjectOpenHashMap<>(); - private static final Comparator COMPARATOR = Comparator.comparing(OreDepositDefinition::getPriority).reversed(); + private static final Comparator COMPARATOR = Comparator + .comparing(OreDepositDefinition::getPriority).reversed(); private static final BlockPos[] CHUNK_CORNER_SPOTS = { new BlockPos(0, 0, 0), new BlockPos(15, 0, 0), @@ -81,9 +85,11 @@ public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16; int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16; - BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2); + BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), + gridZ * gridSizeZ + gridSizeZ / 2); Biome currentBiome = world.getBiomeProvider().getBiome(blockPos); - this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome)); + this.cachedDepositMap = new ArrayList<>( + WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome)); this.worldSeaLevel = world.getSeaLevel(); this.masterEntry = searchMasterOrNull(world); @@ -94,7 +100,7 @@ public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int int masterHeight = world.getHeight(heightSpot).getY(); int masterBottomHeight = world.getTopSolidOrLiquidBlock(heightSpot).getY(); this.masterEntry = primerChunk.getCapability(GTWorldGenCapability.CAPABILITY, null); - if(this.masterEntry == null) { + if (this.masterEntry == null) { this.masterEntry = new GTWorldGenCapability(); } this.masterEntry.setMaxHeight(masterHeight, masterBottomHeight); @@ -204,15 +210,18 @@ public void triggerVeinsGeneration() { this.veinGeneratedMap = new Object2ObjectOpenHashMap<>(); if (!cachedDepositMap.isEmpty()) { int currentCycle = 0; - int maxCycles = ConfigHolder.worldgen.minVeinsInSection + (ConfigHolder.worldgen.additionalVeinsInSection == 0 ? 0 : gridRandom.nextInt(ConfigHolder.worldgen.additionalVeinsInSection + 1)); + int maxCycles = ConfigHolder.worldgen.minVeinsInSection + + (ConfigHolder.worldgen.additionalVeinsInSection == 0 ? 0 : + gridRandom.nextInt(ConfigHolder.worldgen.additionalVeinsInSection + 1)); List veins = new ArrayList<>(); while (currentCycle < cachedDepositMap.size() && currentCycle < maxCycles) { - //instead of removing already generated veins, we swap last element with one we selected - int randomEntryIndex = GTUtility.getRandomItem(gridRandom, cachedDepositMap, cachedDepositMap.size() - currentCycle); + // instead of removing already generated veins, we swap last element with one we selected + int randomEntryIndex = GTUtility.getRandomItem(gridRandom, cachedDepositMap, + cachedDepositMap.size() - currentCycle); OreDepositDefinition randomEntry = cachedDepositMap.get(randomEntryIndex).getValue(); Collections.swap(cachedDepositMap, randomEntryIndex, cachedDepositMap.size() - 1 - currentCycle); - //need to put into list first to apply priority properly, so - //red granite vein will be properly filled with ores from other veins + // need to put into list first to apply priority properly, so + // red granite vein will be properly filled with ores from other veins veins.add(randomEntry); if (!randomEntry.isVein()) maxCycles++; @@ -229,7 +238,8 @@ private void doGenerateVein(OreDepositDefinition definition) { this.currentOreVein = definition; int topHeightOffset = currentOreVein.getShapeGenerator().getMaxSize().getY() / 2 + 4; - int maximumHeight = Math.min(masterEntry.getMaxBottomHeight(), currentOreVein.getHeightLimit()[1] - topHeightOffset); + int maximumHeight = Math.min(masterEntry.getMaxBottomHeight(), + currentOreVein.getHeightLimit()[1] - topHeightOffset); int minimumHeight = Math.max(3, currentOreVein.getHeightLimit()[0]); if (minimumHeight >= maximumHeight) { return; @@ -248,13 +258,15 @@ private void doGenerateVein(OreDepositDefinition definition) { private int calculateVeinCenterX() { int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16; - int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeX / 2 : gridRandom.nextInt(gridSizeX); + int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeX / 2 : + gridRandom.nextInt(gridSizeX); return gridX * gridSizeX + offset; } private int calculateVeinCenterZ() { int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16; - int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeZ / 2 : gridRandom.nextInt(gridSizeZ); + int offset = (ConfigHolder.worldgen.generateVeinsInCenterOfChunk && currentOreVein.isVein()) ? gridSizeZ / 2 : + gridRandom.nextInt(gridSizeZ); return gridZ * gridSizeZ + offset; } @@ -265,11 +277,11 @@ public boolean generateBlock(int x, int y, int z, boolean withRandom) { int globalBlockX = veinCenterX + x; int globalBlockY = veinCenterY + y; int globalBlockZ = veinCenterZ + z; - //we should do all random-related things here, otherwise it gets corrupted by current chunk information + // we should do all random-related things here, otherwise it gets corrupted by current chunk information float randomDensityValue = gridRandom.nextFloat(); if (withRandom && currentOreVein.getDensity() < randomDensityValue) - return false; //only place blocks in positions matching density + return false; // only place blocks in positions matching density setBlock(globalBlockX, globalBlockY, globalBlockZ, currentOreVein, 0); return true; } @@ -301,7 +313,6 @@ private void setBlock(int worldX, int worldY, int worldZ, OreDepositDefinition d } } - public static class ChunkDataEntry { private final Map> oreBlocks = new Object2ObjectOpenHashMap<>(); @@ -344,7 +355,7 @@ public boolean populateChunk(World world) { LongSet generatedBlocks = new LongOpenHashSet(); boolean generatedOreVein = false; // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < blockIndexList.size(); i++) { long blockIndex = blockIndexList.get(i); int xyzValue = (int) (blockIndex >> 32); @@ -356,16 +367,17 @@ public boolean populateChunk(World world) { IBlockState currentState = world.getBlockState(blockPos); IBlockState newState; if (index == 0) { - //it's primary ore block + // it's primary ore block if (!definition.getGenerationPredicate().test(currentState, world, blockPos)) - continue; //do not generate if predicate didn't match - newState = definition.getBlockFiller().apply(currentState, world, blockPos, blockX, blockY, blockZ, definition.getDensity(), gridRandom, blockY - lowestY); + continue; // do not generate if predicate didn't match + newState = definition.getBlockFiller().apply(currentState, world, blockPos, blockX, blockY, + blockZ, definition.getDensity(), gridRandom, blockY - lowestY); } else { - //it's populator-generated block with index + // it's populator-generated block with index VeinBufferPopulator populator = (VeinBufferPopulator) definition.getVeinPopulator(); newState = populator.getBlockByIndex(world, blockPos, index - 1); } - //set flags as 16 to avoid observer updates loading neighbour chunks + // set flags as 16 to avoid observer updates loading neighbour chunks world.setBlockState(blockPos, newState, 16); generatedBlocks.add(Block.getStateId(newState)); generatedOreVein = true; diff --git a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java index 52a5ada8c74..d541a31b1fd 100644 --- a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java +++ b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java @@ -1,6 +1,7 @@ package gregtech.api.worldgen.generator; import gregtech.api.util.GTUtility; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; @@ -15,9 +16,10 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.concurrent.Callable; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.concurrent.Callable; @EventBusSubscriber public class GTWorldGenCapability { @@ -65,13 +67,16 @@ public void setMaxHeight(int maxHeight, int maxLiquidHeight) { public static final Callable FACTORY = GTWorldGenCapability::new; public static final IStorage STORAGE = new IStorage() { + @Override - public NBTBase writeNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side) { + public NBTBase writeNBT(Capability capability, GTWorldGenCapability instance, + EnumFacing side) { return instance.writeToNBT(); } @Override - public void readNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side, NBTBase nbt) { + public void readNBT(Capability capability, GTWorldGenCapability instance, EnumFacing side, + NBTBase nbt) { instance.readFromNBT((NBTTagCompound) nbt); } }; diff --git a/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java b/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java index 568d59b4e17..521cfe46cab 100644 --- a/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java +++ b/src/main/java/gregtech/api/worldgen/generator/GridEntryInfo.java @@ -1,6 +1,7 @@ package gregtech.api.worldgen.generator; import gregtech.api.worldgen.config.OreDepositDefinition; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -20,5 +21,4 @@ public interface GridEntryInfo { BlockPos getCenterPos(OreDepositDefinition definition); Collection getGeneratedBlocks(OreDepositDefinition definition, int chunkX, int chunkZ); - } diff --git a/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java b/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java index 0cdc0d31a71..3ba6879ac0b 100644 --- a/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java +++ b/src/main/java/gregtech/api/worldgen/generator/WorldGeneratorImpl.java @@ -1,8 +1,8 @@ package gregtech.api.worldgen.generator; -import com.google.common.collect.ImmutableSet; import gregtech.common.ConfigHolder; import gregtech.common.worldgen.WorldGenRubberTree; + import net.minecraft.init.Biomes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -18,6 +18,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import com.google.common.collect.ImmutableSet; + import java.util.Random; import java.util.Set; @@ -27,11 +29,12 @@ public class WorldGeneratorImpl implements IWorldGenerator { public static final WorldGeneratorImpl INSTANCE = new WorldGeneratorImpl(); - private static final Set ORE_EVENT_TYPES = ImmutableSet.of(COAL, DIAMOND, GOLD, IRON, LAPIS, REDSTONE, QUARTZ, EMERALD); + private static final Set ORE_EVENT_TYPES = ImmutableSet.of(COAL, DIAMOND, GOLD, IRON, LAPIS, REDSTONE, + QUARTZ, EMERALD); public static final int GRID_SIZE_X = 3; public static final int GRID_SIZE_Z = 3; - private WorldGeneratorImpl() { } + private WorldGeneratorImpl() {} @SubscribeEvent(priority = EventPriority.HIGH) public static void onOreGenerate(OreGenEvent.GenerateMinable event) { @@ -42,23 +45,27 @@ public static void onOreGenerate(OreGenEvent.GenerateMinable event) { } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, + IChunkProvider chunkProvider) { int selfGridX = Math.floorDiv(chunkX, GRID_SIZE_X); int selfGridZ = Math.floorDiv(chunkZ, GRID_SIZE_Z); generateInternal(world, selfGridX, selfGridZ, chunkX, chunkZ, random); long rubberTreeSeed = random.nextLong(); if (!ConfigHolder.worldgen.disableRubberTreeGeneration) { - generateRubberTree(random, rubberTreeSeed, chunkProvider.provideChunk(chunkX, chunkZ), ConfigHolder.worldgen.rubberTreeRateIncrease); + generateRubberTree(random, rubberTreeSeed, chunkProvider.provideChunk(chunkX, chunkZ), + ConfigHolder.worldgen.rubberTreeRateIncrease); } } - private static void generateInternal(World world, int selfGridX, int selfGridZ, int chunkX, int chunkZ, Random random) { + private static void generateInternal(World world, int selfGridX, int selfGridZ, int chunkX, int chunkZ, + Random random) { int halfSizeX = (GRID_SIZE_X - 1) / 2; int halfSizeZ = (GRID_SIZE_Z - 1) / 2; for (int gridX = -halfSizeX; gridX <= halfSizeX; gridX++) { for (int gridZ = -halfSizeZ; gridZ <= halfSizeZ; gridZ++) { - CachedGridEntry cachedGridEntry = CachedGridEntry.getOrCreateEntry(world, selfGridX + gridX, selfGridZ + gridZ, chunkX, chunkZ); + CachedGridEntry cachedGridEntry = CachedGridEntry.getOrCreateEntry(world, selfGridX + gridX, + selfGridZ + gridZ, chunkX, chunkZ); cachedGridEntry.populateChunk(world, chunkX, chunkZ, random); } } @@ -79,7 +86,8 @@ private static void generateRubberTree(Random random, long seed, Chunk chunk, do if (biome != null) { if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SWAMP)) rubberTrees += random.nextInt(10) + 5; - if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST) || + BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) rubberTrees += random.nextInt(5) + 1; } } diff --git a/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java b/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java index 1f51db73b2b..42bcb518ae0 100644 --- a/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/FluidSpringPopulator.java @@ -1,13 +1,15 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidBase; +import com.google.gson.JsonObject; + import java.util.List; import java.util.Random; import java.util.stream.Collectors; @@ -17,8 +19,7 @@ public class FluidSpringPopulator implements VeinBufferPopulator { private IBlockState fluidState; private float springGenerationChance; - public FluidSpringPopulator() { - } + public FluidSpringPopulator() {} public FluidSpringPopulator(IBlockState fluidState, float springGenerationChance) { this.fluidState = fluidState; @@ -35,7 +36,8 @@ public void initializeForVein(OreDepositDefinition definition) { List possibleStates = definition.getBlockFiller().getAllPossibleStates().stream() .flatMap(it -> it.getPossibleResults().stream()) .collect(Collectors.toList()); - this.fluidState = possibleStates.stream().filter(it -> it.getPropertyKeys().contains(BlockFluidBase.LEVEL)).findFirst().orElse(null); + this.fluidState = possibleStates.stream().filter(it -> it.getPropertyKeys().contains(BlockFluidBase.LEVEL)) + .findFirst().orElse(null); if (fluidState == null) { String message = "Can't find fluid block for spring in vein %s. Blocks in vein: %s"; throw new IllegalArgumentException(String.format(message, definition.getDepositName(), possibleStates)); @@ -43,7 +45,8 @@ public void initializeForVein(OreDepositDefinition definition) { } @Override - public void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, OreDepositDefinition depositDefinition) { + public void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, + OreDepositDefinition depositDefinition) { if (random.nextFloat() <= springGenerationChance) { int groundLevel = gridEntryInfo.getTerrainHeight(); int springUndergroundHeight = groundLevel - gridEntryInfo.getCenterPos(depositDefinition).getY(); diff --git a/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java b/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java index e4a9020c6c6..381e6e41b6e 100644 --- a/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java +++ b/src/main/java/gregtech/api/worldgen/populator/IBlockModifierAccess.java @@ -3,5 +3,4 @@ public interface IBlockModifierAccess { boolean setBlock(int x, int y, int z, int index); - } diff --git a/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java b/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java index 4490eb40590..16107900073 100644 --- a/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/IVeinPopulator.java @@ -1,12 +1,12 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreDepositDefinition; +import com.google.gson.JsonObject; + public interface IVeinPopulator { void loadFromConfig(JsonObject object); void initializeForVein(OreDepositDefinition definition); - } diff --git a/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java b/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java index 61a0ad96297..8e628808776 100644 --- a/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/SurfaceBlockPopulator.java @@ -1,10 +1,10 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.config.PredicateConfigUtils; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.JsonUtils; @@ -12,6 +12,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldType; +import com.google.gson.JsonObject; + import java.util.Random; public class SurfaceBlockPopulator implements VeinChunkPopulator { @@ -21,8 +23,7 @@ public class SurfaceBlockPopulator implements VeinChunkPopulator { private int maxIndicatorAmount; private int failedGenerationCounter = 0; - public SurfaceBlockPopulator() { - } + public SurfaceBlockPopulator() {} public SurfaceBlockPopulator(IBlockState blockState) { this.blockState = blockState; @@ -36,23 +37,26 @@ public void loadFromConfig(JsonObject object) { } @Override - public void initializeForVein(OreDepositDefinition definition) { - } + public void initializeForVein(OreDepositDefinition definition) {} /** - * Generates the Surface Block for an underground vein. Spawns the Surface Block on top of the applicable topmost block in + * Generates the Surface Block for an underground vein. Spawns the Surface Block on top of the applicable topmost + * block in * the chunk, at a random position in the chunk. Does not run on a Flat world type * * @param world - The Minecraft world. Used for finding the top most block and its state * @param chunkX - The X chunk coordinate * @param chunkZ - The Z chunk coordinate - * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their position + * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their + * position * @param definition - The Ore Vein definition * @param gridEntryInfo - Information about the ore generation grid for the current generation section */ @Override - public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { - int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : random.nextInt(maxIndicatorAmount - minIndicatorAmount)); + public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo) { + int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : + random.nextInt(maxIndicatorAmount - minIndicatorAmount)); if (stonesCount > 0 && world.getWorldType() != WorldType.FLAT) { for (int i = 0; i < stonesCount; i++) { int randomX = chunkX * 16 + random.nextInt(8); @@ -70,9 +74,12 @@ public void populateChunk(World world, int chunkX, int chunkZ, Random random, Or } - //Log if all Surface Block generation attempts were failed - if (failedGenerationCounter == stonesCount && maxIndicatorAmount > 0 && world.getWorldType() != WorldType.FLAT) { - GTLog.logger.debug("Failed all Surface Block generation attempts for vein {} at chunk with position: x: {}, z: {}", definition.getDepositName(), chunkX, chunkZ); + // Log if all Surface Block generation attempts were failed + if (failedGenerationCounter == stonesCount && maxIndicatorAmount > 0 && + world.getWorldType() != WorldType.FLAT) { + GTLog.logger.debug( + "Failed all Surface Block generation attempts for vein {} at chunk with position: x: {}, z: {}", + definition.getDepositName(), chunkX, chunkZ); } } @@ -81,23 +88,22 @@ private boolean generateSurfaceBlock(World world, BlockPos pos) { IBlockState blockState = world.getBlockState(topBlockPos.down()); Block blockAtPos = blockState.getBlock(); - if(topBlockPos.getY() >= world.provider.getActualHeight()) { + if (topBlockPos.getY() >= world.provider.getActualHeight()) { return false; } - //Check to see if the selected block has special rendering parameters (like glass) or a special model + // Check to see if the selected block has special rendering parameters (like glass) or a special model if (!blockState.isOpaqueCube() || !blockState.isFullBlock()) { return false; } - //Checks if the block is a replaceable feature like grass or snow layers. Liquids are replaceable, so + // Checks if the block is a replaceable feature like grass or snow layers. Liquids are replaceable, so // exclude one deep liquid blocks, for looks if (!blockAtPos.isReplaceable(world, topBlockPos) || blockState.getMaterial().isLiquid()) { return false; } return world.setBlockState(topBlockPos, this.blockState, 16); - } public IBlockState getBlockState() { diff --git a/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java b/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java index 027ada7b335..7085350c828 100644 --- a/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/SurfaceRockPopulator.java @@ -1,6 +1,5 @@ package gregtech.api.worldgen.populator; -import com.google.gson.JsonObject; import gregtech.api.unification.FluidUnifier; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; @@ -11,6 +10,7 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; @@ -24,6 +24,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.IFluidBlock; +import com.google.gson.JsonObject; + import java.util.Collection; import java.util.Random; @@ -32,8 +34,7 @@ public class SurfaceRockPopulator implements VeinChunkPopulator { private Material material; private int failedGenerationCounter = 0; - public SurfaceRockPopulator() { - } + public SurfaceRockPopulator() {} public SurfaceRockPopulator(Material material) { this.material = material; @@ -45,8 +46,7 @@ public void loadFromConfig(JsonObject object) { } @Override - public void initializeForVein(OreDepositDefinition definition) { - } + public void initializeForVein(OreDepositDefinition definition) {} private static boolean hasUndergroundMaterials(Collection generatedBlocks) { for (IBlockState blockState : generatedBlocks) { @@ -56,7 +56,8 @@ private static boolean hasUndergroundMaterials(Collection generated return true; } } else { - ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().damageDropped(blockState)); + ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, + blockState.getBlock().damageDropped(blockState)); UnificationEntry entry = OreDictUnifier.getUnificationEntry(itemStack); if (entry != null && entry.material != null && entry.material.hasProperty(PropertyKey.ORE)) { return true; @@ -67,7 +68,8 @@ private static boolean hasUndergroundMaterials(Collection generated } private void setStoneBlock(World world, BlockPos blockPos) { - boolean surfaceRockPlaced = world.setBlockState(blockPos, MetaBlocks.SURFACE_ROCK.get(this.material).getBlock(this.material)); + boolean surfaceRockPlaced = world.setBlockState(blockPos, + MetaBlocks.SURFACE_ROCK.get(this.material).getBlock(this.material)); if (!surfaceRockPlaced) failedGenerationCounter++; } @@ -79,12 +81,14 @@ private void setStoneBlock(World world, BlockPos blockPos) { * @param world - The Minecraft world. Used for finding the top most block and its state * @param chunkX - The X chunk coordinate * @param chunkZ - The Z chunk coordinate - * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their position + * @param random - A Random parameter. Used for determining the number of spawned Surface Blocks and their + * position * @param definition - The Ore Vein definition * @param gridEntryInfo - Information about the ore generation grid for the current generation section */ @Override - public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { + public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo) { int stonesCount = random.nextInt(2) + 1; if (world.getWorldType() != WorldType.FLAT) { if (!hasUndergroundMaterials(gridEntryInfo.getGeneratedBlocks(definition, chunkX, chunkZ))) { @@ -105,25 +109,27 @@ public void populateChunk(World world, int chunkX, int chunkZ, Random random, Or generateSurfaceRock(world, gridEntryInfo.getCenterPos(definition)); } - //Log if all Surface Rock generation attempts were failed + // Log if all Surface Rock generation attempts were failed if (failedGenerationCounter == stonesCount && world.getWorldType() != WorldType.FLAT) { - GTLog.logger.debug("Failed to generate surface rocks for vein {} at chunk with position: x: {}, z: {}", definition.getDepositName(), chunkX, chunkZ); + GTLog.logger.debug("Failed to generate surface rocks for vein {} at chunk with position: x: {}, z: {}", + definition.getDepositName(), chunkX, chunkZ); } } public void generateSurfaceRock(World world, BlockPos pos) { BlockPos topBlockPos = findSpawnHeight(world, pos); - if(topBlockPos.getY() <= 20) { // don't generate below y20 + if (topBlockPos.getY() <= 20) { // don't generate below y20 return; } Block blockAtPos = world.getBlockState(topBlockPos).getBlock(); - if(topBlockPos.getY() >= world.provider.getActualHeight()) { + if (topBlockPos.getY() >= world.provider.getActualHeight()) { return; } - //Checks if the block is a replaceable feature like grass, snow layers, or Air. Liquids are replaceable, so + // Checks if the block is a replaceable feature like grass, snow layers, or Air. Liquids are replaceable, so // exclude one deep liquid blocks, for looks - if (!blockAtPos.isReplaceable(world, topBlockPos) || world.getBlockState(topBlockPos).getMaterial().isLiquid()) { + if (!blockAtPos.isReplaceable(world, topBlockPos) || + world.getBlockState(topBlockPos).getMaterial().isLiquid()) { return; } @@ -142,13 +148,13 @@ public static BlockPos findSpawnHeight(World world, BlockPos pos) { while (blockpos.getY() > 20) { blockpos.move(EnumFacing.DOWN); IBlockState state = chunk.getBlockState(blockpos); - if(state.getMaterial() == net.minecraft.block.material.Material.AIR || + if (state.getMaterial() == net.minecraft.block.material.Material.AIR || state.getMaterial() == net.minecraft.block.material.Material.LEAVES || state.getMaterial() == net.minecraft.block.material.Material.VINE || state.getBlock().isFoliage(world, blockpos)) { airBlocks++; } else { - if(airBlocks >= 10 && state.isSideSolid(world, blockpos, EnumFacing.UP)) { + if (airBlocks >= 10 && state.isSideSolid(world, blockpos, EnumFacing.UP)) { blockpos.move(EnumFacing.UP); break; } diff --git a/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java b/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java index abcc7653090..a26b95cf4aa 100644 --- a/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/VeinBufferPopulator.java @@ -2,6 +2,7 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -10,7 +11,8 @@ public interface VeinBufferPopulator extends IVeinPopulator { - void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, OreDepositDefinition depositDefinition); + void populateBlockBuffer(Random random, GridEntryInfo gridEntryInfo, IBlockModifierAccess modifier, + OreDepositDefinition depositDefinition); IBlockState getBlockByIndex(World world, BlockPos pos, int index); } diff --git a/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java b/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java index f4f69f02a23..09e2b3a9ea5 100644 --- a/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java +++ b/src/main/java/gregtech/api/worldgen/populator/VeinChunkPopulator.java @@ -2,11 +2,13 @@ import gregtech.api.worldgen.config.OreDepositDefinition; import gregtech.api.worldgen.generator.GridEntryInfo; + import net.minecraft.world.World; import java.util.Random; public interface VeinChunkPopulator extends IVeinPopulator { - void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo); + void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, + GridEntryInfo gridEntryInfo); } diff --git a/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java b/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java index 3a0af9c1eaa..c5c2fe57568 100644 --- a/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/EllipsoidGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class EllipsoidGenerator extends ShapeGenerator { @@ -11,8 +13,7 @@ public class EllipsoidGenerator extends ShapeGenerator { private int radiusMin; private int radiusMax; - public EllipsoidGenerator() { - } + public EllipsoidGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java b/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java index 5cb1e53c048..7372c9457ba 100644 --- a/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/LayeredGenerator.java @@ -1,15 +1,15 @@ package gregtech.api.worldgen.shape; +import net.minecraft.util.math.Vec3i; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import net.minecraft.util.math.Vec3i; public class LayeredGenerator extends EllipsoidGenerator { private int yRadius; - public LayeredGenerator() { - } + public LayeredGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java b/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java index ad1f6f443e3..7ceb052e67d 100644 --- a/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/PlateGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class PlateGenerator extends ShapeGenerator { @@ -17,8 +19,7 @@ public class PlateGenerator extends ShapeGenerator { private float floorSharpness; private float roofSharpness; - public PlateGenerator() { - } + public PlateGenerator() {} @Override public void loadFromConfig(JsonObject object) { diff --git a/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java b/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java index e00c86b514b..c35c7f7baf9 100644 --- a/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/ShapeGenerator.java @@ -1,8 +1,9 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public abstract class ShapeGenerator { diff --git a/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java b/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java index eb84444f3dc..ac77299c6bb 100644 --- a/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/SingleBlockGenerator.java @@ -1,10 +1,12 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos.MutableBlockPos; import net.minecraft.util.math.Vec3i; + +import com.google.gson.JsonObject; import org.apache.commons.lang3.ArrayUtils; import java.util.Random; @@ -14,8 +16,7 @@ public class SingleBlockGenerator extends ShapeGenerator { private int minBlocksCount; private int maxBlocksCount; - public SingleBlockGenerator() { - } + public SingleBlockGenerator() {} public SingleBlockGenerator(int minBlocksCount, int maxBlocksCount) { this.minBlocksCount = minBlocksCount; @@ -37,7 +38,8 @@ public Vec3i getMaxSize() { @Override public void generate(Random gridRandom, IBlockGeneratorAccess relativeBlockAccess) { MutableBlockPos relativePos = new MutableBlockPos(); - int blocksCount = minBlocksCount == maxBlocksCount ? maxBlocksCount : minBlocksCount + gridRandom.nextInt(maxBlocksCount - minBlocksCount); + int blocksCount = minBlocksCount == maxBlocksCount ? maxBlocksCount : + minBlocksCount + gridRandom.nextInt(maxBlocksCount - minBlocksCount); EnumFacing prevDirection = null; for (int i = 0; i < blocksCount; i++) { EnumFacing[] allowedFacings = ArrayUtils.removeElement(EnumFacing.VALUES, prevDirection); diff --git a/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java b/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java index dde72305ebd..e774723d9e9 100644 --- a/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java +++ b/src/main/java/gregtech/api/worldgen/shape/SphereGenerator.java @@ -1,9 +1,11 @@ package gregtech.api.worldgen.shape; -import com.google.gson.JsonObject; import gregtech.api.worldgen.config.OreConfigUtils; + import net.minecraft.util.math.Vec3i; +import com.google.gson.JsonObject; + import java.util.Random; public class SphereGenerator extends ShapeGenerator { @@ -11,8 +13,7 @@ public class SphereGenerator extends ShapeGenerator { private int radiusMin; private int radiusMax; - public SphereGenerator() { - } + public SphereGenerator() {} public SphereGenerator(int radiusMin, int radiusMax) { this.radiusMin = radiusMin; diff --git a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java index 0265b879c43..795e02e9244 100644 --- a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java +++ b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java @@ -7,17 +7,19 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; -import javax.annotation.Nullable; import java.util.Map; +import javax.annotation.Nullable; + @Name("GregTechLoadingPlugin") @MCVersion(ForgeVersion.mcVersion) @TransformerExclusions("gregtech.asm.") @SortingIndex(1001) public class GregTechLoadingPlugin implements IFMLLoadingPlugin { + @Override public String[] getASMTransformerClass() { - return new String[]{"gregtech.asm.GregTechTransformer"}; + return new String[] { "gregtech.asm.GregTechTransformer" }; } @Override @@ -32,8 +34,7 @@ public String getSetupClass() { } @Override - public void injectData(Map data) { - } + public void injectData(Map data) {} @Override public String getAccessTransformerClass() { diff --git a/src/main/java/gregtech/asm/GregTechTransformer.java b/src/main/java/gregtech/asm/GregTechTransformer.java index 64fa7371ab4..4d98621cfa8 100644 --- a/src/main/java/gregtech/asm/GregTechTransformer.java +++ b/src/main/java/gregtech/asm/GregTechTransformer.java @@ -5,10 +5,12 @@ import gregtech.asm.util.TargetClassVisitor; import gregtech.asm.visitors.*; import gregtech.common.ConfigHolder; + import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; + import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -33,44 +35,52 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) if (ConfigHolder.recipes.disableConcreteInWorld) { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, ConcretePowderVisitor.TARGET_METHOD, ConcretePowderVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, ConcretePowderVisitor.TARGET_METHOD, + ConcretePowderVisitor::new), 0); return classWriter.toByteArray(); } break; case LayerCustomHeadVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LayerCustomHeadVisitor.TARGET_METHOD, LayerCustomHeadVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, LayerCustomHeadVisitor.TARGET_METHOD, + LayerCustomHeadVisitor::new), 0); return classWriter.toByteArray(); } case SpecialArmorApplyVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new SpecialArmorClassVisitor(classWriter, SpecialArmorApplyVisitor.TARGET_METHOD, SpecialArmorApplyVisitor::new), 0); + classReader.accept(new SpecialArmorClassVisitor(classWriter, SpecialArmorApplyVisitor.TARGET_METHOD, + SpecialArmorApplyVisitor::new), 0); return classWriter.toByteArray(); } case LayerArmorBaseVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LayerArmorBaseVisitor.TARGET_METHOD, LayerArmorBaseVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, LayerArmorBaseVisitor.TARGET_METHOD, + LayerArmorBaseVisitor::new), 0); return classWriter.toByteArray(); } case RegionRenderCacheBuilderVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, RegionRenderCacheBuilderVisitor.TARGET_METHOD, RegionRenderCacheBuilderVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, RegionRenderCacheBuilderVisitor.TARGET_METHOD, + RegionRenderCacheBuilderVisitor::new), 0); return classWriter.toByteArray(); } case RenderChunkVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, RenderChunkVisitor.TARGET_METHOD, RenderChunkVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, RenderChunkVisitor.TARGET_METHOD, RenderChunkVisitor::new), + 0); return classWriter.toByteArray(); } case EntityRendererVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, EntityRendererVisitor.TARGET_METHOD, EntityRendererVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, EntityRendererVisitor.TARGET_METHOD, + EntityRendererVisitor::new), 0); return classWriter.toByteArray(); } case BlockVisitor.TARGET_CLASS_NAME: { @@ -90,25 +100,30 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) case WorldVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, WorldVisitor.TARGET_METHOD, WorldVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, WorldVisitor.TARGET_METHOD, WorldVisitor::new), + 0); return classWriter.toByteArray(); } case ModelCTMVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, ModelCTMVisitor.TARGET_METHOD, ModelCTMVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, ModelCTMVisitor.TARGET_METHOD, ModelCTMVisitor::new), 0); return classWriter.toByteArray(); } case AbstractCTMBakedModelVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, AbstractCTMBakedModelVisitor.TARGET_METHOD, AbstractCTMBakedModelVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, AbstractCTMBakedModelVisitor.TARGET_METHOD, + AbstractCTMBakedModelVisitor::new), 0); return classWriter.toByteArray(); } case LittleTilesVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, LittleTilesVisitor.TARGET_METHOD, LittleTilesVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, LittleTilesVisitor.TARGET_METHOD, LittleTilesVisitor::new), + 0); return classWriter.toByteArray(); } case CCLVisitor.TARGET_CLASS_NAME: { @@ -124,9 +139,12 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) // fix NC recipe compat different depending on overhaul vs underhaul ModContainer container = Loader.instance().getIndexedModList().get(GTValues.MODID_NC); if (container.getVersion().contains("2o")) { // overhauled - classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, + NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), + 0); } else { - classReader.accept(new TargetClassVisitor(classWriter, NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); + classReader.accept(new TargetClassVisitor(classWriter, + NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); } return classWriter.toByteArray(); } @@ -159,19 +177,24 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) case TheOneProbeVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, TheOneProbeVisitor.TARGET_METHOD, TheOneProbeVisitor::new), 0); + classReader.accept( + new TargetClassVisitor(classWriter, TheOneProbeVisitor.TARGET_METHOD, TheOneProbeVisitor::new), + 0); return classWriter.toByteArray(); } case MinecraftVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, MinecraftVisitor.PROCESS_KEY_F3, MinecraftVisitor::new), ClassReader.EXPAND_FRAMES); + classReader.accept( + new TargetClassVisitor(classWriter, MinecraftVisitor.PROCESS_KEY_F3, MinecraftVisitor::new), + ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } case ModelLoaderRegistryVisitor.TARGET_CLASS_NAME: { ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(0); - classReader.accept(new TargetClassVisitor(classWriter, ModelLoaderRegistryVisitor.TARGET_METHOD, ModelLoaderRegistryVisitor::new), ClassReader.EXPAND_FRAMES); + classReader.accept(new TargetClassVisitor(classWriter, ModelLoaderRegistryVisitor.TARGET_METHOD, + ModelLoaderRegistryVisitor::new), ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } } @@ -179,7 +202,8 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) ObfMapping methodMapping = EnchantmentCanApplyVisitor.CLASS_TO_MAPPING_MAP.get(internalName); ClassReader classReader = new ClassReader(basicClass); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classReader.accept(new TargetClassVisitor(classWriter, methodMapping, mv -> new EnchantmentCanApplyVisitor(mv, methodMapping)), ClassReader.EXPAND_FRAMES); + classReader.accept(new TargetClassVisitor(classWriter, methodMapping, + mv -> new EnchantmentCanApplyVisitor(mv, methodMapping)), ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); } return basicClass; diff --git a/src/main/java/gregtech/asm/hooks/ArmorHooks.java b/src/main/java/gregtech/asm/hooks/ArmorHooks.java index 9708c4d06b5..5eec5ddeff6 100644 --- a/src/main/java/gregtech/asm/hooks/ArmorHooks.java +++ b/src/main/java/gregtech/asm/hooks/ArmorHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.armor.IArmorItem; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; @@ -9,7 +10,8 @@ @SuppressWarnings("unused") public class ArmorHooks { - public static void damageArmor(float damage, EntityLivingBase entity, NonNullList inventory, DamageSource damageSource) { + public static void damageArmor(float damage, EntityLivingBase entity, NonNullList inventory, + DamageSource damageSource) { double armorDamage = Math.max(1.0F, damage / 4.0F); for (int i = 0; i < inventory.size(); i++) { ItemStack itemStack = inventory.get(i); diff --git a/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java b/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java index 5092339a26f..57b6728fc31 100644 --- a/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java +++ b/src/main/java/gregtech/asm/hooks/ArmorRenderHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.armor.IArmorItem; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.GlStateManager; @@ -28,7 +29,9 @@ public static boolean isArmorItem(ItemStack itemStack, EntityEquipmentSlot slot) return (itemStack.getItem() instanceof IArmorItem && itemStack.getItem().getEquipmentSlot(itemStack) == slot); } - public static void renderArmorLayer(LayerArmorBase layer, EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityEquipmentSlot slotIn) { + public static void renderArmorLayer(LayerArmorBase layer, EntityLivingBase entity, float limbSwing, + float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, + float headPitch, float scale, EntityEquipmentSlot slotIn) { ItemStack itemStack = entity.getItemStackFromSlot(slotIn); if (isArmorItem(itemStack, slotIn)) { @@ -56,7 +59,8 @@ public static void renderArmorLayer(LayerArmorBase layer, EntityLivin armorModel.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (itemStack.hasEffect()) { - LayerArmorBase.renderEnchantedGlint(layer.renderer, entity, armorModel, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); + LayerArmorBase.renderEnchantedGlint(layer.renderer, entity, armorModel, limbSwing, limbSwingAmount, + partialTicks, ageInTicks, netHeadYaw, headPitch, scale); } } } @@ -65,13 +69,16 @@ private static boolean isLegSlot(EntityEquipmentSlot equipmentSlot) { return equipmentSlot == EntityEquipmentSlot.LEGS; } - private static ResourceLocation getArmorTexture(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, String type) { + private static ResourceLocation getArmorTexture(EntityLivingBase entity, ItemStack itemStack, + EntityEquipmentSlot slot, String type) { ResourceLocation registryName = itemStack.getItem().getRegistryName(); if (registryName == null) { - throw new IllegalArgumentException("ItemStack " + itemStack.getTranslationKey() + "has a null registry name"); + throw new IllegalArgumentException( + "ItemStack " + itemStack.getTranslationKey() + "has a null registry name"); } - String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", registryName.getNamespace(), registryName.getPath(), + String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", registryName.getNamespace(), + registryName.getPath(), (isLegSlot(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type)); return new ResourceLocation(ForgeHooksClient.getArmorTexture(entity, itemStack, s1, slot, type)); } diff --git a/src/main/java/gregtech/asm/hooks/BlockHooks.java b/src/main/java/gregtech/asm/hooks/BlockHooks.java index 0614ba81f8a..8297a923613 100644 --- a/src/main/java/gregtech/asm/hooks/BlockHooks.java +++ b/src/main/java/gregtech/asm/hooks/BlockHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.client.model.customtexture.CustomTextureBakedModel; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -18,12 +19,12 @@ public static Boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull Bloc if (ENABLE) { IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); if (model instanceof WeightedBakedModel) { - model = ((WeightedBakedModel)model).baseModel; + model = ((WeightedBakedModel) model).baseModel; } Boolean ret; if (model instanceof CustomTextureBakedModel) { - ret = ((CustomTextureBakedModel)model).getModel().canRenderInLayer(state, layer); + ret = ((CustomTextureBakedModel) model).getModel().canRenderInLayer(state, layer); } else { ret = null; } diff --git a/src/main/java/gregtech/asm/hooks/CTMHooks.java b/src/main/java/gregtech/asm/hooks/CTMHooks.java index 97a29daf6e3..33ddc0d7754 100644 --- a/src/main/java/gregtech/asm/hooks/CTMHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMHooks.java @@ -2,6 +2,7 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -24,13 +25,15 @@ public static boolean checkLayerWithOptiFine(boolean canRenderInLayer, byte laye if (layer == BloomEffectUtil.getBloomLayer()) return false; } else if ((layers >> BloomEffectUtil.getBloomLayer().ordinal() & 1) == 1 && layer == BloomEffectUtil.getEffectiveBloomLayer()) { - return true; - } + return true; + } } return canRenderInLayer; } - public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, IBakedModel bakedModel, IBlockState state, EnumFacing side, long rand) { + public static List getQuadsWithOptiFine(List ret, BlockRenderLayer layer, + IBakedModel bakedModel, IBlockState state, EnumFacing side, + long rand) { if (Shaders.isOptiFineShaderPackLoaded() && CTMHooks.ENABLE.get() == null) { if (layer == BloomEffectUtil.getBloomLayer()) { return Collections.emptyList(); diff --git a/src/main/java/gregtech/asm/hooks/CTMModHooks.java b/src/main/java/gregtech/asm/hooks/CTMModHooks.java index 02b37430e95..339a94e1ac3 100644 --- a/src/main/java/gregtech/asm/hooks/CTMModHooks.java +++ b/src/main/java/gregtech/asm/hooks/CTMModHooks.java @@ -1,8 +1,10 @@ package gregtech.asm.hooks; import gregtech.api.util.GTLog; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockRenderLayer; + import team.chisel.ctm.api.model.IModelCTM; import team.chisel.ctm.client.model.ModelCTM; @@ -13,7 +15,7 @@ public class CTMModHooks { private static Field layers; - static{ + static { try { layers = ModelCTM.class.getDeclaredField("layers"); layers.setAccessible(true); diff --git a/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java b/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java index caa541ad649..45a9bd9e92a 100644 --- a/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java +++ b/src/main/java/gregtech/asm/hooks/EnchantmentHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/asm/hooks/JEIHooks.java b/src/main/java/gregtech/asm/hooks/JEIHooks.java index 04be970ac1c..9fd33875382 100644 --- a/src/main/java/gregtech/asm/hooks/JEIHooks.java +++ b/src/main/java/gregtech/asm/hooks/JEIHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.util.FluidTooltipUtil; + import net.minecraftforge.fluids.FluidStack; import java.util.List; diff --git a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java index c8186bd733d..489cdb69a37 100644 --- a/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java +++ b/src/main/java/gregtech/asm/hooks/LittleTilesHooks.java @@ -1,10 +1,12 @@ package gregtech.asm.hooks; +import gregtech.client.utils.BloomEffectUtil; + +import net.minecraft.util.BlockRenderLayer; + import com.creativemd.creativecore.client.mods.optifine.OptifineHelper; import com.creativemd.littletiles.client.render.cache.LayeredRenderBoxCache; import com.creativemd.littletiles.client.render.tile.LittleRenderBox; -import gregtech.client.utils.BloomEffectUtil; -import net.minecraft.util.BlockRenderLayer; import java.util.Iterator; import java.util.List; @@ -15,8 +17,8 @@ public static LayeredRenderBoxCache initLayeredRenderBoxCache() { return new BloomLayeredRenderBoxCache(); } - public static class BloomLayeredRenderBoxCache extends LayeredRenderBoxCache { + private List solid = null; private List cutout_mipped = null; private List cutout = null; @@ -76,7 +78,7 @@ public void sort() { if (!OptifineHelper.isActive()) return; - for (Iterator iterator = solid.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = solid.iterator(); iterator.hasNext();) { LittleRenderBox littleRenderingCube = iterator.next(); if (littleRenderingCube.needsResorting) { cutout_mipped.add(littleRenderingCube); diff --git a/src/main/java/gregtech/asm/hooks/MinecraftHooks.java b/src/main/java/gregtech/asm/hooks/MinecraftHooks.java index 82588d7b765..01d0fef77d9 100644 --- a/src/main/java/gregtech/asm/hooks/MinecraftHooks.java +++ b/src/main/java/gregtech/asm/hooks/MinecraftHooks.java @@ -2,6 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentTranslation; + import org.lwjgl.input.Keyboard; @SuppressWarnings("unused") diff --git a/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java b/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java index 68835870cf2..7956c412a68 100644 --- a/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java +++ b/src/main/java/gregtech/asm/hooks/RecipeRepairItemHooks.java @@ -1,8 +1,8 @@ package gregtech.asm.hooks; -import com.google.common.collect.Lists; import gregtech.api.items.toolitem.IGTTool; import gregtech.api.items.toolitem.ToolHelper; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -10,6 +10,8 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.ForgeEventFactory; +import com.google.common.collect.Lists; + import java.util.List; @SuppressWarnings("unused") @@ -77,7 +79,8 @@ public static ItemStack getCraftingResult(InventoryCrafting inv) { ItemStack first = list.get(0); ItemStack second = list.get(1); - if (first.getItem() == second.getItem() && first.getCount() == 1 && second.getCount() == 1 && first.getItem().isRepairable()) { + if (first.getItem() == second.getItem() && first.getCount() == 1 && second.getCount() == 1 && + first.getItem().isRepairable()) { int j = first.getMaxDamage() - first.getItemDamage(); int k = first.getMaxDamage() - second.getItemDamage(); int l = j + k + first.getMaxDamage() * 5 / 100; diff --git a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java index ab4270efae6..89cadb67e6e 100644 --- a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.metatileentity.MetaTileEntityHolder; + import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -9,7 +10,9 @@ @SuppressWarnings("unused") public class RenderChunkHooks { - public static TileEntitySpecialRenderer getRenderer(TileEntityRendererDispatcher renderer, @Nullable TileEntity tileEntityIn) { + + public static TileEntitySpecialRenderer getRenderer(TileEntityRendererDispatcher renderer, + @Nullable TileEntity tileEntityIn) { // TODO if (tileEntityIn instanceof MetaTileEntityHolder && !((MetaTileEntityHolder) tileEntityIn).hasTESR()) { return null; diff --git a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java index 58c477ff347..fa65ac31edd 100644 --- a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java @@ -4,6 +4,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.client.renderer.handler.LampItemOverlayRenderer; import gregtech.client.utils.ToolChargeBarRenderer; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/asm/hooks/SoundHooks.java b/src/main/java/gregtech/asm/hooks/SoundHooks.java index ec522817890..31bbc697dbb 100644 --- a/src/main/java/gregtech/asm/hooks/SoundHooks.java +++ b/src/main/java/gregtech/asm/hooks/SoundHooks.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MusicDiscStats; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.entity.player.EntityPlayer; @@ -15,13 +16,15 @@ public class SoundHooks { public static void playRecord(IWorldEventListener listener, EntityPlayer player, int type, BlockPos pos, int data) { - if (type == MusicDiscStats.SOUND_TYPE && FMLCommonHandler.instance().getSide().isClient() && listener instanceof RenderGlobal) { + if (type == MusicDiscStats.SOUND_TYPE && FMLCommonHandler.instance().getSide().isClient() && + listener instanceof RenderGlobal) { for (MetaItem metaItem : MetaItem.getMetaItems()) { MetaItem.MetaValueItem valueItem = metaItem.getItem((short) data); if (valueItem != null) { for (IItemBehaviour behavior : valueItem.getBehaviours()) { if (behavior instanceof MusicDiscStats) { - WorldClient world = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, (RenderGlobal)listener, "field_72769_h"); + WorldClient world = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, + (RenderGlobal) listener, "field_72769_h"); world.playRecord(pos, ((MusicDiscStats) behavior).getSound()); return; } diff --git a/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java b/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java index 13ce8fd439e..fd83510be73 100644 --- a/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java +++ b/src/main/java/gregtech/asm/hooks/TheOneProbeHooks.java @@ -1,6 +1,7 @@ package gregtech.asm.hooks; import gregtech.api.block.machines.BlockMachine; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; diff --git a/src/main/java/gregtech/asm/util/ObfMapping.java b/src/main/java/gregtech/asm/util/ObfMapping.java index ba34d31954a..194d379ee3a 100644 --- a/src/main/java/gregtech/asm/util/ObfMapping.java +++ b/src/main/java/gregtech/asm/util/ObfMapping.java @@ -1,12 +1,13 @@ package gregtech.asm.util; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; + import com.google.common.base.Charsets; import com.google.common.base.Objects; import com.google.common.io.LineProcessor; import com.google.common.io.Resources; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; @@ -14,7 +15,6 @@ import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.tree.*; -import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; @@ -22,10 +22,12 @@ import java.util.Map; import java.util.Map.Entry; +import javax.annotation.Nonnull; + /** * @apiNote codechicken.asm.ObfMapping */ -@SuppressWarnings({"unused", "UnstableApiUsage"}) +@SuppressWarnings({ "unused", "UnstableApiUsage" }) public class ObfMapping extends Remapper { public static final ObfRemapper obfMapper = new ObfRemapper(); @@ -69,14 +71,14 @@ public static ObfMapping fromDesc(String s) { if (lastDot < 0) { return new ObfMapping(s, "", ""); } - int sep = s.indexOf('(');//methods + int sep = s.indexOf('(');// methods int sep_end = sep; if (sep < 0) { - sep = s.indexOf(' ');//some stuffs + sep = s.indexOf(' ');// some stuffs sep_end = sep + 1; } if (sep < 0) { - sep = s.indexOf(':');//fields + sep = s.indexOf(':');// fields sep_end = sep + 1; } if (sep < 0) { @@ -246,11 +248,14 @@ public ObfRemapper() { Field rawMethodMapsField = FMLDeobfuscatingRemapper.class.getDeclaredField("rawMethodMaps"); rawFieldMapsField.setAccessible(true); rawMethodMapsField.setAccessible(true); - Map> rawFieldMaps = (Map>) rawFieldMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); - Map> rawMethodMaps = (Map>) rawMethodMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); + Map> rawFieldMaps = (Map>) rawFieldMapsField + .get(FMLDeobfuscatingRemapper.INSTANCE); + Map> rawMethodMaps = (Map>) rawMethodMapsField + .get(FMLDeobfuscatingRemapper.INSTANCE); if (rawFieldMaps == null) { - throw new IllegalStateException("gregtech.asm.util.ObfMapping loaded too early. Make sure all references are in or after the asm transformer load stage"); + throw new IllegalStateException( + "gregtech.asm.util.ObfMapping loaded too early. Make sure all references are in or after the asm transformer load stage"); } for (Map map : rawFieldMaps.values()) { @@ -325,7 +330,7 @@ public static File[] getConfFiles() { File methodCsv = new File(csvDir, "methods.csv"); if (notchSrg.exists() && fieldCsv.exists() && methodCsv.exists()) { - return new File[]{notchSrg, fieldCsv, methodCsv}; + return new File[] { notchSrg, fieldCsv, methodCsv }; } } @@ -363,19 +368,16 @@ public boolean processLine(@Nonnull String line) { public Void getResult() { return null; } - } static { boolean obf = true; try { obf = Launch.classLoader.getClassBytes("net.minecraft.world.World") == null; - } catch (Exception ignored) { - } + } catch (Exception ignored) {} obfuscated = obf; if (!obf) { loadMCPRemapper(); } } - } diff --git a/src/main/java/gregtech/asm/util/TargetClassVisitor.java b/src/main/java/gregtech/asm/util/TargetClassVisitor.java index e8f5fcbca03..5fcbd9fea68 100644 --- a/src/main/java/gregtech/asm/util/TargetClassVisitor.java +++ b/src/main/java/gregtech/asm/util/TargetClassVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.util; import net.minecraftforge.fml.common.FMLLog; + import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; @@ -15,7 +16,8 @@ public class TargetClassVisitor extends ClassVisitor { private final Function visitorCreator; private boolean foundMethod = false; - public TargetClassVisitor(ClassVisitor cv, ObfMapping methodKey, Function visitorCreator) { + public TargetClassVisitor(ClassVisitor cv, ObfMapping methodKey, + Function visitorCreator) { super(Opcodes.ASM5, cv); this.methodKey = methodKey.toRuntime(); this.visitorCreator = visitorCreator; @@ -46,7 +48,8 @@ public void visitEnd() { super.visitEnd(); if (!foundMethod) { FMLLog.log("GregTechTransformer", Level.FATAL, "Failed to find method %s in %s.", methodKey, className); - throw new RuntimeException("Failed to patch method " + methodKey + ", loading cannot continue. Check your environment is correct."); + throw new RuntimeException("Failed to patch method " + methodKey + + ", loading cannot continue. Check your environment is correct."); } } } diff --git a/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java b/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java index 8298b85e62e..ebc2f40c274 100644 --- a/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java +++ b/src/main/java/gregtech/asm/visitors/AbstractCTMBakedModelVisitor.java @@ -1,10 +1,12 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class AbstractCTMBakedModelVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "team/chisel/ctm/client/model/AbstractCTMBakedModel"; public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188616_a", @@ -21,7 +23,6 @@ public class AbstractCTMBakedModelVisitor extends MethodVisitor implements Opcod "J" + ")Ljava/util/List;"); - public AbstractCTMBakedModelVisitor(MethodVisitor mv) { super(ASM5, mv); } diff --git a/src/main/java/gregtech/asm/visitors/BlockVisitor.java b/src/main/java/gregtech/asm/visitors/BlockVisitor.java index 5ababbf16b8..272aa8d3944 100644 --- a/src/main/java/gregtech/asm/visitors/BlockVisitor.java +++ b/src/main/java/gregtech/asm/visitors/BlockVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; public class BlockVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/block/Block"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "canRenderInLayer", "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "canRenderInLayer", + "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); private static final String BLOCK_HOOKS_OWNER = "gregtech/asm/hooks/BlockHooks"; private static final String BLOCK_HOOKS_SIGNATURE = "(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Ljava/lang/Boolean;"; @@ -20,10 +22,16 @@ public static ClassNode handleClassNode(ClassNode classNode) { toAdd.add(new VarInsnNode(ALOAD, 1)); // Load state toAdd.add(new VarInsnNode(ALOAD, 2)); // Load layer // Invoke hook - toAdd.add(new MethodInsnNode(INVOKESTATIC, BLOCK_HOOKS_OWNER, BLOCK_HOOKS_METHOD_NAME, BLOCK_HOOKS_SIGNATURE, false)); + toAdd.add(new MethodInsnNode(INVOKESTATIC, BLOCK_HOOKS_OWNER, BLOCK_HOOKS_METHOD_NAME, + BLOCK_HOOKS_SIGNATURE, false)); toAdd.add(new InsnNode(DUP)); // Copy value on stack, avoids need for local var - toAdd.add(new JumpInsnNode(IFNULL, (LabelNode) m.instructions.getFirst())); // Check if return is null, if it is, jump to vanilla code - toAdd.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false)); // Otherwise evaluate the bool + toAdd.add(new JumpInsnNode(IFNULL, (LabelNode) m.instructions.getFirst())); // Check if return is null, + // if it is, jump to vanilla + // code + toAdd.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false)); // Otherwise + // evaluate + // the + // bool toAdd.add(new InsnNode(IRETURN)); // And return it AbstractInsnNode first = m.instructions.getFirst(); // First vanilla instruction m.instructions.insertBefore(first, toAdd); // Put this before the first instruction (L1 label node) diff --git a/src/main/java/gregtech/asm/visitors/CCLVisitor.java b/src/main/java/gregtech/asm/visitors/CCLVisitor.java index bd92f800329..181a92b796a 100644 --- a/src/main/java/gregtech/asm/visitors/CCLVisitor.java +++ b/src/main/java/gregtech/asm/visitors/CCLVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; diff --git a/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java b/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java index 8270341820b..6f79f47abda 100644 --- a/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ConcretePowderVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; diff --git a/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java b/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java index eaf2eb90187..121e459dc8f 100644 --- a/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java +++ b/src/main/java/gregtech/asm/visitors/DamageSourceVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -28,7 +29,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(TARGET_METHOD_PLAYER.s_name) && m.desc.equals(TARGET_METHOD_PLAYER.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 0)); - insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_PLAYER, TARGET_SIGNATURE_PLAYER, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_PLAYER, + TARGET_SIGNATURE_PLAYER, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -39,7 +41,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(TARGET_METHOD_MOB.s_name) && m.desc.equals(TARGET_METHOD_MOB.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 0)); - insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_MOB, TARGET_SIGNATURE_MOB, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, DAMAGE_SOURCE_OWNER, TARGET_NAME_MOB, TARGET_SIGNATURE_MOB, + false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); diff --git a/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java b/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java index d49d00c1aea..3b2e69563f9 100644 --- a/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java +++ b/src/main/java/gregtech/asm/visitors/EnchantmentCanApplyVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.AdviceAdapter; @@ -28,7 +29,8 @@ public final class EnchantmentCanApplyVisitor extends AdviceAdapter implements O } private static void createMapping(String className) { - CLASS_TO_MAPPING_MAP.put(className, new ObfMapping(className, "func_92089_a", "(Lnet/minecraft/item/ItemStack;)Z").toRuntime()); + CLASS_TO_MAPPING_MAP.put(className, + new ObfMapping(className, "func_92089_a", "(Lnet/minecraft/item/ItemStack;)Z").toRuntime()); } public EnchantmentCanApplyVisitor(MethodVisitor mv, ObfMapping mapping) { @@ -42,7 +44,9 @@ protected void onMethodExit(int opcode) { visitVarInsn(ALOAD, 1); // load ItemStack visitVarInsn(ALOAD, 0); // load this (Enchantment) visitMethodInsn(INVOKESTATIC, "gregtech/asm/hooks/EnchantmentHooks", "checkTool", - "(ZLnet/minecraft/item/ItemStack;Lnet/minecraft/enchantment/Enchantment;)Z", false); // do GT tool checking logic + "(ZLnet/minecraft/item/ItemStack;Lnet/minecraft/enchantment/Enchantment;)Z", false); // do GT tool + // checking + // logic } } } diff --git a/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java b/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java index e54f067c007..a859ff5d4d4 100644 --- a/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java +++ b/src/main/java/gregtech/asm/visitors/EntityRendererVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -30,7 +31,8 @@ public EntityRendererVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEVIRTUAL && (METHOD_RENDER_BLOCK_LAYER.matches(name, desc) || METHOD_RENDER_BLOCK_LAYER2.matches(name, desc))) { + if (opcode == INVOKEVIRTUAL && + (METHOD_RENDER_BLOCK_LAYER.matches(name, desc) || METHOD_RENDER_BLOCK_LAYER2.matches(name, desc))) { time++; if (time == 4) { METHOD_BLOOM_HOOKS.visitMethodInsn(this, INVOKESTATIC); @@ -39,5 +41,4 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, } super.visitMethodInsn(opcode, owner, name, desc, itf); } - } diff --git a/src/main/java/gregtech/asm/visitors/JEIVisitor.java b/src/main/java/gregtech/asm/visitors/JEIVisitor.java index b6a31c0be98..26fc156f89a 100644 --- a/src/main/java/gregtech/asm/visitors/JEIVisitor.java +++ b/src/main/java/gregtech/asm/visitors/JEIVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class JEIVisitor extends MethodVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "mezz/jei/startup/ForgeModIdHelper"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "addModNameToIngredientTooltip", targetSignature()); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "addModNameToIngredientTooltip", + targetSignature()); private static final String FLUID_TOOLTIP_OWNER = "gregtech/asm/hooks/JEIHooks"; private static final String FLUID_TOOLTIP_SIGNATURE = tooltipSignature(); @@ -20,19 +22,19 @@ public JEIVisitor(MethodVisitor mv) { // Need to call JEIHooks#addFluidTooltip(List, Object) @Override public void visitCode() { - mv.visitVarInsn(ALOAD, 1); // List tooltip mv.visitVarInsn(ALOAD, 2); // T ingredient // statically call addFluidTooltip(List, Object) - mv.visitMethodInsn(INVOKESTATIC, FLUID_TOOLTIP_OWNER, FLUID_TOOLTIP_METHOD_NAME, FLUID_TOOLTIP_SIGNATURE, false); + mv.visitMethodInsn(INVOKESTATIC, FLUID_TOOLTIP_OWNER, FLUID_TOOLTIP_METHOD_NAME, FLUID_TOOLTIP_SIGNATURE, + false); mv.visitCode(); } - // public List addModNameToIngredientTooltip(List tooltip, E ingredient, IIngredientHelper ingredientHelper) + // public List addModNameToIngredientTooltip(List tooltip, E ingredient, IIngredientHelper + // ingredientHelper) private static String targetSignature() { - return "(" + "Ljava/util/List;" + // List "Ljava/lang/Object;" + // E @@ -42,7 +44,6 @@ private static String targetSignature() { // public void addFluidTooltip(List tooltip, Object ingredient) private static String tooltipSignature() { - return "(" + "Ljava/util/List;" + // List "Ljava/lang/Object;" + // Object diff --git a/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java b/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java index 9ab91cb67c5..aef7ff3395e 100644 --- a/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LayerArmorBaseVisitor.java @@ -1,13 +1,15 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class LayerArmorBaseVisitor extends MethodVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/entity/layers/LayerArmorBase"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188361_a", "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_188361_a", + "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorRenderHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(Lnet/minecraft/client/renderer/entity/layers/LayerArmorBase;Lnet/minecraft/entity/EntityLivingBase;FFFFFFFLnet/minecraft/inventory/EntityEquipmentSlot;)V"; @@ -20,12 +22,14 @@ public LayerArmorBaseVisitor(MethodVisitor mv) { @Override public void visitInsn(int opcode) { if (opcode == Opcodes.RETURN) { - super.visitVarInsn(ALOAD, 0); //this - super.visitVarInsn(ALOAD, 1); //entityLivingBaseIn + super.visitVarInsn(ALOAD, 0); // this + super.visitVarInsn(ALOAD, 1); // entityLivingBaseIn for (int i = 0; i < 7; i++) - super.visitVarInsn(FLOAD, 2 + i); //limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale - super.visitVarInsn(ALOAD, 9); //slotIn - super.visitMethodInsn(INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); + super.visitVarInsn(FLOAD, 2 + i); // limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, + // headPitch, scale + super.visitVarInsn(ALOAD, 9); // slotIn + super.visitMethodInsn(INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, + false); } super.visitInsn(opcode); } diff --git a/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java b/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java index 70cea4ee7ba..ce253343216 100644 --- a/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LayerCustomHeadVisitor.java @@ -2,6 +2,7 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.SafeMethodVisitor; + import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -9,13 +10,14 @@ public class LayerCustomHeadVisitor extends SafeMethodVisitor { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/entity/layers/LayerCustomHead"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_177141_a", "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_177141_a", + "(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V"); private static final String METHOD_OWNER = "net/minecraft/client/renderer/ItemRenderer"; private static final String METHOD_SIGNATURE = "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;)V"; private static final String METHOD_NAME = "func_178099_a"; - private static final ObfMapping METHOD_MAPPING = new ObfMapping(METHOD_OWNER, METHOD_NAME, METHOD_SIGNATURE).toRuntime(); - + private static final ObfMapping METHOD_MAPPING = new ObfMapping(METHOD_OWNER, METHOD_NAME, METHOD_SIGNATURE) + .toRuntime(); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorRenderHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(Lnet/minecraft/entity/EntityLivingBase;)Z"; @@ -26,7 +28,8 @@ public LayerCustomHeadVisitor(MethodVisitor mv) { } private static boolean checkTargetInsn(int opcode, String owner, String name, String desc) { - return opcode == Opcodes.INVOKEVIRTUAL && METHOD_MAPPING.s_owner.equals(owner) && METHOD_MAPPING.matches(name, desc); + return opcode == Opcodes.INVOKEVIRTUAL && METHOD_MAPPING.s_owner.equals(owner) && + METHOD_MAPPING.matches(name, desc); } @Override @@ -35,10 +38,11 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, markPatchedSuccessfully(); Label endLabel = new Label(); Label skipLabel = new Label(); - super.visitVarInsn(Opcodes.ALOAD, 1); //load entity - super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); + super.visitVarInsn(Opcodes.ALOAD, 1); // load entity + super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, + ARMOR_HOOKS_SIGNATURE, false); super.visitJumpInsn(Opcodes.IFEQ, skipLabel); - for (int i = 0; i < 4; i++) super.visitInsn(Opcodes.POP); //pop this, entity, stack, transformType + for (int i = 0; i < 4; i++) super.visitInsn(Opcodes.POP); // pop this, entity, stack, transformType super.visitJumpInsn(Opcodes.GOTO, endLabel); super.visitLabel(skipLabel); super.visitMethodInsn(opcode, owner, name, desc, itf); diff --git a/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java b/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java index 7cd27e470f3..a4d09e93ff1 100644 --- a/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java +++ b/src/main/java/gregtech/asm/visitors/LittleTilesVisitor.java @@ -1,10 +1,12 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class LittleTilesVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "com/creativemd/littletiles/client/render/world/TileEntityRenderManager"; public static final ObfMapping TARGET_METHOD = new ObfMapping( TARGET_CLASS_NAME, @@ -26,11 +28,10 @@ public LittleTilesVisitor(MethodVisitor mv) { @Override public void visitInsn(int opcode) { if (opcode == RETURN) { - super.visitVarInsn(ALOAD,0); + super.visitVarInsn(ALOAD, 0); METHOD_LAYER_RENDER_BOX_CACHE_HOOKS.visitMethodInsn(this, INVOKESTATIC); FIELD_LAYER_RENDER_BOX_CACHE.visitFieldInsn(this, PUTFIELD); } super.visitInsn(opcode); } - } diff --git a/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java b/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java index 27f2df3684e..05670191a4a 100644 --- a/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java +++ b/src/main/java/gregtech/asm/visitors/MinecraftVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.AdviceAdapter; diff --git a/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java b/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java index e4b3ef7b4ff..06470b38e29 100644 --- a/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ModelCTMVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -20,7 +21,6 @@ public class ModelCTMVisitor extends MethodVisitor implements Opcodes { "canRenderInLayer", "(Lteam/chisel/ctm/api/model/IModelCTM;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockRenderLayer;)Z"); - public ModelCTMVisitor(MethodVisitor mv) { super(ASM5, mv); } diff --git a/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java b/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java index 29131e8ea5f..7b68ba70bac 100644 --- a/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java +++ b/src/main/java/gregtech/asm/visitors/ModelLoaderRegistryVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import static org.objectweb.asm.Opcodes.*; diff --git a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java b/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java index 15794c66e56..a70986c67fb 100644 --- a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java +++ b/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java @@ -1,14 +1,18 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class NuclearCraftRecipeHelperVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "nc/integration/gtce/GTCERecipeHelper"; - public static final ObfMapping TARGET_METHOD_NC = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", "(Ljava/lang/String;Lnc/recipe/ProcessorRecipe;)V"); - public static final ObfMapping TARGET_METHOD_NCO = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", "(Ljava/lang/String;Lnc/recipe/BasicRecipe;)V"); + public static final ObfMapping TARGET_METHOD_NC = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", + "(Ljava/lang/String;Lnc/recipe/ProcessorRecipe;)V"); + public static final ObfMapping TARGET_METHOD_NCO = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", + "(Ljava/lang/String;Lnc/recipe/BasicRecipe;)V"); public NuclearCraftRecipeHelperVisitor(MethodVisitor mv) { super(ASM5, mv); @@ -16,7 +20,8 @@ public NuclearCraftRecipeHelperVisitor(MethodVisitor mv) { @Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { - if (opcode == GETSTATIC && name.equals("FLUID_EXTRACTION_RECIPES")) { // FLUID_EXTRACTION_RECIPES -> EXTRACTOR_RECIPES + if (opcode == GETSTATIC && name.equals("FLUID_EXTRACTION_RECIPES")) { // FLUID_EXTRACTION_RECIPES -> + // EXTRACTOR_RECIPES name = "EXTRACTOR_RECIPES"; } super.visitFieldInsn(opcode, owner, name, desc); diff --git a/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java b/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java index 88fd9572dc9..94ba37b61c8 100644 --- a/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RecipeRepairItemVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -33,7 +34,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(MATCHES_METHOD.s_name) && m.desc.equals(MATCHES_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, MATCHES_HOOK_METHOD_NAME, MATCHES_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, MATCHES_HOOK_METHOD_NAME, + MATCHES_HOOK_SIGNATURE, false)); insns.add(new InsnNode(IRETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -44,7 +46,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(RESULT_METHOD.s_name) && m.desc.equals(RESULT_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, RESULT_HOOK_METHOD_NAME, RESULT_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, RESULT_HOOK_METHOD_NAME, + RESULT_HOOK_SIGNATURE, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); @@ -55,7 +58,8 @@ public static ClassNode handleClassNode(ClassNode classNode) { if (m.name.equals(REMAINING_METHOD.s_name) && m.desc.equals(REMAINING_METHOD.s_desc)) { InsnList insns = new InsnList(); insns.add(new VarInsnNode(ALOAD, 1)); - insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, REMAINING_HOOK_METHOD_NAME, REMAINING_HOOK_SIGNATURE, false)); + insns.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS_NAME, REMAINING_HOOK_METHOD_NAME, + REMAINING_HOOK_SIGNATURE, false)); insns.add(new InsnNode(ARETURN)); AbstractInsnNode first = m.instructions.getFirst(); m.instructions.insertBefore(first, insns); diff --git a/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java b/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java index 29d96a60404..27db622cfa3 100644 --- a/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RegionRenderCacheBuilderVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -17,16 +18,14 @@ public class RegionRenderCacheBuilderVisitor extends MethodVisitor implements Op "initBloomRenderLayer", "([Lnet/minecraft/client/renderer/BufferBuilder;)V"); - public RegionRenderCacheBuilderVisitor(MethodVisitor mv) { super(ASM5, mv); } - @Override public void visitInsn(int opcode) { if (opcode == RETURN) { - super.visitVarInsn(ALOAD,0); + super.visitVarInsn(ALOAD, 0); FIELD_WORLD_RENDERERS.visitFieldInsn(this, GETFIELD); METHOD_BLOOM_HOOKS.visitMethodInsn(this, INVOKESTATIC); } diff --git a/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java b/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java index 0b118a92b22..8f37a9ff9ad 100644 --- a/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RenderChunkVisitor.java @@ -1,16 +1,20 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class RenderChunkVisitor extends MethodVisitor implements Opcodes { + public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/chunk/RenderChunk"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_178581_b", "(FFFLnet/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator;)V"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_178581_b", + "(FFFLnet/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator;)V"); private static final ObfMapping METHOD_GET_RENDERER = new ObfMapping( "net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher", "func_147546_a", - "(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;").toRuntime(); + "(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;") + .toRuntime(); private static final ObfMapping METHOD_GET_RENDERER_HOOKS = new ObfMapping( "gregtech/asm/hooks/RenderChunkHooks", "getRenderer", @@ -20,7 +24,6 @@ public RenderChunkVisitor(MethodVisitor mv) { super(ASM5, mv); } - @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (opcode == INVOKEVIRTUAL && (METHOD_GET_RENDERER.matches(name, desc))) { @@ -29,5 +32,4 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, } super.visitMethodInsn(opcode, owner, name, desc, itf); } - } diff --git a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java index 60c76990991..f1b87a1fc12 100644 --- a/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java +++ b/src/main/java/gregtech/asm/visitors/RenderItemVisitor.java @@ -2,7 +2,9 @@ import gregtech.api.GTValues; import gregtech.asm.util.ObfMapping; + import net.minecraftforge.fml.common.Loader; + import org.objectweb.asm.Label; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; @@ -12,7 +14,8 @@ public class RenderItemVisitor implements Opcodes { public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/RenderItem"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_180453_a", "(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V").toRuntime(); // renderItemOverlayIntoGUI + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "func_180453_a", + "(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V").toRuntime(); // renderItemOverlayIntoGUI public static void transform(Iterator methods) { while (methods.hasNext()) { @@ -22,7 +25,8 @@ public static void transform(Iterator methods) { callRenderLampOverlay.add(new VarInsnNode(ALOAD, 2)); callRenderLampOverlay.add(new VarInsnNode(ILOAD, 3)); callRenderLampOverlay.add(new VarInsnNode(ILOAD, 4)); - callRenderLampOverlay.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", "renderLampOverlay", "(Lnet/minecraft/item/ItemStack;II)V", false)); + callRenderLampOverlay.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", + "renderLampOverlay", "(Lnet/minecraft/item/ItemStack;II)V", false)); boolean enderCoreLoaded = Loader.instance().getIndexedModList().containsKey(GTValues.MODID_ECORE); @@ -33,7 +37,8 @@ public static void transform(Iterator methods) { callRenderElectricBar.add(new VarInsnNode(ALOAD, 2)); callRenderElectricBar.add(new VarInsnNode(ILOAD, 3)); callRenderElectricBar.add(new VarInsnNode(ILOAD, 4)); - callRenderElectricBar.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", "renderElectricBar", "(Lnet/minecraft/item/ItemStack;II)V", false)); + callRenderElectricBar.add(new MethodInsnNode(INVOKESTATIC, "gregtech/asm/hooks/RenderItemHooks", + "renderElectricBar", "(Lnet/minecraft/item/ItemStack;II)V", false)); } else { callRenderElectricBar = null; } diff --git a/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java b/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java index 6aceeb85ab3..4be3efac79d 100644 --- a/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java +++ b/src/main/java/gregtech/asm/visitors/SpecialArmorApplyVisitor.java @@ -2,15 +2,18 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.SafeMethodVisitor; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class SpecialArmorApplyVisitor extends SafeMethodVisitor { public static final String TARGET_CLASS_NAME = "net/minecraftforge/common/ISpecialArmor$ArmorProperties"; - public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "applyArmor", "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;D)F"); + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "applyArmor", + "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;D)F"); - private static final ObfMapping METHOD_MAPPING = new ObfMapping("net/minecraft/util/CombatRules", "func_189427_a", "(FFF)F").toRuntime(); + private static final ObfMapping METHOD_MAPPING = new ObfMapping("net/minecraft/util/CombatRules", "func_189427_a", + "(FFF)F").toRuntime(); private static final String ARMOR_HOOKS_OWNER = "gregtech/asm/hooks/ArmorHooks"; private static final String ARMOR_HOOKS_SIGNATURE = "(FLnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/util/NonNullList;Lnet/minecraft/util/DamageSource;)V"; @@ -21,22 +24,28 @@ public SpecialArmorApplyVisitor(MethodVisitor mv) { } private static boolean checkTargetInsn(int opcode, String owner, String name, String desc) { - return opcode == Opcodes.INVOKESTATIC && METHOD_MAPPING.s_owner.equals(owner) && METHOD_MAPPING.matches(name, desc); + return opcode == Opcodes.INVOKESTATIC && METHOD_MAPPING.s_owner.equals(owner) && + METHOD_MAPPING.matches(name, desc); } @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (checkTargetInsn(opcode, owner, name, desc)) { markPatchedSuccessfully(); - super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); //store armorToughness - super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); //store totalArmor - super.visitInsn(Opcodes.DUP); //duplicate damage - super.visitVarInsn(Opcodes.ALOAD, 0); //load entity - super.visitVarInsn(Opcodes.ALOAD, 1); //load inventory - super.visitVarInsn(Opcodes.ALOAD, 2); //load damageSource - super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false); //call ArmorHooks - super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); //load totalArmor back - super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); //load armorToughness back + super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); // store armorToughness + super.visitFieldInsn(Opcodes.PUTSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); // store totalArmor + super.visitInsn(Opcodes.DUP); // duplicate damage + super.visitVarInsn(Opcodes.ALOAD, 0); // load entity + super.visitVarInsn(Opcodes.ALOAD, 1); // load inventory + super.visitVarInsn(Opcodes.ALOAD, 2); // load damageSource + super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, + ARMOR_HOOKS_SIGNATURE, false); // call ArmorHooks + super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOTAL_ARMOR_FIELD_NAME, "F"); // load totalArmor back + super.visitFieldInsn(Opcodes.GETSTATIC, TARGET_CLASS_NAME, + SpecialArmorClassVisitor.CACHED_TOUGHNESS_FIELD_NAME, "F"); // load armorToughness back } super.visitMethodInsn(opcode, owner, name, desc, itf); } diff --git a/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java b/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java index c215e166c6c..fbc66c71ab1 100644 --- a/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java +++ b/src/main/java/gregtech/asm/visitors/SpecialArmorClassVisitor.java @@ -2,6 +2,7 @@ import gregtech.asm.util.ObfMapping; import gregtech.asm.util.TargetClassVisitor; + import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -13,7 +14,8 @@ public class SpecialArmorClassVisitor extends TargetClassVisitor { public static final String CACHED_TOUGHNESS_FIELD_NAME = "gregtech__cachedToughness"; public static final String CACHED_TOTAL_ARMOR_FIELD_NAME = "gregtech__cachedTotalArmor"; - public SpecialArmorClassVisitor(ClassVisitor cv, ObfMapping methodKey, Function visitorCreator) { + public SpecialArmorClassVisitor(ClassVisitor cv, ObfMapping methodKey, + Function visitorCreator) { super(cv, methodKey, visitorCreator); } diff --git a/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java b/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java index 5ecbce5f5a9..15f7ae71799 100644 --- a/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java +++ b/src/main/java/gregtech/asm/visitors/TheOneProbeVisitor.java @@ -1,9 +1,9 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.AdviceAdapter; public class TheOneProbeVisitor extends MethodVisitor implements Opcodes { @@ -19,21 +19,18 @@ public TheOneProbeVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEVIRTUAL && name.equals(GET_BLOCK_STATE_METHOD.s_name) && desc.equals(GET_BLOCK_STATE_METHOD.s_desc)) { + if (opcode == INVOKEVIRTUAL && name.equals(GET_BLOCK_STATE_METHOD.s_name) && + desc.equals(GET_BLOCK_STATE_METHOD.s_desc)) { visitMethodInsn(INVOKESTATIC, "gregtech/asm/hooks/TheOneProbeHooks", "getActualState", - "(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/state/IBlockState;", false); + "(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/state/IBlockState;", + false); } else super.visitMethodInsn(opcode, owner, name, desc, itf); } private static String getSignature() { - return "(" - + "Lnet/minecraft/entity/player/EntityPlayer;" - + "Lmcjty/theoneprobe/api/ProbeMode;" - + "Lnet/minecraft/world/World;" - + "Lnet/minecraft/util/math/BlockPos;" - + "Lnet/minecraft/util/EnumFacing;" - + "Lnet/minecraft/util/math/Vec3d;" - + "Lnet/minecraft/item/ItemStack;" - + ")Lmcjty/theoneprobe/apiimpl/ProbeInfo;"; + return "(" + "Lnet/minecraft/entity/player/EntityPlayer;" + "Lmcjty/theoneprobe/api/ProbeMode;" + + "Lnet/minecraft/world/World;" + "Lnet/minecraft/util/math/BlockPos;" + + "Lnet/minecraft/util/EnumFacing;" + "Lnet/minecraft/util/math/Vec3d;" + + "Lnet/minecraft/item/ItemStack;" + ")Lmcjty/theoneprobe/apiimpl/ProbeInfo;"; } } diff --git a/src/main/java/gregtech/asm/visitors/WorldVisitor.java b/src/main/java/gregtech/asm/visitors/WorldVisitor.java index 29bf4089c5b..1fc3f5395db 100644 --- a/src/main/java/gregtech/asm/visitors/WorldVisitor.java +++ b/src/main/java/gregtech/asm/visitors/WorldVisitor.java @@ -1,6 +1,7 @@ package gregtech.asm.visitors; import gregtech.asm.util.ObfMapping; + import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; @@ -23,7 +24,8 @@ public WorldVisitor(MethodVisitor mv) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - if (opcode == INVOKEINTERFACE && desc.equals("(Lnet/minecraft/entity/player/EntityPlayer;ILnet/minecraft/util/math/BlockPos;I)V")) { + if (opcode == INVOKEINTERFACE && + desc.equals("(Lnet/minecraft/entity/player/EntityPlayer;ILnet/minecraft/util/math/BlockPos;I)V")) { METHOD_PLAY_RECORD_HOOKS.visitMethodInsn(this, INVOKESTATIC); } else { super.visitMethodInsn(opcode, owner, name, desc, itf); diff --git a/src/main/java/gregtech/client/ClientProxy.java b/src/main/java/gregtech/client/ClientProxy.java index ff1404dd5e4..5da0e9f243b 100644 --- a/src/main/java/gregtech/client/ClientProxy.java +++ b/src/main/java/gregtech/client/ClientProxy.java @@ -1,6 +1,5 @@ package gregtech.client; -import codechicken.lib.texture.TextureUtils; import gregtech.api.GTValues; import gregtech.api.fluids.GTFluidRegistration; import gregtech.api.items.metaitem.MetaOreDictItem; @@ -26,6 +25,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; @@ -54,13 +54,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; + +import codechicken.lib.texture.TextureUtils; import paulscode.sound.SoundSystemConfig; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; + @SideOnly(Side.CLIENT) @Mod.EventBusSubscriber(Side.CLIENT) public class ClientProxy extends CommonProxy { @@ -71,9 +74,11 @@ public void onPreLoad() { SoundSystemConfig.setNumberNormalChannels(ConfigHolder.client.maxNumSounds); if (!Loader.isModLoaded(GTValues.MODID_CTM)) { - Minecraft.getMinecraft().metadataSerializer.registerMetadataSectionType(new MetadataSectionCTM.Serializer(), MetadataSectionCTM.class); + Minecraft.getMinecraft().metadataSerializer.registerMetadataSectionType(new MetadataSectionCTM.Serializer(), + MetadataSectionCTM.class); MinecraftForge.EVENT_BUS.register(CustomTextureModelHandler.INSTANCE); - ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(CustomTextureModelHandler.INSTANCE); + ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(CustomTextureModelHandler.INSTANCE); } MetaTileEntityRenderer.preInit(); @@ -120,7 +125,8 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { ItemStack itemStack = event.getItemStack(); if (itemStack.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) itemStack.getItem()).getBlock(); - if (!(block instanceof BlockFrame) && !(block instanceof BlockCompressed) && !(block instanceof IBlockOre) && !(block instanceof IFluidBlock)) { + if (!(block instanceof BlockFrame) && !(block instanceof BlockCompressed) && + !(block instanceof IBlockOre) && !(block instanceof IFluidBlock)) { // Do not apply this tooltip to blocks other than: // - Frames // - Compressed Blocks @@ -139,27 +145,33 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { if (itemStack.getItem() instanceof MetaOreDictItem) { // Test for OreDictItems MetaOreDictItem oreDictItem = (MetaOreDictItem) itemStack.getItem(); Optional oreDictName = OreDictUnifier.getOreDictionaryNames(itemStack).stream().findFirst(); - if (oreDictName.isPresent() && oreDictItem.OREDICT_TO_FORMULA.containsKey(oreDictName.get()) && !oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get()).isEmpty()) { + if (oreDictName.isPresent() && oreDictItem.OREDICT_TO_FORMULA.containsKey(oreDictName.get()) && + !oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get()).isEmpty()) { tooltips.add(TextFormatting.YELLOW + oreDictItem.OREDICT_TO_FORMULA.get(oreDictName.get())); } } else if (unificationEntry != null && unificationEntry.material != null) { - if (unificationEntry.material.getChemicalFormula() != null && !unificationEntry.material.getChemicalFormula().isEmpty()) + if (unificationEntry.material.getChemicalFormula() != null && + !unificationEntry.material.getChemicalFormula().isEmpty()) tooltips.add(TextFormatting.YELLOW + unificationEntry.material.getChemicalFormula()); } else if (itemStack.hasTagCompound()) { // Test for Fluids // Vanilla bucket - //noinspection ConstantConditions + // noinspection ConstantConditions tooltips = FluidTooltipUtil.getFluidTooltip(itemStack.getTagCompound().getString("FluidName")); // GTCE Cells, Forestry cans, some other containers if (tooltips == null || tooltips.size() == 0) { - //if (itemStack.getItem() instanceof ItemBlock && ((ItemBlock) itemStack.getItem()).getBlock() == GregTechAPI.MACHINE && itemStack.getItemDamage()) + // if (itemStack.getItem() instanceof ItemBlock && ((ItemBlock) itemStack.getItem()).getBlock() == + // GregTechAPI.MACHINE && itemStack.getItemDamage()) NBTTagCompound compound = itemStack.getTagCompound(); - if (compound != null && compound.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { - FluidStack fstack = FluidStack.loadFluidStackFromNBT(compound.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); + if (compound != null && + compound.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { + FluidStack fstack = FluidStack + .loadFluidStackFromNBT(compound.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); tooltips = FluidTooltipUtil.getFluidTooltip(fstack); } } - } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) { // Water and Lava buckets have a separate registry name from other buckets + } else if (itemStack.getItem().equals(Items.WATER_BUCKET)) { // Water and Lava buckets have a separate registry + // name from other buckets tooltips = FluidTooltipUtil.getFluidTooltip(Materials.Water.getFluid()); } else if (itemStack.getItem().equals(Items.LAVA_BUCKET)) { tooltips = FluidTooltipUtil.getFluidTooltip(Materials.Lava.getFluid()); @@ -173,7 +185,7 @@ public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { } } - private static final String[] clearRecipes = new String[]{ + private static final String[] clearRecipes = new String[] { "quantum_tank", "quantum_chest", "super_chest", @@ -205,7 +217,7 @@ public static void addNBTClearingTooltip(ItemTooltipEvent event) { if (stackResult == event.getItemStack()) { if (!stackResult.isEmpty() && ItemStack.areItemsEqual(stackResult, event.getItemStack())) { String unlocalizedName = stackResult.getTranslationKey(); - //noinspection ConstantConditions + // noinspection ConstantConditions String namespace = stackResult.getItem().getRegistryName().getNamespace(); for (String key : clearRecipes) { if (unlocalizedName.contains(key) && namespace.equals(GTValues.MODID)) { @@ -240,15 +252,19 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { // Remove durability keys. These can always be removed, as GT puts one of its own in the tooltip already. if (stack.getItem() instanceof IGTTool) { // vanilla durability key - tooltip.remove(I18n.format("item.durability", stack.getMaxDamage() - stack.getItemDamage(), stack.getMaxDamage())); + tooltip.remove(I18n.format("item.durability", stack.getMaxDamage() - stack.getItemDamage(), + stack.getMaxDamage())); // EnderCore durability key - tooltip.remove(net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.durability") + " " + (stack.getMaxDamage() - stack.getItemDamage()) + "/" + stack.getMaxDamage()); + tooltip.remove( + net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.durability") + + " " + (stack.getMaxDamage() - stack.getItemDamage()) + "/" + stack.getMaxDamage()); } // MC and EnderCore debug tooltips. Remove these always, as we will format them differently later String nbtTags = null, registryName = null; if (stack.getTagCompound() != null) { - nbtTags = TextFormatting.DARK_GRAY + I18n.format("item.nbt_tags", stack.getTagCompound().getKeySet().size()); + nbtTags = TextFormatting.DARK_GRAY + + I18n.format("item.nbt_tags", stack.getTagCompound().getKeySet().size()); tooltip.remove(nbtTags); } if (stack.getItem().getRegistryName() != null) { @@ -263,7 +279,8 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { if (TooltipHelper.isShiftDown()) { int[] oreIds = OreDictionary.getOreIDs(event.getItemStack()); if (oreIds.length > 0) { - tooltip.remove(net.minecraft.util.text.translation.I18n.translateToLocal("endercore.tooltip.oreDictNames")); + tooltip.remove(net.minecraft.util.text.translation.I18n + .translateToLocal("endercore.tooltip.oreDictNames")); for (int i : oreIds) { tooltip.remove(" - " + OreDictionary.getOreName(i)); } @@ -279,9 +296,11 @@ public static void cleanupDebugTooltips(ItemTooltipEvent event) { private static boolean hasActuallyAdvancedInfo(List tooltip) { // Actually Additions Keys - if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.actuallyadditions.extraInfo.desc") + ":")) + if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + + I18n.format("tooltip.actuallyadditions.extraInfo.desc") + ":")) return true; - if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + I18n.format("tooltip.actuallyadditions.ctrlForMoreInfo.desc"))) + if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + + I18n.format("tooltip.actuallyadditions.ctrlForMoreInfo.desc"))) return true; // Actually Advanced Info Keys if (tooltip.contains(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Advanced Info:")) return true; diff --git a/src/main/java/gregtech/client/event/ClientEventHandler.java b/src/main/java/gregtech/client/event/ClientEventHandler.java index 35f9773cbe3..f8c3b3467ad 100644 --- a/src/main/java/gregtech/client/event/ClientEventHandler.java +++ b/src/main/java/gregtech/client/event/ClientEventHandler.java @@ -1,6 +1,5 @@ package gregtech.client.event; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; import gregtech.api.GTValues; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.metaitem.MetaItem; @@ -16,7 +15,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -33,10 +32,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import java.util.UUID; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.CLIENT_TIME; @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/client/event/FluidVisualHandler.java b/src/main/java/gregtech/client/event/FluidVisualHandler.java index 8559f004f6a..01d398c1186 100644 --- a/src/main/java/gregtech/client/event/FluidVisualHandler.java +++ b/src/main/java/gregtech/client/event/FluidVisualHandler.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.fluids.GTFluidBlock; import gregtech.api.util.GTUtility; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -41,7 +42,8 @@ @Mod.EventBusSubscriber(value = Side.CLIENT, modid = GTValues.MODID) public class FluidVisualHandler { - private static final ResourceLocation SUBMERGED_FLUID_OVERLAY = GTUtility.gregtechId("textures/blocks/fluids/submerged_fluid_overlay.png"); + private static final ResourceLocation SUBMERGED_FLUID_OVERLAY = GTUtility + .gregtechId("textures/blocks/fluids/submerged_fluid_overlay.png"); @SubscribeEvent public static void onFOVModifier(@Nonnull EntityViewRenderEvent.FOVModifier event) { @@ -74,7 +76,8 @@ public static void onBlockOverlayRender(@Nonnull RenderBlockOverlayEvent event) final float brightness = player.getBrightness(); GlStateManager.color(brightness * r, brightness * g, brightness * b, 0.5F); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.pushMatrix(); @@ -129,7 +132,8 @@ public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { r *= modifier; g *= modifier; b *= modifier; - double modifier2 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) * entity.getEntityWorld().provider.getVoidFogYFactor(); + double modifier2 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) * + entity.getEntityWorld().provider.getVoidFogYFactor(); if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) { PotionEffect blindness = ((EntityLivingBase) entity).getActivePotionEffect(MobEffects.BLINDNESS); @@ -156,7 +160,8 @@ public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { } if (renderer.bossColorModifier > 0.0F) { - float bossColor = renderer.bossColorModifierPrev + (renderer.bossColorModifier - renderer.bossColorModifierPrev) * partialTicks; + float bossColor = renderer.bossColorModifierPrev + + (renderer.bossColorModifier - renderer.bossColorModifierPrev) * partialTicks; r = r * (1.0F - bossColor) + r * 0.7F * bossColor; g = g * (1.0F - bossColor) + g * 0.6F * bossColor; b = b * (1.0F - bossColor) + b * 0.6F * bossColor; @@ -201,7 +206,8 @@ public static void onFogDensity(@Nonnull EntityViewRenderEvent.FogDensity event) final Entity entity = event.getEntity(); // again the event is fired at a bad location... - if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) return; + if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS)) + return; if (renderer.cloudFog) return; GlStateManager.setFog(GlStateManager.FogMode.EXP); diff --git a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java index 3bbd8a638b4..99e2a367fde 100644 --- a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java +++ b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java @@ -5,7 +5,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -23,19 +23,22 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.BooleanSupplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class ActiveVariantBlockBakedModel implements IBakedModel { private static final Map INSTANCES = new Object2ObjectOpenHashMap<>(); - private static final String[] BLOOM_TEXTURE_SUFFIX = {"_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm"}; + private static final String[] BLOOM_TEXTURE_SUFFIX = { "_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm" }; private final ModelResourceLocation inactiveModelLocation; private final ModelResourceLocation activeModelLocation; @@ -44,12 +47,15 @@ public class ActiveVariantBlockBakedModel implements IBakedModel { private final ModelResourceLocation modelLocation; - public ActiveVariantBlockBakedModel(ModelResourceLocation inactiveModelLocation, ModelResourceLocation activeModelLocation, @Nullable BooleanSupplier bloomConfig) { + public ActiveVariantBlockBakedModel(ModelResourceLocation inactiveModelLocation, + ModelResourceLocation activeModelLocation, + @Nullable BooleanSupplier bloomConfig) { this.inactiveModelLocation = inactiveModelLocation; this.activeModelLocation = activeModelLocation; this.bloomConfig = bloomConfig; this.modelLocation = new ModelResourceLocation( - GTUtility.gregtechId("active_variant_block_" + inactiveModelLocation.getNamespace() + "_" + inactiveModelLocation.getPath()), + GTUtility.gregtechId("active_variant_block_" + inactiveModelLocation.getNamespace() + "_" + + inactiveModelLocation.getPath()), inactiveModelLocation.getVariant().replaceAll(",active=(?:true|false)|active=(?:true|false),?", "")); INSTANCES.put(modelLocation, this); } @@ -63,8 +69,8 @@ protected boolean getBloomConfig() { } protected IBakedModel getModel(IBlockState state) { - //Some mods like to call this without getting the extendedBlockState leading to a NPE crash since the - //unlisted ACTIVE property is null. + // Some mods like to call this without getting the extendedBlockState leading to a NPE crash since the + // unlisted ACTIVE property is null. return getModel(Boolean.TRUE.equals(((IExtendedBlockState) state).getValue(VariantActiveBlock.ACTIVE))); } @@ -100,7 +106,8 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin } } - private static List getBloomQuads(IBakedModel model, @Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + private static List getBloomQuads(IBakedModel model, @Nullable IBlockState state, + @Nullable EnumFacing side, long rand) { List list = new ArrayList<>(); for (BakedQuad q : model.getQuads(state, side, rand)) { for (String bloomTextureSuffix : BLOOM_TEXTURE_SUFFIX) { diff --git a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java index 0e04d78d428..d8f61654659 100644 --- a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java +++ b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java @@ -2,16 +2,18 @@ import gregtech.client.model.lamp.LampBakedModel; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class BorderlessLampBakedModel extends LampBakedModel { // for each 6 side plus "no face" quads diff --git a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java index 5362c802ac4..4f00143fdd3 100644 --- a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java +++ b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java @@ -4,6 +4,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -11,11 +12,12 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.MinecraftForgeClient; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + public class EmissiveOreBakedModel extends OreBakedModel { @SuppressWarnings("unchecked") diff --git a/src/main/java/gregtech/client/model/MaterialStateMapper.java b/src/main/java/gregtech/client/model/MaterialStateMapper.java index 2bfa4271c02..e34034e193d 100644 --- a/src/main/java/gregtech/client/model/MaterialStateMapper.java +++ b/src/main/java/gregtech/client/model/MaterialStateMapper.java @@ -3,6 +3,7 @@ import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.client.model.modelfactories.MaterialBlockModelLoader; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; diff --git a/src/main/java/gregtech/client/model/ModelFactory.java b/src/main/java/gregtech/client/model/ModelFactory.java index bc8f947d8ef..c865610672d 100644 --- a/src/main/java/gregtech/client/model/ModelFactory.java +++ b/src/main/java/gregtech/client/model/ModelFactory.java @@ -1,8 +1,7 @@ package gregtech.client.model; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.renderer.block.model.FaceBakery; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; @@ -17,36 +16,50 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.vecmath.Vector3f; +import com.google.common.collect.ImmutableMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.EnumMap; import java.util.Map; import java.util.function.UnaryOperator; +import javax.vecmath.Vector3f; + /** * Revamped from https://github.com/LoliKingdom/Zairyou/blob/main/src/main/java/zone/rong/zairyou/api/client/Bakery.java */ @SideOnly(Side.CLIENT) public class ModelFactory { - private static final Map blockTransformationMap = new EnumMap<>(ItemCameraTransforms.TransformType.class); - private static final Map itemTransformationMap = new EnumMap<>(ItemCameraTransforms.TransformType.class); + private static final Map blockTransformationMap = new EnumMap<>( + ItemCameraTransforms.TransformType.class); + private static final Map itemTransformationMap = new EnumMap<>( + ItemCameraTransforms.TransformType.class); private static FaceBakery INSTANCE; static { blockTransformationMap.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 30, 225, 0, 0.625f)); blockTransformationMap.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.25f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 45, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 0, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(0, 0, 0, 45, 0, 0, 0.4f)); - blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0, 0, 0, 45, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, + getTransform(0, 0, 0, 0, 45, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, + getTransform(0, 0, 0, 0, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, + getTransform(0, 0, 0, 45, 0, 0, 0.4f)); + blockTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, + getTransform(0, 0, 0, 45, 0, 0, 0.4f)); itemTransformationMap.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 0, 0, 0, 1f)); itemTransformationMap.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.5f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); - itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0f, 4.0f, 0.5f, 0, 90, -55, 0.85f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, + getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, + getTransform(0, 3, 1, 0, 0, 0, 0.55f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, + getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); + itemTransformationMap.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, + getTransform(0f, 4.0f, 0.5f, 0, 90, -55, 0.85f)); } public static FaceBakery getBakery() { @@ -64,8 +77,10 @@ public static TRSRTransformation getItemTransform(ItemCameraTransforms.Transform return itemTransformationMap.get(transformType); } - private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, float s) { - return new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), new Vector3f(s, s, s), null); + private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, + float s) { + return new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), + TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)), new Vector3f(s, s, s), null); } private final ModelTemplate template; diff --git a/src/main/java/gregtech/client/model/OreBakedModel.java b/src/main/java/gregtech/client/model/OreBakedModel.java index 6300312dd86..20573332ba1 100644 --- a/src/main/java/gregtech/client/model/OreBakedModel.java +++ b/src/main/java/gregtech/client/model/OreBakedModel.java @@ -7,7 +7,7 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.StoneType; import gregtech.api.util.GTUtility; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.*; @@ -20,12 +20,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class OreBakedModel implements IBakedModel { @@ -113,7 +116,8 @@ public static void onModelBake(ModelBakeEvent event) { Map overlayCache = new Object2ObjectOpenHashMap<>(); for (Map.Entry e : ENTRIES.entrySet()) { - IBakedModel overlay = overlayCache.computeIfAbsent(MaterialIconType.ore.getBlockTexturePath(e.getKey().iconSet), + IBakedModel overlay = overlayCache.computeIfAbsent( + MaterialIconType.ore.getBlockTexturePath(e.getKey().iconSet), tex -> new ModelFactory(ModelFactory.ModelTemplate.ORE_OVERLAY) .addSprite("texture", tex) .bake()); diff --git a/src/main/java/gregtech/client/model/SimpleStateMapper.java b/src/main/java/gregtech/client/model/SimpleStateMapper.java index 2be583453b8..c46e8774d4e 100644 --- a/src/main/java/gregtech/client/model/SimpleStateMapper.java +++ b/src/main/java/gregtech/client/model/SimpleStateMapper.java @@ -1,6 +1,5 @@ package gregtech.client.model; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -8,9 +7,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nonnull; + @SideOnly(Side.CLIENT) public class SimpleStateMapper implements IStateMapper { @@ -23,7 +25,8 @@ public SimpleStateMapper(ModelResourceLocation mrl) { @Override @Nonnull public Map putStateModelLocations(Block block) { - Map map = new Object2ObjectOpenHashMap<>(block.getBlockState().getValidStates().size()); + Map map = new Object2ObjectOpenHashMap<>( + block.getBlockState().getValidStates().size()); for (IBlockState state : block.getBlockState().getValidStates()) { map.put(state, mrl); } diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java index 4a4a42632da..9221007b552 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java @@ -1,7 +1,5 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.ListMultimap; -import com.google.common.collect.MultimapBuilder; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -14,21 +12,25 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.collect.ListMultimap; +import com.google.common.collect.MultimapBuilder; import org.lwjgl.util.vector.Vector; import org.lwjgl.util.vector.Vector2f; import org.lwjgl.util.vector.Vector3f; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; @SideOnly(Side.CLIENT) public class CustomTexture { + private final MetadataSectionCTM meta; public CustomTexture(MetadataSectionCTM meta) { this.meta = meta; - } public BlockRenderLayer getLayer() { @@ -49,9 +51,12 @@ public static BakedQuad rebake(int blockLight, int skyLight, BakedQuad quad) { // Sorry OF users boolean hasLightmap = (blockLight > 0 || skyLight > 0) && !FMLClientHandler.instance().hasOptifine(); if (hasLightmap) { - if (format == DefaultVertexFormats.ITEM) { // ITEM is convertable to BLOCK (replace normal+padding with lmap) + if (format == DefaultVertexFormats.ITEM) { // ITEM is convertable to BLOCK (replace normal+padding with + // lmap) format = DefaultVertexFormats.BLOCK; - } else if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) { // Otherwise, this format is unknown, add TEX_2S if it does not exist + } else if (!format.getElements().contains(DefaultVertexFormats.TEX_2S)) { // Otherwise, this format is + // unknown, add TEX_2S if it does + // not exist format = new VertexFormat(format).addElement(DefaultVertexFormats.TEX_2S); } } @@ -66,12 +71,13 @@ public static BakedQuad rebake(int blockLight, int skyLight, BakedQuad quad) { for (int v = 0; v < 4; v++) { for (int i = 0; i < format.getElementCount(); i++) { VertexFormatElement ele = format.getElement(i); - //Stuff for Light or UV + // Stuff for Light or UV if (ele.getUsage() == VertexFormatElement.EnumUsage.COLOR) { unpackedBuilder.put(i, 1, 1, 1, 1); } else if (ele.getUsage() == VertexFormatElement.EnumUsage.UV) { if (ele.getIndex() == 1) { - unpackedBuilder.put(i, ((float) blockLight * 0x20) / 0xFFFF, ((float) skyLight * 0x20) / 0xFFFF); + unpackedBuilder.put(i, ((float) blockLight * 0x20) / 0xFFFF, + ((float) skyLight * 0x20) / 0xFFFF); } else if (ele.getIndex() == 0) { Vector2f uv = uvs[v]; unpackedBuilder.put(i, uv.x, uv.y, 0, 1); @@ -92,9 +98,10 @@ public static class Builder implements IVertexConsumer { public int quadTint = -1; public EnumFacing quadOrientation; public boolean applyDiffuseLighting; - public final ListMultimap data = MultimapBuilder.enumKeys(VertexFormatElement.EnumUsage.class).arrayListValues().build(); + public final ListMultimap data = MultimapBuilder + .enumKeys(VertexFormatElement.EnumUsage.class).arrayListValues().build(); - public Builder(VertexFormat vertexFormat, TextureAtlasSprite sprite){ + public Builder(VertexFormat vertexFormat, TextureAtlasSprite sprite) { this.vertexFormat = vertexFormat; this.sprite = sprite; } @@ -120,7 +127,8 @@ public Vector2f[] uvs() { private static T[] fromData(List data, int size) { Vector[] ret = size == 2 ? new Vector2f[data.size()] : new Vector3f[data.size()]; for (int i = 0; i < data.size(); i++) { - ret[i] = size == 2 ? new Vector2f(data.get(i)[0], data.get(i)[1]) : new Vector3f(data.get(i)[0], data.get(i)[1], data.get(i)[2]); + ret[i] = size == 2 ? new Vector2f(data.get(i)[0], data.get(i)[1]) : + new Vector3f(data.get(i)[0], data.get(i)[1], data.get(i)[2]); } return (T[]) ret; } @@ -146,7 +154,7 @@ public void setApplyDiffuseLighting(boolean diffuse) { this.applyDiffuseLighting = diffuse; } - //@Override //soft override, only exists in new forge versions + // @Override //soft override, only exists in new forge versions public void setTexture(@Nullable TextureAtlasSprite texture) {} } } diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java index d21ab5f0033..4549eec1590 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java @@ -1,11 +1,9 @@ package gregtech.client.model.customtexture; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.*; import gregtech.api.util.GTLog; import gregtech.asm.hooks.BlockHooks; import gregtech.asm.hooks.CTMHooks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -14,38 +12,47 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.*; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + @SideOnly(Side.CLIENT) public class CustomTextureBakedModel implements IBakedModel { + private final CustomTextureModel model; private final IBakedModel parent; - public static final Cache MODEL_CACHE = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).maximumSize(5000).build(); + public static final Cache MODEL_CACHE = CacheBuilder + .newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).maximumSize(5000).build(); - protected final ListMultimap genQuads = MultimapBuilder.enumKeys(BlockRenderLayer.class).arrayListValues().build(); - protected final Table> faceQuads = Tables.newCustomTable(Maps.newEnumMap(BlockRenderLayer.class), () -> Maps.newEnumMap(EnumFacing.class)); + protected final ListMultimap genQuads = MultimapBuilder + .enumKeys(BlockRenderLayer.class).arrayListValues().build(); + protected final Table> faceQuads = Tables + .newCustomTable(Maps.newEnumMap(BlockRenderLayer.class), () -> Maps.newEnumMap(EnumFacing.class)); private final EnumMap> noLayerCache = new EnumMap<>(EnumFacing.class); private ImmutableList noSideNoLayerCache; - public CustomTextureBakedModel(CustomTextureModel model, IBakedModel parent){ + public CustomTextureBakedModel(CustomTextureModel model, IBakedModel parent) { this.model = model; this.parent = parent; } public IBakedModel getParent(long rand) { if (parent instanceof WeightedBakedModel) { - return ((WeightedBakedModel)parent).getRandomModel(rand); + return ((WeightedBakedModel) parent).getRandomModel(rand); } return parent; } @@ -77,7 +84,7 @@ private T applyToParent(long rand, Function func protected CustomTextureBakedModel createModel(@Nullable IBlockState state, CustomTextureModel model, long rand) { IBakedModel parent = getParent(rand); while (parent instanceof CustomTextureBakedModel) { - parent = ((CustomTextureBakedModel)parent).getParent(rand); + parent = ((CustomTextureBakedModel) parent).getParent(rand); } CustomTextureBakedModel ret = new CustomTextureBakedModel(model, parent); @@ -108,8 +115,10 @@ protected CustomTextureBakedModel createModel(@Nullable IBlockState state, Custo BlockHooks.ENABLE = false; for (Map.Entry e : textureMap.entrySet()) { - // If the layer is null, this is a wrapped vanilla texture, so passthrough the layer check to the block - if (e.getValue().getLayer() == layer || (e.getValue().getLayer() == null && (state == null || state.getBlock().canRenderInLayer(state, layer)))) { + // If the layer is null, this is a wrapped vanilla texture, so passthrough the layer check to the + // block + if (e.getValue().getLayer() == layer || (e.getValue().getLayer() == null && + (state == null || state.getBlock().canRenderInLayer(state, layer)))) { quads.add(e.getValue().transformQuad(e.getKey())); } } @@ -132,11 +141,12 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin if (side != null && layer != null) { ret = baked.faceQuads.get(layer, side); } else if (side != null) { - ret = baked.noLayerCache.computeIfAbsent(side, f -> ImmutableList.copyOf(baked.faceQuads.column(f).values() - .stream() - .flatMap(List::stream) - .distinct() - .collect(Collectors.toList()))); + ret = baked.noLayerCache.computeIfAbsent(side, + f -> ImmutableList.copyOf(baked.faceQuads.column(f).values() + .stream() + .flatMap(List::stream) + .distinct() + .collect(Collectors.toList()))); } else if (layer != null) { ret = baked.genQuads.get(layer); } else { @@ -190,12 +200,13 @@ public Pair handlePerspective(@Nonnull ItemCame } private static class State { + private final IBlockState cleanState; private final IBakedModel parent; public State(IBlockState cleanState, IBakedModel parent) { this.cleanState = cleanState; - this. parent = parent; + this.parent = parent; } @Override diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java index 6b7b4101407..64048153d08 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java @@ -1,10 +1,8 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import gregtech.api.util.GTLog; import gregtech.asm.hooks.CTMHooks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BlockPart; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -20,16 +18,22 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.*; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + @SideOnly(Side.CLIENT) public class CustomTextureModel implements IModel { + private final ModelBlock modelInfo; private final IModel vanillaModel; private Boolean uvLock; @@ -51,14 +55,16 @@ public IModel getVanillaParent() { } public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - boolean canRenderInLayer = (layers < 0 && state.getBlock().getRenderLayer() == layer) || ((layers >> layer.ordinal()) & 1) == 1; + boolean canRenderInLayer = (layers < 0 && state.getBlock().getRenderLayer() == layer) || + ((layers >> layer.ordinal()) & 1) == 1; return CTMHooks.checkLayerWithOptiFine(canRenderInLayer, layers, layer); } @Override @ParametersAreNonnullByDefault @Nonnull - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + public IBakedModel bake(IModelState state, VertexFormat format, + Function bakedTextureGetter) { IBakedModel parent = vanillaModel.bake(state, format, rl -> { TextureAtlasSprite sprite = bakedTextureGetter.apply(rl); MetadataSectionCTM meta = null; @@ -157,7 +163,8 @@ public IModel retexture(@Nonnull ImmutableMap textures) { } } - private static final MethodHandle _asVanillaModel; static { + private static final MethodHandle _asVanillaModel; + static { MethodHandle mh; try { mh = MethodHandles.lookup().unreflect(IModel.class.getMethod("asVanillaModel")); @@ -195,11 +202,13 @@ private CustomTextureModel deepCopy(IModel newParent, Boolean ao, Boolean gui3d) // Deep copy logic taken from ModelLoader$VanillaModelWrapper List parts = new ArrayList<>(); for (BlockPart part : modelInfo.getElements()) { - parts.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), part.partRotation, part.shade)); + parts.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), + part.partRotation, part.shade)); } ModelBlock newModel = new ModelBlock(modelInfo.getParentLocation(), parts, - Maps.newHashMap(modelInfo.textures), ao == null ? modelInfo.isAmbientOcclusion() : ao, gui3d == null ? modelInfo.isGui3d() : gui3d, + Maps.newHashMap(modelInfo.textures), ao == null ? modelInfo.isAmbientOcclusion() : ao, + gui3d == null ? modelInfo.isGui3d() : gui3d, modelInfo.getAllTransforms(), Lists.newArrayList(modelInfo.getOverrides())); newModel.name = modelInfo.name; diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java index 9bf7286d613..170e8b02802 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java @@ -1,7 +1,5 @@ package gregtech.client.model.customtexture; -import com.google.common.collect.Sets; -import com.google.gson.JsonParseException; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -21,26 +19,32 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Sets; +import com.google.gson.JsonParseException; + import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Copyright CTM. */ @SideOnly(Side.CLIENT) public enum CustomTextureModelHandler implements IResourceManagerReloadListener { + INSTANCE; private final Set wrappedModels = Sets.newHashSet(); @SubscribeEvent(priority = EventPriority.LOWEST) // low priority to capture all event-registered models public void onModelBake(ModelBakeEvent event) { - Map stateModels = ObfuscationReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "stateModels"); + Map stateModels = ObfuscationReflectionHelper.getPrivateValue(ModelLoader.class, + event.getModelLoader(), "stateModels"); for (ModelResourceLocation mrl : event.getModelRegistry().getKeys()) { if (!wrappedModels.contains(mrl)) { IModel rootModel = stateModels.get(mrl); @@ -53,7 +57,8 @@ public void onModelBake(ModelBakeEvent event) { } catch (IOException ignored) {} // Fallthrough if (meta != null) { wrappedModels.add(mrl); - event.getModelRegistry().putObject(mrl, wrap(rootModel, event.getModelRegistry().getObject(mrl))); + event.getModelRegistry().putObject(mrl, + wrap(rootModel, event.getModelRegistry().getObject(mrl))); break; } } @@ -65,7 +70,8 @@ public void onModelBake(ModelBakeEvent event) { @Nonnull private static IBakedModel wrap(IModel model, IBakedModel object) { CustomTextureModel ctm = new CustomTextureModel(null, model); - ctm.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM, rl -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(rl.toString())); + ctm.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM, + rl -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(rl.toString())); return new CustomTextureBakedModel(ctm, object); } diff --git a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java index 6360bf404eb..c903cc12401 100644 --- a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java +++ b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java @@ -1,18 +1,21 @@ package gregtech.client.model.customtexture; -import com.google.gson.*; import net.minecraft.client.resources.data.IMetadataSection; import net.minecraft.client.resources.data.IMetadataSectionSerializer; import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.gson.*; + +import java.lang.reflect.Type; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.lang.reflect.Type; @SideOnly(Side.CLIENT) public class MetadataSectionCTM implements IMetadataSection { + public static final String SECTION_NAME = "ctm"; public BlockRenderLayer layer = null; @@ -48,10 +51,12 @@ public static MetadataSectionCTM fromJson(JsonObject obj) throws JsonParseExcept } } else if (extraData.get("light").isJsonObject()) { JsonObject light = extraData.getAsJsonObject("light"); - if (light.has("block") && light.get("block").isJsonPrimitive() && light.getAsJsonPrimitive("block").isNumber()) { + if (light.has("block") && light.get("block").isJsonPrimitive() && + light.getAsJsonPrimitive("block").isNumber()) { ret.blockLight = light.getAsJsonPrimitive("block").getAsInt(); } - if (light.has("sky") && light.get("sky").isJsonPrimitive() && light.getAsJsonPrimitive("sky").isNumber()) { + if (light.has("sky") && light.get("sky").isJsonPrimitive() && + light.getAsJsonPrimitive("sky").isNumber()) { ret.blockLight = light.getAsJsonPrimitive("sky").getAsInt(); } } @@ -64,8 +69,8 @@ public static MetadataSectionCTM fromJson(JsonObject obj) throws JsonParseExcept public static class Serializer implements IMetadataSectionSerializer { @Override - public @Nullable - MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOfT, @Nullable JsonDeserializationContext context) throws JsonParseException { + public @Nullable MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOfT, + @Nullable JsonDeserializationContext context) throws JsonParseException { if (json != null && json.isJsonObject()) { JsonObject obj = json.getAsJsonObject(); return MetadataSectionCTM.fromJson(obj); @@ -74,8 +79,7 @@ MetadataSectionCTM deserialize(@Nullable JsonElement json, @Nullable Type typeOf } @Override - public @Nonnull - String getSectionName() { + public @Nonnull String getSectionName() { return SECTION_NAME; } } diff --git a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java index 0a72161fa1a..78d272aae7a 100644 --- a/src/main/java/gregtech/client/model/lamp/LampBakedModel.java +++ b/src/main/java/gregtech/client/model/lamp/LampBakedModel.java @@ -4,7 +4,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.*; @@ -19,14 +19,17 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; +import javax.annotation.Nullable; + // TODO could probably be combined with new OreBakedModel or AVBBM @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class LampBakedModel implements IBakedModel { - private static final String[] BLOOM_TEXTURE_SUFFIX = {"_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm"}; + private static final String[] BLOOM_TEXTURE_SUFFIX = { "_bloom", "_emissive", "_bloom_ctm", "_emissive_ctm" }; private static final Map ENTRIES = new Object2ObjectOpenHashMap<>(); public static Entry register(EnumDyeColor color, LampModelType modelType, boolean bloom, boolean active) { @@ -69,7 +72,8 @@ public List getQuads(@Nullable IBlockState state, @Nullable EnumFacin } } - private List getFilteredQuads(boolean emissive, boolean nonEmissive, @Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + private List getFilteredQuads(boolean emissive, boolean nonEmissive, @Nullable IBlockState state, + @Nullable EnumFacing side, long rand) { if (!emissive && !nonEmissive) return Collections.emptyList(); List quads = new ArrayList<>(); BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); diff --git a/src/main/java/gregtech/client/model/lamp/LampModelType.java b/src/main/java/gregtech/client/model/lamp/LampModelType.java index 3e8e6c92ff1..64c91253a0d 100644 --- a/src/main/java/gregtech/client/model/lamp/LampModelType.java +++ b/src/main/java/gregtech/client/model/lamp/LampModelType.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.model.BorderlessLampBakedModel; + import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java b/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java index 3b131ab5bb7..49f9c06a86f 100644 --- a/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java +++ b/src/main/java/gregtech/client/model/modelfactories/BakedModelHandler.java @@ -1,8 +1,5 @@ package gregtech.client.model.modelfactories; -import codechicken.lib.render.item.CCRenderItem; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; @@ -28,26 +25,32 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.item.CCRenderItem; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + @SideOnly(Side.CLIENT) public class BakedModelHandler { private static final StateMapperBase SIMPLE_STATE_MAPPER = new StateMapperBase() { + @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return getSimpleModelLocation(state.getBlock()); } }; - private static final ItemMeshDefinition SIMPLE_MESH_DEFINITION = (stack) -> - getSimpleModelLocation(Block.getBlockFromItem(stack.getItem())); + private static final ItemMeshDefinition SIMPLE_MESH_DEFINITION = (stack) -> getSimpleModelLocation( + Block.getBlockFromItem(stack.getItem())); private static ModelResourceLocation getSimpleModelLocation(Block block) { return new ModelResourceLocation(Block.REGISTRY.getNameForObject(block), ""); @@ -75,7 +78,8 @@ public void onModelsBake(ModelBakeEvent event) { for (BlockFluidBase fluidBlock : fluidBlocks) { Fluid fluid = ObfuscationReflectionHelper.getPrivateValue(BlockFluidBase.class, fluidBlock, "definedFluid"); ModelFluid modelFluid = new ModelFluid(fluid); - IBakedModel bakedModel = modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils::getTexture); + IBakedModel bakedModel = modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, + TextureUtils::getTexture); ModelResourceLocation resourceLocation = getSimpleModelLocation(fluidBlock); event.getModelRegistry().putObject(resourceLocation, bakedModel); } @@ -135,4 +139,3 @@ public Pair handlePerspective(@Nonnull Transfor } } } - diff --git a/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java b/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java index 2b692fec6b4..ddb68081fcc 100644 --- a/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java +++ b/src/main/java/gregtech/client/model/modelfactories/MaterialBlockModelLoader.java @@ -1,13 +1,11 @@ package gregtech.client.model.modelfactories; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import gregtech.api.GTValues; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -21,6 +19,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) @@ -56,7 +58,8 @@ public static void onTextureStitch(TextureStitchEvent.Pre event) { } } - private static void loadModel(TextureStitchEvent.Pre event, ResourceLocation modelLocation, ModelResourceLocation modelId) { + private static void loadModel(TextureStitchEvent.Pre event, ResourceLocation modelLocation, + ModelResourceLocation modelId) { IModel model; try { model = ModelLoaderRegistry.getModel(modelLocation); @@ -95,8 +98,10 @@ private static final class Entry { this.iconType = iconType; this.iconSet = iconSet; - this.blockModelId = new ModelResourceLocation(GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "normal"); - this.itemModelId = new ModelResourceLocation(GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "inventory"); + this.blockModelId = new ModelResourceLocation( + GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "normal"); + this.itemModelId = new ModelResourceLocation( + GTUtility.gregtechId("material_" + iconType.name + "_" + iconSet.name), "inventory"); } ResourceLocation getBlockModelLocation() { diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java index d896fc3cf7b..75f05440797 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterFlatSpecial.java @@ -1,15 +1,17 @@ package gregtech.client.model.pipeline; import gregtech.client.shader.Shaders; + import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.VertexLighterFlat; -import javax.vecmath.Vector3f; import java.util.Objects; +import javax.vecmath.Vector3f; + public class VertexLighterFlatSpecial extends VertexLighterFlat { public int tint = -1; @@ -21,7 +23,6 @@ public VertexLighterFlatSpecial(BlockColors colors) { @Override public void setVertexFormat(VertexFormat format) { - if (!Objects.equals(format, baseFormat)) { baseFormat = format; @@ -35,10 +36,10 @@ public void setVertexFormat(VertexFormat format) { updateIndices(); } - } - //This was copied over from VertexLighterFlat because it was private and thus inaccessible from this extended implementation + // This was copied over from VertexLighterFlat because it was private and thus inaccessible from this extended + // implementation private void updateIndices() { for (int i = 0; i < getVertexFormat().getElementCount(); i++) { switch (getVertexFormat().getElement(i).getUsage()) { @@ -70,19 +71,16 @@ private void updateIndices() { } } - //This was copied over from VertexLighterFlat because it needed tweaks to the color handling + // This was copied over from VertexLighterFlat because it needed tweaks to the color handling @Override protected void processQuad() { - float[][] position = quadData[posIndex]; float[][] normal = null; float[][] lightmap = quadData[lightmapIndex]; float[][] color = quadData[colorIndex]; - if (dataLength[normalIndex] >= 3 - && (quadData[normalIndex][0][0] != -1 - || quadData[normalIndex][0][1] != -1 - || quadData[normalIndex][0][2] != -1)) { + if (dataLength[normalIndex] >= 3 && (quadData[normalIndex][0][0] != -1 || quadData[normalIndex][0][1] != -1 || + quadData[normalIndex][0][2] != -1)) { normal = quadData[normalIndex]; } else { // normals must be generated normal = new float[4][4]; @@ -102,7 +100,7 @@ protected void processQuad() { } } - int multiplier = 0xFFFFFFFF;//white + int multiplier = 0xFFFFFFFF;// white if (tint != -1) { multiplier = blockInfo.getColorMultiplier(tint); } @@ -123,7 +121,7 @@ protected void processQuad() { y += normal[v][1] * .5f; z += normal[v][2] * .5f; - color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white + color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;// Default to white float blockLight = lightmap[v][0]; float skyLight = lightmap[v][1]; @@ -135,7 +133,7 @@ protected void processQuad() { updateColor(normal[v], color[v], x, y, z, tint, multiplier); - //When enabled this causes the rendering to be black with Optifine + // When enabled this causes the rendering to be black with Optifine if (!Shaders.isOptiFineShaderPackLoaded() && diffuse) { float d = LightUtil.diffuseLight(normal[v][0], normal[v][1], normal[v][2]); for (int i = 0; i < 3; i++) { @@ -156,7 +154,7 @@ protected void processQuad() { break; } case COLOR: - //color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white + // color[v][0] = color[v][1] = color[v][2] = color[v][3] = 1.0f;//Default to white parent.put(e, color[v]); break; case UV: @@ -172,8 +170,9 @@ protected void processQuad() { tint = -1; } - //This was copied over from VertexLighterFlat because the tint parameter shouldn't be a float - protected static void updateColor(float[] normal, float[] color, float x, float y, float z, int tint, int multiplier) { + // This was copied over from VertexLighterFlat because the tint parameter shouldn't be a float + protected static void updateColor(float[] normal, float[] color, float x, float y, float z, int tint, + int multiplier) { if (tint != -1) { color[0] *= (float) (multiplier >> 0x10 & 0xFF) / 0xFF; color[1] *= (float) (multiplier >> 0x8 & 0xFF) / 0xFF; @@ -190,5 +189,4 @@ public void setQuadTint(int tint) { public void setApplyDiffuseLighting(boolean diffuse) { this.diffuse = diffuse; } - } diff --git a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java index 0c5358688c0..79b83e9998e 100644 --- a/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java +++ b/src/main/java/gregtech/client/model/pipeline/VertexLighterSmoothAoSpecial.java @@ -1,11 +1,12 @@ package gregtech.client.model.pipeline; import gregtech.client.shader.Shaders; + import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.math.MathHelper; -//This is a verbatim copy of VertexLighterSmoothAo except with a custom base class. -//Ao Features are disabled when the shader is active. +// This is a verbatim copy of VertexLighterSmoothAo except with a custom base class. +// Ao Features are disabled when the shader is active. public class VertexLighterSmoothAoSpecial extends VertexLighterFlatSpecial { public VertexLighterSmoothAoSpecial(BlockColors colors) { @@ -153,5 +154,4 @@ public void updateBlockInfo() { blockInfo.updateShift(); blockInfo.updateLightMatrix(); } - } diff --git a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java index affc28b8c64..a8ef7460fff 100644 --- a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java +++ b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java @@ -1,10 +1,10 @@ package gregtech.client.particle; -import codechicken.lib.vec.Vector3; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.client.renderer.IRenderSetup; import gregtech.client.renderer.fx.LaserBeamRenderer; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -15,6 +15,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; +import codechicken.lib.vec.Vector3; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -148,7 +150,7 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC ITextureObject bodyTexture = null; if (body != null) { bodyTexture = renderEngine.getTexture(body); - //noinspection ConstantValue + // noinspection ConstantValue if (bodyTexture == null) { bodyTexture = new SimpleTexture(body); renderEngine.loadTexture(body, bodyTexture); @@ -157,7 +159,7 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC ITextureObject headTexture = null; if (head != null) { headTexture = renderEngine.getTexture(head); - //noinspection ConstantValue + // noinspection ConstantValue if (headTexture == null) { headTexture = new SimpleTexture(head); renderEngine.loadTexture(head, headTexture); @@ -165,8 +167,10 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC } float offset = -emit * (Minecraft.getMinecraft().player.ticksExisted + context.partialTicks()); LaserBeamRenderer.renderRawBeam(bodyTexture == null ? -1 : - bodyTexture.getGlTextureId(), headTexture == null ? -1 : - headTexture.getGlTextureId(), direction, cameraDirection, beamHeight, headWidth, alpha, offset); + bodyTexture.getGlTextureId(), + headTexture == null ? -1 : + headTexture.getGlTextureId(), + direction, cameraDirection, beamHeight, headWidth, alpha, offset); GlStateManager.translate(context.cameraX() - posX, context.cameraY() - posY, context.cameraZ() - posZ); } @@ -214,7 +218,8 @@ public void postDraw(@Nonnull BufferBuilder buffer) { GlStateManager.enableCull(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); } }; } diff --git a/src/main/java/gregtech/client/particle/GTNameTagParticle.java b/src/main/java/gregtech/client/particle/GTNameTagParticle.java index 6e7dbc03d18..2c4e5251f7c 100644 --- a/src/main/java/gregtech/client/particle/GTNameTagParticle.java +++ b/src/main/java/gregtech/client/particle/GTNameTagParticle.java @@ -2,6 +2,7 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -9,14 +10,16 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; -import javax.annotation.Nonnull; import java.util.Objects; +import javax.annotation.Nonnull; + public class GTNameTagParticle extends GTParticle { private final MetaTileEntityHolder metaTileEntityHolder; - public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, double posZ) { + public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, + double posZ) { super(posX, posY, posZ); this.metaTileEntityHolder = Objects.requireNonNull(metaTileEntityHolder); this.setRenderRange(64); @@ -37,8 +40,10 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC if (name.isEmpty()) return; Entity renderViewEntity = context.renderViewEntity(); - float rotationYaw = renderViewEntity.prevRotationYaw + (renderViewEntity.rotationYaw - renderViewEntity.prevRotationYaw) * context.partialTicks(); - float rotationPitch = renderViewEntity.prevRotationPitch + (renderViewEntity.rotationPitch - renderViewEntity.prevRotationPitch) * context.partialTicks(); + float rotationYaw = renderViewEntity.prevRotationYaw + + (renderViewEntity.rotationYaw - renderViewEntity.prevRotationYaw) * context.partialTicks(); + float rotationPitch = renderViewEntity.prevRotationPitch + + (renderViewEntity.rotationPitch - renderViewEntity.prevRotationPitch) * context.partialTicks(); GlStateManager.pushMatrix(); GlStateManager.translate(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); @@ -48,7 +53,9 @@ public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderC GlStateManager.scale(-0.025F, -0.025F, 0.025F); GlStateManager.depthMask(false); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(name) / 2; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); diff --git a/src/main/java/gregtech/client/particle/GTOverheatParticle.java b/src/main/java/gregtech/client/particle/GTOverheatParticle.java index d3e518f5e57..2eb0f55aa9a 100644 --- a/src/main/java/gregtech/client/particle/GTOverheatParticle.java +++ b/src/main/java/gregtech/client/particle/GTOverheatParticle.java @@ -1,6 +1,5 @@ package gregtech.client.particle; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.postprocessing.BloomEffect; @@ -10,6 +9,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -19,11 +19,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Cuboid6; import org.lwjgl.opengl.GL11; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** * @author brachy84 @@ -153,7 +156,8 @@ public static int getBlackBodyColor(int temperature) { protected float alpha = 0; protected int color = blackBodyColors[0]; - public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, boolean insulated) { + public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, + boolean insulated) { super(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()); this.tileEntity = tileEntity; this.meltTemp = meltTemp; diff --git a/src/main/java/gregtech/client/particle/GTParticle.java b/src/main/java/gregtech/client/particle/GTParticle.java index 3a142f040ab..031daaaa7ac 100644 --- a/src/main/java/gregtech/client/particle/GTParticle.java +++ b/src/main/java/gregtech/client/particle/GTParticle.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.IRenderSetup; import gregtech.client.utils.EffectRenderContext; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -10,7 +11,8 @@ import javax.annotation.Nullable; /** - * A custom particle implementation with framework for more advanced rendering capabilities.

+ * A custom particle implementation with framework for more advanced rendering capabilities. + *

* GTParticle instances are managed by {@link GTParticleManager}. GTParticle instances with same {@link IRenderSetup}s * will be drawn together as a batch. */ @@ -54,8 +56,9 @@ public final void setExpired() { /** * @return {@code true} to render the particle with - * {@link net.minecraft.client.renderer.GlStateManager#depthMask(boolean) depth mask} feature disabled; in other - * words, render the particle without modifying depth buffer. + * {@link net.minecraft.client.renderer.GlStateManager#depthMask(boolean) depth mask} feature disabled; in + * other + * words, render the particle without modifying depth buffer. */ public boolean shouldDisableDepth() { return false; @@ -63,8 +66,9 @@ public boolean shouldDisableDepth() { /** * @return render range. If the distance between particle and render view entity exceeds this value, the particle - * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and the - * particle will be rendered regardless of the distance. + * will not be rendered. If render range is negative value or {@code NaN}, then the check is disabled and + * the + * particle will be rendered regardless of the distance. */ public final double getRenderRange() { return this.renderRange; diff --git a/src/main/java/gregtech/client/particle/GTParticleManager.java b/src/main/java/gregtech/client/particle/GTParticleManager.java index 79a4a7e8b91..cda4ef65828 100644 --- a/src/main/java/gregtech/client/particle/GTParticleManager.java +++ b/src/main/java/gregtech/client/particle/GTParticleManager.java @@ -3,7 +3,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.IRenderSetup; import gregtech.client.utils.EffectRenderContext; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.BufferBuilder; @@ -17,12 +17,15 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; import java.util.*; +import javax.annotation.Nonnull; + /** * Singleton class responsible for managing, updating and rendering {@link GTParticle} instances. */ @@ -54,7 +57,8 @@ public void updateEffects() { for (GTParticle particle : newParticleQueue) { var queue = particle.shouldDisableDepth() ? depthDisabledParticles : depthEnabledParticles; - ArrayDeque particles = queue.computeIfAbsent(particle.getRenderSetup(), setup -> new ArrayDeque<>()); + ArrayDeque particles = queue.computeIfAbsent(particle.getRenderSetup(), + setup -> new ArrayDeque<>()); if (particles.size() > 6000) { particles.removeFirst().setExpired(); diff --git a/src/main/java/gregtech/client/renderer/CubeRendererState.java b/src/main/java/gregtech/client/renderer/CubeRendererState.java index 6fd7a465d5b..484046811e9 100644 --- a/src/main/java/gregtech/client/renderer/CubeRendererState.java +++ b/src/main/java/gregtech/client/renderer/CubeRendererState.java @@ -1,16 +1,18 @@ package gregtech.client.renderer; -import codechicken.lib.vec.Cuboid6; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Cuboid6; + import java.util.Arrays; @SideOnly(Side.CLIENT) public class CubeRendererState { + public final BlockRenderLayer layer; public final boolean[] sideMask; public final IBlockAccess world; diff --git a/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java b/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java index 2b079980bd8..f1d70220390 100644 --- a/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java +++ b/src/main/java/gregtech/client/renderer/ICCLBlockRenderer.java @@ -10,6 +10,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public interface ICCLBlockRenderer { + @SideOnly(Side.CLIENT) void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType transformType); diff --git a/src/main/java/gregtech/client/renderer/ICubeRenderer.java b/src/main/java/gregtech/client/renderer/ICubeRenderer.java index cb6f3ccb3e3..becc55f7f72 100644 --- a/src/main/java/gregtech/client/renderer/ICubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/ICubeRenderer.java @@ -1,11 +1,7 @@ package gregtech.client.renderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.ResourceHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.EnumFacing; @@ -13,6 +9,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -36,30 +38,36 @@ default void render(CCRenderState renderState, Matrix4 translation, IVertexOpera } @SideOnly(Side.CLIENT) - default void renderSided(EnumFacing side, CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + default void renderSided(EnumFacing side, CCRenderState renderState, Matrix4 translation, + IVertexOperation[] pipeline) { renderSided(side, Cuboid6.full, renderState, pipeline, translation); } @SideOnly(Side.CLIENT) - default void renderSided(EnumFacing side, Cuboid6 bounds, CCRenderState renderState, IVertexOperation[] pipeline, Matrix4 translation) { + default void renderSided(EnumFacing side, Cuboid6 bounds, CCRenderState renderState, IVertexOperation[] pipeline, + Matrix4 translation) { renderOrientedState(renderState, translation, pipeline, bounds, side, false, false); } @SideOnly(Side.CLIENT) - default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing) { + default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing) { renderOrientedState(renderState, translation, pipeline, bounds, frontFacing, false, false); } @SideOnly(Side.CLIENT) - default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing) { + default void renderOriented(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing) { renderOriented(renderState, translation, pipeline, Cuboid6.full, frontFacing); } @SideOnly(Side.CLIENT) - void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled); + void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled); @SideOnly(Side.CLIENT) - default void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + default void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { renderOrientedState(renderState, translation, pipeline, Cuboid6.full, frontFacing, isActive, isWorkingEnabled); } diff --git a/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java b/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java index 9f43bfe1565..0018fb0bb1b 100644 --- a/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java +++ b/src/main/java/gregtech/client/renderer/cclop/ColourOperation.java @@ -1,12 +1,14 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; + @SideOnly(Side.CLIENT) public class ColourOperation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); int colour; diff --git a/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java b/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java index 3bb1fb20260..2aa7ce17923 100644 --- a/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java +++ b/src/main/java/gregtech/client/renderer/cclop/LightMapOperation.java @@ -1,10 +1,11 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; + /** * Created with IntelliJ IDEA. * @@ -14,6 +15,7 @@ */ @SideOnly(Side.CLIENT) public class LightMapOperation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); int lightmapX; int lightmapY; diff --git a/src/main/java/gregtech/client/renderer/cclop/UVMirror.java b/src/main/java/gregtech/client/renderer/cclop/UVMirror.java index 52c5ba0dd3a..cc1d3a3618f 100644 --- a/src/main/java/gregtech/client/renderer/cclop/UVMirror.java +++ b/src/main/java/gregtech/client/renderer/cclop/UVMirror.java @@ -1,12 +1,14 @@ package gregtech.client.renderer.cclop; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; + @SideOnly(Side.CLIENT) public class UVMirror extends UVTransformation { + public final double minU; public final double maxU; public final double minV; @@ -37,5 +39,4 @@ public void apply(UV vec) { public UVTransformation inverse() { return null; } - } diff --git a/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java b/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java index 956b9814f0e..32140eedd5d 100644 --- a/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java +++ b/src/main/java/gregtech/client/renderer/fx/LaserBeamRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.fx; -import codechicken.lib.vec.Vector3; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -8,14 +7,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Vector3; + @SideOnly(Side.CLIENT) public class LaserBeamRenderer { /** * Render the Laser Beam. * - * @param texture body texture id. - * @param headTexture head texture id. wont render the head texture if -1. + * @param texture body texture id. + * @param headTexture head texture id. wont render the head texture if -1. * @param direction direction and length vector of laser beam. * @param cameraDirection Vector from the eye to the origin position of the laser. *

@@ -24,12 +25,13 @@ public class LaserBeamRenderer { *

* else render normal vertical quad. *

- * @param beamHeight beam width. - * @param headWidth head width. - * @param alpha alpha. - * @param offset offset of the UV texture. + * @param beamHeight beam width. + * @param headWidth head width. + * @param alpha alpha. + * @param offset offset of the UV texture. */ - public static void renderRawBeam(int texture, int headTexture, Vector3 direction, Vector3 cameraDirection, double beamHeight, double headWidth, float alpha, double offset){ + public static void renderRawBeam(int texture, int headTexture, Vector3 direction, Vector3 cameraDirection, + double beamHeight, double headWidth, float alpha, double offset) { // TODO trick here. should be more strict in the future. if (direction.x == direction.z && direction.x == 0) { direction = direction.copy().add(0.001, 0, 0.001); @@ -42,43 +44,46 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction double start = Math.min(headWidth, distance * headWidth); distance -= start; - float degree = (float)Math.toDegrees(new Vector3(direction.x, 0, -direction.z).angle(new Vector3(1,0,0))); + float degree = (float) Math.toDegrees(new Vector3(direction.x, 0, -direction.z).angle(new Vector3(1, 0, 0))); if (direction.z > 0) { degree = -degree; } GlStateManager.pushMatrix(); GlStateManager.rotate(degree, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(90 - (float)Math.toDegrees(direction.copy().angle(new Vector3(0,1,0))), 0, 0, 1); + GlStateManager.rotate(90 - (float) Math.toDegrees(direction.copy().angle(new Vector3(0, 1, 0))), 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); if (cameraDirection != null) { // Linear algebra drives me crazy Vector3 v1 = cameraDirection.copy().project(direction).subtract(cameraDirection); - Vector3 v2 = new Vector3(0,1,0).crossProduct(direction); - float rowX = (float)Math.toDegrees(v1.copy().angle(v2)); - if (v1.add(v2).y < 0) rowX = - rowX; + Vector3 v2 = new Vector3(0, 1, 0).crossProduct(direction); + float rowX = (float) Math.toDegrees(v1.copy().angle(v2)); + if (v1.add(v2).y < 0) rowX = -rowX; GlStateManager.rotate(rowX, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance, - beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(start, - beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(offset, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); if (headTexture != -1) { // head GlStateManager.bindTexture(headTexture); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(start, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(0, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(0, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(0, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance + start, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); @@ -88,10 +93,12 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance, - beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(start, - beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(offset + distance, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(offset, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(offset, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance, beamHeight, 0).tex(offset + distance, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); } @@ -101,8 +108,8 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(start, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(0, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(start, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(0, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(0, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(start, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); tessellator.draw(); @@ -111,10 +118,12 @@ public static void renderRawBeam(int texture, int headTexture, Vector3 direction GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 1); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(distance + start, - beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance, - beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, -beamHeight, 0).tex(0, 0).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); + bufferbuilder.pos(distance, -beamHeight, 0).tex(1, 0).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); bufferbuilder.pos(distance, beamHeight, 0).tex(1, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); - bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha).endVertex(); + bufferbuilder.pos(distance + start, beamHeight, 0).tex(0, 1).color(1.0f, 1.0f, 1.0f, alpha) + .endVertex(); tessellator.draw(); } } diff --git a/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java b/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java index c7a552ebc41..df5f186744f 100644 --- a/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/BlockPosHighlightRenderer.java @@ -1,6 +1,7 @@ package gregtech.client.renderer.handler; import gregtech.client.utils.RenderBufferHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.BufferBuilder; @@ -11,6 +12,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) @@ -19,7 +21,6 @@ public class BlockPosHighlightRenderer { private static BlockPos posHighLight; private static long hlEndTime; - public static void renderBlockBoxHighLight(BlockPos blockpos, long durTimeMillis) { posHighLight = blockpos; hlEndTime = System.currentTimeMillis() + durTimeMillis; @@ -55,7 +56,8 @@ public static void renderWorldLastEvent(RenderWorldLastEvent evt) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - RenderBufferHelper.renderCubeFace(buffer, posHighLight.getX(), posHighLight.getY(), posHighLight.getZ(), posHighLight.getX() + 1, posHighLight.getY() + 1, posHighLight.getZ() + 1, 1.0f, 0.0f, 0.0f, 0.8f); + RenderBufferHelper.renderCubeFace(buffer, posHighLight.getX(), posHighLight.getY(), posHighLight.getZ(), + posHighLight.getX() + 1, posHighLight.getY() + 1, posHighLight.getZ() + 1, 1.0f, 0.0f, 0.0f, 0.8f); tessellator.draw(); diff --git a/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java b/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java index c13acb04dd7..5dabff41d6a 100644 --- a/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/CCLBlockRenderer.java @@ -1,19 +1,11 @@ package gregtech.client.renderer.handler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.ICCLBlockRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -34,9 +26,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; + @SideOnly(Side.CLIENT) public class CCLBlockRenderer implements ICCBlockRenderer, IItemRenderer { - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("ccl_block"), "normal"); + + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("ccl_block"), "normal"); public static final CCLBlockRenderer INSTANCE = new CCLBlockRenderer(); public static EnumBlockRenderType BLOCK_RENDER_TYPE; public static Minecraft mc = Minecraft.getMinecraft(); @@ -57,12 +61,12 @@ public void onModelsBake(ModelBakeEvent event) { @Override public void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType transformType) { ItemStack stack = ModCompatibility.getRealItemStack(rawStack); - if (stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof ICCLBlockRenderer) { + if (stack.getItem() instanceof ItemBlock && + ((ItemBlock) stack.getItem()).getBlock() instanceof ICCLBlockRenderer) { ((ICCLBlockRenderer) ((ItemBlock) stack.getItem()).getBlock()).renderItem(stack, transformType); } } - @Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { if (state != null && (state.getBlock() instanceof ICCLBlockRenderer)) { @@ -83,11 +87,11 @@ public boolean isBuiltInRenderer() { } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { if (state == null || !(state.getBlock() instanceof ICCLBlockRenderer)) { return; } @@ -96,7 +100,6 @@ public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockStat renderState.bind(buffer); renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite)); codechicken.lib.render.BlockRenderer.renderCuboid(renderState, Cuboid6.full, 0); - } @Override @@ -105,8 +108,7 @@ public TextureAtlasSprite getParticleTexture() { } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public boolean isAmbientOcclusion() { @@ -117,5 +119,4 @@ public boolean isAmbientOcclusion() { public boolean isGui3d() { return true; } - } diff --git a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java index 28a4ce303c2..c6052d576cd 100644 --- a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java @@ -2,6 +2,7 @@ import gregtech.common.entities.DynamiteEntity; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderSnowball; diff --git a/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java b/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java index ab760887031..fcd0c3ba523 100644 --- a/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/FacadeRenderer.java @@ -1,17 +1,5 @@ package gregtech.client.renderer.handler; -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourARGB; -import codechicken.lib.render.CCQuad; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.UV; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import gregtech.api.cover.CoverUtil; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.util.ModCompatibility; @@ -21,6 +9,7 @@ import gregtech.client.utils.FacadeBlockAccess; import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -45,6 +34,19 @@ import net.minecraftforge.common.model.IModelState; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourARGB; +import codechicken.lib.render.CCQuad; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UV; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -59,19 +61,23 @@ @SideOnly(Side.CLIENT) public class FacadeRenderer implements IItemRenderer { - final static int[] sideOffsets = {1, 1, 2, 2, 0, 0}; - final static float[] sideSoftBounds = {0, 1, 0, 1, 0, 1}; + final static int[] sideOffsets = { 1, 1, 2, 2, 0, 0 }; + final static float[] sideSoftBounds = { 0, 1, 0, 1, 0, 1 }; private final static float FACADE_RENDER_OFFSET = 2.0f / 512.0f; private final static float FACADE_RENDER_OFFSET2 = 1 - FACADE_RENDER_OFFSET; - public static final ThreadLocal lighterFlat = ThreadLocal.withInitial(() -> new VertexLighterFlatSpecial(Minecraft.getMinecraft().getBlockColors())); - public static final ThreadLocal lighterSmooth = ThreadLocal.withInitial(() -> new VertexLighterSmoothAoSpecial(Minecraft.getMinecraft().getBlockColors())); + public static final ThreadLocal lighterFlat = ThreadLocal + .withInitial(() -> new VertexLighterFlatSpecial(Minecraft.getMinecraft().getBlockColors())); + public static final ThreadLocal lighterSmooth = ThreadLocal + .withInitial(() -> new VertexLighterSmoothAoSpecial(Minecraft.getMinecraft().getBlockColors())); - public static final Cache> itemQuadCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(); + public static final Cache> itemQuadCache = CacheBuilder.newBuilder() + .expireAfterAccess(1, TimeUnit.HOURS).build(); public static void init() { - ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(resourceManager -> itemQuadCache.invalidateAll()); + ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) + .registerReloadListener(resourceManager -> itemQuadCache.invalidateAll()); } @Override @@ -85,9 +91,9 @@ public void renderItem(ItemStack rawStack, ItemCameraTransforms.TransformType tr renderState.reset(); renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM); try { - FacadeRenderer.renderItemCover(renderState, EnumFacing.NORTH.getIndex(), facadeStack, CoverUtil.getCoverPlateBox(EnumFacing.NORTH, 2.0 / 16.0)); - } catch (Throwable ignored) { - } + FacadeRenderer.renderItemCover(renderState, EnumFacing.NORTH.getIndex(), facadeStack, + CoverUtil.getCoverPlateBox(EnumFacing.NORTH, 2.0 / 16.0)); + } catch (Throwable ignored) {} renderState.draw(); } @@ -106,8 +112,8 @@ public boolean isGui3d() { return false; } - public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, int side, IBlockState state, Cuboid6 bounds, BlockRenderLayer layer) { - + public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, + int side, IBlockState state, Cuboid6 bounds, BlockRenderLayer layer) { EnumFacing face = EnumFacing.VALUES[side]; IBlockAccess coverAccess = new FacadeBlockAccess(world, pos, face, state); if (layer != null && !state.getBlock().canRenderInLayer(state, layer)) { @@ -117,15 +123,13 @@ public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, try { state = state.getActualState(coverAccess, pos); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} IBakedModel model = dispatcher.getModelForState(state); try { state = state.getBlock().getExtendedState(state, coverAccess, pos); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} long posRand = MathHelper.getPositionRandom(pos); List bakedQuads = new ArrayList<>(model.getQuads(state, null, posRand)); @@ -170,7 +174,6 @@ public static void renderItemCover(CCRenderState ccrs, int side, ItemStack rende for (CCQuad quad : renderQuads) { quad.pipe(consumer); } - } public static List applyItemTint(List quads, ItemStack stack) { @@ -198,9 +201,10 @@ public static List applyItemTint(List quads, ItemStack stack) { return retQuads; } - - public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, IBlockAccess access, BlockPos pos, IBakedModel model) { - boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && model.isAmbientOcclusion(); + public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, + IBlockAccess access, BlockPos pos, IBakedModel model) { + boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && + model.isAmbientOcclusion(); VertexLighterFlat lighter = renderAO ? lighterSmooth.get() : lighterFlat.get(); AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs); @@ -209,7 +213,8 @@ public static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 transla return lighter; } - public static boolean renderBlockQuads(VertexLighterFlat lighter, IBlockAccess access, IBlockState state, List quads, BlockPos pos) { + public static boolean renderBlockQuads(VertexLighterFlat lighter, IBlockAccess access, IBlockState state, + List quads, BlockPos pos) { if (!quads.isEmpty()) { lighter.setWorld(access); lighter.setState(state); @@ -275,7 +280,8 @@ public static List sliceQuads(List quads, int side, Cuboid6 boun quadPos[k2][j] = clampF(quadPos[k2][j], bounds, j); } else { if (flag && flag2 && flag3) { - quadPos[k2][j] = MathHelper.clamp(quadPos[k2][j], FACADE_RENDER_OFFSET, FACADE_RENDER_OFFSET2); + quadPos[k2][j] = MathHelper.clamp(quadPos[k2][j], FACADE_RENDER_OFFSET, + FACADE_RENDER_OFFSET2); } } } @@ -312,13 +318,12 @@ public static List sliceQuads(List quads, int side, Cuboid6 boun } private final static EnumFacing[][] sides = { - {EnumFacing.WEST, EnumFacing.EAST}, - {EnumFacing.DOWN, EnumFacing.UP}, - {EnumFacing.NORTH, EnumFacing.SOUTH} + { EnumFacing.WEST, EnumFacing.EAST }, + { EnumFacing.DOWN, EnumFacing.UP }, + { EnumFacing.NORTH, EnumFacing.SOUTH } }; private static double clampF(double x, Cuboid6 b, int j) { - double l = b.getSide(sides[j][0]); double u = b.getSide(sides[j][1]); @@ -370,7 +375,8 @@ public void pipe(IVertexConsumer consumer) { } case COLOR -> { Colour colour = colours[v]; - consumer.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); + consumer.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, + (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); } case UV -> { if (element.getIndex() == 0) { @@ -379,7 +385,8 @@ public void pipe(IVertexConsumer consumer) { } else { // fix int brightness = lightMaps[v]; - consumer.put(e, ((float) (brightness & 0xFFFF) / 0xFFFF) * 2, ((float) (brightness >> 16 & 0xFFFF) / 0xFFFF) * 2, 0, 1); + consumer.put(e, ((float) (brightness & 0xFFFF) / 0xFFFF) * 2, + ((float) (brightness >> 16 & 0xFFFF) / 0xFFFF) * 2, 0, 1); } } default -> consumer.put(e); diff --git a/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java b/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java index d30b9d29925..bb5cb13d9f7 100644 --- a/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/GTBoatRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.entities.GTBoatEntity; + import net.minecraft.client.renderer.entity.RenderBoat; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.item.EntityBoat; @@ -9,8 +10,10 @@ public class GTBoatRenderer extends RenderBoat { - public static final ResourceLocation RUBBER_WOOD_BOAT_TEXTURE = GTUtility.gregtechId("textures/entity/rubber_wood_boat.png"); - public static final ResourceLocation TREATED_WOOD_BOAT_TEXTURE = GTUtility.gregtechId("textures/entity/treated_wood_boat.png"); + public static final ResourceLocation RUBBER_WOOD_BOAT_TEXTURE = GTUtility + .gregtechId("textures/entity/rubber_wood_boat.png"); + public static final ResourceLocation TREATED_WOOD_BOAT_TEXTURE = GTUtility + .gregtechId("textures/entity/treated_wood_boat.png"); public GTBoatRenderer(RenderManager m) { super(m); diff --git a/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java b/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java index f3f10f3e798..431f5f99d90 100644 --- a/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/LampItemOverlayRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.common.blocks.BlockLamp; + import net.minecraft.block.Block; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.Item; @@ -55,6 +56,7 @@ public static void renderOverlay(OverlayType overlayType, int xPosition, int yPo } public enum OverlayType { + NONE, NO_BLOOM, NO_LIGHT, diff --git a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java index ebfbb9d47f8..5aa513fea8c 100644 --- a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityRenderer.java @@ -1,18 +1,5 @@ package gregtech.client.renderer.handler; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTLog; @@ -20,6 +7,7 @@ import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -42,6 +30,20 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; @@ -50,7 +52,8 @@ @SideOnly(Side.CLIENT) public class MetaTileEntityRenderer implements ICCBlockRenderer, IItemRenderer { - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("machine"), "normal"); + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("machine"), "normal"); public static final MetaTileEntityRenderer INSTANCE = new MetaTileEntityRenderer(); public static EnumBlockRenderType BLOCK_RENDER_TYPE; @@ -88,7 +91,6 @@ public void renderItem(ItemStack rawStack, TransformType transformType) { GlStateManager.disableBlend(); } - @Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(world, pos); @@ -107,7 +109,7 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, Textures.RENDER_STATE.set(new CubeRendererState(renderLayer, sideMask, world)); if (metaTileEntity.canRenderInLayer(renderLayer)) { renderState.lightMatrix.locate(world, pos); - IVertexOperation[] pipeline = new IVertexOperation[]{renderState.lightMatrix}; + IVertexOperation[] pipeline = new IVertexOperation[] { renderState.lightMatrix }; metaTileEntity.renderMetaTileEntity(renderState, translation.copy(), pipeline); } @@ -128,11 +130,11 @@ public boolean isBuiltInRenderer() { } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(world, pos); ArrayList boundingBox = new ArrayList<>(); if (metaTileEntity != null) { @@ -163,8 +165,7 @@ public TextureAtlasSprite getParticleTexture() { } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public boolean isAmbientOcclusion() { @@ -175,5 +176,4 @@ public boolean isAmbientOcclusion() { public boolean isGui3d() { return true; } - } diff --git a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java index cb4ae1cb528..98cf6433124 100644 --- a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java +++ b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java @@ -1,11 +1,10 @@ package gregtech.client.renderer.handler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.Cover; import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntityHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -17,6 +16,9 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; import javax.annotation.Nonnull; @@ -25,7 +27,8 @@ public class MetaTileEntityTESR extends TileEntitySpecialRenderer { @Override - public void render(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { + public void render(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, + float alpha) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); @@ -34,12 +37,9 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float GlStateManager.enableBlend(); GlStateManager.disableCull(); - if (Minecraft.isAmbientOcclusionEnabled()) - { + if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); - } - else - { + } else { GlStateManager.shadeModel(GL11.GL_FLAT); } @@ -51,7 +51,8 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float renderState.reset(); renderState.bind(buffer); renderState.setBrightness(te.getWorld(), te.getPos()); - ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4().translate(x, y, z), partialTicks); + ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, + new Matrix4().translate(x, y, z), partialTicks); } if (metaTileEntity != null) { for (EnumFacing side : EnumFacing.VALUES) { @@ -85,14 +86,16 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float } @Override - public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha, @Nonnull BufferBuilder buffer) { + public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, + int destroyStage, float alpha, @Nonnull BufferBuilder buffer) { MetaTileEntity metaTileEntity = te.getMetaTileEntity(); if (metaTileEntity instanceof IFastRenderMetaTileEntity) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(te.getWorld(), te.getPos()); - ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4().translate(x, y, z), partialTicks); + ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, + new Matrix4().translate(x, y, z), partialTicks); ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntity(x, y, z, partialTicks); } if (metaTileEntity != null) { diff --git a/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java b/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java index 3dee2712914..d3531a43d66 100644 --- a/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/MultiblockPreviewRenderer.java @@ -6,6 +6,7 @@ import gregtech.api.pattern.MultiblockShapeInfo; import gregtech.api.util.BlockInfo; import gregtech.client.utils.TrackedDummyWorld; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; @@ -26,6 +27,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import java.util.HashMap; @@ -71,7 +73,6 @@ public static void renderWorldLastEvent(RenderWorldLastEvent event) { } } - public static void renderMultiBlockPreview(MultiblockControllerBase controller, long durTimeMillis) { if (!controller.getPos().equals(mbpPos)) { layer = 0; @@ -98,7 +99,8 @@ public static void resetMultiblockRender() { } } - public static void renderControllerInList(MultiblockControllerBase controllerBase, MultiblockShapeInfo shapeInfo, int layer) { + public static void renderControllerInList(MultiblockControllerBase controllerBase, MultiblockShapeInfo shapeInfo, + int layer) { BlockPos mbpPos = controllerBase.getPos(); EnumFacing frontFacing, previewFacing; previewFacing = controllerBase.getFrontFacing(); @@ -114,8 +116,10 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas BlockInfo[] column = aisle[y]; for (int z = 0; z < column.length; z++) { blockMap.put(new BlockPos(x, y, z), column[z]); - MetaTileEntity metaTE = column[z].getTileEntity() instanceof IGregTechTileEntity ? ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() : null; - if (metaTE instanceof MultiblockControllerBase && metaTE.metaTileEntityId.equals(controllerBase.metaTileEntityId)) { + MetaTileEntity metaTE = column[z].getTileEntity() instanceof IGregTechTileEntity ? + ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() : null; + if (metaTE instanceof MultiblockControllerBase && + metaTE.metaTileEntityId.equals(controllerBase.metaTileEntityId)) { controllerPos = new BlockPos(x, y, z); previewFacing = metaTE.getFrontFacing(); mte = (MultiblockControllerBase) metaTE; @@ -132,8 +136,10 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas EnumFacing facing = controllerBase.getFrontFacing(); EnumFacing upwardsFacing = controllerBase.getUpwardsFacing(); - frontFacing = facing.getYOffset() == 0 ? facing : facing.getYOffset() < 0 ? upwardsFacing : upwardsFacing.getOpposite(); - Rotation rotatePreviewBy = Rotation.values()[(4 + frontFacing.getHorizontalIndex() - previewFacing.getHorizontalIndex()) % 4]; + frontFacing = facing.getYOffset() == 0 ? facing : + facing.getYOffset() < 0 ? upwardsFacing : upwardsFacing.getOpposite(); + Rotation rotatePreviewBy = Rotation + .values()[(4 + frontFacing.getHorizontalIndex() - previewFacing.getHorizontalIndex()) % 4]; Minecraft mc = Minecraft.getMinecraft(); BlockRendererDispatcher brd = mc.getBlockRendererDispatcher(); @@ -154,7 +160,8 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas GlStateManager.rotate(90, previewFacing.getZOffset(), 0, -previewFacing.getXOffset()); GlStateManager.translate(-0.5, -0.5, -0.5); } else { - int degree = 90 * (upwardsFacing == EnumFacing.EAST ? -1 : upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); + int degree = 90 * (upwardsFacing == EnumFacing.EAST ? -1 : + upwardsFacing == EnumFacing.SOUTH ? 2 : upwardsFacing == EnumFacing.WEST ? 1 : 0); GlStateManager.translate(0.5, 0.5, 0.5); GlStateManager.rotate(degree, previewFacing.getXOffset(), 0, previewFacing.getZOffset()); GlStateManager.translate(-0.5, -0.5, -0.5); @@ -189,7 +196,6 @@ public static void renderControllerInList(MultiblockControllerBase controllerBas ForgeHooksClient.setRenderLayer(oldLayer); GlStateManager.popMatrix(); - } @SideOnly(Side.CLIENT) @@ -246,6 +252,5 @@ public WorldType getWorldType() { public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { return pos.equals(BlockPos.ORIGIN) && delegate.isSideSolid(targetPos, side, _default); } - } } diff --git a/src/main/java/gregtech/client/renderer/handler/PortalModel.java b/src/main/java/gregtech/client/renderer/handler/PortalModel.java index 8d189685d75..8d002d60fa1 100644 --- a/src/main/java/gregtech/client/renderer/handler/PortalModel.java +++ b/src/main/java/gregtech/client/renderer/handler/PortalModel.java @@ -9,25 +9,27 @@ @SideOnly(Side.CLIENT) public class PortalModel extends ModelBase { - private final ModelRenderer renderer; - public PortalModel() { - textureWidth = 64; - textureHeight = 64; + private final ModelRenderer renderer; - renderer = new ModelRenderer(this); - renderer.setRotationPoint(0.0F, 24.0F, 0.0F); - renderer.cubeList.add(new ModelBox(renderer, 0, 0, -8.0F, -32.0F, -1.0F, 16, 32, 2, 0.0F, false)); - } + public PortalModel() { + textureWidth = 64; + textureHeight = 64; - @Override - public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - renderer.render(scale); - } + renderer = new ModelRenderer(this); + renderer.setRotationPoint(0.0F, 24.0F, 0.0F); + renderer.cubeList.add(new ModelBox(renderer, 0, 0, -8.0F, -32.0F, -1.0F, 16, 32, 2, 0.0F, false)); + } - public static void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + @Override + public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, + float headPitch, float scale) { + renderer.render(scale); + } + + public static void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java index 35a6742f0a1..aa2ce4c40e2 100644 --- a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.entities.PortalEntity; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; @@ -18,7 +19,7 @@ public class PortalRenderer extends Render { private static final ResourceLocation texture = GTUtility.gregtechId("textures/entity/gtportal.png"); protected PortalModel model = new PortalModel(); - public PortalRenderer(RenderManager renderManagerIn){ + public PortalRenderer(RenderManager renderManagerIn) { super(renderManagerIn); } @@ -35,24 +36,26 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en this.bindEntityTexture(entity); float scaleX = 0.0625F, scaleY = 0.0625F, scaleZ = 0.0625F; float translateY = 0.F; - if(entity.isOpening()){ - if(entity.getTimeToDespawn() <= 195) { - scaleY *= MathHelper.clamp((195.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); - translateY = 0.5F*(1.F - MathHelper.clamp((195.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.F, 1.F)); - }else{ - scaleX *= MathHelper.clamp((200.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); + if (entity.isOpening()) { + if (entity.getTimeToDespawn() <= 195) { + scaleY *= MathHelper.clamp((195.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); + translateY = 0.5F * + (1.F - MathHelper.clamp((195.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.F, 1.F)); + } else { + scaleX *= MathHelper.clamp((200.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); scaleY *= 0.05F; - scaleZ *= MathHelper.clamp((200.F-entity.getTimeToDespawn()+partialTicks)/5.F, 0.05F, 1.F); + scaleZ *= MathHelper.clamp((200.F - entity.getTimeToDespawn() + partialTicks) / 5.F, 0.05F, 1.F); translateY = 0.5F; } - }else if(entity.isClosing()){ - if(entity.getTimeToDespawn() >= 5) { - scaleY *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks-5.F)/5.F, 0.05F, 1.F); - translateY = 0.5F*(1.F-MathHelper.clamp((entity.getTimeToDespawn()-partialTicks-5.F)/5.F, 0.F, 1.F)); - }else{ - scaleX *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks)/5.F, 0.05F, 1.F); + } else if (entity.isClosing()) { + if (entity.getTimeToDespawn() >= 5) { + scaleY *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks - 5.F) / 5.F, 0.05F, 1.F); + translateY = 0.5F * + (1.F - MathHelper.clamp((entity.getTimeToDespawn() - partialTicks - 5.F) / 5.F, 0.F, 1.F)); + } else { + scaleX *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks) / 5.F, 0.05F, 1.F); scaleY *= 0.05F; - scaleZ *= MathHelper.clamp((entity.getTimeToDespawn()-partialTicks)/5.F, 0.05F, 1.F); + scaleZ *= MathHelper.clamp((entity.getTimeToDespawn() - partialTicks) / 5.F, 0.05F, 1.F); translateY = 0.5F; } } @@ -60,7 +63,7 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en GlStateManager.scale(scaleX, scaleY, scaleZ); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); - GlStateManager.rotate( -entity.rotationYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-entity.rotationYaw, 0.0F, 1.0F, 0.0F); this.model.render(entity, partialTicks, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); @@ -69,7 +72,6 @@ public void doRender(PortalEntity entity, double x, double y, double z, float en } public static void setupTranslation(double x, double y, double z) { - GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); + GlStateManager.translate((float) x, (float) y + 0.5F, (float) z); } - } diff --git a/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java b/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java index 4291b84f367..1bc5e61a13e 100644 --- a/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/TerminalARRenderer.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -23,7 +24,7 @@ * @Author: KilaBash * @Date: 2021/09/13 * @Description: Renderer for AR applications. - * Please don't render your stuff here, it's just a handler + * Please don't render your stuff here, it's just a handler */ @SideOnly(Side.CLIENT) public class TerminalARRenderer { @@ -43,7 +44,7 @@ public static void renderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { int sWidth = event.getResolution().getScaledWidth(); int sHeight = event.getResolution().getScaledHeight(); width = (int) (380 * 0.8 * sHeight / 256); - height =(int) (0.8 * sHeight); + height = (int) (0.8 * sHeight); x = (sWidth - width) / 2; y = (sHeight - height) / 2; GlStateManager.enableBlend(); @@ -54,7 +55,7 @@ public static void renderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { public static void renderWorldLastEvent(RenderWorldLastEvent event) { if (APP != null) { - RenderUtil.useScissor(x, y, width, height, ()-> APP.drawARScreen(event)); + RenderUtil.useScissor(x, y, width, height, () -> APP.drawARScreen(event)); } } @@ -70,7 +71,7 @@ public static void onClientTick(TickEvent.ClientTickEvent event) { } HELD_HAND = EnumHand.MAIN_HAND; NBTTagCompound tag = player.getHeldItem(EnumHand.MAIN_HAND).getSubCompound("terminal"); - if (tag == null ) { + if (tag == null) { tag = player.getHeldItem(EnumHand.OFF_HAND).getSubCompound("terminal"); HELD_HAND = EnumHand.OFF_HAND; } @@ -95,5 +96,4 @@ public static void onClientTick(TickEvent.ClientTickEvent event) { } } } - } diff --git a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java index 7d928bdb802..1f111d2c0a2 100644 --- a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.block.material.TileEntityMaterialPipeBase; @@ -11,9 +7,15 @@ import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.cable.Insulation; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; + +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nullable; @@ -39,14 +41,16 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof Insulation)) { return; } int insulationLevel = ((Insulation) pipeType).insulationLevel; IVertexOperation wireRender = new IconTransformation(wireTexture); - ColourMultiplier wireColor = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB())); + ColourMultiplier wireColor = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB())); ColourMultiplier insulationColor = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(0x404040)); if (pipeTile != null) { if (pipeTile.getPaintingColor() != pipeTile.getDefaultPaintingColor()) { @@ -64,7 +68,8 @@ public void buildRenderer(PipeRenderContext renderContext, BlockPipe bl } renderContext.addOpenFaceRender(false, wireRender, wireColor) - .addOpenFaceRender(false, new IconTransformation(insulationTextures[insulationLevel]), insulationColor) + .addOpenFaceRender(false, new IconTransformation(insulationTextures[insulationLevel]), + insulationColor) .addSideRender(false, new IconTransformation(insulationTextures[5]), insulationColor); } else { renderContext.addOpenFaceRender(false, wireRender, wireColor) @@ -86,7 +91,8 @@ public Pair getParticleTexture(IPipeTile pipe if (!(pipeType instanceof Insulation)) { return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } - Material material = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material material = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; TextureAtlasSprite atlasSprite; int particleColor; diff --git a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java index 9eb2f62d59d..b43c6f5755f 100644 --- a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -9,12 +8,16 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.fluidpipe.FluidPipeType; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public class FluidPipeRenderer extends PipeRenderer { public static final FluidPipeRenderer INSTANCE = new FluidPipeRenderer(); @@ -41,13 +44,14 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof FluidPipeType)) { return; } if (ModHandler.isMaterialWood(material)) { TextureAtlasSprite sprite = pipeTexturesWood.get(pipeType); - if(sprite != null) { + if (sprite != null) { renderContext.addOpenFaceRender(new IconTransformation(sprite)); } else { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))); diff --git a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java index d6577a0bd99..90961bb1bfe 100644 --- a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -8,12 +7,16 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.itempipe.ItemPipeType; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public class ItemPipeRenderer extends PipeRenderer { public static final ItemPipeRenderer INSTANCE = new ItemPipeRenderer(); @@ -36,7 +39,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, IPipeTile pipeTile, + IPipeType pipeType, @Nullable Material material) { if (material == null || !(pipeType instanceof ItemPipeType)) { return; } diff --git a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java index 3502a70ae3d..adc2fda4af4 100644 --- a/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/LaserPipeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -14,19 +10,27 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.laser.LaserPipeType; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Nullable; import java.util.EnumMap; public class LaserPipeRenderer extends PipeRenderer { + public static final LaserPipeRenderer INSTANCE = new LaserPipeRenderer(); private final EnumMap pipeTextures = new EnumMap<>(LaserPipeType.class); private boolean active = false; + public LaserPipeRenderer() { super("gt_laser_pipe", GTUtility.gregtechId("laser_pipe")); } @@ -37,7 +41,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { if (pipeType instanceof LaserPipeType) { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))) .addSideRender(false, new IconTransformation(Textures.LASER_PIPE_SIDE)); @@ -45,19 +50,23 @@ public void buildRenderer(PipeRenderContext renderContext, BlockPipe bl renderContext.addSideRender(new IconTransformation(Textures.LASER_PIPE_OVERLAY)); } - active = !ConfigHolder.client.preventAnimatedCables && pipeTile instanceof TileEntityLaserPipe laserPipe && laserPipe.isActive(); + active = !ConfigHolder.client.preventAnimatedCables && pipeTile instanceof TileEntityLaserPipe laserPipe && + laserPipe.isActive(); } } @Override - protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, PipeRenderContext renderContext) { - if (active && layer == BloomEffectUtil.getEffectiveBloomLayer() && (renderContext.getConnections() & 0b111111) != 0) { + protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, + PipeRenderContext renderContext) { + if (active && layer == BloomEffectUtil.getEffectiveBloomLayer() && + (renderContext.getConnections() & 0b111111) != 0) { Cuboid6 innerCuboid = BlockPipe.getSideBox(null, renderContext.getPipeThickness()); if ((renderContext.getConnections() & 0b111111) != 0) { for (EnumFacing side : EnumFacing.VALUES) { if ((renderContext.getConnections() & (1 << side.getIndex())) == 0) { int oppositeIndex = side.getOpposite().getIndex(); - if ((renderContext.getConnections() & (1 << oppositeIndex)) <= 0 || (renderContext.getConnections() & 0b111111 & ~(1 << oppositeIndex)) != 0) { + if ((renderContext.getConnections() & (1 << oppositeIndex)) <= 0 || + (renderContext.getConnections() & 0b111111 & ~(1 << oppositeIndex)) != 0) { // render pipe side IVertexOperation[] ops = renderContext.getBaseVertexOperation(); ops = ArrayUtils.addAll(ops, new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); @@ -70,7 +79,8 @@ protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderSta if (connectionSide.getAxis() != side.getAxis()) { // render side textures IVertexOperation[] ops = renderContext.getBaseVertexOperation(); - ops = ArrayUtils.addAll(ops, new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); + ops = ArrayUtils.addAll(ops, + new IconTransformation(Textures.LASER_PIPE_OVERLAY_EMISSIVE)); renderFace(renderState, ops, connectionSide, sideCuboid); } } diff --git a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java index 5dbd92d4fc2..dd4513708cf 100644 --- a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java @@ -1,6 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; import gregtech.api.pipenet.tile.IPipeTile; @@ -10,12 +9,16 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.optical.OpticalPipeType; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import javax.annotation.Nullable; +import codechicken.lib.vec.uv.IconTransformation; + import java.util.EnumMap; +import javax.annotation.Nullable; + public final class OpticalPipeRenderer extends PipeRenderer { public static final OpticalPipeRenderer INSTANCE = new OpticalPipeRenderer(); @@ -31,7 +34,8 @@ public void registerIcons(TextureMap map) { } @Override - public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { + public void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material) { if (pipeType instanceof OpticalPipeType) { renderContext.addOpenFaceRender(new IconTransformation(pipeTextures.get(pipeType))) .addSideRender(false, new IconTransformation(Textures.OPTICAL_PIPE_SIDE)); diff --git a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java index 4cdeab7d4c6..d7ba5027c3a 100644 --- a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java @@ -1,20 +1,5 @@ package gregtech.client.renderer.pipe; -import codechicken.lib.lighting.LightMatrix; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.block.BlockRenderingRegistry; -import codechicken.lib.render.block.ICCBlockRenderer; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Translation; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.IconTransformation; import gregtech.api.cover.CoverHolder; import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.IPipeType; @@ -29,8 +14,7 @@ import gregtech.api.util.ModCompatibility; import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -55,24 +39,45 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.lighting.LightMatrix; +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.block.BlockRenderingRegistry; +import codechicken.lib.render.block.ICCBlockRenderer; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Translation; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.IconTransformation; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public abstract class PipeRenderer implements ICCBlockRenderer, IItemRenderer { public final ModelResourceLocation modelLocation; private final String name; private EnumBlockRenderType blockRenderType; - protected static final ThreadLocal blockFaces = ThreadLocal.withInitial(BlockRenderer.BlockFace::new); + protected static final ThreadLocal blockFaces = ThreadLocal + .withInitial(BlockRenderer.BlockFace::new); private static final Cuboid6 FRAME_RENDER_CUBOID = new Cuboid6(0.001, 0.001, 0.001, 0.999, 0.999, 0.999); - private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>(EnumFacing.class); + private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>( + EnumFacing.class); private static final Int2ObjectMap RESTRICTOR_MAP = new Int2ObjectOpenHashMap<>(); @SuppressWarnings("unused") @@ -95,12 +100,18 @@ public static void initializeRestrictor(TextureMap map) { } static { - FACE_BORDER_MAP.put(EnumFacing.DOWN, borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST)); - FACE_BORDER_MAP.put(EnumFacing.UP, borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST)); - FACE_BORDER_MAP.put(EnumFacing.NORTH, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST)); - FACE_BORDER_MAP.put(EnumFacing.SOUTH, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST)); - FACE_BORDER_MAP.put(EnumFacing.WEST, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH)); - FACE_BORDER_MAP.put(EnumFacing.EAST, borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.NORTH)); + FACE_BORDER_MAP.put(EnumFacing.DOWN, + borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST)); + FACE_BORDER_MAP.put(EnumFacing.UP, + borderMap(EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST)); + FACE_BORDER_MAP.put(EnumFacing.NORTH, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST)); + FACE_BORDER_MAP.put(EnumFacing.SOUTH, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST)); + FACE_BORDER_MAP.put(EnumFacing.WEST, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH)); + FACE_BORDER_MAP.put(EnumFacing.EAST, + borderMap(EnumFacing.UP, EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.NORTH)); } public PipeRenderer(String name, ModelResourceLocation modelLocation) { @@ -134,7 +145,9 @@ public void onModelsBake(ModelBakeEvent event) { event.getModelRegistry().putObject(modelLocation, this); } - public abstract void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, @Nullable IPipeTile pipeTile, IPipeType pipeType, @Nullable Material material); + public abstract void buildRenderer(PipeRenderContext renderContext, BlockPipe blockPipe, + @Nullable IPipeTile pipeTile, IPipeType pipeType, + @Nullable Material material); @Override public void renderItem(ItemStack rawItemStack, TransformType transformType) { @@ -148,7 +161,8 @@ public void renderItem(ItemStack rawItemStack, TransformType transformType) { renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM); BlockPipe blockFluidPipe = (BlockPipe) ((ItemBlockPipe) stack.getItem()).getBlock(); IPipeType pipeType = blockFluidPipe.getItemPipeType(stack); - Material material = blockFluidPipe instanceof BlockMaterialPipe blockMaterialPipe ? blockMaterialPipe.getItemMaterial(stack) : null; + Material material = blockFluidPipe instanceof BlockMaterialPipe blockMaterialPipe ? + blockMaterialPipe.getItemMaterial(stack) : null; if (pipeType != null) { // 12 == 0b1100 is North and South connection (index 2 & 3) PipeRenderContext renderContext = new PipeRenderContext(12, 0, pipeType.getThickness()); @@ -175,7 +189,8 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, } IPipeType pipeType = pipeTile.getPipeType(); - Material pipeMaterial = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material pipeMaterial = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; int paintingColor = pipeTile.getPaintingColor(); int connectedSidesMap = pipeTile.getVisualConnections(); int blockedConnections = pipeTile.getBlockedConnections(); @@ -189,7 +204,8 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, Textures.RENDER_STATE.set(new CubeRendererState(renderLayer, sideMask, world)); if (canRenderInLayer(renderLayer)) { renderState.lightMatrix.locate(world, pos); - PipeRenderContext renderContext = new PipeRenderContext(pos, renderState.lightMatrix, connectedSidesMap, blockedConnections, pipeType.getThickness()); + PipeRenderContext renderContext = new PipeRenderContext(pos, renderState.lightMatrix, connectedSidesMap, + blockedConnections, pipeType.getThickness()); renderContext.color = GTUtility.convertRGBtoOpaqueRGBA_CL(getPipeColor(pipeMaterial, paintingColor)); buildRenderer(renderContext, blockPipe, pipeTile, pipeType, pipeMaterial); if (renderLayer == BlockRenderLayer.CUTOUT) { @@ -201,13 +217,15 @@ public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, } CoverHolder coverHolder = pipeTile.getCoverableImplementation(); - coverHolder.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); + coverHolder.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), + renderLayer); Textures.RENDER_STATE.set(null); } return true; } - private static void renderFrame(IPipeTile pipeTile, BlockPos pos, CCRenderState renderState, int connections) { + private static void renderFrame(IPipeTile pipeTile, BlockPos pos, CCRenderState renderState, + int connections) { Material frameMaterial = pipeTile.getFrameMaterial(); if (frameMaterial != null) { ResourceLocation rl = MaterialIconType.frameGt.getBlockTexturePath(frameMaterial.getMaterialIconSet()); @@ -250,7 +268,8 @@ public void renderPipeBlock(CCRenderState renderState, PipeRenderContext renderC // if connection is blocked if ((renderContext.connections & 1 << renderedSide.getIndex()) == 0) { int oppositeIndex = renderedSide.getOpposite().getIndex(); - if ((renderContext.connections & 1 << oppositeIndex) > 0 && (renderContext.connections & 63 & ~(1 << oppositeIndex)) == 0) { + if ((renderContext.connections & 1 << oppositeIndex) > 0 && + (renderContext.connections & 63 & ~(1 << oppositeIndex)) == 0) { // render open texture if opposite is open and no other renderOpenFace(renderState, renderContext, renderedSide, cuboid6); } else { @@ -291,13 +310,15 @@ protected void renderPipeCube(CCRenderState renderState, PipeRenderContext rende } } - protected void renderOpenFace(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, Cuboid6 cuboid6) { + protected void renderOpenFace(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, + Cuboid6 cuboid6) { for (IVertexOperation[] vertexOperations : renderContext.openFaceRenderer) { renderFace(renderState, vertexOperations, side, cuboid6); } } - protected void renderPipeSide(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, Cuboid6 cuboid6) { + protected void renderPipeSide(CCRenderState renderState, PipeRenderContext renderContext, EnumFacing side, + Cuboid6 cuboid6) { for (IVertexOperation[] vertexOperations : renderContext.pipeSideRenderer) { renderFace(renderState, vertexOperations, side, cuboid6); } @@ -307,20 +328,22 @@ protected void renderPipeSide(CCRenderState renderState, PipeRenderContext rende int borderMask = 0; for (Border border : Border.VALUES) { EnumFacing borderSide = getSideAtBorder(side, border); - if (TileEntityPipeBase.isFaceBlocked(blockedConnections, borderSide) - && TileEntityPipeBase.isConnected(connections, borderSide)) { + if (TileEntityPipeBase.isFaceBlocked(blockedConnections, borderSide) && + TileEntityPipeBase.isConnected(connections, borderSide)) { // only render when the side is blocked *and* connected borderMask |= border.mask; } } if (borderMask != 0) { - IVertexOperation[] pipeline = ArrayUtils.addAll(renderContext.getBaseVertexOperation(), RESTRICTOR_MAP.get(borderMask)); + IVertexOperation[] pipeline = ArrayUtils.addAll(renderContext.getBaseVertexOperation(), + RESTRICTOR_MAP.get(borderMask)); renderFace(renderState, pipeline, side, cuboid6); } } } - protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline, EnumFacing side, Cuboid6 cuboid6) { + protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline, EnumFacing side, + Cuboid6 cuboid6) { BlockRenderer.BlockFace blockFace = blockFaces.get(); blockFace.loadCuboidFace(cuboid6, side.getIndex()); renderState.setPipeline(blockFace, 0, blockFace.verts.length, pipeline); @@ -328,20 +351,19 @@ protected void renderFace(CCRenderState renderState, IVertexOperation[] pipeline } @Override - public void renderBrightness(IBlockState state, float brightness) { - } + public void renderBrightness(IBlockState state, float brightness) {} /** * Override to render in other layers, e.g. emissive stuff * {@link #canRenderInLayer} also need to be overridden */ - protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, PipeRenderContext renderContext) { - - } + protected void renderOtherLayers(BlockRenderLayer layer, CCRenderState renderState, + PipeRenderContext renderContext) {} /** * What layers can be rendered in. * See also {@link #renderOtherLayers} + * * @param layer the current layer being rendered too * @return true if this should render in {@code layer} */ @@ -350,7 +372,8 @@ protected boolean canRenderInLayer(BlockRenderLayer layer) { } @Override - public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { + public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, + BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); @@ -377,8 +400,7 @@ public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockStat } @Override - public void registerTextures(TextureMap map) { - } + public void registerTextures(TextureMap map) {} @Override public IModelState getTransforms() { @@ -410,7 +432,8 @@ public Pair getParticleTexture(IPipeTile pipe return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } IPipeType pipeType = pipeTile.getPipeType(); - Material material = pipeTile instanceof TileEntityMaterialPipeBase ? ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; + Material material = pipeTile instanceof TileEntityMaterialPipeBase ? + ((TileEntityMaterialPipeBase) pipeTile).getPipeMaterial() : null; if (pipeType == null) { return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF); } @@ -434,16 +457,18 @@ public static class PipeRenderContext { private final int connections; private final int blockedConnections; - public PipeRenderContext(BlockPos pos, LightMatrix lightMatrix, int connections, int blockedConnections, float thickness) { + public PipeRenderContext(BlockPos pos, LightMatrix lightMatrix, int connections, int blockedConnections, + float thickness) { this.pos = pos; this.lightMatrix = lightMatrix; this.connections = connections; this.blockedConnections = blockedConnections; this.pipeThickness = thickness; if (pos != null && lightMatrix != null) { - blockedOverlay = new IVertexOperation[]{new Translation(pos), lightMatrix, new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY)}; + blockedOverlay = new IVertexOperation[] { new Translation(pos), lightMatrix, + new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY) }; } else { - blockedOverlay = new IVertexOperation[]{new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY)}; + blockedOverlay = new IVertexOperation[] { new IconTransformation(Textures.PIPE_BLOCKED_OVERLAY) }; } } @@ -485,9 +510,10 @@ public ColourMultiplier getColorOperation() { protected IVertexOperation[] getBaseVertexOperation() { if (pos == null) { - return lightMatrix == null ? new IVertexOperation[0] : new IVertexOperation[]{lightMatrix}; + return lightMatrix == null ? new IVertexOperation[0] : new IVertexOperation[] { lightMatrix }; } - return lightMatrix == null ? new IVertexOperation[]{new Translation(pos)} : new IVertexOperation[]{new Translation(pos), lightMatrix}; + return lightMatrix == null ? new IVertexOperation[] { new Translation(pos) } : + new IVertexOperation[] { new Translation(pos), lightMatrix }; } public int getConnections() { @@ -509,10 +535,10 @@ public List getOpenFaceRenderer() { public float getPipeThickness() { return pipeThickness; } - } - private static EnumMap borderMap(EnumFacing topSide, EnumFacing bottomSide, EnumFacing leftSide, EnumFacing rightSide) { + private static EnumMap borderMap(EnumFacing topSide, EnumFacing bottomSide, EnumFacing leftSide, + EnumFacing rightSide) { EnumMap sideMap = new EnumMap<>(Border.class); sideMap.put(Border.TOP, topSide); sideMap.put(Border.BOTTOM, bottomSide); @@ -526,7 +552,7 @@ private static void addRestrictor(TextureAtlasSprite sprite, Border... borders) for (Border border : borders) { mask |= border.mask; } - RESTRICTOR_MAP.put(mask, new IVertexOperation[]{new IconTransformation(sprite)}); + RESTRICTOR_MAP.put(mask, new IVertexOperation[] { new IconTransformation(sprite) }); } protected static EnumFacing getSideAtBorder(EnumFacing side, Border border) { @@ -534,7 +560,11 @@ protected static EnumFacing getSideAtBorder(EnumFacing side, Border border) { } public enum Border { - TOP, BOTTOM, LEFT, RIGHT; + + TOP, + BOTTOM, + LEFT, + RIGHT; public static final Border[] VALUES = values(); diff --git a/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java index 3ff6b3b13b4..c7ccac7e16f 100644 --- a/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/FBOWorldSceneRenderer.java @@ -1,6 +1,7 @@ package gregtech.client.renderer.scene; import gregtech.api.util.GTLog; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -12,6 +13,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.EXTFramebufferObject; import org.lwjgl.opengl.GL11; @@ -23,13 +25,14 @@ * @Author: KilaBash * @Date: 2021/08/23 * @Description: It looks similar to {@link ImmediateWorldSceneRenderer}, but totally different. - * It uses FBO and is more universality and efficient(X). - * FBO can be rendered anywhere more flexibly, not just in the GUI. - * If you have scene rendering needs, you will love this FBO renderer. - * TODO OP_LIST might be used in the future to further improve performance. + * It uses FBO and is more universality and efficient(X). + * FBO can be rendered anywhere more flexibly, not just in the GUI. + * If you have scene rendering needs, you will love this FBO renderer. + * TODO OP_LIST might be used in the future to further improve performance. */ @SideOnly(Side.CLIENT) public class FBOWorldSceneRenderer extends WorldSceneRenderer { + private int resolutionWidth = 1080; private int resolutionHeight = 1080; private Framebuffer fbo; @@ -68,12 +71,13 @@ public void setFBOSize(int resolutionWidth, int resolutionHeight) { public RayTraceResult screenPos2BlockPosFace(int mouseX, int mouseY) { int lastID = bindFBO(); - RayTraceResult looking = super.screenPos2BlockPosFace(mouseX, mouseY, 0, 0, this.resolutionWidth, this.resolutionHeight); + RayTraceResult looking = super.screenPos2BlockPosFace(mouseX, mouseY, 0, 0, this.resolutionWidth, + this.resolutionHeight); unbindFBO(lastID); return looking; } - public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth){ + public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth) { int lastID = bindFBO(); Vector3f winPos = super.blockPos2ScreenPos(pos, depth, 0, 0, this.resolutionWidth, this.resolutionHeight); unbindFBO(lastID); @@ -83,7 +87,8 @@ public Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth){ public void render(float x, float y, float width, float height, float mouseX, float mouseY) { // bind to FBO int lastID = bindFBO(); - super.render(0, 0, this.resolutionWidth, this.resolutionHeight, (int) (this.resolutionWidth * mouseX / width), (int) (this.resolutionHeight * (1 - mouseY / height))); + super.render(0, 0, this.resolutionWidth, this.resolutionHeight, (int) (this.resolutionWidth * mouseX / width), + (int) (this.resolutionHeight * (1 - mouseY / height))); // unbind FBO unbindFBO(lastID); @@ -92,7 +97,7 @@ public void render(float x, float y, float width, float height, float mouseX, fl GlStateManager.disableLighting(); lastID = GL11.glGetInteger(GL11.GL_TEXTURE_2D); GlStateManager.bindTexture(fbo.framebufferTexture); - GlStateManager.color(1,1,1,1); + GlStateManager.color(1, 1, 1, 1); // render rect with FBO texture Tessellator tessellator = Tessellator.getInstance(); @@ -112,7 +117,7 @@ public void render(float x, float y, float width, float height, int mouseX, int render(x, y, width, height, (float) mouseX, (float) mouseY); } - private int bindFBO(){ + private int bindFBO() { int lastID = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT); fbo.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); fbo.framebufferClear(); @@ -121,7 +126,7 @@ private int bindFBO(){ return lastID; } - private void unbindFBO(int lastID){ + private void unbindFBO(int lastID) { GlStateManager.popMatrix(); fbo.unbindFramebufferTexture(); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); diff --git a/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java b/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java index fe4d8acb3aa..e6674c9b4d2 100644 --- a/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java +++ b/src/main/java/gregtech/client/renderer/scene/ISceneRenderHook.java @@ -8,8 +8,10 @@ * @Author: KilaBash * @Date: 2021/08/25 * @Description: Scene Render State hooks. - * This is where you decide whether or not this group of pos should be rendered. What other requirements do you have for rendering. + * This is where you decide whether or not this group of pos should be rendered. What other requirements + * do you have for rendering. */ public interface ISceneRenderHook { + void apply(boolean isTESR, int pass, BlockRenderLayer layer); } diff --git a/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java index 0b85cc8d79a..2a4972b7f07 100644 --- a/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/ImmediateWorldSceneRenderer.java @@ -1,19 +1,22 @@ package gregtech.client.renderer.scene; import gregtech.api.util.PositionedRect; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; /** * Created with IntelliJ IDEA. + * * @Author: KilaBash * @Date: 2021/8/24 * @Description: Real-time rendering renderer. - * If you need to render scene as a texture, use the FBO {@link FBOWorldSceneRenderer}. + * If you need to render scene as a texture, use the FBO {@link FBOWorldSceneRenderer}. */ @SideOnly(Side.CLIENT) public class ImmediateWorldSceneRenderer extends WorldSceneRenderer { @@ -26,17 +29,17 @@ public ImmediateWorldSceneRenderer(World world) { protected PositionedRect getPositionedRect(int x, int y, int width, int height) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution resolution = new ScaledResolution(mc); - //compute window size from scaled width & height + // compute window size from scaled width & height int windowWidth = (int) (width / (resolution.getScaledWidth() * 1.0) * mc.displayWidth); int windowHeight = (int) (height / (resolution.getScaledHeight() * 1.0) * mc.displayHeight); - //translate gui coordinates to window's ones (y is inverted) + // translate gui coordinates to window's ones (y is inverted) int windowX = (int) (x / (resolution.getScaledWidth() * 1.0) * mc.displayWidth); - int windowY = mc.displayHeight - (int) (y / (resolution.getScaledHeight() * 1.0) * mc.displayHeight) - windowHeight; + int windowY = mc.displayHeight - (int) (y / (resolution.getScaledHeight() * 1.0) * mc.displayHeight) - + windowHeight; return super.getPositionedRect(windowX, windowY, windowWidth, windowHeight); } - @Override protected void clearView(int x, int y, int width, int height) { GL11.glEnable(GL11.GL_SCISSOR_TEST); diff --git a/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java b/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java index 58be817eb1d..d5947edf46d 100644 --- a/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java +++ b/src/main/java/gregtech/client/renderer/scene/WorldSceneRenderer.java @@ -1,10 +1,10 @@ package gregtech.client.renderer.scene; -import codechicken.lib.vec.Vector3; import gregtech.api.util.Position; import gregtech.api.util.PositionedRect; import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -23,10 +23,11 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.Vector3; import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.GLU; -import javax.vecmath.Vector3f; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; @@ -36,6 +37,8 @@ import java.util.Map; import java.util.function.Consumer; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -45,11 +48,17 @@ */ @SideOnly(Side.CLIENT) public abstract class WorldSceneRenderer { - protected static final FloatBuffer MODELVIEW_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final FloatBuffer PROJECTION_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final IntBuffer VIEWPORT_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asIntBuffer(); - protected static final FloatBuffer PIXEL_DEPTH_BUFFER = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - protected static final FloatBuffer OBJECT_POS_BUFFER = ByteBuffer.allocateDirect(3 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); + + protected static final FloatBuffer MODELVIEW_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); + protected static final FloatBuffer PROJECTION_MATRIX_BUFFER = ByteBuffer.allocateDirect(16 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); + protected static final IntBuffer VIEWPORT_BUFFER = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()) + .asIntBuffer(); + protected static final FloatBuffer PIXEL_DEPTH_BUFFER = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()) + .asFloatBuffer(); + protected static final FloatBuffer OBJECT_POS_BUFFER = ByteBuffer.allocateDirect(3 * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); public final World world; public final Map, ISceneRenderHook> renderedBlocksMap; @@ -99,7 +108,7 @@ public RayTraceResult getLastTraceResult() { public void render(float x, float y, float width, float height, int mouseX, int mouseY) { // setupCamera - PositionedRect positionedRect = getPositionedRect((int)x, (int)y, (int)width, (int)height); + PositionedRect positionedRect = getPositionedRect((int) x, (int) y, (int) width, (int) height); PositionedRect mouse = getPositionedRect(mouseX, mouseY, 0, 0); mouseX = mouse.position.x; mouseY = mouse.position.y; @@ -108,8 +117,9 @@ public void render(float x, float y, float width, float height, int mouseX, int drawWorld(); // check lookingAt this.lastTraceResult = null; - if (onLookingAt != null && mouseX > positionedRect.position.x && mouseX < positionedRect.position.x + positionedRect.size.width - && mouseY > positionedRect.position.y && mouseY < positionedRect.position.y + positionedRect.size.height) { + if (onLookingAt != null && mouseX > positionedRect.position.x && + mouseX < positionedRect.position.x + positionedRect.size.width && mouseY > positionedRect.position.y && + mouseY < positionedRect.position.y + positionedRect.size.height) { Vector3f hitPos = unProject(mouseX, mouseY); RayTraceResult result = rayTrace(hitPos); if (result != null) { @@ -143,7 +153,7 @@ public void setCameraLookAt(Vector3f eyePos, Vector3f lookAt, Vector3f worldUp) public void setCameraLookAt(Vector3f lookAt, double radius, double rotationPitch, double rotationYaw) { this.lookAt = lookAt; Vector3 vecX = new Vector3(Math.cos(rotationPitch), 0, Math.sin(rotationPitch)); - Vector3 vecY = new Vector3(0, Math.tan(rotationYaw) * vecX.mag(),0); + Vector3 vecY = new Vector3(0, Math.tan(rotationYaw) * vecX.mag(), 0); Vector3 pos = vecX.copy().add(vecY).normalize().multiply(radius); this.eyePos = pos.add(lookAt.x, lookAt.y, lookAt.z).vector3f(); } @@ -165,12 +175,12 @@ protected void setupCamera(PositionedRect positionedRect) { GlStateManager.enableDepth(); GlStateManager.enableBlend(); - //setup viewport and clear GL buffers + // setup viewport and clear GL buffers GlStateManager.viewport(x, y, width, height); clearView(x, y, width, height); - //setup projection matrix to perspective + // setup projection matrix to perspective GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); @@ -178,7 +188,7 @@ protected void setupCamera(PositionedRect positionedRect) { float aspectRatio = width / (height * 1.0f); GLU.gluPerspective(60.0f, aspectRatio, 0.1f, 10000.0f); - //setup modelview matrix + // setup modelview matrix GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); @@ -191,22 +201,22 @@ protected void clearView(int x, int y, int width, int height) { } protected static void resetCamera() { - //reset viewport + // reset viewport Minecraft minecraft = Minecraft.getMinecraft(); GlStateManager.viewport(0, 0, minecraft.displayWidth, minecraft.displayHeight); - //reset projection matrix + // reset projection matrix GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.popMatrix(); - //reset modelview matrix + // reset modelview matrix GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.popMatrix(); GlStateManager.disableBlend(); GlStateManager.disableDepth(); - //reset attributes + // reset attributes GlStateManager.popAttrib(); } @@ -231,7 +241,7 @@ protected void drawWorld() { ForgeHooksClient.setRenderLayer(layer); int pass = layer == BlockRenderLayer.TRANSLUCENT ? 1 : 0; - renderedBlocksMap.forEach((renderedBlocks, hook)->{ + renderedBlocksMap.forEach((renderedBlocks, hook) -> { if (hook != null) { hook.apply(false, pass, layer); } else { @@ -267,7 +277,7 @@ protected void drawWorld() { for (int pass = 0; pass < 2; pass++) { ForgeHooksClient.setRenderPass(pass); int finalPass = pass; - renderedBlocksMap.forEach((renderedBlocks, hook)->{ + renderedBlocksMap.forEach((renderedBlocks, hook) -> { if (hook != null) { hook.apply(true, finalPass, null); } else { @@ -314,85 +324,89 @@ public RayTraceResult rayTrace(Vector3f hitPos) { } public static Vector3f project(BlockPos pos) { - //read current rendering parameters + // read current rendering parameters GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, MODELVIEW_MATRIX_BUFFER); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, PROJECTION_MATRIX_BUFFER); GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT_BUFFER); - //rewind buffers after write by OpenGL glGet calls + // rewind buffers after write by OpenGL glGet calls MODELVIEW_MATRIX_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); VIEWPORT_BUFFER.rewind(); - //call gluProject with retrieved parameters - GLU.gluProject(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); + // call gluProject with retrieved parameters + GLU.gluProject(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, MODELVIEW_MATRIX_BUFFER, + PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); - //rewind buffers after read by gluProject + // rewind buffers after read by gluProject VIEWPORT_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); MODELVIEW_MATRIX_BUFFER.rewind(); - //rewind buffer after write by gluProject + // rewind buffer after write by gluProject OBJECT_POS_BUFFER.rewind(); - //obtain position in Screen + // obtain position in Screen float winX = OBJECT_POS_BUFFER.get(); float winY = OBJECT_POS_BUFFER.get(); float winZ = OBJECT_POS_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read OBJECT_POS_BUFFER.rewind(); return new Vector3f(winX, winY, winZ); } public static Vector3f unProject(int mouseX, int mouseY) { - //read depth of pixel under mouse + // read depth of pixel under mouse GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, PIXEL_DEPTH_BUFFER); - //rewind buffer after write by glReadPixels + // rewind buffer after write by glReadPixels PIXEL_DEPTH_BUFFER.rewind(); - //retrieve depth from buffer (0.0-1.0f) + // retrieve depth from buffer (0.0-1.0f) float pixelDepth = PIXEL_DEPTH_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read PIXEL_DEPTH_BUFFER.rewind(); - //read current rendering parameters + // read current rendering parameters GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, MODELVIEW_MATRIX_BUFFER); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, PROJECTION_MATRIX_BUFFER); GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT_BUFFER); - //rewind buffers after write by OpenGL glGet calls + // rewind buffers after write by OpenGL glGet calls MODELVIEW_MATRIX_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); VIEWPORT_BUFFER.rewind(); - //call gluUnProject with retrieved parameters - GLU.gluUnProject(mouseX, mouseY, pixelDepth, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, OBJECT_POS_BUFFER); + // call gluUnProject with retrieved parameters + GLU.gluUnProject(mouseX, mouseY, pixelDepth, MODELVIEW_MATRIX_BUFFER, PROJECTION_MATRIX_BUFFER, VIEWPORT_BUFFER, + OBJECT_POS_BUFFER); - //rewind buffers after read by gluUnProject + // rewind buffers after read by gluUnProject VIEWPORT_BUFFER.rewind(); PROJECTION_MATRIX_BUFFER.rewind(); MODELVIEW_MATRIX_BUFFER.rewind(); - //rewind buffer after write by gluUnProject + // rewind buffer after write by gluUnProject OBJECT_POS_BUFFER.rewind(); - //obtain absolute position in world + // obtain absolute position in world float posX = OBJECT_POS_BUFFER.get(); float posY = OBJECT_POS_BUFFER.get(); float posZ = OBJECT_POS_BUFFER.get(); - //rewind buffer after read + // rewind buffer after read OBJECT_POS_BUFFER.rewind(); return new Vector3f(posX, posY, posZ); } /*** - * For better performance, You'd better handle the event {@link #setOnLookingAt(Consumer)} or {@link #getLastTraceResult()} + * For better performance, You'd better handle the event {@link #setOnLookingAt(Consumer)} or + * {@link #getLastTraceResult()} + * * @param mouseX xPos in Texture * @param mouseY yPos in Texture * @return RayTraceResult Hit @@ -414,11 +428,12 @@ protected RayTraceResult screenPos2BlockPosFace(int mouseX, int mouseY, int x, i /*** * For better performance, You'd better do project in {@link #setAfterWorldRender(Consumer)} - * @param pos BlockPos + * + * @param pos BlockPos * @param depth should pass Depth Test * @return x, y, z */ - protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, int width, int height){ + protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, int width, int height) { // render a frame GlStateManager.enableDepth(); setupCamera(getPositionedRect(x, y, width, height)); @@ -430,5 +445,4 @@ protected Vector3f blockPos2ScreenPos(BlockPos pos, boolean depth, int x, int y, return winPos; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/Textures.java b/src/main/java/gregtech/client/renderer/texture/Textures.java index b3a750b10fe..09de1dbb6ef 100644 --- a/src/main/java/gregtech/client/renderer/texture/Textures.java +++ b/src/main/java/gregtech/client/renderer/texture/Textures.java @@ -1,14 +1,5 @@ package gregtech.client.renderer.texture; -import codechicken.lib.render.BlockRenderer.BlockFace; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.TransformationList; -import codechicken.lib.vec.uv.IconTransformation; -import codechicken.lib.vec.uv.UVTransformationList; import gregtech.api.GTValues; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.info.MaterialIconType; @@ -18,6 +9,7 @@ import gregtech.client.renderer.cclop.UVMirror; import gregtech.client.renderer.texture.cube.*; import gregtech.client.renderer.texture.custom.*; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -25,6 +17,16 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer.BlockFace; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.TransformationList; +import codechicken.lib.vec.uv.IconTransformation; +import codechicken.lib.vec.uv.UVTransformationList; import org.apache.commons.lang3.ArrayUtils; import java.util.ArrayList; @@ -52,259 +54,441 @@ public class Textures { public static final QuantumStorageRenderer QUANTUM_STORAGE_RENDERER = new QuantumStorageRenderer(); // Simple Cube Renderers - public static final SimpleOverlayRenderer BRONZE_PLATED_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_bronze_plated_bricks"); - public static final SimpleOverlayRenderer PRIMITIVE_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_primitive_bricks"); - public static final SimpleOverlayRenderer COKE_BRICKS = new SimpleOverlayRenderer("casings/solid/machine_coke_bricks"); - public static final SimpleOverlayRenderer HEAT_PROOF_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_heatproof"); - public static final SimpleOverlayRenderer FROST_PROOF_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_frost_proof"); - public static final SimpleOverlayRenderer SOLID_STEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_solid_steel"); - public static final SimpleOverlayRenderer CLEAN_STAINLESS_STEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_clean_stainless_steel"); - public static final SimpleOverlayRenderer STABLE_TITANIUM_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_stable_titanium"); - public static final SimpleOverlayRenderer ROBUST_TUNGSTENSTEEL_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_robust_tungstensteel"); - public static final SimpleOverlayRenderer STURDY_HSSE_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_sturdy_hsse"); - public static final SimpleOverlayRenderer PALLADIUM_SUBSTATION_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_palladium_substation"); - public static final SimpleOverlayRenderer INERT_PTFE_CASING = new SimpleOverlayRenderer("casings/solid/machine_casing_inert_ptfe"); + public static final SimpleOverlayRenderer BRONZE_PLATED_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_bronze_plated_bricks"); + public static final SimpleOverlayRenderer PRIMITIVE_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_primitive_bricks"); + public static final SimpleOverlayRenderer COKE_BRICKS = new SimpleOverlayRenderer( + "casings/solid/machine_coke_bricks"); + public static final SimpleOverlayRenderer HEAT_PROOF_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_heatproof"); + public static final SimpleOverlayRenderer FROST_PROOF_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_frost_proof"); + public static final SimpleOverlayRenderer SOLID_STEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_solid_steel"); + public static final SimpleOverlayRenderer CLEAN_STAINLESS_STEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_clean_stainless_steel"); + public static final SimpleOverlayRenderer STABLE_TITANIUM_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_stable_titanium"); + public static final SimpleOverlayRenderer ROBUST_TUNGSTENSTEEL_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_robust_tungstensteel"); + public static final SimpleOverlayRenderer STURDY_HSSE_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_sturdy_hsse"); + public static final SimpleOverlayRenderer PALLADIUM_SUBSTATION_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_palladium_substation"); + public static final SimpleOverlayRenderer INERT_PTFE_CASING = new SimpleOverlayRenderer( + "casings/solid/machine_casing_inert_ptfe"); public static final SimpleOverlayRenderer PLASCRETE = new SimpleOverlayRenderer("casings/cleanroom/plascrete"); - public static final SimpleOverlayRenderer FUSION_TEXTURE = new SimpleOverlayRenderer("casings/fusion/machine_casing_fusion_hatch"); - public static final SimpleOverlayRenderer ACTIVE_FUSION_TEXTURE = new SimpleOverlayRenderer("casings/fusion/machine_casing_fusion_hatch_yellow"); - public static final SimpleOverlayRenderer GRATE_CASING = new SimpleOverlayRenderer("casings/pipe/machine_casing_grate"); - public static final SimpleOverlayRenderer HIGH_POWER_CASING = new SimpleOverlayRenderer("casings/computer/high_power_casing"); + public static final SimpleOverlayRenderer FUSION_TEXTURE = new SimpleOverlayRenderer( + "casings/fusion/machine_casing_fusion_hatch"); + public static final SimpleOverlayRenderer ACTIVE_FUSION_TEXTURE = new SimpleOverlayRenderer( + "casings/fusion/machine_casing_fusion_hatch_yellow"); + public static final SimpleOverlayRenderer GRATE_CASING = new SimpleOverlayRenderer( + "casings/pipe/machine_casing_grate"); + public static final SimpleOverlayRenderer HIGH_POWER_CASING = new SimpleOverlayRenderer( + "casings/computer/high_power_casing"); // Simple Sided Cube Renderers - public static final SimpleSidedCubeRenderer STEAM_CASING_BRONZE = new SimpleSidedCubeRenderer("casings/steam/bronze"); + public static final SimpleSidedCubeRenderer STEAM_CASING_BRONZE = new SimpleSidedCubeRenderer( + "casings/steam/bronze"); public static final SimpleSidedCubeRenderer STEAM_CASING_STEEL = new SimpleSidedCubeRenderer("casings/steam/steel"); - public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_BRONZE = new SimpleSidedCubeRenderer("casings/steam/bricked_bronze"); - public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_STEEL = new SimpleSidedCubeRenderer("casings/steam/bricked_steel"); + public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_BRONZE = new SimpleSidedCubeRenderer( + "casings/steam/bricked_bronze"); + public static final SimpleSidedCubeRenderer STEAM_BRICKED_CASING_STEEL = new SimpleSidedCubeRenderer( + "casings/steam/bricked_steel"); public static final SimpleSidedCubeRenderer[] VOLTAGE_CASINGS = new SimpleSidedCubeRenderer[GTValues.V.length]; public static final SimpleSidedCubeRenderer PRIMITIVE_PUMP = new SimpleSidedCubeRenderer("casings/pump_deck"); public static final SimpleSidedCubeRenderer WOOD_WALL = new SimpleSidedCubeRenderer("casings/wood_wall"); - public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER = new SimpleSidedCubeRenderer("casings/magic/absorber/normal"); - public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER_ACTIVE = new SimpleSidedCubeRenderer("casings/magic/absorber/active"); + public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER = new SimpleSidedCubeRenderer( + "casings/magic/absorber/normal"); + public static final SimpleSidedCubeRenderer MAGIC_ENERGY_ABSORBER_ACTIVE = new SimpleSidedCubeRenderer( + "casings/magic/absorber/active"); public static final SimpleSidedCubeRenderer DRUM_OVERLAY = new SimpleSidedCubeRenderer("storage/drums/drum_top"); // Simple Oriented Cube Renderers - public static final SimpleOrientedCubeRenderer CRAFTING_TABLE = new SimpleOrientedCubeRenderer("casings/crafting_table"); - public static final SimpleOrientedCubeRenderer GRATE_CASING_STEEL_FRONT = new SimpleOrientedCubeRenderer("casings/pipe/grate_steel_front"); + public static final SimpleOrientedCubeRenderer CRAFTING_TABLE = new SimpleOrientedCubeRenderer( + "casings/crafting_table"); + public static final SimpleOrientedCubeRenderer GRATE_CASING_STEEL_FRONT = new SimpleOrientedCubeRenderer( + "casings/pipe/grate_steel_front"); // Oriented Overlay Renderers - public static final OrientedOverlayRenderer COAL_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/coal"); - public static final OrientedOverlayRenderer LAVA_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/lava"); - public static final OrientedOverlayRenderer SOLAR_BOILER_OVERLAY = new OrientedOverlayRenderer("generators/boiler/solar"); - public static final OrientedOverlayRenderer PRIMITIVE_PUMP_OVERLAY = new OrientedOverlayRenderer("multiblock/primitive_pump"); - public static final OrientedOverlayRenderer PRIMITIVE_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/primitive_blast_furnace"); + public static final OrientedOverlayRenderer COAL_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/coal"); + public static final OrientedOverlayRenderer LAVA_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/lava"); + public static final OrientedOverlayRenderer SOLAR_BOILER_OVERLAY = new OrientedOverlayRenderer( + "generators/boiler/solar"); + public static final OrientedOverlayRenderer PRIMITIVE_PUMP_OVERLAY = new OrientedOverlayRenderer( + "multiblock/primitive_pump"); + public static final OrientedOverlayRenderer PRIMITIVE_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/primitive_blast_furnace"); public static final OrientedOverlayRenderer COKE_OVEN_OVERLAY = new OrientedOverlayRenderer("multiblock/coke_oven"); - public static final OrientedOverlayRenderer MULTIBLOCK_WORKABLE_OVERLAY = new OrientedOverlayRenderer("multiblock/multiblock_workable"); - public static final OrientedOverlayRenderer BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/blast_furnace"); - public static final OrientedOverlayRenderer IMPLOSION_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("multiblock/implosion_compressor"); - public static final OrientedOverlayRenderer MULTI_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/multi_furnace"); - public static final OrientedOverlayRenderer PYROLYSE_OVEN_OVERLAY = new OrientedOverlayRenderer("multiblock/pyrolyse_oven"); - public static final OrientedOverlayRenderer VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer("multiblock/vacuum_freezer"); - public static final OrientedOverlayRenderer DISTILLATION_TOWER_OVERLAY = new OrientedOverlayRenderer("multiblock/distillation_tower"); - public static final OrientedOverlayRenderer CRACKING_UNIT_OVERLAY = new OrientedOverlayRenderer("multiblock/cracking_unit"); - public static final OrientedOverlayRenderer LARGE_CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer("multiblock/large_chemical_reactor"); - public static final OrientedOverlayRenderer LARGE_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_combustion_engine"); - public static final OrientedOverlayRenderer EXTREME_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/extreme_combustion_engine"); - public static final OrientedOverlayRenderer FLUID_RIG_OVERLAY = new OrientedOverlayRenderer("multiblock/fluid_drilling_rig"); - public static final OrientedOverlayRenderer LARGE_STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_steam_turbine"); - public static final OrientedOverlayRenderer LARGE_GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_gas_turbine"); - public static final OrientedOverlayRenderer LARGE_PLASMA_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_plasma_turbine"); - public static final OrientedOverlayRenderer LARGE_BRONZE_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_bronze_boiler"); - public static final OrientedOverlayRenderer LARGE_STEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_steel_boiler"); - public static final OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_titanium_boiler"); - public static final OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_tungstensteel_boiler"); - public static final OrientedOverlayRenderer FUSION_REACTOR_OVERLAY = new OrientedOverlayRenderer("multiblock/fusion_reactor"); - public static final OrientedOverlayRenderer PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer("multiblock/processing_array"); - public static final OrientedOverlayRenderer ADVANCED_PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer("multiblock/advanced_processing_array"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_BASIC = new OrientedOverlayRenderer("multiblock/large_miner_basic"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED = new OrientedOverlayRenderer("multiblock/large_miner_advanced"); - public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED_2 = new OrientedOverlayRenderer("multiblock/large_miner_advanced_2"); + public static final OrientedOverlayRenderer MULTIBLOCK_WORKABLE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multiblock_workable"); + public static final OrientedOverlayRenderer BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/blast_furnace"); + public static final OrientedOverlayRenderer IMPLOSION_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/implosion_compressor"); + public static final OrientedOverlayRenderer MULTI_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multi_furnace"); + public static final OrientedOverlayRenderer PYROLYSE_OVEN_OVERLAY = new OrientedOverlayRenderer( + "multiblock/pyrolyse_oven"); + public static final OrientedOverlayRenderer VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer( + "multiblock/vacuum_freezer"); + public static final OrientedOverlayRenderer DISTILLATION_TOWER_OVERLAY = new OrientedOverlayRenderer( + "multiblock/distillation_tower"); + public static final OrientedOverlayRenderer CRACKING_UNIT_OVERLAY = new OrientedOverlayRenderer( + "multiblock/cracking_unit"); + public static final OrientedOverlayRenderer LARGE_CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/large_chemical_reactor"); + public static final OrientedOverlayRenderer LARGE_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_combustion_engine"); + public static final OrientedOverlayRenderer EXTREME_COMBUSTION_ENGINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/extreme_combustion_engine"); + public static final OrientedOverlayRenderer FLUID_RIG_OVERLAY = new OrientedOverlayRenderer( + "multiblock/fluid_drilling_rig"); + public static final OrientedOverlayRenderer LARGE_STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_steam_turbine"); + public static final OrientedOverlayRenderer LARGE_GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_gas_turbine"); + public static final OrientedOverlayRenderer LARGE_PLASMA_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/generator/large_plasma_turbine"); + public static final OrientedOverlayRenderer LARGE_BRONZE_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_bronze_boiler"); + public static final OrientedOverlayRenderer LARGE_STEEL_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_steel_boiler"); + public static final OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_titanium_boiler"); + public static final OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer( + "multiblock/generator/large_tungstensteel_boiler"); + public static final OrientedOverlayRenderer FUSION_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "multiblock/fusion_reactor"); + public static final OrientedOverlayRenderer PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer( + "multiblock/processing_array"); + public static final OrientedOverlayRenderer ADVANCED_PROCESSING_ARRAY_OVERLAY = new OrientedOverlayRenderer( + "multiblock/advanced_processing_array"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_BASIC = new OrientedOverlayRenderer( + "multiblock/large_miner_basic"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED = new OrientedOverlayRenderer( + "multiblock/large_miner_advanced"); + public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED_2 = new OrientedOverlayRenderer( + "multiblock/large_miner_advanced_2"); public static final OrientedOverlayRenderer CLEANROOM_OVERLAY = new OrientedOverlayRenderer("multiblock/cleanroom"); - public static final OrientedOverlayRenderer MULTIBLOCK_TANK_OVERLAY = new OrientedOverlayRenderer("multiblock/multiblock_tank"); - public static final OrientedOverlayRenderer CHARCOAL_PILE_OVERLAY = new OrientedOverlayRenderer("multiblock/charcoal_pile_igniter"); + public static final OrientedOverlayRenderer MULTIBLOCK_TANK_OVERLAY = new OrientedOverlayRenderer( + "multiblock/multiblock_tank"); + public static final OrientedOverlayRenderer CHARCOAL_PILE_OVERLAY = new OrientedOverlayRenderer( + "multiblock/charcoal_pile_igniter"); public static final OrientedOverlayRenderer DATA_BANK_OVERLAY = new OrientedOverlayRenderer("multiblock/data_bank"); - public static final OrientedOverlayRenderer RESEARCH_STATION_OVERLAY = new OrientedOverlayRenderer("multiblock/research_station"); + public static final OrientedOverlayRenderer RESEARCH_STATION_OVERLAY = new OrientedOverlayRenderer( + "multiblock/research_station"); public static final OrientedOverlayRenderer HPCA_OVERLAY = new OrientedOverlayRenderer("multiblock/hpca"); - public static final OrientedOverlayRenderer NETWORK_SWITCH_OVERLAY = new OrientedOverlayRenderer("multiblock/network_switch"); - public static final OrientedOverlayRenderer POWER_SUBSTATION_OVERLAY = new OrientedOverlayRenderer("multiblock/power_substation"); + public static final OrientedOverlayRenderer NETWORK_SWITCH_OVERLAY = new OrientedOverlayRenderer( + "multiblock/network_switch"); + public static final OrientedOverlayRenderer POWER_SUBSTATION_OVERLAY = new OrientedOverlayRenderer( + "multiblock/power_substation"); - public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer("machines/alloy_smelter"); + public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer( + "machines/alloy_smelter"); public static final OrientedOverlayRenderer FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/furnace"); - public static final OrientedOverlayRenderer ELECTRIC_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/electric_furnace"); + public static final OrientedOverlayRenderer ELECTRIC_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "machines/electric_furnace"); public static final OrientedOverlayRenderer EXTRACTOR_OVERLAY = new OrientedOverlayRenderer("machines/extractor"); public static final OrientedOverlayRenderer COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("machines/compressor"); public static final OrientedOverlayRenderer MACERATOR_OVERLAY = new OrientedOverlayRenderer("machines/macerator"); public static final OrientedOverlayRenderer PULVERIZER_OVERLAY = new OrientedOverlayRenderer("machines/pulverizer"); - public static final OrientedOverlayRenderer ARC_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/arc_furnace"); + public static final OrientedOverlayRenderer ARC_FURNACE_OVERLAY = new OrientedOverlayRenderer( + "machines/arc_furnace"); public static final OrientedOverlayRenderer ASSEMBLER_OVERLAY = new OrientedOverlayRenderer("machines/assembler"); public static final OrientedOverlayRenderer AUTOCLAVE_OVERLAY = new OrientedOverlayRenderer("machines/autoclave"); public static final OrientedOverlayRenderer BENDER_OVERLAY = new OrientedOverlayRenderer("machines/bender"); public static final OrientedOverlayRenderer BREWERY_OVERLAY = new OrientedOverlayRenderer("machines/brewery"); public static final OrientedOverlayRenderer CANNER_OVERLAY = new OrientedOverlayRenderer("machines/canner"); public static final OrientedOverlayRenderer CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer("machines/centrifuge"); - public static final OrientedOverlayRenderer CHEMICAL_BATH_OVERLAY = new OrientedOverlayRenderer("machines/chemical_bath"); - public static final OrientedOverlayRenderer CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer("machines/chemical_reactor"); + public static final OrientedOverlayRenderer CHEMICAL_BATH_OVERLAY = new OrientedOverlayRenderer( + "machines/chemical_bath"); + public static final OrientedOverlayRenderer CHEMICAL_REACTOR_OVERLAY = new OrientedOverlayRenderer( + "machines/chemical_reactor"); public static final OrientedOverlayRenderer CUTTER_OVERLAY = new OrientedOverlayRenderer("machines/cutter"); public static final OrientedOverlayRenderer DISTILLERY_OVERLAY = new OrientedOverlayRenderer("machines/distillery"); - public static final OrientedOverlayRenderer ELECTROLYZER_OVERLAY = new OrientedOverlayRenderer("machines/electrolyzer"); - public static final OrientedOverlayRenderer ELECTROMAGNETIC_SEPARATOR_OVERLAY = new OrientedOverlayRenderer("machines/electromagnetic_separator"); + public static final OrientedOverlayRenderer ELECTROLYZER_OVERLAY = new OrientedOverlayRenderer( + "machines/electrolyzer"); + public static final OrientedOverlayRenderer ELECTROMAGNETIC_SEPARATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/electromagnetic_separator"); public static final OrientedOverlayRenderer EXTRUDER_OVERLAY = new OrientedOverlayRenderer("machines/extruder"); public static final OrientedOverlayRenderer FERMENTER_OVERLAY = new OrientedOverlayRenderer("machines/fermenter"); - public static final OrientedOverlayRenderer FLUID_HEATER_OVERLAY = new OrientedOverlayRenderer("machines/fluid_heater"); - public static final OrientedOverlayRenderer FLUID_SOLIDIFIER_OVERLAY = new OrientedOverlayRenderer("machines/fluid_solidifier"); - public static final OrientedOverlayRenderer FORGE_HAMMER_OVERLAY = new OrientedOverlayRenderer("machines/forge_hammer"); + public static final OrientedOverlayRenderer FLUID_HEATER_OVERLAY = new OrientedOverlayRenderer( + "machines/fluid_heater"); + public static final OrientedOverlayRenderer FLUID_SOLIDIFIER_OVERLAY = new OrientedOverlayRenderer( + "machines/fluid_solidifier"); + public static final OrientedOverlayRenderer FORGE_HAMMER_OVERLAY = new OrientedOverlayRenderer( + "machines/forge_hammer"); public static final OrientedOverlayRenderer FORMING_PRESS_OVERLAY = new OrientedOverlayRenderer("machines/press"); - public static final OrientedOverlayRenderer GAS_COLLECTOR_OVERLAY = new OrientedOverlayRenderer("machines/gas_collector"); + public static final OrientedOverlayRenderer GAS_COLLECTOR_OVERLAY = new OrientedOverlayRenderer( + "machines/gas_collector"); public static final OrientedOverlayRenderer LATHE_OVERLAY = new OrientedOverlayRenderer("machines/lathe"); public static final OrientedOverlayRenderer MIXER_OVERLAY = new OrientedOverlayRenderer("machines/mixer"); public static final OrientedOverlayRenderer ORE_WASHER_OVERLAY = new OrientedOverlayRenderer("machines/ore_washer"); public static final OrientedOverlayRenderer PACKER_OVERLAY = new OrientedOverlayRenderer("machines/packer"); public static final OrientedOverlayRenderer POLARIZER_OVERLAY = new OrientedOverlayRenderer("machines/polarizer"); - public static final OrientedOverlayRenderer LASER_ENGRAVER_OVERLAY = new OrientedOverlayRenderer("machines/laser_engraver"); - public static final OrientedOverlayRenderer ROCK_BREAKER_OVERLAY = new OrientedOverlayRenderer("machines/rock_crusher"); + public static final OrientedOverlayRenderer LASER_ENGRAVER_OVERLAY = new OrientedOverlayRenderer( + "machines/laser_engraver"); + public static final OrientedOverlayRenderer ROCK_BREAKER_OVERLAY = new OrientedOverlayRenderer( + "machines/rock_crusher"); public static final OrientedOverlayRenderer SIFTER_OVERLAY = new OrientedOverlayRenderer("machines/sifter"); - public static final OrientedOverlayRenderer THERMAL_CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer("machines/thermal_centrifuge"); + public static final OrientedOverlayRenderer THERMAL_CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer( + "machines/thermal_centrifuge"); public static final OrientedOverlayRenderer WIREMILL_OVERLAY = new OrientedOverlayRenderer("machines/wiremill"); - public static final OrientedOverlayRenderer MASS_FABRICATOR_OVERLAY = new OrientedOverlayRenderer("machines/mass_fabricator"); + public static final OrientedOverlayRenderer MASS_FABRICATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/mass_fabricator"); public static final OrientedOverlayRenderer REPLICATOR_OVERLAY = new OrientedOverlayRenderer("machines/replicator"); public static final OrientedOverlayRenderer SCANNER_OVERLAY = new OrientedOverlayRenderer("machines/scanner"); - public static final OrientedOverlayRenderer COMBUSTION_GENERATOR_OVERLAY = new OrientedOverlayRenderer("generators/combustion"); - public static final OrientedOverlayRenderer GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer("generators/gas_turbine"); - public static final OrientedOverlayRenderer STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer("generators/steam_turbine"); - public static final OrientedOverlayRenderer WORLD_ACCELERATOR_OVERLAY = new OrientedOverlayRenderer("machines/world_accelerator"); - public static final OrientedOverlayRenderer WORLD_ACCELERATOR_TE_OVERLAY = new OrientedOverlayRenderer("machines/world_accelerator_te"); - + public static final OrientedOverlayRenderer COMBUSTION_GENERATOR_OVERLAY = new OrientedOverlayRenderer( + "generators/combustion"); + public static final OrientedOverlayRenderer GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "generators/gas_turbine"); + public static final OrientedOverlayRenderer STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer( + "generators/steam_turbine"); + public static final OrientedOverlayRenderer WORLD_ACCELERATOR_OVERLAY = new OrientedOverlayRenderer( + "machines/world_accelerator"); + public static final OrientedOverlayRenderer WORLD_ACCELERATOR_TE_OVERLAY = new OrientedOverlayRenderer( + "machines/world_accelerator_te"); // Simple Overlay Renderers public static final SimpleOverlayRenderer SCREEN = new SimpleOverlayRenderer("overlay/machine/overlay_screen"); public static final SimpleOverlayRenderer DISPLAY = new SimpleOverlayRenderer("cover/overlay_display"); public static final SimpleOverlayRenderer SHUTTER = new SimpleOverlayRenderer("cover/overlay_shutter"); - public static final SimpleOverlayRenderer DETECTOR_ENERGY = new SimpleOverlayRenderer("cover/overlay_energy_detector"); - public static final SimpleOverlayRenderer DETECTOR_ENERGY_ADVANCED = new SimpleOverlayRenderer("cover/overlay_energy_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_FLUID = new SimpleOverlayRenderer("cover/overlay_fluid_detector"); - public static final SimpleOverlayRenderer DETECTOR_FLUID_ADVANCED = new SimpleOverlayRenderer("cover/overlay_fluid_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_ENERGY = new SimpleOverlayRenderer( + "cover/overlay_energy_detector"); + public static final SimpleOverlayRenderer DETECTOR_ENERGY_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_energy_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_FLUID = new SimpleOverlayRenderer( + "cover/overlay_fluid_detector"); + public static final SimpleOverlayRenderer DETECTOR_FLUID_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_fluid_detector_advanced"); public static final SimpleOverlayRenderer DETECTOR_ITEM = new SimpleOverlayRenderer("cover/overlay_item_detector"); - public static final SimpleOverlayRenderer DETECTOR_ITEM_ADVANCED = new SimpleOverlayRenderer("cover/overlay_item_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_ACTIVITY = new SimpleOverlayRenderer("cover/overlay_activity_detector"); - public static final SimpleOverlayRenderer DETECTOR_ACTIVITY_ADVANCED = new SimpleOverlayRenderer("cover/overlay_activity_detector_advanced"); - public static final SimpleOverlayRenderer DETECTOR_MAINTENANCE = new SimpleOverlayRenderer("cover/overlay_maintenance_detector"); + public static final SimpleOverlayRenderer DETECTOR_ITEM_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_item_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_ACTIVITY = new SimpleOverlayRenderer( + "cover/overlay_activity_detector"); + public static final SimpleOverlayRenderer DETECTOR_ACTIVITY_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_activity_detector_advanced"); + public static final SimpleOverlayRenderer DETECTOR_MAINTENANCE = new SimpleOverlayRenderer( + "cover/overlay_maintenance_detector"); public static final SimpleOverlayRenderer SOLAR_PANEL = new SimpleOverlayRenderer("cover/overlay_solar_panel"); - public static final SimpleOverlayRenderer INFINITE_WATER = new SimpleOverlayRenderer("cover/overlay_infinite_water"); + public static final SimpleOverlayRenderer INFINITE_WATER = new SimpleOverlayRenderer( + "cover/overlay_infinite_water"); public static final SimpleOverlayRenderer FLUID_VOIDING = new SimpleOverlayRenderer("cover/overlay_fluid_voiding"); public static final SimpleOverlayRenderer ITEM_VOIDING = new SimpleOverlayRenderer("cover/overlay_item_voiding"); - public static final SimpleOverlayRenderer FLUID_VOIDING_ADVANCED = new SimpleOverlayRenderer("cover/overlay_fluid_voiding_advanced"); - public static final SimpleOverlayRenderer ITEM_VOIDING_ADVANCED = new SimpleOverlayRenderer("cover/overlay_item_voiding_advanced"); - public static final SimpleOverlayRenderer ENDER_FLUID_LINK = new SimpleOverlayRenderer("cover/overlay_ender_fluid_link"); + public static final SimpleOverlayRenderer FLUID_VOIDING_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_fluid_voiding_advanced"); + public static final SimpleOverlayRenderer ITEM_VOIDING_ADVANCED = new SimpleOverlayRenderer( + "cover/overlay_item_voiding_advanced"); + public static final SimpleOverlayRenderer ENDER_FLUID_LINK = new SimpleOverlayRenderer( + "cover/overlay_ender_fluid_link"); public static final SimpleOverlayRenderer STORAGE = new SimpleOverlayRenderer("cover/overlay_storage"); - public static final SimpleOverlayRenderer PIPE_OUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_out"); - public static final SimpleOverlayRenderer PIPE_IN_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_in"); - public static final SimpleOverlayRenderer PIPE_4X_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_4x"); - public static final SimpleOverlayRenderer PIPE_9X_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_pipe_9x"); - - public static final SimpleOverlayRenderer FLUID_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_output"); - public static final SimpleOverlayRenderer ITEM_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_output"); - - public static final SimpleOverlayRenderer FLUID_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_hatch_output"); - public static final SimpleOverlayRenderer FLUID_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_fluid_hatch_input"); - public static final SimpleOverlayRenderer ITEM_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_output"); - public static final SimpleOverlayRenderer ITEM_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_item_hatch_input"); - public static final SimpleOverlayRenderer WATER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_water"); + public static final SimpleOverlayRenderer PIPE_OUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_out"); + public static final SimpleOverlayRenderer PIPE_IN_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_in"); + public static final SimpleOverlayRenderer PIPE_4X_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_4x"); + public static final SimpleOverlayRenderer PIPE_9X_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_pipe_9x"); + + public static final SimpleOverlayRenderer FLUID_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_output"); + public static final SimpleOverlayRenderer ITEM_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_output"); + + public static final SimpleOverlayRenderer FLUID_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_hatch_output"); + public static final SimpleOverlayRenderer FLUID_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_fluid_hatch_input"); + public static final SimpleOverlayRenderer ITEM_HATCH_OUTPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_hatch_output"); + public static final SimpleOverlayRenderer ITEM_HATCH_INPUT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_item_hatch_input"); + public static final SimpleOverlayRenderer WATER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_water"); public static final ICubeRenderer BRONZE_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/bronze"); - public static final ICubeRenderer BRONZE_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/bronze/active"); + public static final ICubeRenderer BRONZE_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/bronze/active"); public static final ICubeRenderer STEEL_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/steel"); - public static final ICubeRenderer STEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/steel/active"); + public static final ICubeRenderer STEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/steel/active"); public static final ICubeRenderer TITANIUM_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/titanium"); - public static final ICubeRenderer TITANIUM_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/titanium/active"); - public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX = new SidedCubeRenderer("casings/firebox/overlay/tungstensteel"); - public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer("casings/firebox/overlay/tungstensteel/active"); + public static final ICubeRenderer TITANIUM_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/titanium/active"); + public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX = new SidedCubeRenderer( + "casings/firebox/overlay/tungstensteel"); + public static final ICubeRenderer TUNGSTENSTEEL_FIREBOX_ACTIVE = new FireboxActiveRenderer( + "casings/firebox/overlay/tungstensteel/active"); public static final ICubeRenderer COMPUTER_CASING = new SidedCubeRenderer("casings/computer/computer_casing"); - public static final ICubeRenderer ADVANCED_COMPUTER_CASING = new SidedCubeRenderer("casings/computer/advanced_computer_casing"); + public static final ICubeRenderer ADVANCED_COMPUTER_CASING = new SidedCubeRenderer( + "casings/computer/advanced_computer_casing"); public static final AlignedOrientedOverlayRenderer LD_ITEM_PIPE = new LDPipeOverlayRenderer("pipe/ld_item_pipe"); public static final AlignedOrientedOverlayRenderer LD_FLUID_PIPE = new LDPipeOverlayRenderer("pipe/ld_fluid_pipe"); - public static final SimpleOverlayRenderer ROTOR_HOLDER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_rotor_holder"); - public static final SimpleOverlayRenderer ADV_PUMP_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_adv_pump"); - public static final SimpleOverlayRenderer FILTER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_filter"); - public static final SimpleOverlayRenderer HATCH_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_hatch"); - public static final SimpleOverlayRenderer FLUID_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_fluid_filter"); - public static final SimpleOverlayRenderer ITEM_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_item_filter"); - public static final SimpleOverlayRenderer ORE_DICTIONARY_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_ore_dictionary_filter"); - public static final SimpleOverlayRenderer SMART_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_smart_item_filter"); - public static final SimpleOverlayRenderer MACHINE_CONTROLLER_OVERLAY = new SimpleOverlayRenderer("cover/overlay_controller"); - public static final SimpleOverlayRenderer ENERGY_OUT = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out"); - public static final SimpleOverlayRenderer ENERGY_IN = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in"); - public static final SimpleOverlayRenderer ENERGY_OUT_MULTI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_multi"); - public static final SimpleOverlayRenderer ENERGY_IN_MULTI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_multi"); - public static final SimpleOverlayRenderer ENERGY_OUT_HI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_hi"); - public static final SimpleOverlayRenderer ENERGY_IN_HI = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_hi"); - public static final SimpleOverlayRenderer ENERGY_OUT_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_ultra"); - public static final SimpleOverlayRenderer ENERGY_IN_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_ultra"); - public static final SimpleOverlayRenderer ENERGY_OUT_MAX = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_max"); - public static final SimpleOverlayRenderer ENERGY_IN_MAX = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_max"); + public static final SimpleOverlayRenderer ROTOR_HOLDER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_rotor_holder"); + public static final SimpleOverlayRenderer ADV_PUMP_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_adv_pump"); + public static final SimpleOverlayRenderer FILTER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_filter"); + public static final SimpleOverlayRenderer HATCH_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_hatch"); + public static final SimpleOverlayRenderer FLUID_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_fluid_filter"); + public static final SimpleOverlayRenderer ITEM_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_item_filter"); + public static final SimpleOverlayRenderer ORE_DICTIONARY_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_ore_dictionary_filter"); + public static final SimpleOverlayRenderer SMART_FILTER_FILTER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_smart_item_filter"); + public static final SimpleOverlayRenderer MACHINE_CONTROLLER_OVERLAY = new SimpleOverlayRenderer( + "cover/overlay_controller"); + public static final SimpleOverlayRenderer ENERGY_OUT = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out"); + public static final SimpleOverlayRenderer ENERGY_IN = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in"); + public static final SimpleOverlayRenderer ENERGY_OUT_MULTI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_multi"); + public static final SimpleOverlayRenderer ENERGY_IN_MULTI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_multi"); + public static final SimpleOverlayRenderer ENERGY_OUT_HI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_hi"); + public static final SimpleOverlayRenderer ENERGY_IN_HI = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_hi"); + public static final SimpleOverlayRenderer ENERGY_OUT_ULTRA = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_ultra"); + public static final SimpleOverlayRenderer ENERGY_IN_ULTRA = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_ultra"); + public static final SimpleOverlayRenderer ENERGY_OUT_MAX = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_out_max"); + public static final SimpleOverlayRenderer ENERGY_IN_MAX = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_in_max"); public static final SimpleOverlayRenderer CONVEYOR_OVERLAY = new SimpleOverlayRenderer("cover/overlay_conveyor"); - public static final SimpleOverlayRenderer CONVEYOR_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_conveyor_inverted"); + public static final SimpleOverlayRenderer CONVEYOR_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_conveyor_inverted"); public static final SimpleOverlayRenderer ARM_OVERLAY = new SimpleOverlayRenderer("cover/overlay_arm"); - public static final SimpleOverlayRenderer ARM_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_arm_inverted"); + public static final SimpleOverlayRenderer ARM_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_arm_inverted"); public static final SimpleOverlayRenderer PUMP_OVERLAY = new SimpleOverlayRenderer("cover/overlay_pump"); - public static final SimpleOverlayRenderer PUMP_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_pump_inverted"); - public static final SimpleOverlayRenderer AIR_VENT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_air_vent"); - public static final SimpleOverlayRenderer BLOWER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower"); - public static final SimpleOverlayRenderer BLOWER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower_active"); - public static final SimpleOverlayRenderer INFINITE_EMITTER_FACE = new SimpleOverlayRenderer("overlay/machine/overlay_energy_emitter"); - public static final SimpleOverlayRenderer STEAM_VENT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_steam_vent"); - public static final SimpleOverlayRenderer QUANTUM_TANK_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_qtank"); - public static final SimpleOverlayRenderer QUANTUM_CHEST_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_qchest"); - public static final SimpleOverlayRenderer CREATIVE_CONTAINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_creativecontainer"); - public static final SimpleOverlayRenderer BUFFER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_buffer"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_TAPED = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_taped"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CONFIGURABLE = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_configurable"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_FULL_AUTO = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_full_auto"); - public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CLEANING = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_cleaning"); - public static final SimpleOverlayRenderer MUFFLER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_muffler"); - public static final SimpleOverlayRenderer STEAM_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_steam_miner"); - public static final SimpleOverlayRenderer CHUNK_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_chunk_miner"); - public static final SimpleOverlayRenderer BLANK_SCREEN = new SimpleOverlayRenderer("overlay/machine/overlay_blank_screen"); - public static final SimpleOverlayRenderer DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch"); - public static final SimpleOverlayRenderer CREATIVE_DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch_creative"); - public static final SimpleOverlayRenderer OPTICAL_DATA_ACCESS_HATCH = new SimpleOverlayRenderer("overlay/machine/overlay_data_hatch_optical"); - public static final SimpleOverlayRenderer LASER_SOURCE = new SimpleOverlayRenderer("overlay/machine/overlay_laser_source"); - public static final SimpleOverlayRenderer LASER_TARGET = new SimpleOverlayRenderer("overlay/machine/overlay_laser_target"); - public static final SimpleOverlayRenderer OBJECT_HOLDER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_object_holder"); - public static final SimpleOverlayRenderer OBJECT_HOLDER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_object_holder_active"); - public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/active_cooler"); - public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/active_cooler_active"); - public static final SimpleOverlayRenderer HPCA_BRIDGE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/bridge"); - public static final SimpleOverlayRenderer HPCA_BRIDGE_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/bridge_active"); - public static final SimpleOverlayRenderer HPCA_COMPUTATION_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation"); - public static final SimpleOverlayRenderer HPCA_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_active"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_advanced"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/computation_advanced_active"); - public static final SimpleOverlayRenderer HPCA_DAMAGED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged"); - public static final SimpleOverlayRenderer HPCA_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_active"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_advanced"); - public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/damaged_advanced_active"); - public static final SimpleOverlayRenderer HPCA_EMPTY_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/empty"); - public static final SimpleOverlayRenderer HPCA_HEAT_SINK_OVERLAY = new SimpleOverlayRenderer("overlay/machine/hpca/heat_sink"); - public static final SimpleOverlayRenderer ALARM_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_alarm"); - public static final SimpleOverlayRenderer ALARM_OVERLAY_ACTIVE = new SimpleOverlayRenderer("overlay/machine/overlay_alarm_active"); - public static final SimpleOverlayRenderer TAPED_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_ducttape"); - - public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID = new SimpleOverlayRenderer("cover/cover_interface_fluid"); - public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID_GLASS = new SimpleOverlayRenderer("cover/cover_interface_fluid_glass"); - public static final SimpleOverlayRenderer COVER_INTERFACE_ITEM = new SimpleOverlayRenderer("cover/cover_interface_item"); - public static final SimpleOverlayRenderer COVER_INTERFACE_ENERGY = new SimpleOverlayRenderer("cover/cover_interface_energy"); - public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_ON = new SimpleOverlayRenderer("cover/cover_interface_machine_on"); - public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_OFF = new SimpleOverlayRenderer("cover/cover_interface_machine_off"); - public static final SimpleOverlayRenderer COVER_INTERFACE_PROXY = new SimpleOverlayRenderer("cover/cover_interface_proxy"); - public static final SimpleOverlayRenderer COVER_INTERFACE_WIRELESS = new SimpleOverlayRenderer("cover/cover_interface_wireless"); - - public static final SimpleOverlayRenderer CONVERTER_FE_OUT = new SimpleOverlayRenderer("overlay/converter/converter_fe_out"); - public static final SimpleOverlayRenderer CONVERTER_FE_IN = new SimpleOverlayRenderer("overlay/converter/converter_fe_in"); - - public static final SimpleOverlayRenderer ME_OUTPUT_HATCH = new SimpleOverlayRenderer("overlay/appeng/me_output_hatch"); - public static final SimpleOverlayRenderer ME_INPUT_HATCH = new SimpleOverlayRenderer("overlay/appeng/me_input_hatch"); + public static final SimpleOverlayRenderer PUMP_OVERLAY_INVERTED = new SimpleOverlayRenderer( + "cover/overlay_pump_inverted"); + public static final SimpleOverlayRenderer AIR_VENT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_air_vent"); + public static final SimpleOverlayRenderer BLOWER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_blower"); + public static final SimpleOverlayRenderer BLOWER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_blower_active"); + public static final SimpleOverlayRenderer INFINITE_EMITTER_FACE = new SimpleOverlayRenderer( + "overlay/machine/overlay_energy_emitter"); + public static final SimpleOverlayRenderer STEAM_VENT_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_steam_vent"); + public static final SimpleOverlayRenderer QUANTUM_TANK_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_qtank"); + public static final SimpleOverlayRenderer QUANTUM_CHEST_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_qchest"); + public static final SimpleOverlayRenderer CREATIVE_CONTAINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_creativecontainer"); + public static final SimpleOverlayRenderer BUFFER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_buffer"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_TAPED = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_taped"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CONFIGURABLE = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_configurable"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_FULL_AUTO = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_full_auto"); + public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CLEANING = new SimpleOverlayRenderer( + "overlay/machine/overlay_maintenance_cleaning"); + public static final SimpleOverlayRenderer MUFFLER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_muffler"); + public static final SimpleOverlayRenderer STEAM_MINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_steam_miner"); + public static final SimpleOverlayRenderer CHUNK_MINER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_chunk_miner"); + public static final SimpleOverlayRenderer BLANK_SCREEN = new SimpleOverlayRenderer( + "overlay/machine/overlay_blank_screen"); + public static final SimpleOverlayRenderer DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch"); + public static final SimpleOverlayRenderer CREATIVE_DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch_creative"); + public static final SimpleOverlayRenderer OPTICAL_DATA_ACCESS_HATCH = new SimpleOverlayRenderer( + "overlay/machine/overlay_data_hatch_optical"); + public static final SimpleOverlayRenderer LASER_SOURCE = new SimpleOverlayRenderer( + "overlay/machine/overlay_laser_source"); + public static final SimpleOverlayRenderer LASER_TARGET = new SimpleOverlayRenderer( + "overlay/machine/overlay_laser_target"); + public static final SimpleOverlayRenderer OBJECT_HOLDER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_object_holder"); + public static final SimpleOverlayRenderer OBJECT_HOLDER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_object_holder_active"); + public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/active_cooler"); + public static final SimpleOverlayRenderer HPCA_ACTIVE_COOLER_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/active_cooler_active"); + public static final SimpleOverlayRenderer HPCA_BRIDGE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/bridge"); + public static final SimpleOverlayRenderer HPCA_BRIDGE_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/bridge_active"); + public static final SimpleOverlayRenderer HPCA_COMPUTATION_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation"); + public static final SimpleOverlayRenderer HPCA_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_active"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_advanced"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/computation_advanced_active"); + public static final SimpleOverlayRenderer HPCA_DAMAGED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged"); + public static final SimpleOverlayRenderer HPCA_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_active"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_advanced"); + public static final SimpleOverlayRenderer HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/damaged_advanced_active"); + public static final SimpleOverlayRenderer HPCA_EMPTY_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/empty"); + public static final SimpleOverlayRenderer HPCA_HEAT_SINK_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/hpca/heat_sink"); + public static final SimpleOverlayRenderer ALARM_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_alarm"); + public static final SimpleOverlayRenderer ALARM_OVERLAY_ACTIVE = new SimpleOverlayRenderer( + "overlay/machine/overlay_alarm_active"); + public static final SimpleOverlayRenderer TAPED_OVERLAY = new SimpleOverlayRenderer( + "overlay/machine/overlay_ducttape"); + + public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID = new SimpleOverlayRenderer( + "cover/cover_interface_fluid"); + public static final SimpleOverlayRenderer COVER_INTERFACE_FLUID_GLASS = new SimpleOverlayRenderer( + "cover/cover_interface_fluid_glass"); + public static final SimpleOverlayRenderer COVER_INTERFACE_ITEM = new SimpleOverlayRenderer( + "cover/cover_interface_item"); + public static final SimpleOverlayRenderer COVER_INTERFACE_ENERGY = new SimpleOverlayRenderer( + "cover/cover_interface_energy"); + public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_ON = new SimpleOverlayRenderer( + "cover/cover_interface_machine_on"); + public static final SimpleOverlayRenderer COVER_INTERFACE_MACHINE_OFF = new SimpleOverlayRenderer( + "cover/cover_interface_machine_off"); + public static final SimpleOverlayRenderer COVER_INTERFACE_PROXY = new SimpleOverlayRenderer( + "cover/cover_interface_proxy"); + public static final SimpleOverlayRenderer COVER_INTERFACE_WIRELESS = new SimpleOverlayRenderer( + "cover/cover_interface_wireless"); + + public static final SimpleOverlayRenderer CONVERTER_FE_OUT = new SimpleOverlayRenderer( + "overlay/converter/converter_fe_out"); + public static final SimpleOverlayRenderer CONVERTER_FE_IN = new SimpleOverlayRenderer( + "overlay/converter/converter_fe_in"); + + public static final SimpleOverlayRenderer ME_OUTPUT_HATCH = new SimpleOverlayRenderer( + "overlay/appeng/me_output_hatch"); + public static final SimpleOverlayRenderer ME_INPUT_HATCH = new SimpleOverlayRenderer( + "overlay/appeng/me_input_hatch"); public static final SimpleOverlayRenderer ME_OUTPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_output_bus"); public static final SimpleOverlayRenderer ME_INPUT_BUS = new SimpleOverlayRenderer("overlay/appeng/me_input_bus"); @@ -453,15 +637,22 @@ public static void register(TextureMap textureMap) { PIPE_BLOCKED_OVERLAY_DR = textureMap.registerSprite(gregtechId("blocks/pipe/blocked/pipe_blocked_dr")); PIPE_BLOCKED_OVERLAY_LR = textureMap.registerSprite(gregtechId("blocks/pipe/blocked/pipe_blocked_lr")); - OPTICAL_PIPE_IN = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_in")); - OPTICAL_PIPE_SIDE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side")); - OPTICAL_PIPE_SIDE_OVERLAY = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay")); - OPTICAL_PIPE_SIDE_OVERLAY_ACTIVE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay_active")); - - LASER_PIPE_SIDE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side")); + OPTICAL_PIPE_IN = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_in")); + OPTICAL_PIPE_SIDE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side")); + OPTICAL_PIPE_SIDE_OVERLAY = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay")); + OPTICAL_PIPE_SIDE_OVERLAY_ACTIVE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_optical_side_overlay_active")); + + LASER_PIPE_SIDE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side")); LASER_PIPE_IN = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_in")); - LASER_PIPE_OVERLAY = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay")); - LASER_PIPE_OVERLAY_EMISSIVE = textureMap.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay_emissive")); + LASER_PIPE_OVERLAY = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay")); + LASER_PIPE_OVERLAY_EMISSIVE = textureMap + .registerSprite(new ResourceLocation(GTValues.MODID, "blocks/pipe/pipe_laser_side_overlay_emissive")); for (MaterialIconSet iconSet : MaterialIconSet.ICON_SETS.values()) { textureMap.registerSprite(MaterialIconType.frameGt.getBlockTexturePath(iconSet)); @@ -477,9 +668,11 @@ private static int mask(EnumFacing... facings) { } @SideOnly(Side.CLIENT) - public static void renderFace(CCRenderState renderState, Matrix4 translation, IVertexOperation[] ops, EnumFacing face, Cuboid6 bounds, TextureAtlasSprite sprite, BlockRenderLayer layer) { + public static void renderFace(CCRenderState renderState, Matrix4 translation, IVertexOperation[] ops, + EnumFacing face, Cuboid6 bounds, TextureAtlasSprite sprite, BlockRenderLayer layer) { CubeRendererState op = RENDER_STATE.get(); - if (layer != null && op != null && op.layer != null && (op.layer != layer || !op.shouldSideBeRendered(face, bounds))) { + if (layer != null && op != null && op.layer != null && + (op.layer != layer || !op.shouldSideBeRendered(face, bounds))) { return; } BlockFace blockFace = blockFaces.get(); diff --git a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java index 804c28ae56d..3c5f4ab4163 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java @@ -1,8 +1,9 @@ package gregtech.client.renderer.texture.cube; +import net.minecraft.util.EnumFacing; + import codechicken.lib.vec.Matrix4; import codechicken.lib.vec.Rotation; -import net.minecraft.util.EnumFacing; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java index 744305c454d..2f205c38264 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/LDPipeOverlayRenderer.java @@ -2,12 +2,14 @@ import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -56,14 +58,16 @@ public void registerIcons(TextureMap textureMap) { // emissive - TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, overlayPath + EMISSIVE); + TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, + overlayPath + EMISSIVE); sprites.put(overlayFace, new ActivePredicate(normalSprite, normalSprite, null, normalSpriteEmissive, null, null)); } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java index e91a25d51e1..86ea1113462 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/OrientedOverlayRenderer.java @@ -1,10 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.LightMapOperation; @@ -12,6 +7,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -20,6 +16,12 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,7 +32,12 @@ public class OrientedOverlayRenderer implements ICubeRenderer { public enum OverlayFace { - FRONT, BACK, TOP, BOTTOM, SIDE; + + FRONT, + BACK, + TOP, + BOTTOM, + SIDE; public static final OverlayFace[] VALUES = values(); @@ -69,7 +76,6 @@ public ActivePredicate(@NotNull TextureAtlasSprite normalSprite, @Nullable TextureAtlasSprite normalSpriteEmissive, @Nullable TextureAtlasSprite activeSpriteEmissive, @Nullable TextureAtlasSprite pausedSpriteEmissive) { - this.normalSprite = normalSprite; this.activeSprite = activeSprite; this.pausedSprite = pausedSprite; @@ -137,7 +143,8 @@ public void registerIcons(TextureMap textureMap) { TextureAtlasSprite activeSprite = ICubeRenderer.getResource(textureMap, modID, active); if (activeSprite == null) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_" + overlayFace.toString().toLowerCase() + "_active")); + FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, + "blocks/" + basePath + "/overlay_" + overlayFace.toString().toLowerCase() + "_active")); continue; } @@ -146,7 +153,8 @@ public void registerIcons(TextureMap textureMap) { // emissive - TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, overlayPath + EMISSIVE); + TextureAtlasSprite normalSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, + overlayPath + EMISSIVE); TextureAtlasSprite activeSpriteEmissive = ICubeRenderer.getResource(textureMap, modID, active + EMISSIVE); @@ -157,7 +165,8 @@ public void registerIcons(TextureMap textureMap) { } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/overlay_OVERLAY_FACE")); } } @@ -173,7 +182,9 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing renderSide : EnumFacing.VALUES) { ActivePredicate predicate = sprites.get(OverlayFace.bySide(renderSide, frontFacing)); @@ -188,16 +199,20 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, renderTranslation = RenderUtil.adjustTrans(renderTranslation, renderSide, 1); renderTranslation.apply(rotation); - Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, + bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = predicate.getEmissiveSprite(isActive, isWorkingEnabled); if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { - IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), rotation); - Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); + IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), + rotation); + Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, + emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); } else { // have to still render both overlays or else textures will be broken - Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), + renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java index bce57fb7a62..7d95bdb97ef 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SidedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.LightMapOperation; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer.OverlayFace; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -19,6 +16,11 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -72,7 +74,8 @@ public void registerIcons(TextureMap textureMap) { } if (!foundTexture) { - FMLClientHandler.instance().trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/OVERLAY_FACE")); + FMLClientHandler.instance() + .trackMissingTexture(new ResourceLocation(modID, "blocks/" + basePath + "/OVERLAY_FACE")); } } @@ -84,20 +87,25 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing facing : EnumFacing.VALUES) { OverlayFace overlayFace = OverlayFace.bySide(facing, frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); if (renderSprite != null) { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace); if (emissiveSprite != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, BloomEffectUtil.getEffectiveBloomLayer()); + Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, + BloomEffectUtil.getEffectiveBloomLayer()); } else { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, emissiveSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java index 0b64bf6a963..bf5d23c2759 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleCubeRenderer.java @@ -1,18 +1,20 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + public class SimpleCubeRenderer implements ICubeRenderer { protected final String basePath; @@ -43,8 +45,10 @@ public TextureAtlasSprite getParticleSprite() { } @Override - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, + BlockRenderLayer.CUTOUT_MIPPED); } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java index 5c4fb6b5d61..fc26dfda3b5 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -34,7 +36,13 @@ public class SimpleOrientedCubeRenderer implements ICubeRenderer { private Map spritesEmissive; private enum CubeSide { - FRONT, BACK, RIGHT, LEFT, TOP, BOTTOM; + + FRONT, + BACK, + RIGHT, + LEFT, + TOP, + BOTTOM; public static final CubeSide[] VALUES = values(); } @@ -74,27 +82,42 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), + BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), + BlockRenderLayer.CUTOUT_MIPPED); + + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), + BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, + sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); + + Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateY(), bounds, + sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateYCCW(), bounds, + sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); IVertexOperation[] lightPipeline = ConfigHolder.client.machinesEmissiveTextures ? ArrayUtils.add(pipeline, new LightMapOperation(240, 240)) : pipeline; - if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); - - if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BACK)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); - - if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.RIGHT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, + EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, + EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); + + if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, + frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.BACK)) + Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, + sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); + + if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, + frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); + if (spritesEmissive.containsKey(CubeSide.RIGHT)) + Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, + sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java index 01d92f3b8ab..ab6407baa06 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import javax.annotation.Nullable; @@ -58,13 +60,18 @@ public void registerIcons(TextureMap textureMap) { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, BlockRenderLayer.CUTOUT_MIPPED); + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprite, + BlockRenderLayer.CUTOUT_MIPPED); if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); - } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, + BloomEffectUtil.getEffectiveBloomLayer()); + } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -73,5 +80,4 @@ public void renderOrientedState(CCRenderState renderState, Matrix4 translation, public TextureAtlasSprite getParticleSprite() { return sprite; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java index b005e0102a1..6c8b21c07bc 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleSidedCubeRenderer.java @@ -1,9 +1,5 @@ package gregtech.client.renderer.texture.cube; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.resources.ResourceHelper; import gregtech.client.renderer.ICubeRenderer; @@ -11,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -18,6 +15,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import java.util.EnumMap; @@ -26,7 +28,10 @@ public class SimpleSidedCubeRenderer implements ICubeRenderer { public enum RenderSide { - TOP, BOTTOM, SIDE; + + TOP, + BOTTOM, + SIDE; public static final RenderSide[] VALUES = values(); @@ -67,7 +72,8 @@ public void registerIcons(TextureMap textureMap) { this.spritesEmissive = new EnumMap<>(RenderSide.class); for (RenderSide overlayFace : RenderSide.VALUES) { String faceName = overlayFace.name().toLowerCase(); - ResourceLocation resourceLocation = new ResourceLocation(modID, String.format("blocks/%s/%s", basePath, faceName)); + ResourceLocation resourceLocation = new ResourceLocation(modID, + String.format("blocks/%s/%s", basePath, faceName)); sprites.put(overlayFace, textureMap.registerSprite(resourceLocation)); String emissive = String.format("blocks/%s/%s_emissive", basePath, faceName); @@ -90,16 +96,21 @@ public TextureAtlasSprite getParticleSprite() { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { RenderSide overlayFace = RenderSide.bySide(frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite spriteEmissive = spritesEmissive.get(overlayFace); if (spriteEmissive != null) { if (ConfigHolder.client.machinesEmissiveTextures) { IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240)); - Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getEffectiveBloomLayer()); - } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, + BloomEffectUtil.getEffectiveBloomLayer()); + } else Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java index 3006143030b..107200e2989 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/ClipboardRenderer.java @@ -1,13 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.MetaTileEntityClipboard; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -19,6 +14,13 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.tuple.Pair; import java.util.Arrays; @@ -27,12 +29,17 @@ public class ClipboardRenderer implements IIconRegister { - private static final Cuboid6 pageBox = new Cuboid6(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); - private static final Cuboid6 boardBox = new Cuboid6(2.75 / 16.0, 0 / 16.0, 0 / 16.0, 13.25 / 16.0, 15.25 / 16.0, 0.25 / 16.0); - private static final Cuboid6 clipBox = new Cuboid6(5.75 / 16.0, 14.75 / 16.0, 0.25 / 16.0, 10.25 / 16.0, 15.5 / 16.0, 0.4 / 16.0); - private static final Cuboid6 graspBox = new Cuboid6(7 / 16.0, 15.25 / 16.0, 0.1 / 16.0, 9 / 16.0, 16 / 16.0, 0.35 / 16.0); + private static final Cuboid6 pageBox = new Cuboid6(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, + 0.3 / 16.0); + private static final Cuboid6 boardBox = new Cuboid6(2.75 / 16.0, 0 / 16.0, 0 / 16.0, 13.25 / 16.0, 15.25 / 16.0, + 0.25 / 16.0); + private static final Cuboid6 clipBox = new Cuboid6(5.75 / 16.0, 14.75 / 16.0, 0.25 / 16.0, 10.25 / 16.0, + 15.5 / 16.0, 0.4 / 16.0); + private static final Cuboid6 graspBox = new Cuboid6(7 / 16.0, 15.25 / 16.0, 0.1 / 16.0, 9 / 16.0, 16 / 16.0, + 0.35 / 16.0); - private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.EAST); + private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, + EnumFacing.EAST); @SideOnly(Side.CLIENT) private static HashMap boxTextureMap; @@ -61,19 +68,22 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public static void renderBoard(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { + public static void renderBoard(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { translation.translate(0.5, 0.5, 0.5); translation.rotate(Math.toRadians(90.0 * rotations.indexOf(rotation)), Rotation.axes[1]); translation.translate(-0.5, -0.5, -0.5); // Render Clipboard for (EnumFacing renderSide : EnumFacing.VALUES) { - boxTextureMap.forEach((box, sprite) -> Textures.renderFace(renderState, translation, pipeline, renderSide, box, sprite, null)); + boxTextureMap.forEach((box, sprite) -> Textures.renderFace(renderState, translation, pipeline, renderSide, + box, sprite, null)); } } @SideOnly(Side.CLIENT) - public static void renderGUI(double x, double y, double z, EnumFacing rotation, MetaTileEntityClipboard clipboard, float partialTicks) { + public static void renderGUI(double x, double y, double z, EnumFacing rotation, MetaTileEntityClipboard clipboard, + float partialTicks) { GlStateManager.color(1, 1, 1, 1); GlStateManager.pushMatrix(); float lastBrightnessX = OpenGlHelper.lastBrightnessX; diff --git a/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java index a823ed2e944..0f999dd687d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/CrateRenderer.java @@ -1,22 +1,25 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class CrateRenderer implements IIconRegister { + private final String basePath; @SideOnly(Side.CLIENT) @@ -34,11 +37,11 @@ public void registerIcons(TextureMap textureMap) { } public void render(CCRenderState renderState, Matrix4 translation, int baseColor, IVertexOperation[] pipeline) { - IVertexOperation[] basePipeline = ArrayUtils.add(pipeline, new ColourMultiplier(baseColor)); for (EnumFacing renderSide : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, basePipeline, renderSide, Cuboid6.full, sideSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, basePipeline, renderSide, Cuboid6.full, sideSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java index 6931a3090e1..d02d824d280 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/DrumRenderer.java @@ -1,12 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -15,7 +11,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + public class DrumRenderer implements IIconRegister { + private final String basePath; @SideOnly(Side.CLIENT) @@ -37,11 +40,13 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation) { - + public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing rotation) { for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite baseSprite = renderSide == EnumFacing.UP ? textures[0] : renderSide == EnumFacing.DOWN ? textures[2] : textures[1]; - Textures.renderFace(renderState, translation, pipeline, renderSide, Cuboid6.full, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + TextureAtlasSprite baseSprite = renderSide == EnumFacing.UP ? textures[0] : + renderSide == EnumFacing.DOWN ? textures[2] : textures[1]; + Textures.renderFace(renderState, translation, pipeline, renderSide, Cuboid6.full, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } @@ -49,5 +54,4 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat public TextureAtlasSprite getParticleTexture() { return textures[0]; } - } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java index bdbd37ad9a2..6d7b8305d1e 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/FireboxActiveRenderer.java @@ -1,20 +1,22 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.client.renderer.cclop.LightMapOperation; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; import gregtech.client.renderer.texture.cube.SidedCubeRenderer; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class FireboxActiveRenderer extends SidedCubeRenderer { @@ -25,16 +27,23 @@ public FireboxActiveRenderer(String basePath) { @Override @SideOnly(Side.CLIENT) - public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { + public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, + boolean isWorkingEnabled) { for (EnumFacing facing : EnumFacing.VALUES) { - OrientedOverlayRenderer.OverlayFace overlayFace = OrientedOverlayRenderer.OverlayFace.bySide(facing, frontFacing); + OrientedOverlayRenderer.OverlayFace overlayFace = OrientedOverlayRenderer.OverlayFace.bySide(facing, + frontFacing); TextureAtlasSprite renderSprite = sprites.get(overlayFace); if (renderSprite != null) { - Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, + BlockRenderLayer.CUTOUT_MIPPED); TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace); - if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && facing != EnumFacing.DOWN) { - Textures.renderFace(renderState, translation, ArrayUtils.add(pipeline, new LightMapOperation(240, 240)), facing, bounds, emissiveSprite, - BloomEffectUtil.getEffectiveBloomLayer(ConfigHolder.client.machinesEmissiveTextures, BlockRenderLayer.CUTOUT_MIPPED)); + if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && + facing != EnumFacing.DOWN) { + Textures.renderFace(renderState, translation, + ArrayUtils.add(pipeline, new LightMapOperation(240, 240)), facing, bounds, emissiveSprite, + BloomEffectUtil.getEffectiveBloomLayer(ConfigHolder.client.machinesEmissiveTextures, + BlockRenderLayer.CUTOUT_MIPPED)); } } } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java index 656c84a6000..f2f2e063d82 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/LargeTurbineRenderer.java @@ -1,21 +1,23 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.util.GTUtility; import gregtech.client.renderer.cclop.ColourOperation; import gregtech.client.renderer.cclop.LightMapOperation; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; public class LargeTurbineRenderer implements IIconRegister { @@ -36,14 +38,19 @@ public LargeTurbineRenderer() { @Override @SideOnly(Side.CLIENT) public void registerIcons(TextureMap textureMap) { - this.baseRingSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_ring")); - this.baseBackgroundSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_bg")); - this.idleBladeSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_idle")); - this.activeBladeSprite = textureMap.registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_spinning")); + this.baseRingSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_ring")); + this.baseBackgroundSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/base_bg")); + this.idleBladeSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_idle")); + this.activeBladeSprite = textureMap + .registerSprite(GTUtility.gregtechId("blocks/multiblock/large_turbine/rotor_spinning")); } @SideOnly(Side.CLIENT) - public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) { + public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) { Matrix4 cornerOffset = null; switch (side.getAxis()) { case X: @@ -60,14 +67,18 @@ public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexO break; } if (hasBase) { - Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240)), side, Cuboid6.full, baseRingSprite, BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), side, Cuboid6.full, baseBackgroundSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240)), + side, Cuboid6.full, baseRingSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, cornerOffset, + ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), side, + Cuboid6.full, baseBackgroundSprite, BlockRenderLayer.CUTOUT_MIPPED); } if (hasRotor) { TextureAtlasSprite sprite = isActive ? activeBladeSprite : idleBladeSprite; - IVertexOperation[] color = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB))); - Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite, BlockRenderLayer.CUTOUT_MIPPED); + IVertexOperation[] color = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB))); + Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite, + BlockRenderLayer.CUTOUT_MIPPED); } } - } diff --git a/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java index 91fe73f1763..7e6485a155d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/QuantumStorageRenderer.java @@ -1,16 +1,12 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.TextTexture; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer.RenderSide; import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumChest; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -30,9 +26,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; + import java.util.EnumMap; public class QuantumStorageRenderer implements TextureUtils.IIconRegister { + private static final Cuboid6 glassBox = new Cuboid6(1 / 16.0, 1 / 16.0, 1 / 16.0, 15 / 16.0, 15 / 16.0, 15 / 16.0); private static final EnumMap boxFacingMap = new EnumMap<>(EnumFacing.class); @@ -55,23 +58,33 @@ public QuantumStorageRenderer() { @Override public void registerIcons(TextureMap textureMap) { - this.glassTexture = textureMap.registerSprite(new ResourceLocation("gregtech:blocks/overlay/machine/overlay_screen_glass")); + this.glassTexture = textureMap + .registerSprite(new ResourceLocation("gregtech:blocks/overlay/machine/overlay_screen_glass")); } - public void renderMachine(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing frontFacing, int tier) { - Textures.renderFace(renderState, translation, pipeline, frontFacing, glassBox, glassTexture, BlockRenderLayer.CUTOUT_MIPPED); + public void renderMachine(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + EnumFacing frontFacing, int tier) { + Textures.renderFace(renderState, translation, pipeline, frontFacing, glassBox, glassTexture, + BlockRenderLayer.CUTOUT_MIPPED); - TextureAtlasSprite hullTexture = Textures.VOLTAGE_CASINGS[tier].getSpriteOnSide(RenderSide.bySide(EnumFacing.NORTH)); + TextureAtlasSprite hullTexture = Textures.VOLTAGE_CASINGS[tier] + .getSpriteOnSide(RenderSide.bySide(EnumFacing.NORTH)); boxFacingMap.keySet().forEach(facing -> { for (EnumFacing box : EnumFacing.VALUES) { - if ((facing != frontFacing || box != frontFacing) && (facing != EnumFacing.DOWN || box.getAxis().isVertical())) { // Don't render the front facing box from the front, nor allow Z-fighting to occur on the bottom - Textures.renderFace(renderState, translation, pipeline, facing, boxFacingMap.get(box), hullTexture, BlockRenderLayer.CUTOUT_MIPPED); + if ((facing != frontFacing || box != frontFacing) && + (facing != EnumFacing.DOWN || box.getAxis().isVertical())) { // Don't render the front facing + // box from the front, nor allow + // Z-fighting to occur on the + // bottom + Textures.renderFace(renderState, translation, pipeline, facing, boxFacingMap.get(box), hullTexture, + BlockRenderLayer.CUTOUT_MIPPED); } } }); } - public static void renderChestStack(double x, double y, double z, MetaTileEntityQuantumChest machine, ItemStack stack, long count, float partialTicks) { + public static void renderChestStack(double x, double y, double z, MetaTileEntityQuantumChest machine, + ItemStack stack, long count, float partialTicks) { if (stack.isEmpty() || count == 0) return; @@ -106,7 +119,8 @@ public static void renderTankFluid(CCRenderState renderState, Matrix4 translatio if (stack == null || stack.amount == 0) return; - Cuboid6 partialFluidBox = new Cuboid6(1.0625 / 16.0, 2.0625 / 16.0, 1.0625 / 16.0, 14.9375 / 16.0, 14.9375 / 16.0, 14.9375 / 16.0); + Cuboid6 partialFluidBox = new Cuboid6(1.0625 / 16.0, 2.0625 / 16.0, 1.0625 / 16.0, 14.9375 / 16.0, + 14.9375 / 16.0, 14.9375 / 16.0); double fillFraction = (double) stack.amount / tank.getCapacity(); if (tank.getFluid().getFluid().isGaseous()) { @@ -117,9 +131,11 @@ public static void renderTankFluid(CCRenderState renderState, Matrix4 translatio renderState.setFluidColour(stack); ResourceLocation fluidStill = stack.getFluid().getStill(stack); - TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidStill.toString()); + TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks() + .getAtlasSprite(fluidStill.toString()); for (EnumFacing facing : EnumFacing.VALUES) { - Textures.renderFace(renderState, translation, pipeline, facing, partialFluidBox, fluidStillSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, facing, partialFluidBox, fluidStillSprite, + BlockRenderLayer.CUTOUT_MIPPED); } GlStateManager.resetColor(); @@ -137,10 +153,10 @@ public static void renderTankAmount(double x, double y, double z, EnumFacing fro } public static void renderAmountText(double x, double y, double z, long amount, EnumFacing frontFacing) { - GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); - GlStateManager.translate(frontFacing.getXOffset() * -1 / 16f, frontFacing.getYOffset() * -1 / 16f, frontFacing.getZOffset() * -1 / 16f); + GlStateManager.translate(frontFacing.getXOffset() * -1 / 16f, frontFacing.getYOffset() * -1 / 16f, + frontFacing.getZOffset() * -1 / 16f); RenderUtil.moveToFace(0, 0, 0, frontFacing); if (frontFacing.getAxis() == EnumFacing.Axis.Y) { RenderUtil.rotateToFace(frontFacing, EnumFacing.SOUTH); diff --git a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java index 648795e8a60..9e213bfa27d 100644 --- a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java @@ -1,13 +1,8 @@ package gregtech.client.renderer.texture.custom; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.GTValues; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; @@ -17,15 +12,25 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; + import java.util.Arrays; import java.util.List; public class SafeRenderer implements IIconRegister { - private static final Cuboid6 mainBoxOuter = new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0); - private static final Cuboid6 mainBoxInner = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, 12 / 16.0); + private static final Cuboid6 mainBoxOuter = new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, + 13 / 16.0); + private static final Cuboid6 mainBoxInner = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, + 12 / 16.0); private static final Cuboid6 doorBox = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, 4 / 16.0); - private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.EAST); + private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, + EnumFacing.EAST); private final String basePath; @@ -58,7 +63,8 @@ public void registerIcons(TextureMap textureMap) { } @SideOnly(Side.CLIENT) - public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, float capRotation) { + public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, + float capRotation) { translation.translate(0.5, 0.5, 0.5); translation.rotate(Math.toRadians(90.0 * rotations.indexOf(rotation)), Rotation.axes[1]); translation.translate(-0.5, -0.5, -0.5); @@ -67,9 +73,11 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat TextureAtlasSprite baseSprite = renderSide.getAxis() == Axis.Y ? textures[renderSide.getIndex()] : renderSide == EnumFacing.NORTH ? textures[3] : textures[2]; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxOuter, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxOuter, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); if (renderSide == EnumFacing.NORTH) continue; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxInner, baseSprite, BlockRenderLayer.CUTOUT_MIPPED); + Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxInner, baseSprite, + BlockRenderLayer.CUTOUT_MIPPED); } translation.translate(4 / 16.0, 7 / 16.0, 3 / 16.0); @@ -77,10 +85,10 @@ public void render(CCRenderState renderState, Matrix4 translation, IVertexOperat translation.translate(-4 / 16.0, -7 / 16.0, -3 / 16.0); for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite doorSprite = - renderSide == EnumFacing.NORTH ? textures[6] : - renderSide == EnumFacing.SOUTH ? textures[5] : textures[4]; - Textures.renderFace(renderState, translation, pipeline, renderSide, doorBox, doorSprite, BlockRenderLayer.CUTOUT_MIPPED); + TextureAtlasSprite doorSprite = renderSide == EnumFacing.NORTH ? textures[6] : + renderSide == EnumFacing.SOUTH ? textures[5] : textures[4]; + Textures.renderFace(renderState, translation, pipeline, renderSide, doorBox, doorSprite, + BlockRenderLayer.CUTOUT_MIPPED); } } } diff --git a/src/main/java/gregtech/client/shader/PingPongBuffer.java b/src/main/java/gregtech/client/shader/PingPongBuffer.java index 461879a6f5d..a0a87b402fa 100644 --- a/src/main/java/gregtech/client/shader/PingPongBuffer.java +++ b/src/main/java/gregtech/client/shader/PingPongBuffer.java @@ -1,12 +1,14 @@ package gregtech.client.shader; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class PingPongBuffer { + private static final Framebuffer BUFFER_A; private static final Framebuffer BUFFER_B; private static boolean flag; diff --git a/src/main/java/gregtech/client/shader/Shaders.java b/src/main/java/gregtech/client/shader/Shaders.java index 8ad7cf30382..e1eb6ef0474 100644 --- a/src/main/java/gregtech/client/shader/Shaders.java +++ b/src/main/java/gregtech/client/shader/Shaders.java @@ -1,10 +1,9 @@ package gregtech.client.shader; -import codechicken.lib.render.shader.ShaderObject; -import codechicken.lib.render.shader.ShaderProgram; import gregtech.api.GTValues; import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.OpenGlHelper; @@ -14,6 +13,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.render.shader.ShaderObject; +import codechicken.lib.render.shader.ShaderProgram; + import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; @@ -34,12 +36,13 @@ */ @SideOnly(Side.CLIENT) public class Shaders { + public static Minecraft mc; private final static Map FULL_IMAGE_PROGRAMS; public static ShaderObject IMAGE_V; public static ShaderObject IMAGE_F; -// public static ShaderObject BLACK_HOLE; + // public static ShaderObject BLACK_HOLE; public static ShaderObject SCANNING; public static ShaderObject BLOOM_COMBINE; @@ -71,7 +74,8 @@ public class Shaders { try { return shaderPackLoaded.getBoolean(null); } catch (final IllegalAccessException e) { - GTLog.logger.warn("Failed reading field indicating whether shaders are enabled. Shader mod integration disabled."); + GTLog.logger.warn( + "Failed reading field indicating whether shaders are enabled. Shader mod integration disabled."); isShaderPackLoaded = null; return false; } @@ -87,7 +91,7 @@ public class Shaders { public static void initShaders() { IMAGE_V = initShader(IMAGE_V, VERTEX, "image.vert"); IMAGE_F = initShader(IMAGE_F, FRAGMENT, "image.frag"); -// BLACK_HOLE = initShader(BLACK_HOLE, FRAGMENT, "blackhole.frag"); + // BLACK_HOLE = initShader(BLACK_HOLE, FRAGMENT, "blackhole.frag"); SCANNING = initShader(SCANNING, FRAGMENT, "scanning.frag"); BLOOM_COMBINE = initShader(BLOOM_COMBINE, FRAGMENT, "bloom_combine.frag"); BLUR = initShader(BLUR, FRAGMENT, "blur.frag"); @@ -105,7 +109,9 @@ private static ShaderObject initShader(ShaderObject object, ShaderObject.ShaderT public static ShaderObject loadShader(ShaderObject.ShaderType shaderType, String location) { try { - return new ShaderObject(shaderType, readShader(getStream(String.format("/assets/%s/shaders/%s", GTValues.MODID, location)))).compileShader(); + return new ShaderObject(shaderType, + readShader(getStream(String.format("/assets/%s/shaders/%s", GTValues.MODID, location)))) + .compileShader(); } catch (Exception exception) { GTLog.logger.error("error while loading shader {}", location, exception); } @@ -126,9 +132,10 @@ public static boolean isOptiFineShaderPackLoaded() { return isShaderPackLoaded != null && isShaderPackLoaded.getAsBoolean(); } - public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject frag, Consumer uniformCache) { + public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject frag, + Consumer uniformCache) { if (fbo == null || frag == null || !allowedShader()) return fbo; -// int lastID = glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); + // int lastID = glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); fbo.bindFramebuffer(true); @@ -140,7 +147,7 @@ public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject fra FULL_IMAGE_PROGRAMS.put(frag, program); } - program.useShader(cache->{ + program.useShader(cache -> { cache.glUniform2F("u_resolution", fbo.framebufferWidth, fbo.framebufferHeight); if (uniformCache != null) { uniformCache.accept(cache); @@ -158,9 +165,9 @@ public static Framebuffer renderFullImageInFBO(Framebuffer fbo, ShaderObject fra tessellator.draw(); program.releaseShader(); -// GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); + // GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); -// OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); + // OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, lastID); return fbo; } } diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java index 1b154a7085a..8da7d5b9ffa 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomEffect.java @@ -4,10 +4,12 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; @@ -108,7 +110,8 @@ public static void renderUnity(Framebuffer highLightFBO, Framebuffer backgroundF renderDownSampling(downSampleFBO[i], downSampleFBO[i + 1]); } - renderUpSampling(downSampleFBO[downSampleFBO.length - 1], downSampleFBO[downSampleFBO.length - 2], upSampleFBO[downSampleFBO.length - 2]); + renderUpSampling(downSampleFBO[downSampleFBO.length - 1], downSampleFBO[downSampleFBO.length - 2], + upSampleFBO[downSampleFBO.length - 2]); for (int i = upSampleFBO.length - 2; i > 0; i--) { renderUpSampling(upSampleFBO[i], downSampleFBO[i - 1], upSampleFBO[i - 1]); } @@ -125,7 +128,8 @@ public static void renderUnity(Framebuffer highLightFBO, Framebuffer backgroundF private static void renderDownSampling(Framebuffer U, Framebuffer D) { U.bindFramebufferTexture(); - Shaders.renderFullImageInFBO(D, Shaders.DOWN_SAMPLING, uniformCache -> uniformCache.glUniform2F("u_resolution2", U.framebufferWidth, U.framebufferHeight)); + Shaders.renderFullImageInFBO(D, Shaders.DOWN_SAMPLING, + uniformCache -> uniformCache.glUniform2F("u_resolution2", U.framebufferWidth, U.framebufferHeight)); } private static void renderUpSampling(Framebuffer U, Framebuffer D, Framebuffer T) { @@ -148,7 +152,7 @@ public static void renderUnreal(Framebuffer highLightFBO, Framebuffer background cleanUP(backgroundFBO.framebufferWidth, backgroundFBO.framebufferHeight); // blur all mips - int[] kernelSizeArray = new int[]{3, 5, 7, 9, 11}; + int[] kernelSizeArray = new int[] { 3, 5, 7, 9, 11 }; highLightFBO.bindFramebufferTexture(); for (int i = 0; i < downSampleFBO.length; i++) { Framebuffer buffer_h = downSampleFBO[i]; diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java index 8b65f89503f..2ba0c084fb4 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; public enum BloomType { + /** * Simple Gaussian Blur */ diff --git a/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java b/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java index 5ee0fb3b530..07f4109b732 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BlurEffect.java @@ -3,13 +3,16 @@ import gregtech.client.shader.PingPongBuffer; import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; + import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class BlurEffect { + private static Framebuffer BLUR_H; private static Framebuffer BLUR_W; private static Framebuffer BLUR_H2; @@ -29,7 +32,7 @@ public static void updateSize(int lastWidth, int lastHeight) { BLUR_H2.setFramebufferFilter(GL11.GL_LINEAR); BLUR_W.setFramebufferFilter(GL11.GL_LINEAR); BLUR_W2.setFramebufferFilter(GL11.GL_LINEAR); - } else if (RenderUtil.updateFBOSize(BLUR_H, lastWidth / 8, lastHeight / 8)){ + } else if (RenderUtil.updateFBOSize(BLUR_H, lastWidth / 8, lastHeight / 8)) { RenderUtil.updateFBOSize(BLUR_H2, lastWidth / 4, lastHeight / 4); RenderUtil.updateFBOSize(BLUR_W, lastWidth / 8, lastHeight / 8); RenderUtil.updateFBOSize(BLUR_W2, lastWidth / 4, lastHeight / 4); @@ -42,17 +45,23 @@ public static void updateSize(int lastWidth, int lastHeight) { } public static Framebuffer renderBlur1(float step) { - Shaders.renderFullImageInFBO(BLUR_H2, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_W2, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_H, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(BLUR_W, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_H2, Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_W2, Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_H, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)) + .bindFramebufferTexture(); + Shaders.renderFullImageInFBO(BLUR_W, Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)) + .bindFramebufferTexture(); return BLUR_W; } public static Framebuffer renderBlur2(int loop, float step) { for (int i = 0; i < loop; i++) { - Shaders.renderFullImageInFBO(PingPongBuffer.swap(true), Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); - Shaders.renderFullImageInFBO(PingPongBuffer.swap(), Shaders.BLUR, uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(PingPongBuffer.swap(true), Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", 0, step)).bindFramebufferTexture(); + Shaders.renderFullImageInFBO(PingPongBuffer.swap(), Shaders.BLUR, + uniformCache -> uniformCache.glUniform2F("blurDir", step, 0)).bindFramebufferTexture(); } return PingPongBuffer.getCurrentBuffer(false); } diff --git a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java index 87dbe090c9e..be6ba9e0ce5 100644 --- a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java +++ b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java @@ -1,8 +1,5 @@ package gregtech.client.utils; -import codechicken.lib.colour.Colour; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.Matrix4; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; @@ -11,6 +8,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.colour.Colour; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; @SideOnly(Side.CLIENT) @@ -71,14 +72,11 @@ public void setTranslation(Matrix4 translation) { } @Override - public void setQuadTint(int tint) { - } + public void setQuadTint(int tint) {} @Override - public void setQuadOrientation(@Nonnull EnumFacing orientation) { - } + public void setQuadOrientation(@Nonnull EnumFacing orientation) {} @Override - public void setApplyDiffuseLighting(boolean diffuse) { - } + public void setApplyDiffuseLighting(boolean diffuse) {} } diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index b77529a6b4c..d893799d2c5 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -1,12 +1,11 @@ package gregtech.client.utils; -import com.github.bsideup.jabel.Desugar; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.Shaders; import gregtech.client.shader.postprocessing.BloomEffect; import gregtech.client.shader.postprocessing.BloomType; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; @@ -20,14 +19,14 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.github.bsideup.jabel.Desugar; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Contract; import org.lwjgl.opengl.GL11; -import javax.annotation.CheckReturnValue; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -35,6 +34,10 @@ import java.util.Objects; import java.util.function.Consumer; +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public class BloomEffectUtil { @@ -78,7 +81,7 @@ public static BlockRenderLayer getRealBloomLayer() { * disabled, {@link BlockRenderLayer#CUTOUT} is returned instead. * * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * bloom layer is disabled * @see #getEffectiveBloomLayer(BlockRenderLayer) */ @Nonnull @@ -93,7 +96,7 @@ public static BlockRenderLayer getEffectiveBloomLayer() { * * @param fallback Block render layer to be returned when bloom layer is disabled * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is - * disabled + * disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ @Contract("null -> _; !null -> !null") @@ -109,7 +112,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) * @param isBloomActive Whether bloom layer should be active. If this value is {@code false}, {@code fallback} layer * will be returned. Has no effect if Optifine is present. * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * bloom layer is disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ @Nonnull @@ -126,7 +129,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive) { * will be returned. Has no effect if Optifine is present. * @param fallback Block render layer to be returned when bloom layer is disabled * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@code fallback} if bloom layer is - * disabled + * disabled */ @Contract("_, null -> _; _, !null -> !null") public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive, BlockRenderLayer fallback) { @@ -171,7 +174,8 @@ public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup } /** - * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hook + * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @@ -180,15 +184,17 @@ public static void requestCustomBloom(IBloomRenderFast handler, Consumer render.accept(b)).legacy = true; } - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) public static void init() { - bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[]{String.class}, "Bloom"); + bloom = EnumHelper.addEnum(BlockRenderLayer.class, "BLOOM", new Class[] { String.class }, "Bloom"); BLOOM = bloom; if (Loader.isModLoaded("nothirium")) { try { - //Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to that too. - Class crp = Class.forName("meldexun.nothirium.api.renderer.chunk.ChunkRenderPass", false, Launch.classLoader); - EnumHelper.addEnum(crp, "BLOOM", new Class[]{}); + // Nothirium hard copies the BlockRenderLayer enum into a ChunkRenderPass enum. Add our BLOOM layer to + // that too. + Class crp = Class.forName("meldexun.nothirium.api.renderer.chunk.ChunkRenderPass", false, + Launch.classLoader); + EnumHelper.addEnum(crp, "BLOOM", new Class[] {}); Field all = FieldUtils.getField(crp, "ALL", false); FieldUtils.removeFinalModifier(all); FieldUtils.writeStaticField(all, crp.getEnumConstants()); @@ -326,7 +332,7 @@ public static int renderBloomBlockLayer(RenderGlobal renderGlobal, GlStateManager.disableBlend(); Shaders.renderFullImageInFBO(fbo, Shaders.IMAGE_F, null); - //********** render custom bloom ************ + // ********** render custom bloom ************ if (!BLOOM_RENDERS.isEmpty()) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); @@ -419,7 +425,7 @@ private static void preDraw() { } private static void postDraw() { - for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext(); ) { + for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext();) { List list = it.next(); if (!list.isEmpty()) { @@ -447,7 +453,8 @@ public static final class BloomRenderTicket { */ private boolean legacy; - BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, @Nonnull IBloomEffect render) { + BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, + @Nonnull IBloomEffect render) { this.renderSetup = renderSetup; this.bloomType = Objects.requireNonNull(bloomType, "bloomType == null"); this.render = Objects.requireNonNull(render, "render == null"); @@ -473,7 +480,8 @@ public void invalidate() { } /** - * @deprecated use ticket-based bloom render hook {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hook + * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @@ -483,12 +491,12 @@ public interface IBloomRenderFast extends IRenderSetup { * Custom Bloom Style. * * @return 0 - Simple Gaussian Blur Bloom - *

- * 1 - Unity Bloom - *

- *

- * 2 - Unreal Bloom - *

+ *

+ * 1 - Unity Bloom + *

+ *

+ * 2 - Unreal Bloom + *

*/ int customBloomStyle(); } diff --git a/src/main/java/gregtech/client/utils/DepthTextureUtil.java b/src/main/java/gregtech/client/utils/DepthTextureUtil.java index d8210e6807b..3aa59bf75b4 100644 --- a/src/main/java/gregtech/client/utils/DepthTextureUtil.java +++ b/src/main/java/gregtech/client/utils/DepthTextureUtil.java @@ -2,6 +2,7 @@ import gregtech.client.shader.Shaders; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import org.lwjgl.opengl.GL30; @@ -25,10 +27,12 @@ * @Author: KilaBash * @Date: 2021/09/11 * @Description: You'll need it when you need to get deep textures to do more cool things. - * The default FBO is used, unfortunately, sometimes we have to abandon native way to create a new fbo. But generally not. + * The default FBO is used, unfortunately, sometimes we have to abandon native way to create a new fbo. + * But generally not. */ @SideOnly(Side.CLIENT) public class DepthTextureUtil { + public static int framebufferObject; public static int framebufferDepthTexture; private static boolean useDefaultFBO = true; @@ -36,14 +40,16 @@ public class DepthTextureUtil { private static int lastWidth, lastHeight; private static boolean shouldRenderDepthTexture() { - return lastBind && !Shaders.isOptiFineShaderPackLoaded() && ConfigHolder.client.hookDepthTexture && OpenGlHelper.isFramebufferEnabled(); + return lastBind && !Shaders.isOptiFineShaderPackLoaded() && ConfigHolder.client.hookDepthTexture && + OpenGlHelper.isFramebufferEnabled(); } public static void onPreWorldRender(TickEvent.RenderTickEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (event.phase == TickEvent.Phase.START && mc.world != null) { if (shouldRenderDepthTexture()) { - if (useDefaultFBO && GL11.glGetError() != 0) { // if we can't use the vanilla fbo.... okay, why not create our own fbo? + if (useDefaultFBO && GL11.glGetError() != 0) { // if we can't use the vanilla fbo.... okay, why not + // create our own fbo? useDefaultFBO = false; if (framebufferDepthTexture != 0) { disposeDepthTexture(); @@ -52,10 +58,11 @@ public static void onPreWorldRender(TickEvent.RenderTickEvent event) { } if (framebufferDepthTexture == 0) { createDepthTexture(); - } else if (lastWidth != mc.getFramebuffer().framebufferWidth || lastHeight != mc.getFramebuffer().framebufferHeight) { - disposeDepthTexture(); - createDepthTexture(); - } + } else if (lastWidth != mc.getFramebuffer().framebufferWidth || + lastHeight != mc.getFramebuffer().framebufferHeight) { + disposeDepthTexture(); + createDepthTexture(); + } } else { disposeDepthTexture(); } @@ -66,7 +73,8 @@ public static void onPreWorldRender(TickEvent.RenderTickEvent event) { public static void renderWorld(RenderWorldLastEvent event) { // re-render world in our own fbo. Minecraft mc = Minecraft.getMinecraft(); Entity viewer = mc.getRenderViewEntity(); - if (DepthTextureUtil.framebufferDepthTexture != 0 && mc.world != null && viewer != null && !DepthTextureUtil.useDefaultFBO) { + if (DepthTextureUtil.framebufferDepthTexture != 0 && mc.world != null && viewer != null && + !DepthTextureUtil.useDefaultFBO) { int lastFBO = GlStateManager.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); @@ -108,7 +116,8 @@ public static void createDepthTexture() { lastWidth = framebuffer.framebufferTextureWidth; lastHeight = framebuffer.framebufferTextureHeight; - OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); // bind buffer then bind depth texture + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, framebufferObject); // bind buffer then bind depth + // texture OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, stencil ? GL30.GL_DEPTH_STENCIL_ATTACHMENT : OpenGlHelper.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, diff --git a/src/main/java/gregtech/client/utils/EffectRenderContext.java b/src/main/java/gregtech/client/utils/EffectRenderContext.java index 3c296072d36..b1a6793396a 100644 --- a/src/main/java/gregtech/client/utils/EffectRenderContext.java +++ b/src/main/java/gregtech/client/utils/EffectRenderContext.java @@ -4,9 +4,10 @@ import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; +import java.util.Objects; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Objects; /** * Collection of various information for rendering purposes. @@ -38,9 +39,12 @@ public EffectRenderContext update(@Nonnull Entity renderViewEntity, float partia this.renderViewEntity = renderViewEntity; this.partialTicks = partialTicks; - this.cameraX = renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; - this.cameraY = renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; - this.cameraZ = renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; + this.cameraX = renderViewEntity.lastTickPosX + + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; + this.cameraY = renderViewEntity.lastTickPosY + + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; + this.cameraZ = renderViewEntity.lastTickPosZ + + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; this.cameraViewDir = renderViewEntity.getLook(partialTicks); this.rotationX = ActiveRenderInfo.getRotationX(); diff --git a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java index 5216c24084d..084e1b46101 100644 --- a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java +++ b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java @@ -1,6 +1,7 @@ package gregtech.client.utils; import gregtech.api.pipenet.IBlockAppearance; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -30,7 +31,6 @@ public class FacadeBlockAccess implements IBlockAccess { public final IBlockState state; public FacadeBlockAccess(IBlockAccess world, BlockPos pos, EnumFacing side, IBlockState state) { - this.world = world; this.pos = pos; this.side = side; @@ -38,7 +38,11 @@ public FacadeBlockAccess(IBlockAccess world, BlockPos pos, EnumFacing side, IBlo } public enum Result { - ORIGINAL, AIR, BASE, BEDROCK, COVER + ORIGINAL, + AIR, + BASE, + BEDROCK, + COVER } public Result getAction(BlockPos pos) { diff --git a/src/main/java/gregtech/client/utils/IBloomEffect.java b/src/main/java/gregtech/client/utils/IBloomEffect.java index 0f755b376bd..984acd91aa8 100644 --- a/src/main/java/gregtech/client/utils/IBloomEffect.java +++ b/src/main/java/gregtech/client/utils/IBloomEffect.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.postprocessing.BloomType; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -26,7 +27,7 @@ public interface IBloomEffect { /** * @param context render context * @return if this effect should be rendered; returning {@code false} skips {@link #renderBloomEffect(BufferBuilder, - * EffectRenderContext)} call. + * EffectRenderContext)} call. */ @SideOnly(Side.CLIENT) default boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { diff --git a/src/main/java/gregtech/client/utils/PipelineUtil.java b/src/main/java/gregtech/client/utils/PipelineUtil.java index 286c0c70737..4bc47855665 100644 --- a/src/main/java/gregtech/client/utils/PipelineUtil.java +++ b/src/main/java/gregtech/client/utils/PipelineUtil.java @@ -1,10 +1,12 @@ package gregtech.client.utils; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; import gregtech.api.util.GTUtility; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; import org.apache.commons.lang3.ArrayUtils; @SideOnly(Side.CLIENT) @@ -13,5 +15,4 @@ public class PipelineUtil { public static IVertexOperation[] color(IVertexOperation[] ops, int rgbColor) { return ArrayUtils.add(ops, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rgbColor))); } - } diff --git a/src/main/java/gregtech/client/utils/RenderBufferHelper.java b/src/main/java/gregtech/client/utils/RenderBufferHelper.java index 84ede4e950b..b1cffd4c734 100644 --- a/src/main/java/gregtech/client/utils/RenderBufferHelper.java +++ b/src/main/java/gregtech/client/utils/RenderBufferHelper.java @@ -1,16 +1,18 @@ package gregtech.client.utils; -import codechicken.lib.vec.Cuboid6; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Cuboid6; + @SideOnly(Side.CLIENT) public class RenderBufferHelper { - public static void renderCubeFrame(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float r, float g, float b, float a) { + public static void renderCubeFrame(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float r, float g, float b, float a) { buffer.pos(minX, minY, minZ).color(r, g, b, a).endVertex(); buffer.pos(maxX, minY, minZ).color(r, g, b, a).endVertex(); @@ -48,15 +50,20 @@ public static void renderCubeFrame(BufferBuilder buffer, double minX, double min buffer.pos(minX, maxY, maxZ).color(r, g, b, a).endVertex(); } - public static void renderCubeFace(BufferBuilder buffer, Cuboid6 cuboid, float r, float g, float b, float a, boolean shade) { - renderCubeFace(buffer, cuboid.min.x, cuboid.min.y, cuboid.min.z, cuboid.max.x, cuboid.max.y, cuboid.max.z, r, g, b, a, shade); + public static void renderCubeFace(BufferBuilder buffer, Cuboid6 cuboid, float r, float g, float b, float a, + boolean shade) { + renderCubeFace(buffer, cuboid.min.x, cuboid.min.y, cuboid.min.z, cuboid.max.x, cuboid.max.y, cuboid.max.z, r, g, + b, a, shade); } - public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float red, float green, float blue, float alpha) { renderCubeFace(buffer, minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, false); } - public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float a, boolean shade) { + public static void renderCubeFace(BufferBuilder buffer, double minX, double minY, double minZ, double maxX, + double maxY, double maxZ, float red, float green, float blue, float a, + boolean shade) { float r = red, g = green, b = blue; if (shade) { @@ -110,7 +117,9 @@ public static void renderCubeFace(BufferBuilder buffer, double minX, double minY buffer.pos(minX, maxY, maxZ).color(r, g, b, a).endVertex(); } - public static void renderRing(BufferBuilder buffer, double x, double y, double z, double r, double tubeRadius, int sides, int segments, float red, float green, float blue, float alpha, EnumFacing.Axis axis) { + public static void renderRing(BufferBuilder buffer, double x, double y, double z, double r, double tubeRadius, + int sides, int segments, float red, float green, float blue, float alpha, + EnumFacing.Axis axis) { double sideDelta = 2.0 * Math.PI / sides; double ringDelta = 2.0 * Math.PI / segments; double theta = 0; @@ -134,16 +143,22 @@ public static void renderRing(BufferBuilder buffer, double x, double y, double z switch (axis) { case Y: - buffer.pos(x + sinTheta * dist, y + tubeRadius * sinPhi, z + cosTheta * dist).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + sinTheta1 * dist, y + tubeRadius * sinPhi, z + cosTheta1 * dist).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + sinTheta * dist, y + tubeRadius * sinPhi, z + cosTheta * dist) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + sinTheta1 * dist, y + tubeRadius * sinPhi, z + cosTheta1 * dist) + .color(red, green, blue, alpha).endVertex(); break; case X: - buffer.pos(x + tubeRadius * sinPhi, y + sinTheta * dist, z + cosTheta * dist).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + tubeRadius * sinPhi, y + sinTheta1 * dist, z + cosTheta1 * dist).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + tubeRadius * sinPhi, y + sinTheta * dist, z + cosTheta * dist) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + tubeRadius * sinPhi, y + sinTheta1 * dist, z + cosTheta1 * dist) + .color(red, green, blue, alpha).endVertex(); break; case Z: - buffer.pos(x + cosTheta * dist, y + sinTheta * dist, z + tubeRadius * sinPhi).color(red, green, blue, alpha).endVertex(); - buffer.pos(x + cosTheta1 * dist, y + sinTheta1 * dist, z + tubeRadius * sinPhi).color(red, green, blue, alpha).endVertex(); + buffer.pos(x + cosTheta * dist, y + sinTheta * dist, z + tubeRadius * sinPhi) + .color(red, green, blue, alpha).endVertex(); + buffer.pos(x + cosTheta1 * dist, y + sinTheta1 * dist, z + tubeRadius * sinPhi) + .color(red, green, blue, alpha).endVertex(); break; } @@ -154,6 +169,4 @@ public static void renderRing(BufferBuilder buffer, double x, double y, double z } } - - } diff --git a/src/main/java/gregtech/client/utils/RenderUtil.java b/src/main/java/gregtech/client/utils/RenderUtil.java index ff6f613f5c0..20d46b9e509 100644 --- a/src/main/java/gregtech/client/utils/RenderUtil.java +++ b/src/main/java/gregtech/client/utils/RenderUtil.java @@ -1,8 +1,7 @@ package gregtech.client.utils; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -25,14 +24,18 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL30; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.image.BufferedImage; import java.util.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @SideOnly(Side.CLIENT) public class RenderUtil { @@ -51,7 +54,7 @@ private static int[] peekFirstScissorOrFullScreen() { int[] currentTopFrame = scissorFrameStack.isEmpty() ? null : scissorFrameStack.peek(); if (currentTopFrame == null) { Minecraft minecraft = Minecraft.getMinecraft(); - return new int[]{0, 0, minecraft.displayWidth, minecraft.displayHeight}; + return new int[] { 0, 0, minecraft.displayWidth, minecraft.displayHeight }; } return currentTopFrame; } @@ -75,11 +78,11 @@ public static void pushScissorFrame(int x, int y, int width, int height) { newWidth = Math.min(maxWidth, newWidth); newHeight = Math.min(maxHeight, newHeight); applyScissor(newX, newY, newWidth, newHeight); - //finally, push applied scissor on top of scissor stack + // finally, push applied scissor on top of scissor stack if (scissorFrameStack.isEmpty()) { GL11.glEnable(GL11.GL_SCISSOR_TEST); } - scissorFrameStack.push(new int[]{newX, newY, newWidth, newHeight}); + scissorFrameStack.push(new int[] { newX, newY, newWidth, newHeight }); pushedFrame = true; } } @@ -87,7 +90,7 @@ public static void pushScissorFrame(int x, int y, int width, int height) { if (scissorFrameStack.isEmpty()) { GL11.glEnable(GL11.GL_SCISSOR_TEST); } - scissorFrameStack.push(new int[]{parentX, parentY, parentWidth, parentHeight}); + scissorFrameStack.push(new int[] { parentX, parentY, parentWidth, parentHeight }); } } @@ -104,9 +107,9 @@ public static void popScissorFrame() { } } - //applies scissor with gui-space coordinates and sizes + // applies scissor with gui-space coordinates and sizes private static void applyScissor(int x, int y, int w, int h) { - //translate upper-left to bottom-left + // translate upper-left to bottom-left ScaledResolution r = ((GuiIngameForge) Minecraft.getMinecraft().ingameGUI).getResolution(); int s = r == null ? 1 : r.getScaleFactor(); int translatedY = r == null ? 0 : (r.getScaledHeight() - y - h); @@ -115,10 +118,12 @@ private static void applyScissor(int x, int y, int w, int h) { /*** * used to render pixels in stencil mask. (e.g. Restrict rendering results to be displayed only in Monitor Screens) - * if you want to do the similar things in Gui(2D) not World(3D), plz consider using the {@link #useScissor(int, int, int, int, Runnable)} + * if you want to do the similar things in Gui(2D) not World(3D), plz consider using the + * {@link #useScissor(int, int, int, int, Runnable)} * that you don't need to draw mask to build a rect mask easily. - * @param mask draw mask - * @param renderInMask rendering in the mask + * + * @param mask draw mask + * @param renderInMask rendering in the mask * @param shouldRenderMask should mask be rendered too */ public static void useStencil(Runnable mask, Runnable renderInMask, boolean shouldRenderMask) { @@ -161,14 +166,15 @@ public static void useLightMap(float x, float y, Runnable codeBlock) { if (codeBlock != null) { codeBlock.run(); } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); } public static void moveToFace(double x, double y, double z, EnumFacing face) { - GlStateManager.translate(x + 0.5 + face.getXOffset() * 0.5, y + 0.5 + face.getYOffset() * 0.5, z + 0.5 + face.getZOffset() * 0.5); + GlStateManager.translate(x + 0.5 + face.getXOffset() * 0.5, y + 0.5 + face.getYOffset() * 0.5, + z + 0.5 + face.getZOffset() * 0.5); } public static void rotateToFace(EnumFacing face, @Nullable EnumFacing spin) { @@ -182,7 +188,8 @@ public static void rotateToFace(EnumFacing face, @Nullable EnumFacing spin) { case DOWN: GlStateManager.scale(1.0f, -1.0f, 1.0f); GlStateManager.rotate(-90.0f, 1.0f, 0.0f, 0.0f); - GlStateManager.rotate(spin == EnumFacing.EAST ? 90 : spin == EnumFacing.NORTH ? 180 : spin == EnumFacing.WEST ? -90 : 0, 0, 0, 1); + GlStateManager.rotate(spin == EnumFacing.EAST ? 90 : + spin == EnumFacing.NORTH ? 180 : spin == EnumFacing.WEST ? -90 : 0, 0, 0, 1); break; case EAST: GlStateManager.scale(-1.0f, -1.0f, -1.0f); @@ -226,7 +233,8 @@ public static void bindTextureAtlasSprite(TextureAtlasSprite textureAtlasSprite) return; } - BufferedImage bufferedImage = new BufferedImage(iconWidth, iconHeight * frameCount, BufferedImage.TYPE_4BYTE_ABGR); + BufferedImage bufferedImage = new BufferedImage(iconWidth, iconHeight * frameCount, + BufferedImage.TYPE_4BYTE_ABGR); for (int i = 0; i < frameCount; i++) { int[][] frameTextureData = textureAtlasSprite.getFrameTextureData(i); int[] largestMipMapTextureData = frameTextureData[0]; @@ -243,9 +251,10 @@ public static void bindTextureAtlasSprite(TextureAtlasSprite textureAtlasSprite) /*** * avoid z-fighting. not familiar with the CCL, its a trick. * //TODO could DisableDepthMask in the CCL? + * * @param translation origin - * @param side facing - * @param layer level + * @param side facing + * @param layer level * @return adjust */ public static Matrix4 adjustTrans(Matrix4 translation, EnumFacing side, int layer) { @@ -313,7 +322,8 @@ public static void renderRect(float x, float y, float width, float height, float GlStateManager.color(1, 1, 1, 1); } - public static void renderGradientRect(float x, float y, float width, float height, float z, int startColor, int endColor, boolean horizontal) { + public static void renderGradientRect(float x, float y, float width, float height, float z, int startColor, + int endColor, boolean horizontal) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; @@ -325,7 +335,9 @@ public static void renderGradientRect(float x, float y, float width, float heigh 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.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -347,7 +359,8 @@ public static void renderGradientRect(float x, float y, float width, float heigh GlStateManager.enableTexture2D(); } - public static void renderText(float x, float y, float z, float scale, int color, final String renderedText, boolean centered) { + public static void renderText(float x, float y, float z, float scale, int color, final String renderedText, + boolean centered) { GlStateManager.pushMatrix(); final FontRenderer fr = Minecraft.getMinecraft().fontRenderer; final int width = fr.getStringWidth(renderedText); @@ -370,7 +383,8 @@ public static void renderItemOverLay(float x, float y, float z, float scale, Ite net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); } - public static void renderFluidOverLay(float x, float y, float width, float height, float z, FluidStack fluidStack, float alpha) { + public static void renderFluidOverLay(float x, float y, float width, float height, float z, FluidStack fluidStack, + float alpha) { if (fluidStack != null) { int color = fluidStack.getFluid().getColor(fluidStack); float r = (color >> 16 & 255) / 255.0f; @@ -378,9 +392,10 @@ public static void renderFluidOverLay(float x, float y, float width, float heigh float b = (color & 255) / 255.0f; TextureAtlasSprite sprite = TextureUtils.getTexture(fluidStack.getFluid().getStill(fluidStack)); GlStateManager.enableBlend(); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); - //GlStateManager.disableLighting(); + // GlStateManager.disableLighting(); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); BufferBuilder buf = tess.getBuffer(); @@ -394,14 +409,15 @@ public static void renderFluidOverLay(float x, float y, float width, float heigh buf.pos(x + width, y, z).tex(uMax, vMin).color(r, g, b, alpha).endVertex(); tess.draw(); - //GlStateManager.enableLighting(); + // GlStateManager.enableLighting(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); GlStateManager.color(1F, 1F, 1F, 1F); } } - public static void renderTextureArea(TextureArea textureArea, float x, float y, float width, float height, float z) { + public static void renderTextureArea(TextureArea textureArea, float x, float y, float width, float height, + float z) { double imageU = textureArea.offsetX; double imageV = textureArea.offsetY; double imageWidth = textureArea.imageWidth; @@ -417,14 +433,16 @@ public static void renderTextureArea(TextureArea textureArea, float x, float y, tessellator.draw(); } - public static void renderLineChart(List data, long max, float x, float y, float width, float height, float lineWidth, int color) { + public static void renderLineChart(List data, long max, float x, float y, float width, float height, + float lineWidth, int color) { float durX = data.size() > 1 ? width / (data.size() - 1) : 0; float hY = max > 0 ? height / max : 0; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); - GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, ((color >> 24) & 0xFF) / 255f); + GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, + ((color >> 24) & 0xFF) / 255f); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -462,7 +480,8 @@ public static void renderLine(float x1, float y1, float x2, float y2, float line GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); - GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, ((color >> 24) & 0xFF) / 255f); + GlStateManager.color(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, + ((color >> 24) & 0xFF) / 255f); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); @@ -484,7 +503,8 @@ public static void renderLine(float x1, float y1, float x2, float y2, float line GlStateManager.color(1, 1, 1, 1); } - public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { + public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, + int maskRight, double zLevel) { double uMin = textureSprite.getMinU(); double uMax = textureSprite.getMaxU(); double vMin = textureSprite.getMinV(); @@ -502,12 +522,14 @@ public static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSp tessellator.draw(); } - public static void drawFluidForGui(FluidStack contents, int tankCapacity, int startX, int startY, int widthT, int heightT) { + public static void drawFluidForGui(FluidStack contents, int tankCapacity, int startX, int startY, int widthT, + int heightT) { widthT--; heightT--; Fluid fluid = contents.getFluid(); ResourceLocation fluidStill = fluid.getStill(contents); - TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluidStill.toString()); + TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks() + .getAtlasSprite(fluidStill.toString()); int fluidColor = fluid.getColor(contents); int scaledAmount; if (contents.amount == tankCapacity) { @@ -585,23 +607,30 @@ public static boolean updateFBOSize(Framebuffer fbo, int width, int height) { } public static void hookDepthBuffer(Framebuffer fbo, int depthBuffer) { - //Hook DepthBuffer + // Hook DepthBuffer OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, fbo.framebufferObject); if (fbo.isStencilEnabled()) { - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, + org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, + depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, + org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, + depthBuffer); } else { - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, depthBuffer); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, + OpenGlHelper.GL_RENDERBUFFER, depthBuffer); } } public static void hookDepthTexture(Framebuffer fbo, int depthTexture) { - //Hook DepthTexture + // Hook DepthTexture OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, fbo.framebufferObject); if (fbo.isStencilEnabled()) { - OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, GL30.GL_DEPTH_STENCIL_ATTACHMENT, GL11.GL_TEXTURE_2D, depthTexture, 0); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, GL30.GL_DEPTH_STENCIL_ATTACHMENT, + GL11.GL_TEXTURE_2D, depthTexture, 0); } else { - OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, depthTexture, 0); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, + GL11.GL_TEXTURE_2D, depthTexture, 0); } } @@ -609,7 +638,8 @@ public static void hookDepthTexture(Framebuffer fbo, int depthTexture) { * Makes given BakedQuad emissive; specifically, it makes a new UnpackedBakedQuad with * constant lightmap coordination and {@code applyDiffuseLighting} set to {@code false}. * The other properties, such as textures, tint color and other vertex data will be copied from - * the template.

+ * the template. + *

* Note that this method just returns {@code quad} if Optifine is installed. * * @param quad Template BakedQuad. @@ -623,6 +653,7 @@ public static BakedQuad makeEmissive(BakedQuad quad) { format.addElement(DefaultVertexFormats.TEX_2S); } UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format) { + @Override public void put(int element, @Nonnull float... data) { if (this.getVertexFormat().getElement(element) == DefaultVertexFormats.TEX_2S) diff --git a/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java b/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java index eb0af0b2d28..de982d07450 100644 --- a/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java +++ b/src/main/java/gregtech/client/utils/ToolChargeBarRenderer.java @@ -7,6 +7,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.util.GTUtility; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -15,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; @@ -38,7 +40,8 @@ public final class ToolChargeBarRenderer { private static final Color colorBarLeftDepleted = new Color(122, 0, 0, 255); private static final Color colorBarRightDepleted = new Color(255, 27, 27, 255); - public static void render(double level, int xPosition, int yPosition, int offset, boolean shadow, Color left, Color right, boolean doDepletedColor) { + public static void render(double level, int xPosition, int yPosition, int offset, boolean shadow, Color left, + Color right, boolean doDepletedColor) { double width = level * BAR_W; if (doDepletedColor && level <= 0.25) { left = colorBarLeftDepleted; @@ -71,23 +74,38 @@ public static void render(double level, int xPosition, int yPosition, int offset private static void drawGrad(BufferBuilder renderer, int x, int y, double width, Color left, Color right) { renderer.pos(x, y, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()).endVertex(); - renderer.pos(x, y + (double) 1, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()).endVertex(); - renderer.pos(x + width, y + (double) 1, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); - renderer.pos(x + width, y, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); + renderer.pos(x, y + (double) 1, 0.0D).color(left.getRed(), left.getGreen(), left.getBlue(), left.getAlpha()) + .endVertex(); + renderer.pos(x + width, y + (double) 1, 0.0D) + .color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()).endVertex(); + renderer.pos(x + width, y, 0.0D).color(right.getRed(), right.getGreen(), right.getBlue(), right.getAlpha()) + .endVertex(); } private static void drawShadow(BufferBuilder renderer, int x, int y, double width, double height) { - renderer.pos(x, y, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x, y + height, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x + width, y + height, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); - renderer.pos(x + width, y, 0.0D).color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()).endVertex(); + renderer.pos(x, y, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x, y + height, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x + width, y + height, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); + renderer.pos(x + width, y, 0.0D) + .color(colorShadow.getRed(), colorShadow.getGreen(), colorShadow.getBlue(), colorShadow.getAlpha()) + .endVertex(); } private static void drawBG(BufferBuilder renderer, int x, int y, double width) { - renderer.pos(x - width, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x - width, y + (double) 1, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x, y + (double) 1, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); - renderer.pos(x, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x - width, y, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x - width, y + (double) 1, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x, y + (double) 1, 0.0D) + .color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()).endVertex(); + renderer.pos(x, y, 0.0D).color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), colorBG.getAlpha()) + .endVertex(); } private static void overpaintVanillaRenderBug(BufferBuilder worldrenderer, int xPosition, int yPosition) { @@ -98,10 +116,12 @@ public static void renderBarsTool(IGTTool tool, ItemStack stack, int xPosition, boolean renderedDurability = false; NBTTagCompound tag = GTUtility.getOrCreateNbtCompound(stack); if (!tag.getBoolean(ToolHelper.UNBREAKABLE_KEY)) { - renderedDurability = renderDurabilityBar(stack.getItem().getDurabilityForDisplay(stack), xPosition, yPosition); + renderedDurability = renderDurabilityBar(stack.getItem().getDurabilityForDisplay(stack), xPosition, + yPosition); } if (tool.isElectric()) { - renderElectricBar(tool.getCharge(stack), tool.getMaxCharge(stack), xPosition, yPosition, renderedDurability); + renderElectricBar(tool.getCharge(stack), tool.getMaxCharge(stack), xPosition, yPosition, + renderedDurability); } } @@ -114,18 +134,22 @@ public static void renderBarsItem(MetaItem metaItem, ItemStack stack, int xPo IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem != null) { - renderElectricBar(electricItem.getCharge(), electricItem.getMaxCharge(), xPosition, yPosition, renderedDurability); + renderElectricBar(electricItem.getCharge(), electricItem.getMaxCharge(), xPosition, yPosition, + renderedDurability); } } - private static void renderElectricBar(long charge, long maxCharge, int xPosition, int yPosition, boolean renderedDurability) { + private static void renderElectricBar(long charge, long maxCharge, int xPosition, int yPosition, + boolean renderedDurability) { if (charge > 0 && maxCharge > 0) { double level = (double) charge / (double) maxCharge; - render(level, xPosition, yPosition, renderedDurability ? 2 : 0, true, colorBarLeftEnergy, colorBarRightEnergy, true); + render(level, xPosition, yPosition, renderedDurability ? 2 : 0, true, colorBarLeftEnergy, + colorBarRightEnergy, true); } } - private static boolean renderDurabilityBar(ItemStack stack, IItemDurabilityManager manager, int xPosition, int yPosition) { + private static boolean renderDurabilityBar(ItemStack stack, IItemDurabilityManager manager, int xPosition, + int yPosition) { double level = manager.getDurabilityForDisplay(stack); if (level == 0.0 && !manager.showEmptyBar(stack)) return false; if (level == 1.0 && !manager.showFullBar(stack)) return false; @@ -142,6 +166,5 @@ private static boolean renderDurabilityBar(double level, int xPosition, int yPos return true; } - private ToolChargeBarRenderer() { - } + private ToolChargeBarRenderer() {} } diff --git a/src/main/java/gregtech/client/utils/TooltipHelper.java b/src/main/java/gregtech/client/utils/TooltipHelper.java index c39b4f111da..b352bb6ca35 100644 --- a/src/main/java/gregtech/client/utils/TooltipHelper.java +++ b/src/main/java/gregtech/client/utils/TooltipHelper.java @@ -2,8 +2,10 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; + import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.gameevent.TickEvent; + import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -49,7 +51,8 @@ public static GTFormatCode createNewCode(int rate, TextFormatting... codes) { return null; } if (codes == null || codes.length <= 1) { - GTLog.logger.error("Could not create GT Format Code with codes {}, must have length greater than one!", Arrays.toString(codes)); + GTLog.logger.error("Could not create GT Format Code with codes {}, must have length greater than one!", + Arrays.toString(codes)); return null; } GTFormatCode code = new GTFormatCode(rate, codes); diff --git a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java index 925836aab09..9e1a0c3bfcf 100644 --- a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java +++ b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java @@ -2,6 +2,7 @@ import gregtech.api.util.BlockInfo; import gregtech.api.util.world.DummyWorld; + import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; @@ -10,13 +11,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.vecmath.Vector3f; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.vecmath.Vector3f; + /** * Created with IntelliJ IDEA. * @@ -26,6 +28,7 @@ */ @SideOnly(Side.CLIENT) public class TrackedDummyWorld extends DummyWorld { + public final Set renderedBlocks = new HashSet<>(); private Predicate renderFilter; private final World proxyWorld; @@ -37,11 +40,11 @@ public void setRenderFilter(Predicate renderFilter) { this.renderFilter = renderFilter; } - public TrackedDummyWorld(){ + public TrackedDummyWorld() { proxyWorld = null; } - public TrackedDummyWorld(World world){ + public TrackedDummyWorld(World world) { proxyWorld = world; } @@ -67,7 +70,7 @@ public TileEntity getTileEntity(@Nonnull BlockPos pos) { @Override public IBlockState getBlockState(@Nonnull BlockPos pos) { if (renderFilter != null && !renderFilter.test(pos)) - return Blocks.AIR.getDefaultState(); //return air if not rendering this block + return Blocks.AIR.getDefaultState(); // return air if not rendering this block return proxyWorld != null ? proxyWorld.getBlockState(pos) : super.getBlockState(pos); } diff --git a/src/main/java/gregtech/common/CommonProxy.java b/src/main/java/gregtech/common/CommonProxy.java index 04c05dde5fe..7cac0f93204 100644 --- a/src/main/java/gregtech/common/CommonProxy.java +++ b/src/main/java/gregtech/common/CommonProxy.java @@ -37,6 +37,7 @@ import gregtech.loaders.OreDictionaryLoader; import gregtech.loaders.recipe.CraftingComponent; import gregtech.loaders.recipe.GTRecipeManager; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -56,6 +57,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; + import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; @@ -84,7 +86,8 @@ public static void registerBlocks(RegistryEvent.Register event) { if (material.hasProperty(PropertyKey.WIRE)) { for (BlockCable cable : CABLES.get(materialRegistry.getModid())) { - if (!cable.getItemPipeType(null).isCable() || !material.getProperty(PropertyKey.WIRE).isSuperconductor()) + if (!cable.getItemPipeType(null).isCable() || + !material.getProperty(PropertyKey.WIRE).isSuperconductor()) cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE)); } } @@ -194,7 +197,7 @@ private static void createOreBlock(Material material, StoneType[] stoneTypes, in @SubscribeEvent(priority = EventPriority.LOWEST) public static void registerBlocksLast(RegistryEvent.Register event) { - //last chance for mods to register their potion types is here + // last chance for mods to register their potion types is here FLUID_BLOCKS.forEach(event.getRegistry()::register); } @@ -217,9 +220,12 @@ public static void registerItems(RegistryEvent.Register event) { registry.register(createItemBlock(MACHINE, MachineItemBlock::new)); for (MaterialRegistry materialRegistry : GregTechAPI.materialManager.getRegistries()) { - for (BlockCable cable : CABLES.get(materialRegistry.getModid())) registry.register(createItemBlock(cable, ItemBlockCable::new)); - for (BlockFluidPipe pipe : FLUID_PIPES.get(materialRegistry.getModid())) registry.register(createItemBlock(pipe, ItemBlockFluidPipe::new)); - for (BlockItemPipe pipe : ITEM_PIPES.get(materialRegistry.getModid())) registry.register(createItemBlock(pipe, ItemBlockItemPipe::new)); + for (BlockCable cable : CABLES.get(materialRegistry.getModid())) + registry.register(createItemBlock(cable, ItemBlockCable::new)); + for (BlockFluidPipe pipe : FLUID_PIPES.get(materialRegistry.getModid())) + registry.register(createItemBlock(pipe, ItemBlockFluidPipe::new)); + for (BlockItemPipe pipe : ITEM_PIPES.get(materialRegistry.getModid())) + registry.register(createItemBlock(pipe, ItemBlockItemPipe::new)); } for (BlockOpticalPipe pipe : OPTICAL_PIPES) registry.register(createItemBlock(pipe, ItemBlockOpticalPipe::new)); for (BlockLaserPipe pipe : LASER_PIPES) registry.register(createItemBlock(pipe, ItemBlockLaserPipe::new)); @@ -286,11 +292,11 @@ public static void initComponents(RegistryEvent.Register event) { MinecraftForge.EVENT_BUS.post(new GregTechAPI.RegisterEvent<>(null, CraftingComponent.class)); } - //this is called with normal priority, so most mods working with - //ore dictionary and recipes will get recipes accessible in time + // this is called with normal priority, so most mods working with + // ore dictionary and recipes will get recipes accessible in time @SubscribeEvent public static void registerRecipes(RegistryEvent.Register event) { - //Registers Fusion tiers for the FusionEUToStartProperty + // Registers Fusion tiers for the FusionEUToStartProperty FusionEUToStartProperty.registerFusionTier(6, "(MK1)"); FusionEUToStartProperty.registerFusionTier(7, "(MK2)"); FusionEUToStartProperty.registerFusionTier(8, "(MK3)"); @@ -314,17 +320,17 @@ public static void registerRecipes(RegistryEvent.Register event) { GTRecipeManager.load(); } - //this is called almost last, to make sure all mods registered their ore dictionary - //items and blocks for running first phase of material handlers - //it will also clear generated materials + // this is called almost last, to make sure all mods registered their ore dictionary + // items and blocks for running first phase of material handlers + // it will also clear generated materials @SubscribeEvent(priority = EventPriority.LOW) public static void runEarlyMaterialHandlers(RegistryEvent.Register event) { GTLog.logger.info("Running early material handlers..."); OrePrefix.runMaterialHandlers(); } - //this is called last, so all mods finished registering their stuff, as example, CraftTweaker - //if it registered some kind of ore dictionary entry, late processing will hook it and generate recipes + // this is called last, so all mods finished registering their stuff, as example, CraftTweaker + // if it registered some kind of ore dictionary entry, late processing will hook it and generate recipes @SubscribeEvent(priority = EventPriority.LOWEST) public static void registerRecipesLowest(RegistryEvent.Register event) { GTLog.logger.info("Running late material handlers..."); @@ -348,17 +354,17 @@ public static void syncConfigValues(ConfigChangedEvent.OnConfigChangedEvent even public static void modifyFuelBurnTime(FurnaceFuelBurnTimeEvent event) { ItemStack stack = event.getItemStack(); Block block = Block.getBlockFromItem(stack.getItem()); - //handle sapling and log burn rates + // handle sapling and log burn rates if (block == RUBBER_SAPLING) { event.setBurnTime(100); } else if (block == WOOD_SLAB) { event.setBurnTime(150); } else if (block instanceof BlockCompressed) { - //handle material blocks burn value + // handle material blocks burn value Material material = ((BlockCompressed) block).getGtMaterial(stack); DustProperty property = material.getProperty(PropertyKey.DUST); if (property != null && property.getBurnTime() > 0) { - //compute burn value for block prefix, taking amount of material in block into account + // compute burn value for block prefix, taking amount of material in block into account double materialUnitsInBlock = OrePrefix.block.getMaterialAmount(material) / (GTValues.M * 1.0); event.setBurnTime((int) (materialUnitsInBlock * property.getBurnTime())); } @@ -375,11 +381,9 @@ private static ItemBlock createItemBlock(T block, Function 1 EU. 0.5 means 2L Steam -> 1 EU.", "Default: 0.5"}) + @Config.Comment({ "Steam to EU multiplier for Steam Multiblocks.", + "1.0 means 1L Steam -> 1 EU. 0.5 means 2L Steam -> 1 EU.", "Default: 0.5" }) public double multiblockSteamToEU = 0.5; - @Config.Comment({"Whether machines or boilers damage the terrain when they explode.", - "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", "Default: true"}) + @Config.Comment({ "Whether machines or boilers damage the terrain when they explode.", + "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", + "Default: true" }) public boolean doesExplosionDamagesTerrain = true; - @Config.Comment({"Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", "Default: false"}) + @Config.Comment({ + "Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", + "Default: false" }) public boolean doTerrainExplosion = false; - @Config.Comment({"Energy use multiplier for electric items.", "Default: 100"}) + @Config.Comment({ "Energy use multiplier for electric items.", "Default: 100" }) public int energyUsageMultiplier = 100; - @Config.Comment({"The EU/t drain for each screen of the Central Monitor.", "Default: 8"}) + @Config.Comment({ "The EU/t drain for each screen of the Central Monitor.", "Default: 8" }) @Config.RangeInt(min = 0) public int centralMonitorEuCost = 8; - @Config.Comment({"Whether to play machine sounds while machines are active.", "Default: true"}) + @Config.Comment({ "Whether to play machine sounds while machines are active.", "Default: true" }) public boolean machineSounds = true; - @Config.Comment({"Additional Fluids to allow in GT Boilers in place of Water or Distilled Water.", - "Useful for mods like TerraFirmaCraft with different Fluids for Water", "Default: none"}) + @Config.Comment({ "Additional Fluids to allow in GT Boilers in place of Water or Distilled Water.", + "Useful for mods like TerraFirmaCraft with different Fluids for Water", "Default: none" }) public String[] boilerFluids = new String[0]; - @Config.Comment({"Blacklist of machines for the Processing Array.", + @Config.Comment({ "Blacklist of machines for the Processing Array.", "Add the unlocalized Recipe Map name to blacklist the machine.", - "Default: All machines allowed"}) + "Default: All machines allowed" }) public String[] processingArrayBlacklist = new String[0]; - @Config.Comment({"Whether to enable the cleanroom, required for various recipes.", "Default: true"}) + @Config.Comment({ "Whether to enable the cleanroom, required for various recipes.", "Default: true" }) public boolean enableCleanroom = true; - @Config.Comment({"Whether multiblocks should ignore all cleanroom requirements.", + @Config.Comment({ "Whether multiblocks should ignore all cleanroom requirements.", "This does nothing if B:enableCleanroom is false.", - "Default: false"}) + "Default: false" }) public boolean cleanMultiblocks = false; - @Config.Comment({"Block to replace mined ores with in the miner and multiblock miner.", "Default: minecraft:cobblestone"}) + @Config.Comment({ "Block to replace mined ores with in the miner and multiblock miner.", + "Default: minecraft:cobblestone" }) public String replaceMinedBlocksWith = "minecraft:cobblestone"; - @Config.Comment({"Whether to enable Assembly Line research for recipes.", "Default: true"}) + @Config.Comment({ "Whether to enable Assembly Line research for recipes.", "Default: true" }) @Config.RequiresMcRestart public boolean enableResearch = true; - @Config.Comment({"Whether the Assembly Line should require the item inputs to be in order.", "Default: true"}) + @Config.Comment({ "Whether the Assembly Line should require the item inputs to be in order.", "Default: true" }) @Config.RequiresMcRestart public boolean orderedAssembly = true; - @Config.Comment({"Whether the Assembly Line should require the fluid inputs to be in order.", + @Config.Comment({ "Whether the Assembly Line should require the fluid inputs to be in order.", "This does nothing if B:orderedAssembly is false.", - "Default: false"}) + "Default: false" }) @Config.RequiresMcRestart public boolean orderedFluidAssembly = false; @@ -143,113 +154,130 @@ public static class MachineOptions { * Addons mods should not reference this config directly. * Use {@link GregTechAPI#isHighTier()} instead. */ - @Config.Comment({"If High Tier (>UV-tier) GT content should be registered.", + @Config.Comment({ "If High Tier (>UV-tier) GT content should be registered.", "Items and Machines enabled with this config will have missing recipes by default.", "This is intended for modpack developers only, and is not playable without custom tweaks or addons.", "Other mods can override this to true, regardless of the config file.", - "Default: false"}) + "Default: false" }) @Config.RequiresMcRestart public boolean highTierContent = false; } public static class WorldGenOptions { - @Config.Comment({"Specifies the minimum number of veins in a section.", "Default: 1"}) + @Config.Comment({ "Specifies the minimum number of veins in a section.", "Default: 1" }) public int minVeinsInSection = 1; - @Config.Comment({"Specifies an additional random number of veins in a section.", "Default: 0"}) + @Config.Comment({ "Specifies an additional random number of veins in a section.", "Default: 0" }) public int additionalVeinsInSection = 0; - @Config.Comment({"Whether veins should be generated in the center of chunks.", "Default: true"}) + @Config.Comment({ "Whether veins should be generated in the center of chunks.", "Default: true" }) public boolean generateVeinsInCenterOfChunk = true; - @Config.Comment({"Whether to disable Vanilla ore generation in world.", "Default: true"}) + @Config.Comment({ "Whether to disable Vanilla ore generation in world.", "Default: true" }) public boolean disableVanillaOres = true; - @Config.Comment({"Whether to disable Rubber Tree world generation.", "Default: false"}) + @Config.Comment({ "Whether to disable Rubber Tree world generation.", "Default: false" }) public boolean disableRubberTreeGeneration = false; - @Config.Comment({"Multiplier for the chance to spawn a Rubber Tree on any given roll. Higher values make Rubber Trees more common.", "Default: 1.0"}) + @Config.Comment({ + "Multiplier for the chance to spawn a Rubber Tree on any given roll. Higher values make Rubber Trees more common.", + "Default: 1.0" }) @Config.RangeDouble(min = 0) public double rubberTreeRateIncrease = 1.0; - @Config.Comment({"Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", "Default: true"}) + @Config.Comment({ "Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", + "Default: true" }) public boolean increaseDungeonLoot = true; - @Config.Comment({"Allow GregTech to add additional GregTech Items as loot in various structures.", "Default: true"}) + @Config.Comment({ "Allow GregTech to add additional GregTech Items as loot in various structures.", + "Default: true" }) public boolean addLoot = true; - @Config.Comment({"Should all Stone Types drop unique Ore Item Blocks?", "Default: false (meaning only Stone, Netherrack, and Endstone"}) + @Config.Comment({ "Should all Stone Types drop unique Ore Item Blocks?", + "Default: false (meaning only Stone, Netherrack, and Endstone" }) public boolean allUniqueStoneTypes = false; } public static class RecipeOptions { - @Config.Comment({"Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", "Default: false"}) + @Config.Comment({ + "Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", + "Default: false" }) public boolean harderRods = false; - @Config.Comment({"Whether to make Glass related recipes harder. Default: true"}) + @Config.Comment({ "Whether to make Glass related recipes harder. Default: true" }) public boolean hardGlassRecipes = true; - @Config.Comment({"Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", "Default: false"}) + @Config.Comment({ "Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", + "Default: false" }) public boolean nerfWoodCrafting = false; - @Config.Comment({"Whether to nerf the Paper crafting recipe.", "Default: true"}) + @Config.Comment({ "Whether to nerf the Paper crafting recipe.", "Default: true" }) public boolean nerfPaperCrafting = true; - @Config.Comment({"Whether to make Wood related recipes harder.", "Excludes sticks and planks.", "Default: false"}) + @Config.Comment({ "Whether to make Wood related recipes harder.", "Excludes sticks and planks.", + "Default: false" }) public boolean hardWoodRecipes = false; - @Config.Comment({"Whether to make Redstone related recipes harder.", "Default: false"}) + @Config.Comment({ "Whether to make Redstone related recipes harder.", "Default: false" }) public boolean hardRedstoneRecipes = false; - @Config.Comment({"Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + - " require Iron Plates, Rods, and more.", "Default: true"}) + @Config.Comment({ "Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + + " require Iron Plates, Rods, and more.", "Default: true" }) public boolean hardIronRecipes = true; - @Config.Comment({"Recipes for items like Iron Doors, Trapdoors, Anvil" + - " require Iron Plates, Rods, and more.", "Default: false"}) + @Config.Comment({ "Recipes for items like Iron Doors, Trapdoors, Anvil" + + " require Iron Plates, Rods, and more.", "Default: false" }) public boolean hardAdvancedIronRecipes = false; - @Config.Comment({"Whether to make miscellaneous recipes harder.", "Default: false"}) + @Config.Comment({ "Whether to make miscellaneous recipes harder.", "Default: false" }) public boolean hardMiscRecipes = false; - @Config.Comment({"Whether to make coloring blocks like Concrete or Glass harder.", "Default: false"}) + @Config.Comment({ "Whether to make coloring blocks like Concrete or Glass harder.", "Default: false" }) public boolean hardDyeRecipes = false; - @Config.Comment({"Whether to remove charcoal smelting recipes from the vanilla furnace.", "Default: true"}) + @Config.Comment({ "Whether to remove charcoal smelting recipes from the vanilla furnace.", "Default: true" }) public boolean harderCharcoalRecipe = true; - @Config.Comment({"Whether to make the Flint and Steel recipe require steel parts.", "Default: true."}) + @Config.Comment({ "Whether to make the Flint and Steel recipe require steel parts.", "Default: true." }) public boolean flintAndSteelRequireSteel = true; - @Config.Comment({"Whether to make Vanilla Tools and Armor recipes harder.", "Excludes Flint and Steel, and Buckets.", "Default: false"}) + @Config.Comment({ "Whether to make Vanilla Tools and Armor recipes harder.", + "Excludes Flint and Steel, and Buckets.", "Default: false" }) public boolean hardToolArmorRecipes = false; - @Config.Comment({"Whether to disable the Vanilla Concrete from Powder with Water behavior, forcing the GT recipe.", "Default: false"}) + @Config.Comment({ + "Whether to disable the Vanilla Concrete from Powder with Water behavior, forcing the GT recipe.", + "Default: false" }) public boolean disableConcreteInWorld = false; - @Config.Comment({"Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", - "Useful for mods like TerraFirmaCraft.", "Default: false"}) + @Config.Comment({ "Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", + "Useful for mods like TerraFirmaCraft.", "Default: false" }) public boolean generateLowQualityGems = false; - @Config.Comment({"Whether to remove Block/Ingot compression and decompression in the Crafting Table.", "Default: false"}) + @Config.Comment({ "Whether to remove Block/Ingot compression and decompression in the Crafting Table.", + "Default: false" }) public boolean disableManualCompression = false; - @Config.Comment({"Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false"}) + @Config.Comment({ "Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false" }) public boolean removeVanillaBlockRecipes = false; - @Config.Comment({"Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder.", "Default: false"}) + @Config.Comment({ + "Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder.", + "Default: false" }) public boolean harderBrickRecipes = false; - @Config.Comment({"Whether to make the recipe for the EBF Controller harder.", "Default: false"}) + @Config.Comment({ "Whether to make the recipe for the EBF Controller harder.", "Default: false" }) public boolean harderEBFControllerRecipe = false; - @Config.Comment({"How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2"}) + @Config.Comment({ "How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2" }) @Config.RangeInt(min = 1, max = 3) public int casingsPerCraft = 2; - @Config.Comment({"Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", "Default: false"}) + @Config.Comment({ + "Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", + "Default: false" }) public boolean harderCircuitRecipes = false; } @@ -263,45 +291,54 @@ public static class CompatibilityOptions { @Config.Name("Energy Compat Options") public AE2CompatOptions ae2 = new AE2CompatOptions(); - @Config.Comment({"Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true"}) + @Config.Comment({ "Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true" }) public boolean hideFacadesInJEI = true; - @Config.Comment({"Whether to hide filled cells in JEI and creative search menu.", "Default: true"}) + @Config.Comment({ "Whether to hide filled cells in JEI and creative search menu.", "Default: true" }) public boolean hideFilledCellsInJEI = true; - @Config.Comment({"Specifies priorities of mods in Ore Dictionary item registration.", "First ModID has highest priority, last has lowest. " + - "Unspecified ModIDs follow standard sorting, but always have lower priority than the last specified ModID.", "Default: [\"minecraft\", \"gregtech\"]"}) + @Config.Comment({ "Specifies priorities of mods in Ore Dictionary item registration.", + "First ModID has highest priority, last has lowest. " + + "Unspecified ModIDs follow standard sorting, but always have lower priority than the last specified ModID.", + "Default: [\"minecraft\", \"gregtech\"]" }) public String[] modPriorities = { "minecraft", "gregtech" }; - @Config.Comment({"Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", "Default: true"}) + @Config.Comment({ + "Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", + "Default: true" }) public boolean removeSmeltingForEBFMetals = true; public static class EnergyCompatOptions { - @Config.Comment({"Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires.", "This does not enable nor disable Converters.", "Default: true"}) + @Config.Comment({ "Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires.", + "This does not enable nor disable Converters.", "Default: true" }) public boolean nativeEUToFE = true; - @Config.Comment({"Enable GTEU to FE (and vice versa) Converters.", "Default: false"}) + @Config.Comment({ "Enable GTEU to FE (and vice versa) Converters.", "Default: false" }) public boolean enableFEConverters = false; - @Config.Comment({"Forge Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", "Default: 4 FE == 1 EU"}) + @Config.Comment({ "Forge Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", + "Default: 4 FE == 1 EU" }) @Config.RangeInt(min = 1, max = 16) public int feToEuRatio = 4; - @Config.Comment({"GTEU to Forge Energy ratio for converting EU to FE.", "Affects native conversion and Converters.", "Default: 4 FE == 1 EU"}) + @Config.Comment({ "GTEU to Forge Energy ratio for converting EU to FE.", + "Affects native conversion and Converters.", "Default: 4 FE == 1 EU" }) @Config.RangeInt(min = 1, max = 16) public int euToFeRatio = 4; } public static class AE2CompatOptions { - @Config.Comment({"The interval between ME Hatch/Bus interact ME network.", "It may cause lag if the interval is too small.", "Default: 2 sec"}) + + @Config.Comment({ "The interval between ME Hatch/Bus interact ME network.", + "It may cause lag if the interval is too small.", "Default: 2 sec" }) @Config.RangeInt(min = 1, max = 80) public int updateIntervals = 40; - @Config.Comment({"The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t"}) + @Config.Comment({ "The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t" }) @Config.RangeDouble(min = 0.0, max = 10.0) public double meHatchEnergyUsage = 1.0; } @@ -309,26 +346,27 @@ public static class AE2CompatOptions { public static class MiscOptions { - @Config.Comment({"Whether to enable more verbose logging.", "Default: false"}) + @Config.Comment({ "Whether to enable more verbose logging.", "Default: false" }) public boolean debug = false; - @Config.Comment({"Whether to enable Special Event features (e.g. Christmas, etc).", "Default: true"}) + @Config.Comment({ "Whether to enable Special Event features (e.g. Christmas, etc).", "Default: true" }) public boolean specialEvents = true; - @Config.Comment({"Setting this to true makes GTCEu ignore error and invalid recipes that would otherwise cause crash.", "Default: true"}) + @Config.Comment({ + "Setting this to true makes GTCEu ignore error and invalid recipes that would otherwise cause crash.", + "Default: true" }) public boolean ignoreErrorOrInvalidRecipes = true; - @Config.Comment({"Whether to enable a login message to players when they join the world.", "Default: true"}) + @Config.Comment({ "Whether to enable a login message to players when they join the world.", "Default: true" }) public boolean loginMessage = true; @Config.RangeInt(min = 0, max = 100) - @Config.Comment({"Chance with which flint and steel will create fire.", "Default: 50"}) + @Config.Comment({ "Chance with which flint and steel will create fire.", "Default: 50" }) @Config.SlidingOption public int flintChanceToCreateFire = 50; - @Config.Comment({"Whether to give the terminal to new players on login", "Default: true"}) + @Config.Comment({ "Whether to give the terminal to new players on login", "Default: true" }) public boolean spawnTerminal = true; - } public static class ClientOptions { @@ -344,94 +382,106 @@ public static class ClientOptions { @Config.Name("Shader Options") public ShaderOptions shader = new ShaderOptions(); - @Config.Comment({"Terminal root path.", "Default: {.../config}/gregtech/terminal"}) + @Config.Comment({ "Terminal root path.", "Default: {.../config}/gregtech/terminal" }) @Config.RequiresMcRestart public String terminalRootPath = "gregtech/terminal"; - @Config.Comment({"Whether to hook depth texture. Has no effect on performance, but if there is a problem with rendering, try disabling it.", "Default: true"}) + @Config.Comment({ + "Whether to hook depth texture. Has no effect on performance, but if there is a problem with rendering, try disabling it.", + "Default: true" }) public boolean hookDepthTexture = true; - @Config.Comment({"Resolution level for fragment shaders.", - "Higher values increase quality (limited by the resolution of your screen) but are more GPU intensive.", "Default: 2"}) + @Config.Comment({ "Resolution level for fragment shaders.", + "Higher values increase quality (limited by the resolution of your screen) but are more GPU intensive.", + "Default: 2" }) @Config.RangeDouble(min = 0, max = 5) @Config.SlidingOption public double resolution = 2; - @Config.Comment({"Whether or not to enable Emissive Textures for GregTech Machines and multiblock parts.", "Default: true"}) + @Config.Comment({ "Whether or not to enable Emissive Textures for GregTech Machines and multiblock parts.", + "Default: true" }) public boolean machinesEmissiveTextures = true; - @Config.Comment({"Whether or not to enable Emissive Textures for Electric Blast Furnace Coils when the multiblock is working.", "Default: false"}) + @Config.Comment({ + "Whether or not to enable Emissive Textures for Electric Blast Furnace Coils when the multiblock is working.", + "Default: false" }) public boolean coilsActiveEmissiveTextures = true; - @Config.Comment({"Whether or not sounds should be played when using tools outside of crafting.", "Default: true"}) + @Config.Comment({ "Whether or not sounds should be played when using tools outside of crafting.", + "Default: true" }) public boolean toolUseSounds = true; - @Config.Comment({"Whether or not sounds should be played when crafting with tools.", "Default: true"}) + @Config.Comment({ "Whether or not sounds should be played when crafting with tools.", "Default: true" }) public boolean toolCraftingSounds = true; - @Config.Comment({"Overrides the MC total playable sounds limit. MC's default is 28, which causes problems with many machine sounds at once", + @Config.Comment({ + "Overrides the MC total playable sounds limit. MC's default is 28, which causes problems with many machine sounds at once", "If sounds are causing large amounts of lag, try lowering this.", - "If sounds are not working at all, try setting this to the lowest value (28).", "Default: 512"}) + "If sounds are not working at all, try setting this to the lowest value (28).", "Default: 512" }) @Config.RangeInt(min = 28, max = 2048) @Config.RequiresMcRestart public int maxNumSounds = 512; - @Config.Comment({"The default color to overlay onto machines.", "16777215 (0xFFFFFF in decimal) is no coloring (like GTCE).", - "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)."}) + @Config.Comment({ "The default color to overlay onto machines.", + "16777215 (0xFFFFFF in decimal) is no coloring (like GTCE).", + "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int defaultPaintingColor = 0xD2DCFF; - @Config.Comment({"The default color to overlay onto Machine (and other) UIs.", "16777215 (0xFFFFFF) is no coloring (like GTCE).", - "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)."}) + @Config.Comment({ "The default color to overlay onto Machine (and other) UIs.", + "16777215 (0xFFFFFF) is no coloring (like GTCE).", + "13819135 (0xD2DCFF in decimal) is the classic blue from GT5 (default)." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int defaultUIColor = 0xD2DCFF; // requires mc restart, color is set upon jei plugin registration - @Config.Comment({"The color to use as a background for the Multiblock Preview JEI Page.", - "Default: 13027014 (0xC6C6C6), which is JEI's background color."}) + @Config.Comment({ "The color to use as a background for the Multiblock Preview JEI Page.", + "Default: 13027014 (0xC6C6C6), which is JEI's background color." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) @Config.RequiresMcRestart public int multiblockPreviewColor = 0xC6C6C6; - @Config.Comment({"Whether to use the Spray Can color in UIs when a machine is painted.", "Default: true"}) + @Config.Comment({ "Whether to use the Spray Can color in UIs when a machine is painted.", "Default: true" }) public boolean useSprayCanColorInUI = true; // does not require mc restart, drawn dynamically - @Config.Comment({"The color to use for the text in the Multiblock Preview JEI Page.", - "Default: 3355443 (0x333333), which is minecraft's dark gray color."}) + @Config.Comment({ "The color to use for the text in the Multiblock Preview JEI Page.", + "Default: 3355443 (0x333333), which is minecraft's dark gray color." }) @Config.RangeInt(min = 0, max = 0xFFFFFF) public int multiblockPreviewFontColor = 0x333333; @Config.Comment("Prevent tooltips from blinking for better visibility") public boolean preventBlinkingTooltips = false; - @Config.Comment({"Prevent optical and laser cables from animating when active.", "Default: false"}) + @Config.Comment({ "Prevent optical and laser cables from animating when active.", "Default: false" }) public boolean preventAnimatedCables = false; public static class GuiConfig { - @Config.Comment({"The scrolling speed of widgets", "Default: 13"}) + + @Config.Comment({ "The scrolling speed of widgets", "Default: 13" }) @Config.RangeInt(min = 1) public int scrollSpeed = 13; - @Config.Comment({"If progress bars should move smoothly.", + @Config.Comment({ "If progress bars should move smoothly.", "False is incremental like the Minecraft furnace.", - "Default: true"}) + "Default: true" }) public boolean smoothProgressBars = true; } public static class ArmorHud { - @Config.Comment({"Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1"}) + @Config.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", + "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1" }) @Config.RangeInt(min = 1, max = 4) @Config.SlidingOption public int hudLocation = 1; - @Config.Comment({"Horizontal offset of HUD.", "Default: 0"}) + @Config.Comment({ "Horizontal offset of HUD.", "Default: 0" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int hudOffsetX = 0; - @Config.Comment({"Vertical offset of HUD.", "Default: 0"}) + @Config.Comment({ "Vertical offset of HUD.", "Default: 0" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int hudOffsetY = 0; @@ -450,98 +500,137 @@ public static class ShaderOptions { @Config.Name("Heat Effect") public HeatEffectBloom heatEffectBloom = new HeatEffectBloom(); - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Whether or not to enable Emissive Textures with bloom effect.", "Default: true"}) + @Config.Comment({ "Whether or not to enable Emissive Textures with bloom effect.", "Default: true" }) public boolean emissiveTexturesBloom = true; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 2; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 0.5; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.2; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0.1; - @Config.Comment({"Mipmap Size.", "Higher values increase quality, but are slower to render.", "Default: 5"}) + @Config.Comment({ "Mipmap Size.", "Higher values increase quality, but are slower to render.", + "Default: 5" }) @Config.RangeInt(min = 2, max = 5) @Config.SlidingOption public int nMips = 5; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.5; - @Config.Comment({"Blur Step (bloom range)", "Default: 1"}) + @Config.Comment({ "Blur Step (bloom range)", "Default: 1" }) @Config.RangeDouble(min = 0) public double step = 1; } } public static class FusionBloom { - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.5; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 1; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 1.3; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.3; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0; } public static class HeatEffectBloom { - @Config.Comment({"Whether to use shader programs.", "Default: true"}) + + @Config.Comment({ "Whether to use shader programs.", "Default: true" }) public boolean useShader = true; - @Config.Comment({"Bloom Strength", "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 2"}) + @Config.Comment({ "Bloom Strength", + "OUTPUT = BACKGROUND + BLOOM * {strength} * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 2" }) @Config.RangeDouble(min = 0) public double strength = 1.1; - @Config.Comment({"Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", "2 - Unreal Bloom", "Default: 2"}) + @Config.Comment({ "Bloom Algorithm", "0 - Simple Gaussian Blur Bloom (Fast)", "1 - Unity Bloom", + "2 - Unreal Bloom", "Default: 2" }) @Config.RangeInt(min = 0, max = 2) @Config.SlidingOption public int bloomStyle = 2; - @Config.Comment({"The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + - "(e.g., daytime).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", "This value should be greater than lowBrightnessThreshold.", "Default: 0.5"}) + @Config.Comment({ + "The brightness after bloom should not exceed this value. It can be used to limit the brightness of highlights " + + "(e.g., daytime).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + LT + (1 - BACKGROUND_BRIGHTNESS)*({HT}-LT)))", + "This value should be greater than lowBrightnessThreshold.", "Default: 0.5" }) @Config.RangeDouble(min = 0) public double highBrightnessThreshold = 1.4; - @Config.Comment({"The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + - "(e.g., night/caves).", "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", "This value should be smaller than highBrightnessThreshold.", "Default: 0.2"}) + @Config.Comment({ + "The brightness after bloom should not smaller than this value. It can be used to limit the brightness of dusky parts " + + "(e.g., night/caves).", + "OUTPUT = BACKGROUND + BLOOM * strength * (base + {LT} + (1 - BACKGROUND_BRIGHTNESS)*(HT-{LT})))", + "This value should be smaller than highBrightnessThreshold.", "Default: 0.2" }) @Config.RangeDouble(min = 0) public double lowBrightnessThreshold = 0.6; - @Config.Comment({"The base brightness of the bloom.", "It is similar to strength", "This value should be smaller than highBrightnessThreshold.", "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", "Default: 0.1"}) + @Config.Comment({ "The base brightness of the bloom.", "It is similar to strength", + "This value should be smaller than highBrightnessThreshold.", + "OUTPUT = BACKGROUND + BLOOM * strength * ({base} + LT + (1 - BACKGROUND_BRIGHTNESS)*(HT-LT)))", + "Default: 0.1" }) @Config.RangeDouble(min = 0) public double baseBrightness = 0; } @@ -559,28 +648,28 @@ public static class ToolOptions { @Config.RangeInt(min = 0, max = 14) public int voltageTierNanoSuit = 3; - @Config.Comment({"Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)"}) + @Config.Comment({ "Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvNanoSuit = 3; - @Config.Comment({"QuarkTech Suit Voltage Tier.", "Default: 5 (IV)"}) + @Config.Comment({ "QuarkTech Suit Voltage Tier.", "Default: 5 (IV)" }) @Config.RangeInt(min = 0, max = 14) @Config.SlidingOption public int voltageTierQuarkTech = 5; - @Config.Comment({"Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)"}) + @Config.Comment({ "Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvQuarkTech = 6; - @Config.Comment({"Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)"}) + @Config.Comment({ "Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierImpeller = 2; - @Config.Comment({"Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)"}) + @Config.Comment({ "Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)" }) @Config.RangeInt(min = 0, max = 14) public int voltageTierAdvImpeller = 3; - @Config.Comment({"Random chance for electric tools to take actual damage", "Default: 10%"}) + @Config.Comment({ "Random chance for electric tools to take actual damage", "Default: 10%" }) @Config.RangeInt(min = 0, max = 100) @Config.SlidingOption public int rngDamageElectricTools = 10; @@ -590,7 +679,9 @@ public static class ToolOptions { } public static class ArmorHud { - @Config.Comment({"Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", "3 - left-bottom corner", "4 - right-bottom corner"}) + + @Config.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", + "3 - left-bottom corner", "4 - right-bottom corner" }) public byte hudLocation = 1; @Config.Comment("Horizontal offset of HUD [0 ~ 100)") public byte hudOffsetX = 0; @@ -601,18 +692,18 @@ public static class ArmorHud { public static class NanoSaber { @Config.RangeDouble(min = 0, max = 100) - @Config.Comment({"The additional damage added when the NanoSaber is powered.", "Default: 20.0"}) + @Config.Comment({ "The additional damage added when the NanoSaber is powered.", "Default: 20.0" }) public double nanoSaberDamageBoost = 20; @Config.RangeDouble(min = 0, max = 100) - @Config.Comment({"The base damage of the NanoSaber.", "Default: 5.0"}) + @Config.Comment({ "The base damage of the NanoSaber.", "Default: 5.0" }) public double nanoSaberBaseDamage = 5; - @Config.Comment({"Should Zombies spawn with charged, active NanoSabers on hard difficulty?", "Default: true"}) + @Config.Comment({ "Should Zombies spawn with charged, active NanoSabers on hard difficulty?", "Default: true" }) public boolean zombieSpawnWithSabers = true; @Config.RangeInt(min = 1, max = 512) - @Config.Comment({"The EU/t consumption of the NanoSaber.", "Default: 64"}) + @Config.Comment({ "The EU/t consumption of the NanoSaber.", "Default: 64" }) public int energyConsumption = 64; } } diff --git a/src/main/java/gregtech/common/EventHandlers.java b/src/main/java/gregtech/common/EventHandlers.java index dbe8d76fd7d..a25b6b99716 100644 --- a/src/main/java/gregtech/common/EventHandlers.java +++ b/src/main/java/gregtech/common/EventHandlers.java @@ -17,6 +17,7 @@ import gregtech.common.items.armor.PowerlessJetpack; import gregtech.common.items.behaviors.ToggleEnergyConsumerBehavior; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityEnderman; @@ -85,15 +86,14 @@ public static void onPlayerInteractionRightClickBlock(PlayerInteractEvent.RightC TileEntity tileEntity = event.getWorld().getTileEntity(event.getPos()); if (tileEntity instanceof IGregTechTileEntity) { event.setUseBlock(Event.Result.ALLOW); - } else if (tileEntity instanceof IPipeTile) { + } else if (tileEntity instanceof IPipeTile) { event.setUseBlock(Event.Result.ALLOW); } ItemStack stack = event.getItemStack(); if (!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL) { - if (!event.getWorld().isRemote - && !event.getEntityPlayer().capabilities.isCreativeMode - && GTValues.RNG.nextInt(100) >= ConfigHolder.misc.flintChanceToCreateFire) { + if (!event.getWorld().isRemote && !event.getEntityPlayer().capabilities.isCreativeMode && + GTValues.RNG.nextInt(100) >= ConfigHolder.misc.flintChanceToCreateFire) { stack.damageItem(1, event.getEntityPlayer()); if (stack.getItemDamage() >= stack.getMaxDamage()) { stack.shrink(1); @@ -107,8 +107,10 @@ public static void onPlayerInteractionRightClickBlock(PlayerInteractEvent.RightC public static void onPlayerInteractionLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) { if (event.getEntityPlayer().isCreative()) { TileEntity holder = event.getWorld().getTileEntity(event.getPos()); - if (holder instanceof IGregTechTileEntity && ((IGregTechTileEntity) holder).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { - ((MetaTileEntityCentralMonitor) ((IGregTechTileEntity) holder).getMetaTileEntity()).invalidateStructure(); + if (holder instanceof IGregTechTileEntity && + ((IGregTechTileEntity) holder).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { + ((MetaTileEntityCentralMonitor) ((IGregTechTileEntity) holder).getMetaTileEntity()) + .invalidateStructure(); } } } @@ -127,7 +129,8 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE } tool = ToolClasses.PICKAXE; int harvestLevel = event.getTargetBlock().getBlock().getHarvestLevel(event.getTargetBlock()); - if (!item.isEmpty() && harvestLevel > item.getItem().getHarvestLevel(item, tool, event.getEntityPlayer(), event.getTargetBlock())) { + if (!item.isEmpty() && harvestLevel > + item.getItem().getHarvestLevel(item, tool, event.getEntityPlayer(), event.getTargetBlock())) { event.setCanHarvest(false); } } @@ -137,13 +140,12 @@ public static void onHarvestCheck(net.minecraftforge.event.entity.player.PlayerE public static void onDestroySpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) { ItemStack item = event.getEntityPlayer().getHeldItemMainhand(); String tool = event.getState().getBlock().getHarvestTool(event.getState()); - if (tool != null && !item.isEmpty() && ToolHelper.canMineWithPick(tool) && item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { + if (tool != null && !item.isEmpty() && ToolHelper.canMineWithPick(tool) && + item.getItem().getToolClasses(item).contains(ToolClasses.PICKAXE)) { event.setNewSpeed(event.getNewSpeed() * 0.75f); } } - - @SubscribeEvent(priority = EventPriority.LOW) public static void onEntityLivingFallEvent(LivingFallEvent event) { if (event.getEntity() instanceof EntityPlayerMP) { @@ -157,18 +159,21 @@ public static void onEntityLivingFallEvent(LivingFallEvent event) { if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem) { ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) armor.getItem()).getItem(armor); if (valueItem != null) { - valueItem.getArmorLogic().damageArmor(player, armor, DamageSource.FALL, (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); + valueItem.getArmorLogic().damageArmor(player, armor, DamageSource.FALL, + (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); player.fallDistance = 0; event.setCanceled(true); } - } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorMetaItem && GTUtility.getOrCreateNbtCompound(jet).hasKey("flyMode")) { - ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) jet.getItem()).getItem(jet); - if (valueItem != null) { - valueItem.getArmorLogic().damageArmor(player, jet, DamageSource.FALL, (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); - player.fallDistance = 0; - event.setCanceled(true); - } - } + } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorMetaItem && + GTUtility.getOrCreateNbtCompound(jet).hasKey("flyMode")) { + ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) jet.getItem()).getItem(jet); + if (valueItem != null) { + valueItem.getArmorLogic().damageArmor(player, jet, DamageSource.FALL, + (int) (player.fallDistance - 1.2f), EntityEquipmentSlot.FEET); + player.fallDistance = 0; + event.setCanceled(true); + } + } } } @@ -204,11 +209,13 @@ public static void onLivingEquipmentChangeEvent(LivingEquipmentChangeEvent event @SubscribeEvent @SideOnly(Side.CLIENT) public static void onPlayerTick(TickEvent.PlayerTickEvent event) { - if (event.phase == TickEvent.Phase.START && !event.player.isSpectator() && !(event.player instanceof EntityOtherPlayerMP) && !(event.player instanceof FakePlayer)) { + if (event.phase == TickEvent.Phase.START && !event.player.isSpectator() && + !(event.player instanceof EntityOtherPlayerMP) && !(event.player instanceof FakePlayer)) { ItemStack feetEquip = event.player.getItemStackFromSlot(EntityEquipmentSlot.FEET); if (!lastFeetEquip.getItem().equals(feetEquip.getItem())) { if (lastFeetEquip.getItem() instanceof ArmorMetaItem) { - ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) lastFeetEquip.getItem()).getItem(lastFeetEquip); + ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) lastFeetEquip.getItem()) + .getItem(lastFeetEquip); if (valueItem != null && valueItem.getArmorLogic() instanceof IStepAssist) { event.player.stepHeight = 0.6f; } @@ -250,7 +257,8 @@ public static void onWorldSaveEvent(WorldEvent.Save event) { public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { if (ConfigHolder.misc.spawnTerminal) { NBTTagCompound playerData = event.player.getEntityData(); - NBTTagCompound data = playerData.hasKey(EntityPlayer.PERSISTED_NBT_TAG) ? playerData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG) : new NBTTagCompound(); + NBTTagCompound data = playerData.hasKey(EntityPlayer.PERSISTED_NBT_TAG) ? + playerData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG) : new NBTTagCompound(); if (!data.getBoolean(HAS_TERMINAL)) { ItemStack terminal = MetaItems.TERMINAL.getStackForm(); @@ -268,7 +276,8 @@ public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { @SubscribeEvent public static void onFurnaceFuelBurnTime(FurnaceFuelBurnTimeEvent event) { - if (ItemStack.areItemStacksEqual(event.getItemStack(), FluidUtil.getFilledBucket(Materials.Creosote.getFluid(1000)))) { + if (ItemStack.areItemStacksEqual(event.getItemStack(), + FluidUtil.getFilledBucket(Materials.Creosote.getFluid(1000)))) { event.setBurnTime(6400); } } diff --git a/src/main/java/gregtech/common/MetaEntities.java b/src/main/java/gregtech/common/MetaEntities.java index 7e09df91d5b..00efb35f87d 100644 --- a/src/main/java/gregtech/common/MetaEntities.java +++ b/src/main/java/gregtech/common/MetaEntities.java @@ -8,6 +8,7 @@ import gregtech.common.entities.DynamiteEntity; import gregtech.common.entities.GTBoatEntity; import gregtech.common.entities.PortalEntity; + import net.minecraft.client.Minecraft; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -17,14 +18,18 @@ public class MetaEntities { public static void init() { - EntityRegistry.registerModEntity(GTUtility.gregtechId("dynamite"), DynamiteEntity.class, "Dynamite", 1, GregTechAPI.instance, 64, 3, true); - EntityRegistry.registerModEntity(GTUtility.gregtechId("gtportal"), PortalEntity.class, "GTPortal", 2, GregTechAPI.instance, 64, 5, true); - EntityRegistry.registerModEntity(GTUtility.gregtechId("gtboat"), GTBoatEntity.class, "GTBoat", 3, GregTechAPI.instance, 64, 2, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("dynamite"), DynamiteEntity.class, "Dynamite", 1, + GregTechAPI.instance, 64, 3, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("gtportal"), PortalEntity.class, "GTPortal", 2, + GregTechAPI.instance, 64, 5, true); + EntityRegistry.registerModEntity(GTUtility.gregtechId("gtboat"), GTBoatEntity.class, "GTBoat", 3, + GregTechAPI.instance, 64, 2, true); } @SideOnly(Side.CLIENT) public static void initRenderers() { - RenderingRegistry.registerEntityRenderingHandler(DynamiteEntity.class, manager -> new DynamiteRenderer(manager, Minecraft.getMinecraft().getRenderItem())); + RenderingRegistry.registerEntityRenderingHandler(DynamiteEntity.class, + manager -> new DynamiteRenderer(manager, Minecraft.getMinecraft().getRenderItem())); RenderingRegistry.registerEntityRenderingHandler(PortalEntity.class, PortalRenderer::new); RenderingRegistry.registerEntityRenderingHandler(GTBoatEntity.class, GTBoatRenderer::new); } diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index 77ba6c49b70..95731245465 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -1,6 +1,5 @@ package gregtech.common; -import codechicken.lib.vec.*; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -22,6 +21,7 @@ import gregtech.api.util.TaskScheduler; import gregtech.common.items.tool.rotation.CustomBlockRotations; import gregtech.common.items.tool.rotation.ICustomRotationBehavior; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -55,15 +55,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.vec.*; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Iterator; import java.util.Set; import java.util.function.BooleanSupplier; import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @Mod.EventBusSubscriber(modid = GTValues.MODID) public class ToolEventHandlers { @@ -80,7 +83,8 @@ public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { // Transfer over remaining charge to power units if (brokenStack.hasCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) && def.isElectric()) { long remainingCharge = def.getCharge(event.getOriginal()); - IElectricItem electricStack = brokenStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricStack = brokenStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricStack != null) { // update the max charge of the item, if possible // applies to items like power units, which can have different max charges depending on their recipe @@ -104,14 +108,13 @@ public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { } } - @SubscribeEvent public static void onPlayerEntityInteract(@Nonnull PlayerInteractEvent.EntityInteract event) { ItemStack itemStack = event.getItemStack(); Item item = itemStack.getItem(); /* - Handle item frame power unit duping + * Handle item frame power unit duping */ if (item instanceof IGTTool) { Entity entity = event.getTarget(); @@ -143,11 +146,13 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) { return; } if (!event.isSilkTouching()) { - ToolHelper.applyHammerDropConversion(stack, event.getState(), event.getDrops(), event.getFortuneLevel(), event.getDropChance(), player.getRNG()); + ToolHelper.applyHammerDropConversion(stack, event.getState(), event.getDrops(), event.getFortuneLevel(), + event.getDropChance(), player.getRNG()); } NBTTagCompound behaviorTag = ToolHelper.getBehaviorsTag(stack); Block block = event.getState().getBlock(); - if (!event.isSilkTouching() && (block == Blocks.ICE || block == Blocks.PACKED_ICE) && behaviorTag.getBoolean(ToolHelper.HARVEST_ICE_KEY)) { + if (!event.isSilkTouching() && (block == Blocks.ICE || block == Blocks.PACKED_ICE) && + behaviorTag.getBoolean(ToolHelper.HARVEST_ICE_KEY)) { Item iceBlock = Item.getItemFromBlock(block); if (event.getDrops().stream().noneMatch(drop -> drop.getItem() == iceBlock)) { event.getDrops().add(new ItemStack(iceBlock)); @@ -172,7 +177,8 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) { EntityItem drop = new EntityItem(event.getWorld()); drop.setItem(dropStack); - if (ForgeEventFactory.onItemPickup(drop, player) == -1 || player.addItemStackToInventory(dropStack)) { + if (ForgeEventFactory.onItemPickup(drop, player) == -1 || + player.addItemStackToInventory(dropStack)) { dropItr.remove(); } } @@ -205,7 +211,7 @@ public static void onAnvilUpdateEvent(AnvilUpdateEvent event) { @SubscribeEvent @SideOnly(Side.CLIENT) public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) { - //noinspection ConstantConditions + // noinspection ConstantConditions if (event.getTarget().getBlockPos() == null) return; EntityPlayer player = event.getPlayer(); @@ -225,13 +231,16 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) // AoE selection box and block damage overlay if (!sneaking && stack.getItem() instanceof IGTTool tool) { state = state.getActualState(player.world, pos); - if (!ToolHelper.isToolEffective(state, tool.getToolClasses(stack), tool.getTotalHarvestLevel(stack))) return; - Set validPositions = ToolHelper.getHarvestableBlocks(stack, player.world, player, event.getTarget()); + if (!ToolHelper.isToolEffective(state, tool.getToolClasses(stack), tool.getTotalHarvestLevel(stack))) + return; + Set validPositions = ToolHelper.getHarvestableBlocks(stack, player.world, player, + event.getTarget()); if (validPositions.isEmpty()) return; float partialTicks = event.getPartialTicks(); for (BlockPos validPosition : validPositions) { - event.getContext().drawSelectionBox(player, new RayTraceResult(Vec3d.ZERO, player.getHorizontalFacing(), validPosition), 0, partialTicks); + event.getContext().drawSelectionBox(player, + new RayTraceResult(Vec3d.ZERO, player.getHorizontalFacing(), validPosition), 0, partialTicks); } DestroyBlockProgress progress = event.getContext().damagedBlocks.get(player.getEntityId()); @@ -252,7 +261,8 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) TileEntity tileEntity = mc.world.getTileEntity(validPosition); if (tileEntity == null || tileEntity.canRenderBreaking()) { TextureAtlasSprite sprite = event.getContext().destroyBlockIcons[damage]; - rendererDispatcher.renderBlockDamage(mc.world.getBlockState(validPosition), validPosition, sprite, mc.world); + rendererDispatcher.renderBlockDamage(mc.world.getBlockState(validPosition), validPosition, + sprite, mc.world); } } Tessellator.getInstance().draw(); @@ -267,7 +277,8 @@ public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) * Sets up for rendering blocks with break progress */ private static void preRenderDamagedBlocks() { - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, + GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); @@ -291,19 +302,22 @@ private static void postRenderDamagedBlocks() { } @SideOnly(Side.CLIENT) - private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, ItemStack mainHand, ItemStack offHand, boolean isSneaking) { - if (state.getBlock() instanceof BlockPipe pipe) { - if (isSneaking && (mainHand.isEmpty() || mainHand.getItem().getClass() == Item.getItemFromBlock(pipe).getClass())) { + private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, + ItemStack mainHand, ItemStack offHand, boolean isSneaking) { + if (state.getBlock() instanceof BlockPipepipe) { + if (isSneaking && + (mainHand.isEmpty() || mainHand.getItem().getClass() == Item.getItemFromBlock(pipe).getClass())) { return true; } else { Set mainToolClasses = mainHand.getItem().getToolClasses(mainHand); Set offToolClasses = offHand.getItem().getToolClasses(offHand); if (mainToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state)) || - offToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state))) return true; + offToolClasses.stream().anyMatch(s -> pipe.isToolEffective(s, state))) + return true; BooleanSupplier hasCover; Predicate canCover; - if (tile instanceof IPipeTile pipeTile) { + if (tile instanceof IPipeTilepipeTile) { final boolean hasAnyCover = pipeTile.getCoverableImplementation().hasAnyCover(); if (hasAnyCover) { if (mainToolClasses.contains(ToolClasses.SCREWDRIVER)) return true; @@ -352,10 +366,13 @@ private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nul private static float bColour; @SideOnly(Side.CLIENT) - private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos pos, IBlockState state, EnumFacing facing, TileEntity tile, float partialTicks) { + private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos pos, IBlockState state, + EnumFacing facing, TileEntity tile, float partialTicks) { if (player.world.getWorldBorder().contains(pos)) { GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ZERO); GlStateManager.glLineWidth(2.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); @@ -365,15 +382,18 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos AxisAlignedBB box = state.getSelectedBoundingBox(player.world, pos).grow(0.002D).offset(-d3, -d4, -d5); RenderGlobal.drawSelectionBoundingBox(box, 1, 1, 1, 0.4F); - rColour = gColour = bColour = 0.2F + (float) Math.sin((float) (System.currentTimeMillis() % (Math.PI * 800)) / 800) / 2; + rColour = gColour = bColour = 0.2F + + (float) Math.sin((float) (System.currentTimeMillis() % (Math.PI * 800)) / 800) / 2; if (tile instanceof TileEntityPipeBase) { TileEntityPipeBase tepb = (TileEntityPipeBase) tile; - drawGridOverlays(facing, box, face -> tepb.isConnected(face) || tepb.getCoverableImplementation().getCoverAtSide(face) != null); + drawGridOverlays(facing, box, face -> tepb.isConnected(face) || + tepb.getCoverableImplementation().getCoverAtSide(face) != null); } else if (tile instanceof MetaTileEntityHolder) { MetaTileEntity mte = ((MetaTileEntityHolder) tile).getMetaTileEntity(); drawGridOverlays(facing, box, mte::isSideUsed); - if (mte instanceof MultiblockControllerBase multi && multi.allowsExtendedFacing() && ToolHelper.isTool(player.getHeldItemMainhand(), ToolClasses.WRENCH)) { + if (mte instanceof MultiblockControllerBase multi && multi.allowsExtendedFacing() && + ToolHelper.isTool(player.getHeldItemMainhand(), ToolClasses.WRENCH)) { // set up some render state first GL11.glPushMatrix(); GL11.glTranslated(pos.getX() - (int) d3, pos.getY() - (int) d4, pos.getZ() - (int) d5); @@ -391,8 +411,10 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos } } else { // render on the side of the grid - drawRotationMarker(ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ - ROTATION_MARKER_TRANSFORMS_SIDES[facing.getIndex() * 6 + multi.getFrontFacing().getIndex()]], player.isSneaking()); + drawRotationMarker( + ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[facing + .getIndex() * 6 + multi.getFrontFacing().getIndex()]], + player.isSneaking()); } GL11.glPopMatrix(); } @@ -622,14 +644,20 @@ private static void drawGridOverlays(EnumFacing facing, AxisAlignedBB box, Predi Vector3 localXShiftVert = new Vector3(0, 0, 0); for (int j = 0; j < 2; j++) { startLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert)); - endLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).add(shift).subtract(shiftVert)); + endLine(buffer, + topLeft.copy().add(localXShift).add(localXShiftVert).add(shift).subtract(shiftVert)); startLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).add(shift)); endLine(buffer, topLeft.copy().add(localXShift).add(localXShiftVert).subtract(shiftVert)); - localXShiftVert.add(bottomLeft.copy().subtract(topLeft).add(shiftVert)); // Move by the vector from the top to the bottom, minus the shift from the edge. + localXShiftVert.add(bottomLeft.copy().subtract(topLeft).add(shiftVert)); // Move by the vector from + // the top to the bottom, + // minus the shift from the + // edge. } - localXShift.add(topRight.copy().subtract(topLeft).subtract(shift)); // Move by the vector from the left to the right, minus the shift from the edge. + localXShift.add(topRight.copy().subtract(topLeft).subtract(shift)); // Move by the vector from the left + // to the right, minus the shift + // from the edge. } } @@ -653,14 +681,14 @@ private static void endLine(BufferBuilder buffer, Vector3 vec) { new Scale(0.25).with(new Translation(0, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(0.375, 0, 0)).compile(), new Scale(0.25).with(new Translation(0, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile()}; + new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile() }; private static final int[] ROTATION_MARKER_TRANSFORMS_SIDES = { -1, -1, 2, 0, 3, 1, -1, -1, 0, 2, 3, 1, 0, 2, -1, -1, 3, 1, 2, 0, -1, -1, 3, 1, 1, 3, 2, 0, -1, -1, 3, 1, 2, 0, -1, -1 }; private static final Transformation[] ROTATION_MARKER_TRANSFORMS_CORNER = { new Scale(0.25).with(new Translation(0.375, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(-0.375, 0, 0.375)).compile(), new Scale(0.25).with(new Translation(0.375, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile()}; + new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile() }; private static int rotationMarkerDisplayList; private static boolean rotationMarkerDisplayListCompiled = false; diff --git a/src/main/java/gregtech/common/blocks/BlockAsphalt.java b/src/main/java/gregtech/common/blocks/BlockAsphalt.java index aec0ea5bec5..c5c9b5b28ac 100644 --- a/src/main/java/gregtech/common/blocks/BlockAsphalt.java +++ b/src/main/java/gregtech/common/blocks/BlockAsphalt.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -26,7 +27,8 @@ public BlockAsphalt() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java index 86d2589f7ad..e89734051b1 100644 --- a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java +++ b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java @@ -4,6 +4,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.metatileentity.multiblock.IBatteryData; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,6 +16,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -33,12 +35,14 @@ public BlockBatteryPart() { } @Override - public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, @NotNull EntityLiving.SpawnPlacementType placementType) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType placementType) { return false; } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World world, List tooltip, @NotNull ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, List tooltip, + @NotNull ITooltipFlag advanced) { super.addInformation(stack, world, tooltip, advanced); BatteryPartType batteryType = getState(stack); @@ -50,6 +54,7 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World world, List } public enum BatteryPartType implements IStringSerializable, IBatteryData { + EMPTY_TIER_I, LAPOTRONIC_EV(GTValues.EV, 25_000_000L * 6), // Lapotron Crystal * 6 LAPOTRONIC_IV(GTValues.IV, 250_000_000L * 6), // Lapotronic Orb * 6 diff --git a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java index f8585341695..5ba9ef69c02 100644 --- a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockBoilerCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -61,5 +63,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java index 75fe5f1deb5..f8e5d91cc33 100644 --- a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java +++ b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.GTValues; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; @@ -15,9 +16,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockBrittleCharcoal extends Block { @@ -31,12 +33,14 @@ public BlockBrittleCharcoal() { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { drops.add(new ItemStack(Items.COAL, 1 + GTValues.RNG.nextInt(2), 1)); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, + @Nonnull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.1")); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.2")); diff --git a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java index 7a790f2c897..59828acd886 100644 --- a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,10 +16,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; @ParametersAreNonnullByDefault public class BlockCleanroomCasing extends VariantBlock implements IStateHarvestLevel { @@ -33,7 +35,8 @@ public BlockCleanroomCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -74,9 +77,12 @@ public String getHarvestTool(IBlockState state) { } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, @Nonnull List tooltip, @Nonnull ITooltipFlag advanced) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World player, @Nonnull List tooltip, + @Nonnull ITooltipFlag advanced) { super.addInformation(stack, player, tooltip, advanced); - if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING))) tooltip.add(I18n.format("tile.cleanroom_casing.filter.tooltip")); - if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING_STERILE))) tooltip.add(I18n.format("tile.cleanroom_casing.filter_sterile.tooltip")); + if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING))) + tooltip.add(I18n.format("tile.cleanroom_casing.filter.tooltip")); + if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING_STERILE))) + tooltip.add(I18n.format("tile.cleanroom_casing.filter_sterile.tooltip")); } } diff --git a/src/main/java/gregtech/common/blocks/BlockColored.java b/src/main/java/gregtech/common/blocks/BlockColored.java index 8b6d8b1d773..9f84069c345 100644 --- a/src/main/java/gregtech/common/blocks/BlockColored.java +++ b/src/main/java/gregtech/common/blocks/BlockColored.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.block.VariantBlock; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -14,10 +15,12 @@ public class BlockColored extends VariantBlock { public BlockColored() { - this(net.minecraft.block.material.Material.IRON, "block_colored", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + this(net.minecraft.block.material.Material.IRON, "block_colored", 2.0f, 5.0f, SoundType.METAL, + EnumDyeColor.WHITE); } - public BlockColored(Material material, String translationKey, float hardness, float resistance, SoundType soundType, EnumDyeColor defaultColor) { + public BlockColored(Material material, String translationKey, float hardness, float resistance, SoundType soundType, + EnumDyeColor defaultColor) { super(material); setTranslationKey(translationKey); setHardness(hardness); @@ -27,7 +30,8 @@ public BlockColored(Material material, String translationKey, float hardness, fl } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -43,7 +47,6 @@ public boolean checkApplicableBlocks(IBlockState state) { @Override public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeColor color) { - if (world.getBlockState(pos) != getState(color)) { world.setBlockState(pos, getState(color)); return true; @@ -51,5 +54,4 @@ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeC return false; } - } diff --git a/src/main/java/gregtech/common/blocks/BlockCompressed.java b/src/main/java/gregtech/common/blocks/BlockCompressed.java index d4cbf7e1866..5ebc94cfda2 100644 --- a/src/main/java/gregtech/common/blocks/BlockCompressed.java +++ b/src/main/java/gregtech/common/blocks/BlockCompressed.java @@ -9,6 +9,7 @@ import gregtech.client.model.modelfactories.MaterialBlockModelLoader; import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; @@ -21,15 +22,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public abstract class BlockCompressed extends BlockMaterialBase { public static BlockCompressed create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockCompressed() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -63,7 +66,8 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { return SoundType.STONE; diff --git a/src/main/java/gregtech/common/blocks/BlockComputerCasing.java b/src/main/java/gregtech/common/blocks/BlockComputerCasing.java index 2ad69cbf422..95ee6542223 100644 --- a/src/main/java/gregtech/common/blocks/BlockComputerCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockComputerCasing.java @@ -2,9 +2,11 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; + import org.jetbrains.annotations.NotNull; public class BlockComputerCasing extends VariantBlock { diff --git a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java index c025c16f891..250ca9dda00 100644 --- a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java @@ -4,6 +4,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.blocks.BlockFireboxCasing.FireboxCasingType; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -26,7 +27,8 @@ public BlockFireboxCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -61,5 +63,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockFrame.java b/src/main/java/gregtech/common/blocks/BlockFrame.java index f948a502214..170c123a7e3 100644 --- a/src/main/java/gregtech/common/blocks/BlockFrame.java +++ b/src/main/java/gregtech/common/blocks/BlockFrame.java @@ -15,6 +15,7 @@ import gregtech.client.model.modelfactories.MaterialBlockModelLoader; import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.EnumPushReaction; @@ -41,9 +42,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public abstract class BlockFrame extends BlockMaterialBase { @@ -52,6 +54,7 @@ public abstract class BlockFrame extends BlockMaterialBase { public static BlockFrame create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockFrame() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -79,7 +82,8 @@ public String getHarvestTool(IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return SoundType.WOOD; @@ -112,11 +116,13 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } - public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, ItemStack stackInHand, EnumFacing facing) { + public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, + ItemStack stackInHand, EnumFacing facing) { BlockPipe blockPipe = (BlockPipe) ((ItemBlockPipe) stackInHand.getItem()).getBlock(); if (blockPipe.getItemPipeType(stackInHand).getThickness() < 1) { ItemBlock itemBlock = (ItemBlock) stackInHand.getItem(); @@ -131,7 +137,8 @@ public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState st return false; } SoundType type = blockPipe.getSoundType(state, worldIn, pos, playerIn); - worldIn.playSound(playerIn, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + worldIn.playSound(playerIn, pos, type.getPlaceSound(), SoundCategory.BLOCKS, + (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); if (!playerIn.capabilities.isCreativeMode) { stackInHand.shrink(1); } @@ -189,9 +196,11 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No continue; } if (canPlaceBlockAt(world, blockPos)) { - world.setBlockState(blockPos, frameBlock.getStateFromMeta(stack.getItem().getMetadata(stack.getItemDamage()))); + world.setBlockState(blockPos, + frameBlock.getStateFromMeta(stack.getItem().getMetadata(stack.getItemDamage()))); SoundType type = getSoundType(stack); - world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, + type.getPitch() * 0.8F); if (!player.capabilities.isCreativeMode) { stack.shrink(1); } @@ -200,7 +209,8 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No } else if (te instanceof TileEntityPipeBase && ((TileEntityPipeBase) te).getFrameMaterial() == null) { ((TileEntityPipeBase) te).setFrameMaterial(frameBlock.getGtMaterial(stack)); SoundType type = getSoundType(stack); - world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, + type.getPitch() * 0.8F); if (!player.capabilities.isCreativeMode) { stack.shrink(1); } @@ -216,7 +226,8 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, Entity entityIn) { + public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + Entity entityIn) { entityIn.motionX = MathHelper.clamp(entityIn.motionX, -0.15, 0.15); entityIn.motionZ = MathHelper.clamp(entityIn.motionZ, -0.15, 0.15); entityIn.fallDistance = 0.0F; @@ -240,7 +251,8 @@ public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { return COLLISION_BOX; } @@ -259,7 +271,8 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } diff --git a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java index 65aaa08806c..06ab2ece46b 100644 --- a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLiving; @@ -24,7 +25,8 @@ public BlockFusionCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java index 6ff2f9a5223..a5812dd9348 100644 --- a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -32,7 +33,8 @@ public BlockGlassCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } @@ -44,7 +46,8 @@ public BlockRenderLayer getRenderLayer() { @Override public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { - return getState(state) == CasingType.TEMPERED_GLASS ? layer == BlockRenderLayer.TRANSLUCENT : super.canRenderInLayer(state, layer); + return getState(state) == CasingType.TEMPERED_GLASS ? layer == BlockRenderLayer.TRANSLUCENT : + super.canRenderInLayer(state, layer); } @Override @@ -88,6 +91,5 @@ public enum CasingType implements IStringSerializable { public String getName() { return this.name; } - } } diff --git a/src/main/java/gregtech/common/blocks/BlockGregStairs.java b/src/main/java/gregtech/common/blocks/BlockGregStairs.java index beb20fd6805..88bc3490190 100644 --- a/src/main/java/gregtech/common/blocks/BlockGregStairs.java +++ b/src/main/java/gregtech/common/blocks/BlockGregStairs.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockStairs; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; @@ -20,7 +21,8 @@ public BlockGregStairs(IBlockState state) { } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java index e6928599e96..a94715647bd 100644 --- a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -28,7 +29,8 @@ public BlockHermeticCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockLamp.java b/src/main/java/gregtech/common/blocks/BlockLamp.java index 76d0260f932..bb37e097a7d 100644 --- a/src/main/java/gregtech/common/blocks/BlockLamp.java +++ b/src/main/java/gregtech/common/blocks/BlockLamp.java @@ -8,6 +8,7 @@ import gregtech.client.model.lamp.LampBakedModel; import gregtech.client.model.lamp.LampModelType; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; @@ -30,14 +31,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class BlockLamp extends Block { @@ -187,7 +189,8 @@ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { public void onModelRegister() { Map models = new HashMap<>(); for (IBlockState state : getBlockState().getValidStates()) { - LampBakedModel.Entry entry = LampBakedModel.register(color, getModelType(), state.getValue(BLOOM), isLightActive(state)); + LampBakedModel.Entry entry = LampBakedModel.register(color, getModelType(), state.getValue(BLOOM), + isLightActive(state)); models.put(state, entry.getBlockModelId()); if (state.getValue(POWERED)) continue; Item item = Item.getItemFromBlock(this); @@ -204,7 +207,8 @@ protected LampModelType getModelType() { } public void registerOreDict() { - OreDictUnifier.registerOre(new ItemStack(this, 1, GTValues.W), OrePrefix.lampGt, MarkerMaterials.Color.COLORS.get(color)); + OreDictUnifier.registerOre(new ItemStack(this, 1, GTValues.W), OrePrefix.lampGt, + MarkerMaterials.Color.COLORS.get(color)); } public static boolean isLightActive(IBlockState state) { diff --git a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java index 26467f777b4..3f54c3c426e 100644 --- a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java +++ b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java @@ -2,6 +2,7 @@ import gregtech.client.model.lamp.LampModelType; import gregtech.client.utils.BloomEffectUtil; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumDyeColor; import net.minecraft.util.BlockRenderLayer; @@ -16,7 +17,8 @@ public BlockLampBorderless(EnumDyeColor color) { @Override public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { - return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), BlockRenderLayer.SOLID); + return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), + BlockRenderLayer.SOLID); } @Nonnull diff --git a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java index 98fea579f7c..46f313e64a9 100644 --- a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java @@ -4,6 +4,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,9 +16,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import java.util.Locale; + import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.Locale; import static gregtech.api.GTValues.VOLTAGE_NAMES; @@ -50,7 +52,7 @@ public void getSubBlocks(CreativeTabs tab, NonNullList list) { public enum MachineCasingType implements IStringSerializable { - //Voltage-tiered casings + // Voltage-tiered casings ULV(makeName(VOLTAGE_NAMES[GTValues.ULV])), LV(makeName(VOLTAGE_NAMES[GTValues.LV])), MV(makeName(VOLTAGE_NAMES[GTValues.MV])), diff --git a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java index 2498cc72cca..ff551e6bd6a 100644 --- a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java +++ b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java @@ -5,6 +5,7 @@ import gregtech.api.unification.material.info.MaterialFlags; import gregtech.api.util.GTUtility; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.state.BlockStateContainer; diff --git a/src/main/java/gregtech/common/blocks/BlockMetalCasing.java b/src/main/java/gregtech/common/blocks/BlockMetalCasing.java index 56fad410076..9386de8dba8 100644 --- a/src/main/java/gregtech/common/blocks/BlockMetalCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMetalCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockMetalCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -42,8 +44,7 @@ public enum MetalCasingType implements IStringSerializable, IStateHarvestLevel { COKE_BRICKS("coke_bricks", 1), PTFE_INERT_CASING("ptfe_inert", 0), HSSE_STURDY("hsse_sturdy", 3), - PALLADIUM_SUBSTATION("palladium_substation", 3) - ; + PALLADIUM_SUBSTATION("palladium_substation", 3); private final String name; private final int harvestLevel; @@ -69,5 +70,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java index 30e7995c7b2..92848f68cf0 100644 --- a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantActiveBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -25,7 +26,8 @@ public BlockMultiblockCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -48,7 +50,5 @@ public enum MultiblockCasingType implements IStringSerializable { public String getName() { return this.name; } - } - } diff --git a/src/main/java/gregtech/common/blocks/BlockOre.java b/src/main/java/gregtech/common/blocks/BlockOre.java index 13499872741..b91135bc0d1 100644 --- a/src/main/java/gregtech/common/blocks/BlockOre.java +++ b/src/main/java/gregtech/common/blocks/BlockOre.java @@ -13,6 +13,7 @@ import gregtech.client.model.OreBakedModel; import gregtech.client.utils.BloomEffectUtil; import gregtech.common.blocks.properties.PropertyStoneType; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockStateContainer; @@ -32,12 +33,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Objects; import java.util.Random; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class BlockOre extends Block implements IBlockOre { public final PropertyStoneType STONE_TYPE; @@ -107,7 +109,8 @@ public int damageDropped(@Nonnull IBlockState state) { @Nonnull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { StoneType stoneType = state.getValue(STONE_TYPE); return stoneType.soundType; } @@ -122,7 +125,8 @@ public String getHarvestTool(IBlockState state) { @Override public int getHarvestLevel(IBlockState state) { // this is save because ore blocks and stone types only generate for materials with dust property - return Math.max(state.getValue(STONE_TYPE).stoneMaterial.getBlockHarvestLevel(), material.getBlockHarvestLevel()); + return Math.max(state.getValue(STONE_TYPE).stoneMaterial.getBlockHarvestLevel(), + material.getBlockHarvestLevel()); } @Nonnull @@ -152,7 +156,8 @@ public int getMetaFromState(IBlockState state) { @Nonnull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { // Still get correct block even if shouldBeDroppedAsItem is false return GTUtility.toItem(state); } @@ -195,8 +200,7 @@ public void onModelRegister() { ModelLoader.setCustomStateMapper(this, b -> b.getBlockState().getValidStates().stream() .collect(Collectors.toMap( s -> s, - s -> OreBakedModel.registerOreEntry(s.getValue(STONE_TYPE), this.material) - ))); + s -> OreBakedModel.registerOreEntry(s.getValue(STONE_TYPE), this.material)))); for (IBlockState state : this.getBlockState().getValidStates()) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), OreBakedModel.registerOreEntry(state.getValue(STONE_TYPE), this.material)); diff --git a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java index 72d4f0ef864..01c0b5d393e 100644 --- a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -15,10 +16,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; @ParametersAreNonnullByDefault public class BlockSteamCasing extends VariantBlock { @@ -33,7 +35,8 @@ public BlockSteamCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, + EntityLiving.SpawnPlacementType type) { return false; } diff --git a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java index dc44d26821a..dc06466524e 100755 --- a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java +++ b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java @@ -7,6 +7,7 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.api.util.GTUtility; import gregtech.common.blocks.properties.PropertyMaterial; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockFaceShape; @@ -30,12 +31,15 @@ @SuppressWarnings("deprecation") public abstract class BlockSurfaceRock extends BlockMaterialBase { - private static final AxisAlignedBB STONE_AABB = new AxisAlignedBB(2.0 / 16.0, 0.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0); - public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(GTUtility.gregtechId("surface_rock"), "normal"); + private static final AxisAlignedBB STONE_AABB = new AxisAlignedBB(2.0 / 16.0, 0.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0, + 2.0 / 16.0, 14.0 / 16.0); + public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation( + GTUtility.gregtechId("surface_rock"), "normal"); public static BlockSurfaceRock create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockSurfaceRock() { + @Nonnull @Override public PropertyMaterial getVariantProperty() { @@ -57,7 +61,9 @@ public String getHarvestTool(@Nonnull IBlockState state) { } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { dropBlockAsItem(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); playerIn.swingArm(hand); @@ -66,13 +72,15 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ @Nonnull @Override - public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { + public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + @Nullable Entity entity) { return SoundType.GROUND; } @Override @Nonnull - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, @Nonnull BlockPos pos) { + public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, + @Nonnull BlockPos pos) { return STONE_AABB; } @@ -82,12 +90,14 @@ private ItemStack getDropStack(IBlockState state, int amount) { @Override @Nonnull - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, + @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { return getDropStack(state, 1); } @Override - public void getDrops(NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, int fortune) { + public void getDrops(NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull IBlockState state, int fortune) { int amount = 3 + GTValues.RNG.nextInt((int) (2 + fortune * 1.5)); drops.add(getDropStack(state, amount)); } @@ -103,9 +113,11 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, BlockPos fromPos) { + public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, + @Nonnull Block blockIn, BlockPos fromPos) { if (fromPos.up().equals(pos)) { - if (worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != BlockFaceShape.SOLID) { + if (worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != + BlockFaceShape.SOLID) { worldIn.destroyBlock(pos, true); } } @@ -113,7 +125,8 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Override @Nonnull - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java index c3173ed2129..984b4869533 100644 --- a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java @@ -3,6 +3,7 @@ import gregtech.api.block.IStateHarvestLevel; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -68,5 +69,4 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } } - } diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign.java b/src/main/java/gregtech/common/blocks/BlockWarningSign.java index fd060b459aa..d35241a8699 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; @@ -52,7 +53,5 @@ public enum SignType implements IStringSerializable { public String getName() { return this.name; } - } - } diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java index 05ad51ae3a5..bb03ca19a3a 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 9fff79fde24..8587e149364 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -9,6 +9,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityMultiSmelter; + import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -23,9 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockWireCoil extends VariantActiveBlock { @@ -46,7 +48,8 @@ public BlockRenderLayer getRenderLayer() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, List lines, @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, List lines, + @Nonnull ITooltipFlag tooltipFlag) { super.addInformation(itemStack, worldIn, lines, tooltipFlag); // noinspection rawtypes, unchecked @@ -60,7 +63,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn int coilTier = coilType.ordinal(); lines.add(I18n.format("tile.wire_coil.tooltip_smelter")); lines.add(I18n.format("tile.wire_coil.tooltip_parallel_smelter", coilType.level * 32)); - int EUt = MetaTileEntityMultiSmelter.getEUtForParallel(MetaTileEntityMultiSmelter.getMaxParallel(coilType.getLevel()), coilType.getEnergyDiscount()); + int EUt = MetaTileEntityMultiSmelter.getEUtForParallel( + MetaTileEntityMultiSmelter.getMaxParallel(coilType.getLevel()), coilType.getEnergyDiscount()); lines.add(I18n.format("tile.wire_coil.tooltip_energy_smelter", EUt)); lines.add(I18n.format("tile.wire_coil.tooltip_pyro")); lines.add(I18n.format("tile.wire_coil.tooltip_speed_pyro", coilTier == 0 ? 75 : 50 * (coilTier + 1))); @@ -72,7 +76,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } @@ -93,9 +98,9 @@ public enum CoilType implements IStringSerializable, IHeatingCoilBlockStats { TRITANIUM("tritanium", 10800, 16, 8, Materials.Tritanium); private final String name; - //electric blast furnace properties + // electric blast furnace properties private final int coilTemperature; - //multi smelter properties + // multi smelter properties private final int level; private final int energyDiscount; private final Material material; diff --git a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java index 75564c3ad53..b8ac343fe6d 100644 --- a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java +++ b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.unification.ore.OrePrefix; + import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index 385b2365566..64e5fd1abf4 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -1,12 +1,9 @@ package gregtech.common.blocks; -import com.google.common.collect.ImmutableMap; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.BlockMachine; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.pipenet.longdist.BlockLongDistancePipe; -import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; -import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; @@ -32,10 +29,12 @@ import gregtech.common.pipelike.cable.tile.TileEntityCableTickable; import gregtech.common.pipelike.fluidpipe.BlockFluidPipe; import gregtech.common.pipelike.fluidpipe.FluidPipeType; +import gregtech.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; import gregtech.common.pipelike.itempipe.BlockItemPipe; import gregtech.common.pipelike.itempipe.ItemPipeType; +import gregtech.common.pipelike.itempipe.longdistance.LDItemPipeType; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipeTickable; import gregtech.common.pipelike.laser.BlockLaserPipe; @@ -44,9 +43,7 @@ import gregtech.common.pipelike.optical.BlockOpticalPipe; import gregtech.common.pipelike.optical.OpticalPipeType; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; -import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.*; import net.minecraft.block.BlockLog.EnumAxis; import net.minecraft.block.BlockSlab.EnumBlockHalf; @@ -70,12 +67,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.google.common.collect.ImmutableMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; import java.util.Map.Entry; import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + import static gregtech.api.unification.material.info.MaterialFlags.FORCE_GENERATE_BLOCK; import static gregtech.api.unification.material.info.MaterialFlags.GENERATE_FRAME; import static gregtech.api.util.GTUtility.gregtechId; @@ -115,7 +118,8 @@ private MetaBlocks() {} public static BlockAsphalt ASPHALT; - public static final EnumMap STONE_BLOCKS = new EnumMap<>(StoneVariantBlock.StoneVariant.class); + public static final EnumMap STONE_BLOCKS = new EnumMap<>( + StoneVariantBlock.StoneVariant.class); public static BlockFoam FOAM; public static BlockFoam REINFORCED_FOAM; @@ -288,26 +292,31 @@ public static void init() { BRITTLE_CHARCOAL = new BlockBrittleCharcoal(); BRITTLE_CHARCOAL.setRegistryName("brittle_charcoal"); - METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "metal_sheet", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "metal_sheet", 2.0f, 5.0f, + SoundType.METAL, EnumDyeColor.WHITE); METAL_SHEET.setRegistryName("metal_sheet"); - LARGE_METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "large_metal_sheet", 2.0f, 5.0f, SoundType.METAL, EnumDyeColor.WHITE); + LARGE_METAL_SHEET = new BlockColored(net.minecraft.block.material.Material.IRON, "large_metal_sheet", 2.0f, + 5.0f, SoundType.METAL, EnumDyeColor.WHITE); LARGE_METAL_SHEET.setRegistryName("large_metal_sheet"); - STUDS = new BlockColored(net.minecraft.block.material.Material.CARPET, "studs", 1.5f, 2.5f, SoundType.CLOTH, EnumDyeColor.BLACK); + STUDS = new BlockColored(net.minecraft.block.material.Material.CARPET, "studs", 1.5f, 2.5f, SoundType.CLOTH, + EnumDyeColor.BLACK); STUDS.setRegistryName("studs"); - createGeneratedBlock(m -> m.hasProperty(PropertyKey.DUST) && m.hasFlag(GENERATE_FRAME), MetaBlocks::createFrameBlock); - createGeneratedBlock(m -> m.hasProperty(PropertyKey.ORE) && m.hasProperty(PropertyKey.DUST), MetaBlocks::createSurfaceRockBlock); + createGeneratedBlock(m -> m.hasProperty(PropertyKey.DUST) && m.hasFlag(GENERATE_FRAME), + MetaBlocks::createFrameBlock); + createGeneratedBlock(m -> m.hasProperty(PropertyKey.ORE) && m.hasProperty(PropertyKey.DUST), + MetaBlocks::createSurfaceRockBlock); createGeneratedBlock( - material -> (material.hasProperty(PropertyKey.INGOT) || material.hasProperty(PropertyKey.GEM) || material.hasFlag(FORCE_GENERATE_BLOCK)) - && !OrePrefix.block.isIgnored(material), + material -> (material.hasProperty(PropertyKey.INGOT) || material.hasProperty(PropertyKey.GEM) || + material.hasFlag(FORCE_GENERATE_BLOCK)) && !OrePrefix.block.isIgnored(material), MetaBlocks::createCompressedBlock); - registerTileEntity(); - //not sure if that's a good place for that, but i don't want to make a dedicated method for that - //could possibly override block methods, but since these props don't depend on state why not just use nice and simple vanilla method + // not sure if that's a good place for that, but i don't want to make a dedicated method for that + // could possibly override block methods, but since these props don't depend on state why not just use nice and + // simple vanilla method Blocks.FIRE.setFireInfo(RUBBER_LOG, 5, 5); Blocks.FIRE.setFireInfo(RUBBER_LEAVES, 30, 60); Blocks.FIRE.setFireInfo(PLANKS, 5, 20); @@ -395,16 +404,19 @@ public static void registerTileEntity() { @SideOnly(Side.CLIENT) public static void registerItemModels() { - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MACHINE), stack -> MetaTileEntityRenderer.MODEL_LOCATION); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MACHINE), + stack -> MetaTileEntityRenderer.MODEL_LOCATION); for (MaterialRegistry registry : GregTechAPI.materialManager.getRegistries()) { for (BlockCable cable : CABLES.get(registry.getModid())) cable.onModelRegister(); for (BlockFluidPipe pipe : FLUID_PIPES.get(registry.getModid())) pipe.onModelRegister(); for (BlockItemPipe pipe : ITEM_PIPES.get(registry.getModid())) pipe.onModelRegister(); } for (BlockOpticalPipe pipe : OPTICAL_PIPES) - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), stack -> OpticalPipeRenderer.INSTANCE.getModelLocation()); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), + stack -> OpticalPipeRenderer.INSTANCE.getModelLocation()); for (BlockLaserPipe pipe : LASER_PIPES) - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), stack -> LaserPipeRenderer.INSTANCE.getModelLocation()); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(pipe), + stack -> LaserPipeRenderer.INSTANCE.getModelLocation()); registerItemModel(BOILER_CASING); registerItemModel(METAL_CASING); @@ -438,9 +450,11 @@ public static void registerItemModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TREATED_WOOD_FENCE), 0, new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE.getRegistryName()), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RUBBER_WOOD_FENCE_GATE), 0, - new ModelResourceLocation(Objects.requireNonNull(RUBBER_WOOD_FENCE_GATE.getRegistryName()), "inventory")); + new ModelResourceLocation(Objects.requireNonNull(RUBBER_WOOD_FENCE_GATE.getRegistryName()), + "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TREATED_WOOD_FENCE_GATE), 0, - new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE_GATE.getRegistryName()), "inventory")); + new ModelResourceLocation(Objects.requireNonNull(TREATED_WOOD_FENCE_GATE.getRegistryName()), + "inventory")); registerItemModel(BRITTLE_CHARCOAL); registerItemModel(METAL_SHEET); @@ -464,7 +478,7 @@ public static void registerItemModels() { @SideOnly(Side.CLIENT) private static void registerItemModel(Block block) { for (IBlockState state : block.getBlockState().getValidStates()) { - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(state), new ModelResourceLocation(block.getRegistryName(), @@ -477,7 +491,7 @@ private static void registerItemModelWithOverride(Block block, Map, for (IBlockState state : block.getBlockState().getValidStates()) { Map, Comparable> stringProperties = new Object2ObjectOpenHashMap<>(state.getProperties()); stringProperties.putAll(stateOverrides); - //noinspection ConstantConditions + // noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(state), new ModelResourceLocation(block.getRegistryName(), @@ -519,6 +533,7 @@ public static void registerStateMappers() { } normalStateMapper = new StateMapperBase() { + @Nonnull @Override protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { @@ -543,54 +558,48 @@ public static void registerColors() { BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); ItemColors itemColors = Minecraft.getMinecraft().getItemColors(); - blockColors.registerBlockColorHandler((s, w, p, i) -> - s.getValue(net.minecraft.block.BlockColored.COLOR).colorValue, + blockColors.registerBlockColorHandler( + (s, w, p, i) -> s.getValue(net.minecraft.block.BlockColored.COLOR).colorValue, FOAM, REINFORCED_FOAM, PETRIFIED_FOAM, REINFORCED_PETRIFIED_FOAM); final int rubberLeavesColor = 0x98de4b; - blockColors.registerBlockColorHandler((s, w, p, i) -> - rubberLeavesColor, RUBBER_LEAVES); - itemColors.registerItemColorHandler((s, i) -> - rubberLeavesColor, RUBBER_LEAVES); + blockColors.registerBlockColorHandler((s, w, p, i) -> rubberLeavesColor, RUBBER_LEAVES); + itemColors.registerItemColorHandler((s, i) -> rubberLeavesColor, RUBBER_LEAVES); for (BlockCompressed block : COMPRESSED_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); - itemColors.registerItemColorHandler((s, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); + blockColors.registerBlockColorHandler((s, w, p, i) -> block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> block.getGtMaterial(s).getMaterialRGB(), block); } for (BlockFrame block : FRAME_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); - itemColors.registerItemColorHandler((s, i) -> - block.getGtMaterial(s).getMaterialRGB(), block); + blockColors.registerBlockColorHandler((s, w, p, i) -> block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> block.getGtMaterial(s).getMaterialRGB(), block); } for (BlockSurfaceRock block : SURFACE_ROCK_BLOCKS) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - i == 1 ? block.getGtMaterial(s).getMaterialRGB() : -1, block); + blockColors.registerBlockColorHandler((s, w, p, i) -> i == 1 ? block.getGtMaterial(s).getMaterialRGB() : -1, + block); } for (BlockOre block : ORES) { - blockColors.registerBlockColorHandler((s, w, p, i) -> - i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); - itemColors.registerItemColorHandler((s, i) -> - i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); + blockColors.registerBlockColorHandler((s, w, p, i) -> i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, + block); + itemColors.registerItemColorHandler((s, i) -> i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); } - blockColors.registerBlockColorHandler((s, w, p, i) -> - MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? - 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); - itemColors.registerItemColorHandler((s, i) -> - MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? - 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); - - blockColors.registerBlockColorHandler((s, w, p, i) -> - ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); - itemColors.registerItemColorHandler((s, i) -> - ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); + blockColors.registerBlockColorHandler( + (s, w, p, i) -> MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, + MACHINE_CASING); + itemColors.registerItemColorHandler( + (s, i) -> MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, + MACHINE_CASING); + + blockColors.registerBlockColorHandler((s, w, p, i) -> ConfigHolder.client.defaultPaintingColor, + HERMETIC_CASING); + itemColors.registerItemColorHandler((s, i) -> ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); } public static void registerOreDict() { diff --git a/src/main/java/gregtech/common/blocks/OreItemBlock.java b/src/main/java/gregtech/common/blocks/OreItemBlock.java index 8108d1f1df5..1e2b569c801 100644 --- a/src/main/java/gregtech/common/blocks/OreItemBlock.java +++ b/src/main/java/gregtech/common/blocks/OreItemBlock.java @@ -1,6 +1,7 @@ package gregtech.common.blocks; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java index 0098a77fecf..c532c1700dc 100644 --- a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java +++ b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; + import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.properties.PropertyEnum; @@ -17,9 +18,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + @SuppressWarnings("deprecation") public class StoneVariantBlock extends VariantBlock { @@ -50,7 +52,8 @@ protected BlockStateContainer createBlockState() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull EntityLiving.SpawnPlacementType type) { return false; } @@ -100,22 +103,34 @@ public String getName() { public OrePrefix getOrePrefix() { switch (this) { - case BLACK_GRANITE: case RED_GRANITE: case MARBLE: case BASALT: + case BLACK_GRANITE: + case RED_GRANITE: + case MARBLE: + case BASALT: return OrePrefix.stone; - case CONCRETE_LIGHT: case CONCRETE_DARK: + case CONCRETE_LIGHT: + case CONCRETE_DARK: return OrePrefix.block; - default: throw new IllegalStateException("Unreachable"); + default: + throw new IllegalStateException("Unreachable"); } } public Material getMaterial() { switch (this) { - case BLACK_GRANITE: return Materials.GraniteBlack; - case RED_GRANITE: return Materials.GraniteRed; - case MARBLE: return Materials.Marble; - case BASALT: return Materials.Basalt; - case CONCRETE_LIGHT: case CONCRETE_DARK: return Materials.Concrete; - default: throw new IllegalStateException("Unreachable"); + case BLACK_GRANITE: + return Materials.GraniteBlack; + case RED_GRANITE: + return Materials.GraniteRed; + case MARBLE: + return Materials.Marble; + case BASALT: + return Materials.Basalt; + case CONCRETE_LIGHT: + case CONCRETE_DARK: + return Materials.Concrete; + default: + throw new IllegalStateException("Unreachable"); } } } diff --git a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java index 6a7d8c7f312..426701f2682 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java @@ -2,6 +2,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.SoundType; @@ -23,9 +24,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.Random; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Random; public class BlockFoam extends BlockColored { @@ -43,7 +45,9 @@ public BlockFoam(boolean isReinforced) { } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { ItemStack stackInHand = playerIn.getHeldItem(hand); if (!stackInHand.isEmpty() && OreDictUnifier.hasOreDictionary(stackInHand, "sand")) { worldIn.setBlockState(pos, getPetrifiedBlock(state)); @@ -78,7 +82,8 @@ public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { @Nullable @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, + @Nonnull BlockPos pos) { return null; } @@ -100,7 +105,6 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { return false; } - @Override @SuppressWarnings("deprecation") public boolean isFullCube(@Nonnull IBlockState state) { @@ -110,7 +114,8 @@ public boolean isFullCube(@Nonnull IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, + @Nonnull BlockPos pos, @Nonnull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java index 08a34fdacbc..769eaef2194 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.foam; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockColored; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -23,7 +24,8 @@ public BlockPetrifiedFoam(boolean isReinforced) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + @Nonnull SpawnPlacementType type) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java index e5b6fa2ff01..64c176b21b8 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java @@ -1,16 +1,19 @@ package gregtech.common.blocks.properties; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; + import net.minecraft.block.properties.PropertyHelper; -import javax.annotation.Nonnull; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; + import java.util.Arrays; import java.util.Collection; +import javax.annotation.Nonnull; + public class PropertyMaterial extends PropertyHelper { private final ImmutableList allowedValues; diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java index ca9c10db241..771c045b3da 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java @@ -1,14 +1,17 @@ package gregtech.common.blocks.properties; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.ore.StoneType; + import net.minecraft.block.properties.PropertyHelper; -import javax.annotation.Nonnull; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; + import java.util.Arrays; import java.util.Collection; +import javax.annotation.Nonnull; + public class PropertyStoneType extends PropertyHelper { private final ImmutableList allowedValues; @@ -66,5 +69,4 @@ public int hashCode() { i = 31 * i + this.allowedValues.hashCode(); return i; } - } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java b/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java index 91dd4a7c10f..975c0708a22 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregFence.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockFence; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java b/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java index 0e25e0e47d7..29c539eca35 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregFenceGate.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockPlanks; import net.minecraft.block.SoundType; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java index 297e77ea51d..9333e23a8bc 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java @@ -2,6 +2,7 @@ import gregtech.api.block.VariantBlock; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java index 4f4d3df4f5c..6fd4f614b81 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.BlockSlab; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -18,12 +19,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + public abstract class BlockGregWoodSlab extends BlockSlab { - private static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockGregPlanks.BlockType.class); + private static final PropertyEnum VARIANT = PropertyEnum.create("variant", + BlockGregPlanks.BlockType.class); public BlockGregWoodSlab() { super(Material.WOOD); @@ -114,7 +117,8 @@ protected BlockStateContainer createBlockState() { } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java index 13bbbe46c25..751ea10fa13 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberDoor.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.wood; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java index 0b884519ef4..7c351a19ee5 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java @@ -1,9 +1,9 @@ package gregtech.common.blocks.wood; -import com.google.common.collect.Lists; import gregtech.api.GregTechAPI; import gregtech.common.blocks.MetaBlocks; import gregtech.core.CoreModule; + import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockPlanks.EnumType; import net.minecraft.block.state.BlockStateContainer; @@ -18,10 +18,13 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import com.google.common.collect.Lists; + import java.util.List; import java.util.Random; +import javax.annotation.Nonnull; + public class BlockRubberLeaves extends BlockLeaves { public BlockRubberLeaves() { @@ -46,7 +49,8 @@ protected BlockStateContainer createBlockState() { @SuppressWarnings("deprecation") @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, + float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false); } @@ -101,7 +105,8 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { } @Override - public boolean shouldSideBeRendered(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldSideBeRendered(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, + @Nonnull BlockPos pos, @Nonnull EnumFacing side) { if (!fancyLeaves()) { return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java index f676aa6b579..60a17930696 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java @@ -3,6 +3,7 @@ import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.common.items.MetaItems; + import net.minecraft.block.BlockLog; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; @@ -13,9 +14,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + public class BlockRubberLog extends BlockLog { public static final PropertyBool NATURAL = PropertyBool.create("natural"); @@ -49,7 +51,8 @@ public int getMetaFromState(IBlockState state) { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, IBlockState state, int fortune) { + public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + IBlockState state, int fortune) { Random rand = world instanceof World ? ((World) world).rand : RANDOM; if (state.getValue(NATURAL)) { if (rand.nextDouble() <= .85D) { diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java index 51e22dd36fa..2c17b442f62 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.common.worldgen.WorldGenRubberTree; + import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; @@ -13,9 +14,10 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + import static net.minecraft.block.BlockSapling.STAGE; public class BlockRubberSapling extends BlockBush implements IGrowable { @@ -66,22 +68,26 @@ public int getMetaFromState(IBlockState state) { @Nonnull @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, @Nonnull BlockPos pos) { + public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, + @Nonnull BlockPos pos) { return SAPLING_AABB; } @Override - public boolean canGrow(@Nonnull World world, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState, boolean b) { + public boolean canGrow(@Nonnull World world, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState, + boolean b) { return true; } @Override - public boolean canUseBonemeal(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState) { + public boolean canUseBonemeal(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos blockPos, + @Nonnull IBlockState iBlockState) { return true; } @Override - public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, + @Nonnull BlockPos pos) { return true; } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java b/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java index 9411ee11177..c24e92abfc0 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockWoodenDoor.java @@ -1,6 +1,7 @@ package gregtech.common.blocks.wood; import gregtech.api.items.toolitem.ToolClasses; + import net.minecraft.block.BlockDoor; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -32,7 +33,8 @@ public ItemStack getItem(World world, BlockPos pos, IBlockState state) { } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, + int fortune) { if (state.getValue(HALF) == EnumDoorHalf.LOWER) { drops.add(itemSupplier.get()); } diff --git a/src/main/java/gregtech/common/command/CommandHand.java b/src/main/java/gregtech/common/command/CommandHand.java index e14a848e847..8a847ef8be2 100644 --- a/src/main/java/gregtech/common/command/CommandHand.java +++ b/src/main/java/gregtech/common/command/CommandHand.java @@ -11,6 +11,7 @@ import gregtech.api.util.GTLog; import gregtech.integration.RecipeCompatUtil; import gregtech.modules.GregTechModules; + import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -27,9 +28,10 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; import java.util.Set; +import javax.annotation.Nonnull; + public class CommandHand extends CommandBase { @Nonnull @@ -45,7 +47,8 @@ public String getUsage(@Nonnull ICommandSender sender) { } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) throws CommandException { + public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, + @Nonnull String[] args) throws CommandException { if (sender instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) sender; ItemStack stackInHand = player.getHeldItemMainhand(); @@ -56,19 +59,21 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } } String registryName; - ResourceLocation registryLocation = stackInHand.getItem().getRegistryName(); - if (registryLocation != null) { + ResourceLocation registryLocation = stackInHand.getItem().getRegistryName(); + if (registryLocation != null) { registryName = registryLocation.toString(); } else { registryName = "ERROR"; GTLog.logger.warn("ItemStack {} has a null registry name", stackInHand.getTranslationKey()); } ClickEvent itemNameEvent = new ClickEvent(Action.OPEN_URL, registryName); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.item_id", registryName, stackInHand.getItemDamage()) - .setStyle(new Style().setClickEvent(itemNameEvent))); + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.item_id", registryName, + stackInHand.getItemDamage()) + .setStyle(new Style().setClickEvent(itemNameEvent))); IElectricItem electricItem = stackInHand.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - IFluidHandlerItem fluidHandlerItem = stackInHand.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stackInHand + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (electricItem != null) { player.sendMessage(new TextComponentTranslation("gregtech.command.hand.electric", electricItem.getCharge(), @@ -86,7 +91,9 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen properties.getCapacity(), Boolean.toString(properties.canFill()), Boolean.toString(properties.canDrain()))); if (contents != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.fluid2", fluidName).appendSibling(new TextComponentString(" " + fluidName).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.fluid2", fluidName) + .appendSibling(new TextComponentString(" " + fluidName) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle("", false))); } } @@ -96,26 +103,33 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (id != null) { String ctId = ""; ClipboardUtil.copyToClipboard(player, ctId); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.meta_item", id).appendSibling(new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.meta_item", id) + .appendSibling( + new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle(ctId, true))); } // tool info if (stackInHand.getItem() instanceof IGTTool) { IGTTool tool = (IGTTool) stackInHand.getItem(); - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.tool_stats", + tool.getToolClasses(stackInHand))); } // material info MaterialStack material = OreDictUnifier.getMaterial(stackInHand); if (material != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.material").appendSibling(new TextComponentString(" " + material.material).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.material") + .appendSibling(new TextComponentString(" " + material.material) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle("", false))); } // ore prefix info OrePrefix orePrefix = OreDictUnifier.getPrefix(stackInHand); if (orePrefix != null) { - player.sendMessage(new TextComponentTranslation("gregtech.command.hand.ore_prefix").appendSibling(new TextComponentString(" " + orePrefix.name).setStyle(new Style().setColor(TextFormatting.GREEN))) + player.sendMessage(new TextComponentTranslation("gregtech.command.hand.ore_prefix") + .appendSibling(new TextComponentString(" " + orePrefix.name) + .setStyle(new Style().setColor(TextFormatting.GREEN))) .setStyle(getCopyStyle(orePrefix.name, false))); } @@ -142,10 +156,13 @@ public static Style getCopyStyle(String copyMessage, boolean alreadyCopied) { style.setClickEvent(click); ITextComponent text = alreadyCopied ? - new TextComponentString("").appendSibling(new TextComponentString(copyMessage + " ").setStyle(new Style().setColor(TextFormatting.GOLD))) + new TextComponentString("") + .appendSibling(new TextComponentString(copyMessage + " ") + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_and_click")) : new TextComponentTranslation("gregtech.command.copy.click_to_copy") - .appendSibling(new TextComponentString(" " + copyMessage).setStyle(new Style().setColor(TextFormatting.GOLD))); + .appendSibling(new TextComponentString(" " + copyMessage) + .setStyle(new Style().setColor(TextFormatting.GOLD))); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, text)); return style; diff --git a/src/main/java/gregtech/common/command/CommandRecipeCheck.java b/src/main/java/gregtech/common/command/CommandRecipeCheck.java index b2bc3d0c2a9..68f6d17f513 100644 --- a/src/main/java/gregtech/common/command/CommandRecipeCheck.java +++ b/src/main/java/gregtech/common/command/CommandRecipeCheck.java @@ -19,10 +19,7 @@ import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; import gregtech.common.items.MetaItems; -import it.unimi.dsi.fastutil.ints.IntOpenHashSet; -import it.unimi.dsi.fastutil.ints.IntSet; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.Block; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -34,13 +31,19 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class CommandRecipeCheck extends CommandBase { @Nonnull @@ -79,7 +82,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } } - // set amount of itemstacks to Integer.MAX_VALUE to detect conflicts only occurring if batching the recipe + // set amount of itemstacks to Integer.MAX_VALUE to detect conflicts only occurring if batching the + // recipe List inputs = new ArrayList<>(); for (GTRecipeInput input : currentRecipe.getInputs()) { for (ItemStack stack : input.getInputStacks()) { @@ -90,7 +94,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen } List fluidInputs = currentRecipe.getFluidInputs() - // set volume of fluids to Integer.MAX_VALUE to detect conflicts only occurring if batching the recipe + // set volume of fluids to Integer.MAX_VALUE to detect conflicts only occurring if batching the + // recipe .stream().map(stack -> new FluidStack(stack.getInputFluidStack(), Integer.MAX_VALUE)) .collect(Collectors.toList()); @@ -98,15 +103,19 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen inputs, fluidInputs); if (collidingRecipeSet == null) { - GTLog.logger.error("This recipe returned null for findRecipeCollisions: {}", prettyPrintRecipe(currentRecipe)); + GTLog.logger.error("This recipe returned null for findRecipeCollisions: {}", + prettyPrintRecipe(currentRecipe)); continue; } if (collidingRecipeSet.size() > 1) { // remove the current recipe from the list of recipes, as it's not a conflict collidingRecipeSet.remove(currentRecipe); - Object2ObjectOpenHashMap> conflictingRecipeMap = mismatchedRecipes.get(recipeMap); - // if the conflicting recipe was iterated over before, and the current recipe is in the list, remove it - collidingRecipeSet.removeIf(cf -> conflictingRecipeMap.get(cf) != null && conflictingRecipeMap.get(cf).contains(currentRecipe)); + Object2ObjectOpenHashMap> conflictingRecipeMap = mismatchedRecipes + .get(recipeMap); + // if the conflicting recipe was iterated over before, and the current recipe is in the list, remove + // it + collidingRecipeSet.removeIf(cf -> conflictingRecipeMap.get(cf) != null && + conflictingRecipeMap.get(cf).contains(currentRecipe)); if (collidingRecipeSet.size() > 0) { mismatchedRecipes.get(recipeMap).put(currentRecipe, collidingRecipeSet); } @@ -130,9 +139,11 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (mismatchedRecipes.size() == 0) { GTLog.logger.info("No recipe conflicts found in all recipe maps!"); } else { - count = (int) mismatchedRecipes.values().stream().mapToLong(s -> s.values().stream().mapToLong(Set::size).sum()).sum(); + count = (int) mismatchedRecipes.values().stream() + .mapToLong(s -> s.values().stream().mapToLong(Set::size).sum()).sum(); GTLog.logger.info("[Recipe Checker] Found {} potential conflicts", count); - for (Map.Entry, Object2ObjectOpenHashMap>> recipeMap : mismatchedRecipes.entrySet()) { + for (Map.Entry, Object2ObjectOpenHashMap>> recipeMap : mismatchedRecipes + .entrySet()) { GTLog.logger.error( "\n[In Recipe map] : \"{}\"", recipeMap.getKey().unlocalizedName); for (Map.Entry> reciper : mismatchedRecipes.get(recipeMap.getKey()).entrySet()) { @@ -174,7 +185,8 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end", count)); } if (emptyInputRecipes.size() != 0) { - sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end_empty_inputs", emptyCount, emptyOreDicts.size())); + sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.end_empty_inputs", emptyCount, + emptyOreDicts.size())); } } @@ -287,13 +299,14 @@ public static String prettyPrintRecipeInput(GTRecipeInput recipeInput) { } public static String prettyPrintItemStack(ItemStack stack) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { MetaValueItem metaValueItem = metaItem.getItem(stack); if (metaValueItem == null) { if (metaItem instanceof MetaPrefixItem metaPrefixItem) { Material material = metaPrefixItem.getMaterial(stack); OrePrefix orePrefix = metaPrefixItem.getOrePrefix(); - return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + stack.getCount(); + return "(MetaItem) OrePrefix: " + orePrefix.name + ", Material: " + material + " * " + + stack.getCount(); } } else { if (MetaItems.INTEGRATED_CIRCUIT.isItemEqual(stack)) { @@ -316,7 +329,7 @@ public static String prettyPrintItemStack(ItemStack stack) { id = "block" + ((BlockCompressed) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockFrame) { id = "frame" + ((BlockFrame) block).getGtMaterial(stack).toCamelCaseString(); - } else if (block instanceof BlockMaterialPipe blockMaterialPipe) { + } else if (block instanceof BlockMaterialPipeblockMaterialPipe) { id = blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString(); } @@ -324,7 +337,8 @@ public static String prettyPrintItemStack(ItemStack stack) { return "(MetaBlock) " + id + " * " + stack.getCount(); } } - //noinspection ConstantConditions - return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + stack.getItemDamage() + ")"; + // noinspection ConstantConditions + return stack.getItem().getRegistryName().toString() + " * " + stack.getCount() + " (Meta " + + stack.getItemDamage() + ")"; } } diff --git a/src/main/java/gregtech/common/command/CommandShaders.java b/src/main/java/gregtech/common/command/CommandShaders.java index 4cb2a3101f6..ced67002537 100644 --- a/src/main/java/gregtech/common/command/CommandShaders.java +++ b/src/main/java/gregtech/common/command/CommandShaders.java @@ -2,6 +2,7 @@ import gregtech.api.GregTechAPI; import gregtech.core.network.packets.PacketReloadShaders; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,7 +26,8 @@ public String getUsage(@Nonnull ICommandSender iCommandSender) { } @Override - public void execute(@Nonnull MinecraftServer minecraftServer, @Nonnull ICommandSender iCommandSender, @Nonnull String[] strings) { + public void execute(@Nonnull MinecraftServer minecraftServer, @Nonnull ICommandSender iCommandSender, + @Nonnull String[] strings) { if (iCommandSender instanceof EntityPlayerMP) { GregTechAPI.networkHandler.sendTo(new PacketReloadShaders(), (EntityPlayerMP) iCommandSender); iCommandSender.sendMessage(new TextComponentString("Reloaded Shaders")); diff --git a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java index ae3b37983cb..db35254e038 100644 --- a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java +++ b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java @@ -2,6 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.WorldGenRegistry; + import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; @@ -9,9 +10,10 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nonnull; import java.io.IOException; +import javax.annotation.Nonnull; + public class CommandWorldgenReload extends CommandBase { @Nonnull diff --git a/src/main/java/gregtech/common/covers/CoverBehaviors.java b/src/main/java/gregtech/common/covers/CoverBehaviors.java index 72002cc4617..3e5779fb3bf 100644 --- a/src/main/java/gregtech/common/covers/CoverBehaviors.java +++ b/src/main/java/gregtech/common/covers/CoverBehaviors.java @@ -14,8 +14,10 @@ import gregtech.common.covers.filter.SmartItemFilter; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.CoverDigitalInterfaceWirelessPlaceBehaviour; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; + import org.jetbrains.annotations.NotNull; import static gregtech.api.GTValues.*; @@ -29,103 +31,179 @@ private CoverBehaviors() {} public static void init() { GTLog.logger.info("Registering cover behaviors..."); - registerBehavior(gregtechId("conveyor.lv"), MetaItems.CONVEYOR_MODULE_LV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LV, 8)); - registerBehavior(gregtechId("conveyor.mv"), MetaItems.CONVEYOR_MODULE_MV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.MV, 32)); - registerBehavior(gregtechId("conveyor.hv"), MetaItems.CONVEYOR_MODULE_HV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.HV, 64)); - registerBehavior(gregtechId("conveyor.ev"), MetaItems.CONVEYOR_MODULE_EV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.EV, 3 * 64)); - registerBehavior(gregtechId("conveyor.iv"), MetaItems.CONVEYOR_MODULE_IV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.IV, 8 * 64)); - registerBehavior(gregtechId("conveyor.luv"), MetaItems.CONVEYOR_MODULE_LuV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LuV, 16 * 64)); - registerBehavior(gregtechId("conveyor.zpm"), MetaItems.CONVEYOR_MODULE_ZPM, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.ZPM, 16 * 64)); - registerBehavior(gregtechId("conveyor.uv"), MetaItems.CONVEYOR_MODULE_UV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UV, 16 * 64)); - - registerBehavior(gregtechId("robotic_arm.lv"), MetaItems.ROBOT_ARM_LV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LV, 8)); - registerBehavior(gregtechId("robotic_arm.mv"), MetaItems.ROBOT_ARM_MV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.MV, 32)); - registerBehavior(gregtechId("robotic_arm.hv"), MetaItems.ROBOT_ARM_HV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.HV, 64)); - registerBehavior(gregtechId("robotic_arm.ev"), MetaItems.ROBOT_ARM_EV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.EV, 3 * 64)); - registerBehavior(gregtechId("robotic_arm.iv"), MetaItems.ROBOT_ARM_IV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.IV, 8 * 64)); - registerBehavior(gregtechId("robotic_arm.luv"), MetaItems.ROBOT_ARM_LuV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LuV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.zpm"), MetaItems.ROBOT_ARM_ZPM, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.ZPM, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uv"), MetaItems.ROBOT_ARM_UV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UV, 16 * 64)); - - registerBehavior(gregtechId("ore_dictionary_filter"), MetaItems.ORE_DICTIONARY_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.ore_dictionary_filter.title", Textures.ORE_DICTIONARY_FILTER_OVERLAY, new OreDictionaryItemFilter())); - registerBehavior(gregtechId("item_filter"), MetaItems.ITEM_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.item_filter.title", Textures.ITEM_FILTER_FILTER_OVERLAY, new SimpleItemFilter())); - registerBehavior(gregtechId("fluid_filter"), MetaItems.FLUID_FILTER, (def, tile, side) -> new CoverFluidFilter(def, tile, side, "cover.fluid_filter.title", Textures.FLUID_FILTER_OVERLAY, new SimpleFluidFilter())); + registerBehavior(gregtechId("conveyor.lv"), MetaItems.CONVEYOR_MODULE_LV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LV, 8)); + registerBehavior(gregtechId("conveyor.mv"), MetaItems.CONVEYOR_MODULE_MV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.MV, 32)); + registerBehavior(gregtechId("conveyor.hv"), MetaItems.CONVEYOR_MODULE_HV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.HV, 64)); + registerBehavior(gregtechId("conveyor.ev"), MetaItems.CONVEYOR_MODULE_EV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.EV, 3 * 64)); + registerBehavior(gregtechId("conveyor.iv"), MetaItems.CONVEYOR_MODULE_IV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.IV, 8 * 64)); + registerBehavior(gregtechId("conveyor.luv"), MetaItems.CONVEYOR_MODULE_LuV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.LuV, 16 * 64)); + registerBehavior(gregtechId("conveyor.zpm"), MetaItems.CONVEYOR_MODULE_ZPM, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.ZPM, 16 * 64)); + registerBehavior(gregtechId("conveyor.uv"), MetaItems.CONVEYOR_MODULE_UV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UV, 16 * 64)); + + registerBehavior(gregtechId("robotic_arm.lv"), MetaItems.ROBOT_ARM_LV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LV, 8)); + registerBehavior(gregtechId("robotic_arm.mv"), MetaItems.ROBOT_ARM_MV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.MV, 32)); + registerBehavior(gregtechId("robotic_arm.hv"), MetaItems.ROBOT_ARM_HV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.HV, 64)); + registerBehavior(gregtechId("robotic_arm.ev"), MetaItems.ROBOT_ARM_EV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.EV, 3 * 64)); + registerBehavior(gregtechId("robotic_arm.iv"), MetaItems.ROBOT_ARM_IV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.IV, 8 * 64)); + registerBehavior(gregtechId("robotic_arm.luv"), MetaItems.ROBOT_ARM_LuV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.LuV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.zpm"), MetaItems.ROBOT_ARM_ZPM, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.ZPM, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uv"), MetaItems.ROBOT_ARM_UV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UV, 16 * 64)); + + registerBehavior(gregtechId("ore_dictionary_filter"), MetaItems.ORE_DICTIONARY_FILTER, + (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.ore_dictionary_filter.title", + Textures.ORE_DICTIONARY_FILTER_OVERLAY, new OreDictionaryItemFilter())); + registerBehavior(gregtechId("item_filter"), MetaItems.ITEM_FILTER, (def, tile, side) -> new CoverItemFilter(def, + tile, side, "cover.item_filter.title", Textures.ITEM_FILTER_FILTER_OVERLAY, new SimpleItemFilter())); + registerBehavior(gregtechId("fluid_filter"), MetaItems.FLUID_FILTER, + (def, tile, side) -> new CoverFluidFilter(def, tile, side, "cover.fluid_filter.title", + Textures.FLUID_FILTER_OVERLAY, new SimpleFluidFilter())); registerBehavior(gregtechId("shutter"), MetaItems.COVER_SHUTTER, CoverShutter::new); - registerBehavior(gregtechId("solar_panel.basic"), MetaItems.COVER_SOLAR_PANEL, (def, tile, side) -> new CoverSolarPanel(def, tile, side, 1)); - registerBehavior(gregtechId("solar_panel.ulv"), MetaItems.COVER_SOLAR_PANEL_ULV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ULV])); - registerBehavior(gregtechId("solar_panel.lv"), MetaItems.COVER_SOLAR_PANEL_LV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LV])); - registerBehavior(gregtechId("solar_panel.mv"), MetaItems.COVER_SOLAR_PANEL_MV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[MV])); - registerBehavior(gregtechId("solar_panel.hv"), MetaItems.COVER_SOLAR_PANEL_HV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[HV])); - registerBehavior(gregtechId("solar_panel.ev"), MetaItems.COVER_SOLAR_PANEL_EV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[EV])); - registerBehavior(gregtechId("solar_panel.iv"), MetaItems.COVER_SOLAR_PANEL_IV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[IV])); - registerBehavior(gregtechId("solar_panel.luv"), MetaItems.COVER_SOLAR_PANEL_LUV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LuV])); - registerBehavior(gregtechId("solar_panel.zpm"), MetaItems.COVER_SOLAR_PANEL_ZPM, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ZPM])); - registerBehavior(gregtechId("solar_panel.uv"), MetaItems.COVER_SOLAR_PANEL_UV, (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[UV])); - - registerBehavior(gregtechId("machine_controller"), MetaItems.COVER_MACHINE_CONTROLLER, CoverMachineController::new); - registerBehavior(gregtechId("smart_filter"), MetaItems.SMART_FILTER, (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.smart_item_filter.title", Textures.SMART_FILTER_FILTER_OVERLAY, new SmartItemFilter())); + registerBehavior(gregtechId("solar_panel.basic"), MetaItems.COVER_SOLAR_PANEL, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, 1)); + registerBehavior(gregtechId("solar_panel.ulv"), MetaItems.COVER_SOLAR_PANEL_ULV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ULV])); + registerBehavior(gregtechId("solar_panel.lv"), MetaItems.COVER_SOLAR_PANEL_LV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LV])); + registerBehavior(gregtechId("solar_panel.mv"), MetaItems.COVER_SOLAR_PANEL_MV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[MV])); + registerBehavior(gregtechId("solar_panel.hv"), MetaItems.COVER_SOLAR_PANEL_HV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[HV])); + registerBehavior(gregtechId("solar_panel.ev"), MetaItems.COVER_SOLAR_PANEL_EV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[EV])); + registerBehavior(gregtechId("solar_panel.iv"), MetaItems.COVER_SOLAR_PANEL_IV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[IV])); + registerBehavior(gregtechId("solar_panel.luv"), MetaItems.COVER_SOLAR_PANEL_LUV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[LuV])); + registerBehavior(gregtechId("solar_panel.zpm"), MetaItems.COVER_SOLAR_PANEL_ZPM, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[ZPM])); + registerBehavior(gregtechId("solar_panel.uv"), MetaItems.COVER_SOLAR_PANEL_UV, + (def, tile, side) -> new CoverSolarPanel(def, tile, side, V[UV])); + + registerBehavior(gregtechId("machine_controller"), MetaItems.COVER_MACHINE_CONTROLLER, + CoverMachineController::new); + registerBehavior(gregtechId("smart_filter"), MetaItems.SMART_FILTER, + (def, tile, side) -> new CoverItemFilter(def, tile, side, "cover.smart_item_filter.title", + Textures.SMART_FILTER_FILTER_OVERLAY, new SmartItemFilter())); registerBehavior(gregtechId("facade"), MetaItems.COVER_FACADE, CoverFacade::new); registerBehavior(gregtechId("screen"), MetaItems.COVER_SCREEN, CoverScreen::new); registerBehavior(gregtechId("energy_detector"), MetaItems.COVER_ENERGY_DETECTOR, CoverDetectorEnergy::new); - registerBehavior(gregtechId("energy_detector_advanced"), MetaItems.COVER_ENERGY_DETECTOR_ADVANCED, CoverDetectorEnergyAdvanced::new); + registerBehavior(gregtechId("energy_detector_advanced"), MetaItems.COVER_ENERGY_DETECTOR_ADVANCED, + CoverDetectorEnergyAdvanced::new); registerBehavior(gregtechId("fluid_detector"), MetaItems.COVER_FLUID_DETECTOR, CoverDetectorFluid::new); - registerBehavior(gregtechId("fluid_detector_advanced"), MetaItems.COVER_FLUID_DETECTOR_ADVANCED, CoverDetectorFluidAdvanced::new); + registerBehavior(gregtechId("fluid_detector_advanced"), MetaItems.COVER_FLUID_DETECTOR_ADVANCED, + CoverDetectorFluidAdvanced::new); registerBehavior(gregtechId("item_detector"), MetaItems.COVER_ITEM_DETECTOR, CoverDetectorItem::new); - registerBehavior(gregtechId("item_detector_advanced"), MetaItems.COVER_ITEM_DETECTOR_ADVANCED, CoverDetectorItemAdvanced::new); - registerBehavior(gregtechId("activity_detector"), MetaItems.COVER_ACTIVITY_DETECTOR, CoverDetectorActivity::new); - registerBehavior(gregtechId("activity_detector_advanced"), MetaItems.COVER_ACTIVITY_DETECTOR_ADVANCED, CoverDetectorActivityAdvanced::new); - registerBehavior(gregtechId("maintenance_detector"), MetaItems.COVER_MAINTENANCE_DETECTOR, CoverDetectorMaintenance::new); + registerBehavior(gregtechId("item_detector_advanced"), MetaItems.COVER_ITEM_DETECTOR_ADVANCED, + CoverDetectorItemAdvanced::new); + registerBehavior(gregtechId("activity_detector"), MetaItems.COVER_ACTIVITY_DETECTOR, + CoverDetectorActivity::new); + registerBehavior(gregtechId("activity_detector_advanced"), MetaItems.COVER_ACTIVITY_DETECTOR_ADVANCED, + CoverDetectorActivityAdvanced::new); + registerBehavior(gregtechId("maintenance_detector"), MetaItems.COVER_MAINTENANCE_DETECTOR, + CoverDetectorMaintenance::new); registerCover(gregtechId("crafting_table"), ItemStack.EMPTY, CoverCraftingTable::new); registerBehavior(gregtechId("infinite_water"), MetaItems.COVER_INFINITE_WATER, CoverInfiniteWater::new); registerBehavior(gregtechId("ender_fluid_link"), MetaItems.COVER_ENDER_FLUID_LINK, CoverEnderFluidLink::new); registerBehavior(gregtechId("cover.digital"), MetaItems.COVER_DIGITAL_INTERFACE, CoverDigitalInterface::new); // Custom cover behaviour - MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.addComponents(new CoverDigitalInterfaceWirelessPlaceBehaviour(registerCover(gregtechId("cover.digital.wireless"), MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.getStackForm(), CoverDigitalInterfaceWireless::new))); - - registerBehavior(gregtechId("pump.lv"), MetaItems.ELECTRIC_PUMP_LV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LV, 1280)); - registerBehavior(gregtechId("pump.mv"), MetaItems.ELECTRIC_PUMP_MV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.MV, 1280 * 4)); - registerBehavior(gregtechId("pump.hv"), MetaItems.ELECTRIC_PUMP_HV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.HV, 1280 * 16)); - registerBehavior(gregtechId("pump.ev"), MetaItems.ELECTRIC_PUMP_EV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.EV, 1280 * 64)); - registerBehavior(gregtechId("pump.iv"), MetaItems.ELECTRIC_PUMP_IV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.IV, 1280 * 64 * 4)); - registerBehavior(gregtechId("pump.luv"), MetaItems.ELECTRIC_PUMP_LuV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); - registerBehavior(gregtechId("pump.zpm"), MetaItems.ELECTRIC_PUMP_ZPM, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); - registerBehavior(gregtechId("pump.uv"), MetaItems.ELECTRIC_PUMP_UV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); - - registerBehavior(gregtechId("fluid.regulator.lv"), MetaItems.FLUID_REGULATOR_LV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LV, 1280)); - registerBehavior(gregtechId("fluid.regulator.mv"), MetaItems.FLUID_REGULATOR_MV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.MV, 1280 * 4)); - registerBehavior(gregtechId("fluid.regulator.hv"), MetaItems.FLUID_REGULATOR_HV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.HV, 1280 * 16)); - registerBehavior(gregtechId("fluid.regulator.ev"), MetaItems.FLUID_REGULATOR_EV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.EV, 1280 * 64)); - registerBehavior(gregtechId("fluid.regulator.iv"), MetaItems.FLUID_REGULATOR_IV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.IV, 1280 * 64 * 4)); - registerBehavior(gregtechId("fluid.regulator.luv"), MetaItems.FLUID_REGULATOR_LUV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); - registerBehavior(gregtechId("fluid.regulator.zpm"), MetaItems.FLUID_REGULATOR_ZPM, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); - registerBehavior(gregtechId("fluid.regulator.uv"), MetaItems.FLUID_REGULATOR_UV, (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); + MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.addComponents( + new CoverDigitalInterfaceWirelessPlaceBehaviour(registerCover(gregtechId("cover.digital.wireless"), + MetaItems.COVER_DIGITAL_INTERFACE_WIRELESS.getStackForm(), + CoverDigitalInterfaceWireless::new))); + + registerBehavior(gregtechId("pump.lv"), MetaItems.ELECTRIC_PUMP_LV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LV, 1280)); + registerBehavior(gregtechId("pump.mv"), MetaItems.ELECTRIC_PUMP_MV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.MV, 1280 * 4)); + registerBehavior(gregtechId("pump.hv"), MetaItems.ELECTRIC_PUMP_HV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.HV, 1280 * 16)); + registerBehavior(gregtechId("pump.ev"), MetaItems.ELECTRIC_PUMP_EV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.EV, 1280 * 64)); + registerBehavior(gregtechId("pump.iv"), MetaItems.ELECTRIC_PUMP_IV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.IV, 1280 * 64 * 4)); + registerBehavior(gregtechId("pump.luv"), MetaItems.ELECTRIC_PUMP_LuV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); + registerBehavior(gregtechId("pump.zpm"), MetaItems.ELECTRIC_PUMP_ZPM, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); + registerBehavior(gregtechId("pump.uv"), MetaItems.ELECTRIC_PUMP_UV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); + + registerBehavior(gregtechId("fluid.regulator.lv"), MetaItems.FLUID_REGULATOR_LV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LV, 1280)); + registerBehavior(gregtechId("fluid.regulator.mv"), MetaItems.FLUID_REGULATOR_MV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.MV, 1280 * 4)); + registerBehavior(gregtechId("fluid.regulator.hv"), MetaItems.FLUID_REGULATOR_HV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.HV, 1280 * 16)); + registerBehavior(gregtechId("fluid.regulator.ev"), MetaItems.FLUID_REGULATOR_EV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.EV, 1280 * 64)); + registerBehavior(gregtechId("fluid.regulator.iv"), MetaItems.FLUID_REGULATOR_IV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.IV, 1280 * 64 * 4)); + registerBehavior(gregtechId("fluid.regulator.luv"), MetaItems.FLUID_REGULATOR_LUV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.LuV, 1280 * 64 * 16)); + registerBehavior(gregtechId("fluid.regulator.zpm"), MetaItems.FLUID_REGULATOR_ZPM, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.ZPM, 1280 * 64 * 64)); + registerBehavior(gregtechId("fluid.regulator.uv"), MetaItems.FLUID_REGULATOR_UV, + (def, tile, side) -> new CoverFluidRegulator(def, tile, side, GTValues.UV, 1280 * 64 * 64 * 4)); // UHV+ - registerBehavior(gregtechId("conveyor.uhv"), MetaItems.CONVEYOR_MODULE_UHV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UHV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uev"), MetaItems.CONVEYOR_MODULE_UEV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UEV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uiv"), MetaItems.CONVEYOR_MODULE_UIV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UIV, 16 * 64)); - registerBehavior(gregtechId("conveyor.uxv"), MetaItems.CONVEYOR_MODULE_UXV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UXV, 16 * 64)); - registerBehavior(gregtechId("conveyor.opv"), MetaItems.CONVEYOR_MODULE_OpV, (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.OpV, 16 * 64)); - - registerBehavior(gregtechId("robotic_arm.uhv"), MetaItems.ROBOT_ARM_UHV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UHV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uev"), MetaItems.ROBOT_ARM_UEV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UEV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uiv"), MetaItems.ROBOT_ARM_UIV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UIV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.uxv"), MetaItems.ROBOT_ARM_UXV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UXV, 16 * 64)); - registerBehavior(gregtechId("robotic_arm.opv"), MetaItems.ROBOT_ARM_OpV, (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.OpV, 16 * 64)); - - registerBehavior(gregtechId("pump.uhv"), MetaItems.ELECTRIC_PUMP_UHV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UHV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uev"), MetaItems.ELECTRIC_PUMP_UEV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UEV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uiv"), MetaItems.ELECTRIC_PUMP_UIV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UIV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.uxv"), MetaItems.ELECTRIC_PUMP_UXV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UXV, 1280 * 64 * 64 * 4)); - registerBehavior(gregtechId("pump.opv"), MetaItems.ELECTRIC_PUMP_OpV, (def, tile, side) -> new CoverPump(def, tile, side, GTValues.OpV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("conveyor.uhv"), MetaItems.CONVEYOR_MODULE_UHV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UHV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uev"), MetaItems.CONVEYOR_MODULE_UEV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UEV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uiv"), MetaItems.CONVEYOR_MODULE_UIV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UIV, 16 * 64)); + registerBehavior(gregtechId("conveyor.uxv"), MetaItems.CONVEYOR_MODULE_UXV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.UXV, 16 * 64)); + registerBehavior(gregtechId("conveyor.opv"), MetaItems.CONVEYOR_MODULE_OpV, + (def, tile, side) -> new CoverConveyor(def, tile, side, GTValues.OpV, 16 * 64)); + + registerBehavior(gregtechId("robotic_arm.uhv"), MetaItems.ROBOT_ARM_UHV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UHV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uev"), MetaItems.ROBOT_ARM_UEV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UEV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uiv"), MetaItems.ROBOT_ARM_UIV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UIV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.uxv"), MetaItems.ROBOT_ARM_UXV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.UXV, 16 * 64)); + registerBehavior(gregtechId("robotic_arm.opv"), MetaItems.ROBOT_ARM_OpV, + (def, tile, side) -> new CoverRoboticArm(def, tile, side, GTValues.OpV, 16 * 64)); + + registerBehavior(gregtechId("pump.uhv"), MetaItems.ELECTRIC_PUMP_UHV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UHV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uev"), MetaItems.ELECTRIC_PUMP_UEV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UEV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uiv"), MetaItems.ELECTRIC_PUMP_UIV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UIV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.uxv"), MetaItems.ELECTRIC_PUMP_UXV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.UXV, 1280 * 64 * 64 * 4)); + registerBehavior(gregtechId("pump.opv"), MetaItems.ELECTRIC_PUMP_OpV, + (def, tile, side) -> new CoverPump(def, tile, side, GTValues.OpV, 1280 * 64 * 64 * 4)); registerBehavior(gregtechId("fluid_voiding"), MetaItems.COVER_FLUID_VOIDING, CoverFluidVoiding::new); - registerBehavior(gregtechId("fluid_voiding.advanced"), MetaItems.COVER_FLUID_VOIDING_ADVANCED, CoverFluidVoidingAdvanced::new); + registerBehavior(gregtechId("fluid_voiding.advanced"), MetaItems.COVER_FLUID_VOIDING_ADVANCED, + CoverFluidVoidingAdvanced::new); registerBehavior(gregtechId("item_voiding"), MetaItems.COVER_ITEM_VOIDING, CoverItemVoiding::new); - registerBehavior(gregtechId("item_voiding.advanced"), MetaItems.COVER_ITEM_VOIDING_ADVANCED, CoverItemVoidingAdvanced::new); + registerBehavior(gregtechId("item_voiding.advanced"), MetaItems.COVER_ITEM_VOIDING_ADVANCED, + CoverItemVoidingAdvanced::new); registerBehavior(gregtechId("storage"), MetaItems.COVER_STORAGE, CoverStorage::new); } @@ -138,7 +216,8 @@ public static void init() { */ public static void registerBehavior(@NotNull ResourceLocation coverId, @NotNull MetaValueItem placerItem, @NotNull CoverDefinition.CoverCreator behaviorCreator) { - placerItem.addComponents(new CoverItemBehavior(registerCover(coverId, placerItem.getStackForm(), behaviorCreator))); + placerItem.addComponents( + new CoverItemBehavior(registerCover(coverId, placerItem.getStackForm(), behaviorCreator))); } /** @@ -149,7 +228,8 @@ public static void registerBehavior(@NotNull ResourceLocation coverId, @NotNull * @param behaviorCreator a function creating the cover behavior * @return the registered cover definition */ - public static @NotNull CoverDefinition registerCover(@NotNull ResourceLocation coverId, @NotNull ItemStack itemStack, + public static @NotNull CoverDefinition registerCover(@NotNull ResourceLocation coverId, + @NotNull ItemStack itemStack, @NotNull CoverDefinition.CoverCreator behaviorCreator) { CoverDefinition coverDefinition = new CoverDefinition(coverId, behaviorCreator, itemStack); GregTechAPI.COVER_REGISTRY.register(rollingId++, coverId, coverDefinition); diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index e666591730b..c92346bafcc 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -23,11 +18,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.ItemFilterContainer; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -42,13 +33,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; + public class CoverConveyor extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -140,7 +143,8 @@ public void update() { if (timer % 5 == 0 && isWorkingAllowed && itemsLeftToTransferLastSecond > 0) { EnumFacing side = getAttachedSide(); TileEntity tileEntity = coverable.getNeighbor(side); - IItemHandler itemHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); + IItemHandler itemHandler = tileEntity == null ? null : + tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); IItemHandler myItemHandler = coverable.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); if (itemHandler != null && myItemHandler != null) { int totalTransferred = doTransferItems(itemHandler, myItemHandler, itemsLeftToTransferLastSecond); @@ -165,7 +169,8 @@ protected int doTransferItemsAny(IItemHandler itemHandler, IItemHandler myItemHa return 0; } - protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myItemHandler, Map itemInfos, int maxTransferAmount) { + protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myItemHandler, + Map itemInfos, int maxTransferAmount) { if (conveyorMode == ConveyorMode.IMPORT) { return moveInventoryItems(itemHandler, myItemHandler, itemInfos, maxTransferAmount); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -174,7 +179,8 @@ protected int doTransferItemsByGroup(IItemHandler itemHandler, IItemHandler myIt return 0; } - protected Map doCountDestinationInventoryItemsByMatchIndex(IItemHandler itemHandler, IItemHandler myItemHandler) { + protected Map doCountDestinationInventoryItemsByMatchIndex(IItemHandler itemHandler, + IItemHandler myItemHandler) { if (conveyorMode == ConveyorMode.IMPORT) { return countInventoryItemsByMatchSlot(myItemHandler); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -183,7 +189,8 @@ protected Map doCountDestinationInventoryItemsByMatchInde return Collections.emptyMap(); } - protected Map doCountSourceInventoryItemsByType(IItemHandler itemHandler, IItemHandler myItemHandler) { + protected Map doCountSourceInventoryItemsByType(IItemHandler itemHandler, + IItemHandler myItemHandler) { if (conveyorMode == ConveyorMode.IMPORT) { return countInventoryItemsByType(itemHandler); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -192,7 +199,8 @@ protected Map doCountSourceInventoryItemsByType(IItemHa return Collections.emptyMap(); } - protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler myItemHandler, TypeItemInfo itemInfo) { + protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler myItemHandler, + TypeItemInfo itemInfo) { if (conveyorMode == ConveyorMode.IMPORT) { return moveInventoryItemsExact(itemHandler, myItemHandler, itemInfo); } else if (conveyorMode == ConveyorMode.EXPORT) { @@ -201,10 +209,11 @@ protected boolean doTransferItemsExact(IItemHandler itemHandler, IItemHandler my return false; } - protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, IItemHandler targetInventory, TypeItemInfo itemInfo) { - //first, compute how much can we extract in reality from the machine, - //because totalCount is based on what getStackInSlot returns, which may differ from what - //extractItem() will return + protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, IItemHandler targetInventory, + TypeItemInfo itemInfo) { + // first, compute how much can we extract in reality from the machine, + // because totalCount is based on what getStackInSlot returns, which may differ from what + // extractItem() will return ItemStack resultStack = itemInfo.itemStack.copy(); int totalExtractedCount = 0; int itemsLeftToExtract = itemInfo.totalCount; @@ -222,25 +231,25 @@ protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, I break; } } - //if amount of items extracted is not equal to the amount of items we - //wanted to extract, abort item extraction + // if amount of items extracted is not equal to the amount of items we + // wanted to extract, abort item extraction if (totalExtractedCount != itemInfo.totalCount) { return false; } - //adjust size of the result stack accordingly + // adjust size of the result stack accordingly resultStack.setCount(totalExtractedCount); - //now, see how much we can insert into destination inventory - //if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort + // now, see how much we can insert into destination inventory + // if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort ItemStack remainder = GTTransferUtils.insertItem(targetInventory, resultStack, true); if (!remainder.isEmpty()) { return false; } - //otherwise, perform real insertion and then remove items from the source inventory + // otherwise, perform real insertion and then remove items from the source inventory GTTransferUtils.insertItem(targetInventory, resultStack, false); - //perform real extraction of the items from the source inventory now + // perform real extraction of the items from the source inventory now itemsLeftToExtract = itemInfo.totalCount; for (int i = 0; i < itemInfo.slots.size(); i++) { int slotIndex = itemInfo.slots.get(i); @@ -257,7 +266,8 @@ protected static boolean moveInventoryItemsExact(IItemHandler sourceInventory, I return true; } - protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, Map itemInfos, int maxTransferAmount) { + protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, + Map itemInfos, int maxTransferAmount) { int itemsLeftToTransfer = maxTransferAmount; for (int i = 0; i < sourceInventory.getSlots(); i++) { ItemStack itemStack = sourceInventory.getStackInSlot(i); @@ -271,7 +281,8 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ GroupItemInfo itemInfo = itemInfos.get(matchSlotIndex); - ItemStack extractedStack = sourceInventory.extractItem(i, Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); + ItemStack extractedStack = sourceInventory.extractItem(i, + Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); ItemStack remainderStack = GTTransferUtils.insertItem(targetInventory, extractedStack, true); int amountToInsert = extractedStack.getCount() - remainderStack.getCount(); @@ -300,7 +311,8 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ return maxTransferAmount - itemsLeftToTransfer; } - protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, int maxTransferAmount) { + protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targetInventory, + int maxTransferAmount) { int itemsLeftToTransfer = maxTransferAmount; for (int srcIndex = 0; srcIndex < sourceInventory.getSlots(); srcIndex++) { ItemStack sourceStack = sourceInventory.extractItem(srcIndex, itemsLeftToTransfer, true); @@ -329,6 +341,7 @@ protected int moveInventoryItems(IItemHandler sourceInventory, IItemHandler targ } protected static class TypeItemInfo { + public final ItemStack itemStack; public final Object filterSlot; public final IntList slots; @@ -343,6 +356,7 @@ public TypeItemInfo(ItemStack itemStack, Object filterSlot, IntList slots, int t } protected static class GroupItemInfo { + public final Object filterSlot; public final Set itemStackTypes; public int totalCount; @@ -356,7 +370,8 @@ public GroupItemInfo(Object filterSlot, Set itemStackTypes, int total @Nonnull protected Map countInventoryItemsByType(@Nonnull IItemHandler inventory) { - Map result = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Map result = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { ItemStack itemStack = inventory.getStackInSlot(srcIndex); if (itemStack.isEmpty()) { @@ -393,7 +408,8 @@ protected Map countInventoryItemsByMatchSlot(@Nonnull IIt continue; } if (!result.containsKey(transferSlotIndex)) { - GroupItemInfo itemInfo = new GroupItemInfo(transferSlotIndex, new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount()), 0); + GroupItemInfo itemInfo = new GroupItemInfo(transferSlotIndex, + new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount()), 0); itemInfo.itemStackTypes.add(itemStack.copy()); itemInfo.totalCount += itemStack.getCount(); result.put(transferSlotIndex, itemInfo); @@ -422,16 +438,19 @@ public void onRemoval() { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { if (conveyorMode == ConveyorMode.EXPORT) { Textures.CONVEYOR_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { - Textures.CONVEYOR_OVERLAY_INVERTED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + Textures.CONVEYOR_OVERLAY_INVERTED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -478,26 +497,26 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new ImageWidget(40, 20, 96, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new TextFieldWidget2(42, 26, 92, 20, () -> String.valueOf(transferRate), val -> { - if (val != null && !val.isEmpty()) - setTransferRate(MathHelper.clamp(Integer.parseInt(val), 1, maxItemTransferRate)); - }) - .setNumbersOnly(1, maxItemTransferRate) - .setMaxLength(4) - .setPostFix("cover.conveyor.transfer_rate") - ); + if (val != null && !val.isEmpty()) + setTransferRate(MathHelper.clamp(Integer.parseInt(val), 1, maxItemTransferRate)); + }) + .setNumbersOnly(1, maxItemTransferRate) + .setMaxLength(4) + .setPostFix("cover.conveyor.transfer_rate")); primaryGroup.addWidget(new CycleButtonWidget(10, 45, 75, 20, ConveyorMode.class, this::getConveyorMode, this::setConveyorMode)); primaryGroup.addWidget(new CycleButtonWidget(7, 166, 116, 20, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); if (getTileEntityHere() instanceof TileEntityItemPipe || getNeighbor(getAttachedSide()) instanceof TileEntityItemPipe) { - final ImageCycleButtonWidget distributionModeButton = new ImageCycleButtonWidget(149, 166, 20, 20, GuiTextures.DISTRIBUTION_MODE, 3, + final ImageCycleButtonWidget distributionModeButton = new ImageCycleButtonWidget(149, 166, 20, 20, + GuiTextures.DISTRIBUTION_MODE, 3, () -> distributionMode.ordinal(), val -> setDistributionMode(DistributionMode.values()[val])) - .setTooltipHoverString(val -> DistributionMode.values()[val].getName()); + .setTooltipHoverString(val -> DistributionMode.values()[val].getName()); primaryGroup.addWidget(distributionModeButton); } @@ -571,6 +590,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum ConveyorMode implements IStringSerializable, IIOMode { + IMPORT("cover.conveyor.mode.import"), EXPORT("cover.conveyor.mode.export"); @@ -604,7 +624,8 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate if (conveyorMode == ConveyorMode.EXPORT && manualImportExportMode == ManualImportExportMode.DISABLED) { return stack; } - if (manualImportExportMode == ManualImportExportMode.FILTERED && !itemFilterContainer.testItemStack(stack)) { + if (manualImportExportMode == ManualImportExportMode.FILTERED && + !itemFilterContainer.testItemStack(stack)) { return stack; } return super.insertItem(slot, stack, simulate); diff --git a/src/main/java/gregtech/common/covers/CoverCraftingTable.java b/src/main/java/gregtech/common/covers/CoverCraftingTable.java index 8f73b5185ed..902873c7ffa 100644 --- a/src/main/java/gregtech/common/covers/CoverCraftingTable.java +++ b/src/main/java/gregtech/common/covers/CoverCraftingTable.java @@ -1,14 +1,11 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GregTechAPI; import gregtech.api.cover.*; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; import gregtech.common.inventory.handlers.ToolItemStackHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -17,6 +14,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,7 +40,8 @@ public class CoverCraftingTable extends CoverBase implements ITickable { private final ItemStackHandler internalInventory = new ItemStackHandler(18); private final ItemStackHandler toolInventory = new ToolItemStackHandler(9); - public CoverCraftingTable(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverCraftingTable(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -53,7 +56,8 @@ public boolean shouldAutoConnectToPipes() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} @Override public void update() { diff --git a/src/main/java/gregtech/common/covers/CoverDigitalInterface.java b/src/main/java/gregtech/common/covers/CoverDigitalInterface.java index 8ea20311664..0a04343acde 100644 --- a/src/main/java/gregtech/common/covers/CoverDigitalInterface.java +++ b/src/main/java/gregtech/common/covers/CoverDigitalInterface.java @@ -1,11 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; import gregtech.api.capability.*; import gregtech.api.capability.impl.*; import gregtech.api.cover.CoverBase; @@ -25,6 +19,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; import gregtech.common.terminal.app.prospector.widget.WidgetOreList; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -56,6 +51,13 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Rotation; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -69,16 +71,19 @@ public class CoverDigitalInterface extends CoverBase implements IFastRenderMetaTileEntity, ITickable, CoverWithUI { - public CoverDigitalInterface(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDigitalInterface(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } public enum MODE { + FLUID, ITEM, ENERGY, MACHINE, PROXY; + public static MODE[] VALUES; static { @@ -106,7 +111,7 @@ public enum MODE { protected int slot = 0; protected MODE mode = MODE.PROXY; protected EnumFacing spin = EnumFacing.NORTH; - protected final int[] proxyMode = new int[]{0, 0, 0, 0}; // server-only + protected final int[] proxyMode = new int[] { 0, 0, 0, 0 }; // server-only public MODE getMode() { return mode; @@ -204,7 +209,8 @@ public void writeToNBT(NBTTagCompound tagCompound) { public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.mode = tagCompound.hasKey("cdiMode") ? MODE.VALUES[tagCompound.getByte("cdiMode")] : MODE.PROXY; - this.spin = tagCompound.hasKey("cdiSpin") ? EnumFacing.byIndex(tagCompound.getByte("cdiSpin")) : EnumFacing.NORTH; + this.spin = tagCompound.hasKey("cdiSpin") ? EnumFacing.byIndex(tagCompound.getByte("cdiSpin")) : + EnumFacing.NORTH; this.slot = tagCompound.hasKey("cdiSlot") ? tagCompound.getInteger("cdiSlot") : 0; this.proxyMode[0] = tagCompound.hasKey("cdi0") ? tagCompound.getInteger("cdi0") : 0; this.proxyMode[1] = tagCompound.hasKey("cdi1") ? tagCompound.getInteger("cdi1") : 0; @@ -213,7 +219,8 @@ public void readFromNBT(NBTTagCompound tagCompound) { } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { if (getFluidCapability() != null) { fluids = new FluidTankProperties[getFluidCapability().getTankProperties().length]; this.mode = MODE.FLUID; @@ -283,13 +290,14 @@ public void readInitialSyncData(@NotNull PacketBuffer packetBuffer) { @Override public void update() { - if (!isRemote() && getOffsetTimer() % 2 ==0) { + if (!isRemote() && getOffsetTimer() % 2 == 0) { syncAllInfo(); } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!this.getWorld().isRemote) { this.openUI((EntityPlayerMP) playerIn); } @@ -297,9 +305,11 @@ public void update() { } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult rayTraceResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult rayTraceResult) { if (!isRemote()) { - if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { + if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && + playerIn.getPersistentID().equals(lastClickUUID)) { return EnumActionResult.SUCCESS; } lastClickTime = this.getWorld().getTotalWorldTime(); @@ -307,7 +317,7 @@ public void update() { if (playerIn.isSneaking() && playerIn.getHeldItemMainhand().isEmpty()) { if (rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK) { int maxSlotLimit = Integer.MAX_VALUE; - if(this.getCoverableView() instanceof MetaTileEntity metaTileEntity) { + if (this.getCoverableView() instanceof MetaTileEntity metaTileEntity) { maxSlotLimit = this.mode == MODE.ITEM ? metaTileEntity.getImportItems().getSlots() : metaTileEntity.getImportFluids().getTanks(); } @@ -339,7 +349,8 @@ public void update() { @Override public boolean onLeftClick(@NotNull EntityPlayer entityPlayer, @NotNull CuboidRayTraceResult hitResult) { if (!isRemote()) { - if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && entityPlayer.getPersistentID().equals(lastClickUUID)) { + if (this.getWorld().getTotalWorldTime() - lastClickTime < 2 && + entityPlayer.getPersistentID().equals(lastClickUUID)) { return true; } lastClickTime = this.getWorld().getTotalWorldTime(); @@ -353,7 +364,8 @@ public EnumActionResult modeRightClick(EntityPlayer playerIn, EnumHand hand, MOD IFluidHandler fluidHandler = this.getFluidCapability(); if (mode == MODE.FLUID && fluidHandler != null) { if (!FluidUtil.interactWithFluidHandler(playerIn, hand, fluidHandler)) { - if (fluidHandler instanceof FluidHandlerProxy && FluidUtil.interactWithFluidHandler(playerIn, hand, ((FluidHandlerProxy) fluidHandler).input)) { + if (fluidHandler instanceof FluidHandlerProxy && + FluidUtil.interactWithFluidHandler(playerIn, hand, ((FluidHandlerProxy) fluidHandler).input)) { return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; @@ -414,7 +426,8 @@ public boolean modeLeftClick(EntityPlayer entityPlayer, MODE mode, int slot) { itemStack = itemHandler.extractItem(slot, 1, false); } if (itemStack.isEmpty() && itemHandler instanceof ItemHandlerProxy) { - IItemHandler insertHandler = ObfuscationReflectionHelper.getPrivateValue(ItemHandlerProxy.class, (ItemHandlerProxy) itemHandler, "insertHandler"); + IItemHandler insertHandler = ObfuscationReflectionHelper.getPrivateValue(ItemHandlerProxy.class, + (ItemHandlerProxy) itemHandler, "insertHandler"); if (slot < insertHandler.getSlots()) { if (entityPlayer.isSneaking()) { itemStack = insertHandler.extractItem(slot, 64, false); @@ -424,7 +437,8 @@ public boolean modeLeftClick(EntityPlayer entityPlayer, MODE mode, int slot) { } } if (!itemStack.isEmpty()) { - EntityItem entity = new EntityItem(entityPlayer.world, entityPlayer.posX + .5f, entityPlayer.posY + .3f, entityPlayer.posZ + .5f, itemStack); + EntityItem entity = new EntityItem(entityPlayer.world, entityPlayer.posX + .5f, + entityPlayer.posY + .3f, entityPlayer.posZ + .5f, itemStack); entity.addVelocity(-entity.motionX, -entity.motionY, -entity.motionZ); entityPlayer.world.spawnEntity(entity); } @@ -439,21 +453,26 @@ public ModularUI createUI(EntityPlayer player) { WidgetGroup primaryGroup = new WidgetGroup(new Position(0, 10)); primaryGroup.addWidget(new LabelWidget(10, 5, "metaitem.cover.digital.name", 0)); ToggleButtonWidget[] buttons = new ToggleButtonWidget[5]; - buttons[0] = new ToggleButtonWidget(40, 20, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == MODE.FLUID, (pressed) -> { - if (pressed) setMode(MODE.FLUID); - }).setTooltipText("metaitem.cover.digital.mode.fluid"); - buttons[1] = new ToggleButtonWidget(60, 20, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == MODE.ITEM, (pressed) -> { - if (pressed) setMode(MODE.ITEM); - }).setTooltipText("metaitem.cover.digital.mode.item"); - buttons[2] = new ToggleButtonWidget(80, 20, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == MODE.ENERGY, (pressed) -> { - if (pressed) setMode(MODE.ENERGY); - }).setTooltipText("metaitem.cover.digital.mode.energy"); - buttons[3] = new ToggleButtonWidget(100, 20, 20, 20, GuiTextures.BUTTON_MACHINE, () -> this.mode == MODE.MACHINE, (pressed) -> { - if (pressed) setMode(MODE.MACHINE); - }).setTooltipText("metaitem.cover.digital.mode.machine"); - buttons[4] = new ToggleButtonWidget(140, 20, 20, 20, GuiTextures.BUTTON_INTERFACE, () -> this.mode == MODE.PROXY, (pressed) -> { - if (pressed) setMode(MODE.PROXY); - }).setTooltipText("metaitem.cover.digital.mode.proxy"); + buttons[0] = new ToggleButtonWidget(40, 20, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == MODE.FLUID, + (pressed) -> { + if (pressed) setMode(MODE.FLUID); + }).setTooltipText("metaitem.cover.digital.mode.fluid"); + buttons[1] = new ToggleButtonWidget(60, 20, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == MODE.ITEM, + (pressed) -> { + if (pressed) setMode(MODE.ITEM); + }).setTooltipText("metaitem.cover.digital.mode.item"); + buttons[2] = new ToggleButtonWidget(80, 20, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == MODE.ENERGY, + (pressed) -> { + if (pressed) setMode(MODE.ENERGY); + }).setTooltipText("metaitem.cover.digital.mode.energy"); + buttons[3] = new ToggleButtonWidget(100, 20, 20, 20, GuiTextures.BUTTON_MACHINE, + () -> this.mode == MODE.MACHINE, (pressed) -> { + if (pressed) setMode(MODE.MACHINE); + }).setTooltipText("metaitem.cover.digital.mode.machine"); + buttons[4] = new ToggleButtonWidget(140, 20, 20, 20, GuiTextures.BUTTON_INTERFACE, + () -> this.mode == MODE.PROXY, (pressed) -> { + if (pressed) setMode(MODE.PROXY); + }).setTooltipText("metaitem.cover.digital.mode.proxy"); primaryGroup.addWidget(new LabelWidget(10, 25, "metaitem.cover.digital.title.mode", 0)); primaryGroup.addWidget(buttons[0]); primaryGroup.addWidget(buttons[1]); @@ -462,8 +481,10 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(buttons[4]); primaryGroup.addWidget(new LabelWidget(10, 50, "monitor.gui.title.slot", 0)); - primaryGroup.addWidget(new ClickButtonWidget(40, 45, 20, 20, "-1", (data) -> setMode(slot - (data.isShiftClick ? 10 : 1)))); - primaryGroup.addWidget(new ClickButtonWidget(140, 45, 20, 20, "+1", (data) -> setMode(slot + (data.isShiftClick ? 10 : 1)))); + primaryGroup.addWidget( + new ClickButtonWidget(40, 45, 20, 20, "-1", (data) -> setMode(slot - (data.isShiftClick ? 10 : 1)))); + primaryGroup.addWidget( + new ClickButtonWidget(140, 45, 20, 20, "+1", (data) -> setMode(slot + (data.isShiftClick ? 10 : 1)))); primaryGroup.addWidget(new ImageWidget(60, 45, 80, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new SimpleTextWidget(100, 55, "", 16777215, () -> Integer.toString(this.slot))); @@ -471,7 +492,8 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new ClickButtonWidget(40, 70, 20, 20, "R", (data) -> setMode(this.spin.rotateY()))); primaryGroup.addWidget(new ImageWidget(60, 70, 80, 20, GuiTextures.DISPLAY)); primaryGroup.addWidget(new SimpleTextWidget(100, 80, "", 16777215, () -> this.spin.toString())); - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 202).widget(primaryGroup).bindPlayerInventory(player.inventory, GuiTextures.SLOT, 8, 120); + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 202).widget(primaryGroup) + .bindPlayerInventory(player.inventory, GuiTextures.SLOT, 8, 120); return builder.build(this, player); } @@ -488,20 +510,26 @@ private void syncAllInfo() { List toUpdate = new ArrayList<>(); for (int i = 0; i < fluidTankProperties.length; i++) { FluidStack content = fluidTankProperties[i].getContents(); - if (fluids[i] == null || (content == null && fluids[i].getContents() != null) || (content != null && fluids[i].getContents() == null) || + if (fluids[i] == null || (content == null && fluids[i].getContents() != null) || + (content != null && fluids[i].getContents() == null) || fluidTankProperties[i].getCapacity() != fluids[i].getCapacity() || fluidTankProperties[i].canDrain() != fluids[i].canDrain() || fluidTankProperties[i].canFill() != fluids[i].canFill()) { syncFlag = true; - fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); - toUpdate.add(i); - } else if (content != null && (fluids[i] != null && fluids[i].getContents() != null && (content.amount != fluids[i].getContents().amount || !content.isFluidEqual(fluids[i].getContents())))) { - syncFlag = true; - fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); + fluids[i] = new FluidTankProperties(content, fluidTankProperties[i].getCapacity(), + fluidTankProperties[i].canFill(), fluidTankProperties[i].canDrain()); toUpdate.add(i); - } + } else if (content != null && (fluids[i] != null && fluids[i].getContents() != null && + (content.amount != fluids[i].getContents().amount || + !content.isFluidEqual(fluids[i].getContents())))) { + syncFlag = true; + fluids[i] = new FluidTankProperties(content, + fluidTankProperties[i].getCapacity(), fluidTankProperties[i].canFill(), + fluidTankProperties[i].canDrain()); + toUpdate.add(i); + } } - if (syncFlag) writeCustomData(GregtechDataCodes.UPDATE_FLUID, packetBuffer->{ + if (syncFlag) writeCustomData(GregtechDataCodes.UPDATE_FLUID, packetBuffer -> { packetBuffer.writeVarInt(fluids.length); packetBuffer.writeVarInt(toUpdate.size()); for (Integer index : toUpdate) { @@ -513,7 +541,7 @@ private void syncAllInfo() { if (mode == MODE.ITEM || (mode == MODE.PROXY && proxyMode[1] > 0)) { boolean syncFlag = false; IItemHandler itemHandler = this.getItemCapability(); - if(itemHandler != null) { + if (itemHandler != null) { int size = itemHandler.getSlots(); if (this.slot < size) { int maxStoredItems = itemHandler.getSlotLimit(this.slot); @@ -553,7 +581,8 @@ private void syncAllInfo() { IEnergyContainer energyContainer = this.getEnergyCapability(); if (energyContainer != null) { // TODO, figure out what to do when values exceed Long.MAX_VALUE, ie with multiple Ultimate batteries - if (energyStored != energyContainer.getEnergyStored() || energyCapability != energyContainer.getEnergyCapacity()) { + if (energyStored != energyContainer.getEnergyStored() || + energyCapability != energyContainer.getEnergyCapacity()) { energyStored = energyContainer.getEnergyStored(); energyCapability = energyContainer.getEnergyCapacity(); writeCustomData(GregtechDataCodes.UPDATE_ENERGY, packetBuffer -> { @@ -561,7 +590,7 @@ private void syncAllInfo() { packetBuffer.writeLong(energyCapability); }); } - if (this.getOffsetTimer() % 20 == 0) { //per second + if (this.getOffsetTimer() % 20 == 0) { // per second writeCustomData(GregtechDataCodes.UPDATE_ENERGY_PER, packetBuffer -> { packetBuffer.writeLong(energyContainer.getInputPerSec()); packetBuffer.writeLong(energyContainer.getOutputPerSec()); @@ -582,7 +611,8 @@ private void syncAllInfo() { int maxProgress = workable.getMaxProgress(); boolean isActive = workable.isActive(); boolean isWorkingEnable = workable.isWorkingEnabled(); - if (isActive != this.isActive || isWorkingEnable != this.isWorkingEnabled || this.progress != progress || this.maxProgress != maxProgress) { + if (isActive != this.isActive || isWorkingEnable != this.isWorkingEnabled || + this.progress != progress || this.maxProgress != maxProgress) { this.progress = progress; this.maxProgress = maxProgress; this.isWorkingEnabled = isWorkingEnable; @@ -597,7 +627,8 @@ private void syncAllInfo() { if (this.getOffsetTimer() % 20 == 0) { IEnergyContainer energyContainer = this.getEnergyCapability(); if (energyContainer != null) { - if (energyStored != energyContainer.getEnergyStored() || energyCapability != energyContainer.getEnergyCapacity()) { + if (energyStored != energyContainer.getEnergyStored() || + energyCapability != energyContainer.getEnergyCapacity()) { energyStored = energyContainer.getEnergyStored(); energyCapability = energyContainer.getEnergyCapacity(); writeCustomData(GregtechDataCodes.UPDATE_ENERGY, packetBuffer -> { @@ -641,7 +672,8 @@ private void readFluids(PacketBuffer packetBuffer) { int index = packetBuffer.readVarInt(); NBTTagCompound nbt = packetBuffer.readCompoundTag(); if (nbt != null) { - fluids[index] = new FluidTankProperties(FluidStack.loadFluidStackFromNBT(nbt), nbt.getInteger("Capacity")); + fluids[index] = new FluidTankProperties(FluidStack.loadFluidStackFromNBT(nbt), + nbt.getInteger("Capacity")); } } } catch (IOException e) { @@ -662,7 +694,7 @@ private void writeAllItems(PacketBuffer packetBuffer) { private void readItems(PacketBuffer packetBuffer) { maxItemCapability = packetBuffer.readVarInt(); int size = packetBuffer.readVarInt(); - if(items == null || items.length != size) { + if (items == null || items.length != size) { items = new ItemStack[size]; } size = packetBuffer.readVarInt(); @@ -674,7 +706,7 @@ private void readItems(PacketBuffer packetBuffer) { items[index] = new ItemStack(nbt); items[index].setCount(nbt.getInteger("count")); } else { - items [index] = ItemStack.EMPTY; + items[index] = ItemStack.EMPTY; } } } catch (IOException e) { @@ -690,7 +722,8 @@ public static NBTTagCompound fixItemStackSer(ItemStack itemStack) { public IFluidHandler getFluidCapability() { TileEntity te = getCoveredTE(); - IFluidHandler capability = te == null ? null : te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getCoveredFacing()); + IFluidHandler capability = te == null ? null : + te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.IMPORT_FLUIDS); List output = controllerBase.getAbilities(MultiblockAbility.EXPORT_FLUIDS); @@ -708,7 +741,8 @@ public IFluidHandler getFluidCapability() { public IItemHandler getItemCapability() { TileEntity te = getCoveredTE(); - IItemHandler capability = te == null ? null : te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getCoveredFacing()); + IItemHandler capability = te == null ? null : + te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.IMPORT_ITEMS); List output = controllerBase.getAbilities(MultiblockAbility.EXPORT_ITEMS); @@ -726,7 +760,8 @@ public IItemHandler getItemCapability() { public IEnergyContainer getEnergyCapability() { TileEntity te = getCoveredTE(); - IEnergyContainer capability = te == null ? null : te.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, getCoveredFacing()); + IEnergyContainer capability = te == null ? null : + te.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, getCoveredFacing()); if (capability == null && this.getCoverableView() instanceof MultiblockControllerBase controllerBase) { List input = controllerBase.getAbilities(MultiblockAbility.INPUT_ENERGY); List output = controllerBase.getAbilities(MultiblockAbility.OUTPUT_ENERGY); @@ -740,26 +775,33 @@ public IEnergyContainer getEnergyCapability() { capability = new EnergyContainerList(list); } else if (capability == null && te != null) { IEnergyStorage fe = te.getCapability(CapabilityEnergy.ENERGY, getCoveredFacing()); - if(fe != null) { + if (fe != null) { return new IEnergyContainer() { + public long acceptEnergyFromNetwork(EnumFacing enumFacing, long l, long l1) { return 0; } + public boolean inputsEnergy(EnumFacing enumFacing) { return false; } + public long changeEnergy(long l) { return 0; } + public long getEnergyStored() { return FeCompat.toEu(fe.getEnergyStored(), FeCompat.ratio(false)); } + public long getEnergyCapacity() { return FeCompat.toEu(fe.getMaxEnergyStored(), FeCompat.ratio(false)); } + public long getInputAmperage() { return 0; } + public long getInputVoltage() { return 0; } @@ -778,7 +820,8 @@ public IWorkable getMachineCapability() { public void readCustomData(int id, @NotNull PacketBuffer packetBuffer) { super.readCustomData(id, packetBuffer); if (id == GregtechDataCodes.UPDATE_COVER_MODE) { // set mode - setMode(MODE.VALUES[packetBuffer.readByte()], packetBuffer.readInt(), EnumFacing.byIndex(packetBuffer.readByte())); + setMode(MODE.VALUES[packetBuffer.readByte()], packetBuffer.readInt(), + EnumFacing.byIndex(packetBuffer.readByte())); } else if (id == GregtechDataCodes.UPDATE_FLUID) { // sync fluids readFluids(packetBuffer); } else if (id == GregtechDataCodes.UPDATE_ITEM) { @@ -814,7 +857,7 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } public boolean canCapabilityAttach() { - return getFluidCapability() != null || + return getFluidCapability() != null || getItemCapability() != null || getEnergyCapability() != null || getMachineCapability() != null; @@ -831,7 +874,8 @@ public T getCapability(@NotNull Capability capability, T defaultValue) { } @Override - public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, BlockRenderLayer blockRenderLayer) { + public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, + BlockRenderLayer blockRenderLayer) { codechicken.lib.vec.Rotation rotation = new codechicken.lib.vec.Rotation(0, 0, 1, 0); if (this.getAttachedSide().getAxis().isVertical()) { if (this.spin == EnumFacing.WEST) { @@ -849,26 +893,30 @@ public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVerte if (mode == MODE.PROXY) { Textures.COVER_INTERFACE_PROXY.renderSided(getAttachedSide(), cuboid6, ccRenderState, ops, translation); } else if (mode == MODE.FLUID) { - Textures.COVER_INTERFACE_FLUID.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); - Textures.COVER_INTERFACE_FLUID_GLASS.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), RenderUtil.adjustTrans(translation, getAttachedSide(), 3)); + Textures.COVER_INTERFACE_FLUID.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_FLUID_GLASS.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), RenderUtil.adjustTrans(translation, getAttachedSide(), 3)); } else if (mode == MODE.ITEM) { - Textures.COVER_INTERFACE_ITEM.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_ITEM.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else if (mode == MODE.ENERGY) { - Textures.COVER_INTERFACE_ENERGY.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_ENERGY.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else if (mode == MODE.MACHINE) { if (isWorkingEnabled) { - Textures.COVER_INTERFACE_MACHINE_ON.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_MACHINE_ON.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } else { - Textures.COVER_INTERFACE_MACHINE_OFF.renderSided(getAttachedSide(), cuboid6, ccRenderState, ArrayUtils.addAll(ops, rotation), translation); + Textures.COVER_INTERFACE_MACHINE_OFF.renderSided(getAttachedSide(), cuboid6, ccRenderState, + ArrayUtils.addAll(ops, rotation), translation); } } } @SideOnly(Side.CLIENT) @Override - public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - - } + public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {} @SideOnly(Side.CLIENT) @Override @@ -881,13 +929,14 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); RenderUtil.moveToFace(x, y, z, getAttachedSide()); - RenderUtil.rotateToFace(getAttachedSide(), getAttachedSide().getAxis() == EnumFacing.Axis.Y ? this.spin : EnumFacing.NORTH); + RenderUtil.rotateToFace(getAttachedSide(), + getAttachedSide().getAxis() == EnumFacing.Axis.Y ? this.spin : EnumFacing.NORTH); if (!renderSneakingLookAt(this.getPos(), getAttachedSide(), this.slot, partialTicks)) { renderMode(this.mode, this.slot, partialTicks); } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); @@ -907,8 +956,10 @@ public AxisAlignedBB getRenderBoundingBox() { public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot, float partialTicks) { EntityPlayer player = Minecraft.getMinecraft().player; if (player != null && player.isSneaking() && player.getHeldItemMainhand().isEmpty()) { - RayTraceResult rayTraceResult = player.rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && rayTraceResult.sideHit == side && rayTraceResult.getBlockPos().equals(blockPos)) { + RayTraceResult rayTraceResult = player + .rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && + rayTraceResult.sideHit == side && rayTraceResult.getBlockPos().equals(blockPos)) { RenderUtil.renderRect(-7f / 16, -7f / 16, 3f / 16, 3f / 16, 0.002f, 0XFF838583); RenderUtil.renderRect(4f / 16, -7f / 16, 3f / 16, 3f / 16, 0.002f, 0XFF838583); RenderUtil.renderText(-5.5f / 16, -5.5F / 16, 0, 1.0f / 70, 0XFFFFFFFF, "<", true); @@ -921,7 +972,9 @@ public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot itemStack = ((IGregTechTileEntity) te).getMetaTileEntity().getStackForm(); } else { BlockPos pos = te.getPos(); - itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), getCoveredFacing(), pos), te.getWorld(), pos, Minecraft.getMinecraft().player); + itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), + new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), getCoveredFacing(), pos), te.getWorld(), + pos, Minecraft.getMinecraft().player); } String name = itemStack.getDisplayName(); RenderUtil.renderRect(-7f / 16, -4f / 16, 14f / 16, 1f / 16, 0.002f, 0XFF000000); @@ -936,7 +989,8 @@ public boolean renderSneakingLookAt(BlockPos blockPos, EnumFacing side, int slot @SideOnly(Side.CLIENT) public void renderMode(MODE mode, int slot, float partialTicks) { - if (mode == MODE.FLUID && fluids.length > slot && slot >= 0 && fluids[slot] != null && fluids[slot].getContents() != null) { + if (mode == MODE.FLUID && fluids.length > slot && slot >= 0 && fluids[slot] != null && + fluids[slot].getContents() != null) { renderFluidMode(slot); } else if (mode == MODE.ITEM && items.length > slot && slot >= 0 && items[slot] != null) { renderItemMode(slot); @@ -962,16 +1016,20 @@ private void renderMachineMode(float partialTicks) { endAlpha = (int) (510 - 255 / 0.4375 * offset); } RenderUtil.renderRect(-7f / 16, -7f / 16, progress * 14f / (maxProgress * 16), 3f / 16, 0.002f, 0XFFFF5F44); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(progress * 100L / maxProgress, MODE.MACHINE), true); - RenderUtil.renderGradientRect(start, -4f / 16, width, 1f / 16, 0.002f, (color & 0X00FFFFFF) | (startAlpha << 24), (color & 0X00FFFFFF) | (endAlpha << 24), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(progress * 100L / maxProgress, MODE.MACHINE), true); + RenderUtil.renderGradientRect(start, -4f / 16, width, 1f / 16, 0.002f, + (color & 0X00FFFFFF) | (startAlpha << 24), (color & 0X00FFFFFF) | (endAlpha << 24), true); } else { RenderUtil.renderRect(-7f / 16, -4f / 16, 14f / 16, 1f / 16, 0.002f, color); } if (this.isProxy()) { if (isWorkingEnabled) { - RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_ON_PROXY, -7f / 16, 1f / 16, 14f / 16, 3f / 16, 0.002f); + RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_ON_PROXY, -7f / 16, 1f / 16, 14f / 16, + 3f / 16, 0.002f); } else { - RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_OFF_PROXY, -7f / 16, -1f / 16, 14f / 16, 5f / 16, 0.002f); + RenderUtil.renderTextureArea(GuiTextures.COVER_INTERFACE_MACHINE_OFF_PROXY, -7f / 16, -1f / 16, + 14f / 16, 5f / 16, 0.002f); } } } @@ -988,11 +1046,16 @@ private void renderEnergyMode() { } RenderUtil.renderLineChart(inputEnergyList, max, -5.5f / 16, 5.5f / 16, 12f / 16, 6f / 16, 0.005f, 0XFF03FF00); RenderUtil.renderLineChart(outputEnergyList, max, -5.5f / 16, 5.5f / 16, 12f / 16, 6f / 16, 0.005f, 0XFFFF2F39); - RenderUtil.renderText(-5.7f / 16, -2.3f / 16, 0, 1.0f / 270, 0XFF03FF00, "EU I: " + energyInputPerDur + "EU/s", false); - RenderUtil.renderText(-5.7f / 16, -1.6f / 16, 0, 1.0f / 270, 0XFFFF0000, "EU O: " + energyOutputPerDur + "EU/s", false); - // Bandaid fix to prevent overflowing renders when dealing with items that cause long overflow, ie Ultimate Battery - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(0, energyStored * 14f / (energyCapability * 16)), 3f / 16, 0.002f, 0XFFFFD817); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(energyStored, MODE.ENERGY), true); + RenderUtil.renderText(-5.7f / 16, -2.3f / 16, 0, 1.0f / 270, 0XFF03FF00, "EU I: " + energyInputPerDur + "EU/s", + false); + RenderUtil.renderText(-5.7f / 16, -1.6f / 16, 0, 1.0f / 270, 0XFFFF0000, "EU O: " + energyOutputPerDur + "EU/s", + false); + // Bandaid fix to prevent overflowing renders when dealing with items that cause long overflow, ie Ultimate + // Battery + RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(0, energyStored * 14f / (energyCapability * 16)), 3f / 16, + 0.002f, 0XFFFFD817); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(energyStored, MODE.ENERGY), true); } @SideOnly(Side.CLIENT) @@ -1001,11 +1064,16 @@ private void renderItemMode(int slot) { if (!itemStack.isEmpty()) { RenderUtil.renderItemOverLay(-8f / 16, -5f / 16, 0, 1f / 32, itemStack); if (maxItemCapability != 0) { - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(itemStack.getCount() * 14f / (maxItemCapability * 16), 0.001f), 3f / 16, 0.002f, 0XFF25B9FF); + RenderUtil.renderRect(-7f / 16, -7f / 16, + Math.max(itemStack.getCount() * 14f / (maxItemCapability * 16), 0.001f), 3f / 16, 0.002f, + 0XFF25B9FF); } else { - RenderUtil.renderRect(-7f / 16, -7f / 16, Math.max(itemStack.getCount() * 14f / (itemStack.getMaxStackSize() * 16), 0.001f), 3f / 16, 0.002f, 0XFF25B9FF); + RenderUtil.renderRect(-7f / 16, -7f / 16, + Math.max(itemStack.getCount() * 14f / (itemStack.getMaxStackSize() * 16), 0.001f), 3f / 16, + 0.002f, 0XFF25B9FF); } - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, readAmountOrCountOrEnergy(itemStack.getCount(), MODE.ITEM), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), 0XFFFFFFFF, + readAmountOrCountOrEnergy(itemStack.getCount(), MODE.ITEM), true); } } @@ -1017,18 +1085,20 @@ private void renderFluidMode(int slot) { float height = 10f / 16 * Math.max(fluidStack.amount * 1.0f / fluids[slot].getCapacity(), 0.001f); RenderUtil.renderFluidOverLay(-7f / 16, 0.4375f - height, 14f / 16, height, 0.002f, fluidStack, 0.8f); int fluidColor = WidgetOreList.getFluidColor(fluidStack.getFluid()); - int textColor = ((fluidColor & 0xff) + ((fluidColor >> 8) & 0xff) + ((fluidColor >> 16) & 0xff)) / 3 > (255 / 2) ? 0X0 : 0XFFFFFFFF; + int textColor = ((fluidColor & 0xff) + ((fluidColor >> 8) & 0xff) + ((fluidColor >> 16) & 0xff)) / 3 > + (255 / 2) ? 0X0 : 0XFFFFFFFF; RenderUtil.renderRect(-7f / 16, -7f / 16, 14f / 16, 3f / 16, 0.002f, fluidColor | (255 << 24)); - RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), textColor, readAmountOrCountOrEnergy(fluidStack.amount, MODE.FLUID), true); + RenderUtil.renderText(0, -5.5F / 16, 0, 1.0f / (isProxy() ? 110 : 70), textColor, + readAmountOrCountOrEnergy(fluidStack.amount, MODE.FLUID), true); } static String[][] units = { - {"", "mB", "", "EU"}, - {"", "B", "K", "KEU"}, - {"", "KB", "M", "MEU"}, - {"", "MB", "G", "GEU"}, - {"", "GB", "T", "TEU"}, - {"", "TB", "P", "PEU"}, + { "", "mB", "", "EU" }, + { "", "B", "K", "KEU" }, + { "", "KB", "M", "MEU" }, + { "", "MB", "G", "GEU" }, + { "", "GB", "T", "TEU" }, + { "", "TB", "P", "PEU" }, }; @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java b/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java index 1d7efdb7ee9..329085dc55c 100644 --- a/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java +++ b/src/main/java/gregtech/common/covers/CoverDigitalInterfaceWireless.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -12,6 +7,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.items.behaviors.CoverDigitalInterfaceWirelessPlaceBehaviour; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -23,6 +19,12 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,13 +32,13 @@ public class CoverDigitalInterfaceWireless extends CoverDigitalInterface { private BlockPos remote; - public CoverDigitalInterfaceWireless(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDigitalInterfaceWireless(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void setMode(MODE mode, int slot, EnumFacing spin) { - } + public void setMode(MODE mode, int slot, EnumFacing spin) {} @Override public void writeToNBT(NBTTagCompound tagCompound) { @@ -49,7 +51,8 @@ public void writeToNBT(NBTTagCompound tagCompound) { @Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - this.remote = tagCompound.hasKey("cdiRemote") ? NBTUtil.getPosFromTag(tagCompound.getCompoundTag("cdiRemote")) : null; + this.remote = tagCompound.hasKey("cdiRemote") ? NBTUtil.getPosFromTag(tagCompound.getCompoundTag("cdiRemote")) : + null; } @Override @@ -70,7 +73,8 @@ public void readInitialSyncData(PacketBuffer packetBuffer) { } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { remote = CoverDigitalInterfaceWirelessPlaceBehaviour.getRemotePos(itemStack); } @@ -79,14 +83,16 @@ public void update() { super.update(); if (remote != null && !isRemote() && getOffsetTimer() % 20 == 0) { TileEntity te = getWorld().getTileEntity(remote); - if (te instanceof IGregTechTileEntity igtte && igtte.getMetaTileEntity() instanceof MetaTileEntityCentralMonitor monitor) { + if (te instanceof IGregTechTileEntity igtte && + igtte.getMetaTileEntity() instanceof MetaTileEntityCentralMonitor monitor) { monitor.addRemoteCover(new FacingPos(getPos(), getAttachedSide())); } } } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.SUCCESS; } @@ -100,7 +106,8 @@ public void update() { } @Override - public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, BlockRenderLayer blockRenderLayer) { + public void renderCover(CCRenderState ccRenderState, Matrix4 translation, IVertexOperation[] ops, Cuboid6 cuboid6, + BlockRenderLayer blockRenderLayer) { Textures.COVER_INTERFACE_WIRELESS.renderSided(getAttachedSide(), cuboid6, ccRenderState, ops, translation); } } diff --git a/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java b/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java index b79abfcef6d..b34348c69bb 100644 --- a/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java +++ b/src/main/java/gregtech/common/covers/CoverEnderFluidLink.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.CoverBase; @@ -19,6 +14,7 @@ import gregtech.api.util.VirtualTankRegistry; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -28,6 +24,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,7 +52,8 @@ public class CoverEnderFluidLink extends CoverBase implements CoverWithUI, ITick private final FluidTankSwitchShim linkedTank; protected final FluidFilterContainer fluidFilter; - protected CoverEnderFluidLink(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + protected CoverEnderFluidLink(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.linkedTank = new FluidTankSwitchShim(VirtualTankRegistry.getTankCreate(makeTankName(), null)); this.fluidFilter = new FluidFilterContainer(this); @@ -78,12 +81,14 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.ENDER_FLUID_LINK.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -91,7 +96,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); if (player != null) { this.playerUUID = player.getUniqueID(); @@ -111,7 +117,8 @@ public void update() { } protected void transferFluids() { - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (fluidHandler == null) return; if (pumpMode == CoverPump.PumpMode.IMPORT) { GTTransferUtils.transferFluids(fluidHandler, linkedTank, TRANSFER_RATE, fluidFilter::testFluidStack); @@ -141,13 +148,13 @@ public ModularUI createUI(EntityPlayer player) { widgetGroup.addWidget(new LabelWidget(10, 5, "cover.ender_fluid_link.title")); widgetGroup.addWidget(new ToggleButtonWidget(12, 18, 18, 18, GuiTextures.BUTTON_PUBLIC_PRIVATE, this::isPrivate, this::setPrivate) - .setTooltipText("cover.ender_fluid_link.private.tooltip")); + .setTooltipText("cover.ender_fluid_link.private.tooltip")); widgetGroup.addWidget(new SyncableColorRectWidget(35, 18, 18, 18, () -> color) .setBorderWidth(1) .drawCheckerboard(4, 4)); widgetGroup.addWidget(new TextFieldWidget(58, 13, 58, 18, true, this::getColorStr, this::updateColor, 8) - .setValidator(str -> COLOR_INPUT_PATTERN.matcher(str).matches())); + .setValidator(str -> COLOR_INPUT_PATTERN.matcher(str).matches())); widgetGroup.addWidget(new TankWidget(this.linkedTank, 123, 18, 18, 18) .setContainerClicking(true, true) .setBackgroundTexture(GuiTextures.FLUID_SLOT).setAlwaysShowFull(true)); @@ -159,7 +166,8 @@ public ModularUI createUI(EntityPlayer player) { widgetGroup.addWidget(new CycleButtonWidget(10, 42, 75, 18, CoverPump.PumpMode.class, this::getPumpMode, this::setPumpMode)); widgetGroup.addWidget(new CycleButtonWidget(92, 42, 75, 18, - this::isIoEnabled, this::setIoEnabled, "cover.ender_fluid_link.iomode.disabled", "cover.ender_fluid_link.iomode.enabled")); + this::isIoEnabled, this::setIoEnabled, "cover.ender_fluid_link.iomode.disabled", + "cover.ender_fluid_link.iomode.enabled")); this.fluidFilter.initUI(65, widgetGroup::addWidget); return ModularUI.builder(GuiTextures.BACKGROUND, 176, 221) .widget(widgetGroup) @@ -226,10 +234,10 @@ public void writeInitialSyncData(PacketBuffer packetBuffer) { @Override public void readInitialSyncData(PacketBuffer packetBuffer) { this.color = packetBuffer.readInt(); - //does client even need uuid info? just in case + // does client even need uuid info? just in case String uuidStr = packetBuffer.readString(36); this.playerUUID = uuidStr.equals("null") ? null : UUID.fromString(uuidStr); - //client does not need the actual tank reference, the default one will do just fine + // client does not need the actual tank reference, the default one will do just fine } @Override diff --git a/src/main/java/gregtech/common/covers/CoverFacade.java b/src/main/java/gregtech/common/covers/CoverFacade.java index 7b03c3d9a0b..9f458f8cec2 100644 --- a/src/main/java/gregtech/common/covers/CoverFacade.java +++ b/src/main/java/gregtech/common/covers/CoverFacade.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -13,6 +9,7 @@ import gregtech.client.renderer.handler.FacadeRenderer; import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -25,6 +22,11 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.MinecraftForgeClient; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,17 +55,20 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); setFacadeStack(FacadeItem.getFacadeStack(itemStack)); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { BlockRenderLayer oldLayer = MinecraftForgeClient.getRenderLayer(); ForgeHooksClient.setRenderLayer(layer); - FacadeRenderer.renderBlockCover(renderState, translation, getCoverableView().getWorld(), getCoverableView().getPos(), getAttachedSide().getIndex(), facadeState, plateBox, layer); + FacadeRenderer.renderBlockCover(renderState, translation, getCoverableView().getWorld(), + getCoverableView().getPos(), getAttachedSide().getIndex(), facadeState, plateBox, layer); ForgeHooksClient.setRenderLayer(oldLayer); } @@ -152,5 +157,7 @@ public boolean canRenderBackside() { } @Override - public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) {} + public void renderCoverPlate(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, + @NotNull BlockRenderLayer layer) {} } diff --git a/src/main/java/gregtech/common/covers/CoverFluidFilter.java b/src/main/java/gregtech/common/covers/CoverFluidFilter.java index 5e1ac806d5d..0e8fa374c0a 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidFilter.java +++ b/src/main/java/gregtech/common/covers/CoverFluidFilter.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerDelegate; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -19,6 +14,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.FluidFilter; import gregtech.common.covers.filter.FluidFilterWrapper; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -30,6 +26,12 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -43,7 +45,8 @@ public class CoverFluidFilter extends CoverBase implements CoverWithUI { protected FluidHandlerFiltered fluidHandler; public CoverFluidFilter(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, - @NotNull EnumFacing attachedSide, String titleLocale, SimpleOverlayRenderer texture, FluidFilter fluidFilter) { + @NotNull EnumFacing attachedSide, String titleLocale, SimpleOverlayRenderer texture, + FluidFilter fluidFilter) { super(definition, coverableView, attachedSide); this.filterMode = FluidFilterMode.FILTER_FILL; this.titleLocale = titleLocale; @@ -79,7 +82,8 @@ public boolean canPipePassThrough() { return true; } - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!playerIn.world.isRemote) { this.openUI((EntityPlayerMP) playerIn); } @@ -101,7 +105,8 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { this.texture.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java index e6d70dfc2a4..553f2734b46 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java +++ b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java @@ -1,6 +1,5 @@ package gregtech.common.covers; -import com.google.common.math.IntMath; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -12,7 +11,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.FluidFilter; import gregtech.common.covers.filter.FluidFilterContainer; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -27,6 +26,9 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.math.IntMath; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.apache.logging.log4j.message.FormattedMessage; import org.jetbrains.annotations.NotNull; @@ -36,13 +38,13 @@ import java.util.Objects; import java.util.function.Predicate; - public class CoverFluidRegulator extends CoverPump { protected TransferMode transferMode = TransferMode.TRANSFER_ANY; protected int transferAmount = 0; - public CoverFluidRegulator(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide, int tier, int mbPerTick) { + public CoverFluidRegulator(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide, int tier, int mbPerTick) { super(definition, coverableView, attachedSide, tier, mbPerTick); this.fluidFilter = new FluidFilterContainer(this, this::shouldShowTip, maxFluidTransferRate * 100); } @@ -57,7 +59,8 @@ public int getTransferAmount() { } @Override - protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, int transferLimit) { + protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, + int transferLimit) { IFluidHandler sourceHandler; IFluidHandler destHandler; @@ -71,20 +74,22 @@ protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandl return 0; } return switch (transferMode) { - case TRANSFER_ANY -> - GTTransferUtils.transferFluids(sourceHandler, destHandler, transferLimit, fluidFilter::testFluidStack); - case KEEP_EXACT -> - doKeepExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, this.transferAmount); - case TRANSFER_EXACT -> - doTransferExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, this.transferAmount); + case TRANSFER_ANY -> GTTransferUtils.transferFluids(sourceHandler, destHandler, transferLimit, + fluidFilter::testFluidStack); + case KEEP_EXACT -> doKeepExact(transferLimit, sourceHandler, destHandler, fluidFilter::testFluidStack, + this.transferAmount); + case TRANSFER_EXACT -> doTransferExact(transferLimit, sourceHandler, destHandler, + fluidFilter::testFluidStack, this.transferAmount); }; } - protected int doTransferExact(int transferLimit, IFluidHandler sourceHandler, IFluidHandler destHandler, Predicate fluidFilter, int supplyAmount) { + protected int doTransferExact(int transferLimit, IFluidHandler sourceHandler, IFluidHandler destHandler, + Predicate fluidFilter, int supplyAmount) { int fluidLeftToTransfer = transferLimit; for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { FluidStack sourceFluid = tankProperties.getContents(); - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && transferMode != TransferMode.TRANSFER_ANY) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + transferMode != TransferMode.TRANSFER_ANY) { supplyAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(sourceFluid); } if (fluidLeftToTransfer < supplyAmount) @@ -114,21 +119,21 @@ protected int doKeepExact(final int transferLimit, final IFluidHandler destHandler, final Predicate fluidFilter, int keepAmount) { - if (sourceHandler == null || destHandler == null || fluidFilter == null) return 0; - final Map sourceFluids = - collectDistinctFluids(sourceHandler, IFluidTankProperties::canDrain, fluidFilter); - final Map destFluids = - collectDistinctFluids(destHandler, IFluidTankProperties::canFill, fluidFilter); + final Map sourceFluids = collectDistinctFluids(sourceHandler, + IFluidTankProperties::canDrain, fluidFilter); + final Map destFluids = collectDistinctFluids(destHandler, IFluidTankProperties::canFill, + fluidFilter); int transferred = 0; for (FluidStack fluidStack : sourceFluids.keySet()) { if (transferred >= transferLimit) break; - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && transferMode != TransferMode.TRANSFER_ANY) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + transferMode != TransferMode.TRANSFER_ANY) { keepAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(fluidStack); } @@ -145,7 +150,8 @@ protected int doKeepExact(final int transferLimit, continue; // Simulate a drain of this fluid from the source tanks - FluidStack drainedResult = sourceHandler.drain(copyFluidStackWithAmount(fluidStack, amountToMove), false); + FluidStack drainedResult = sourceHandler.drain(copyFluidStackWithAmount(fluidStack, amountToMove), + false); // Can't drain this fluid. Try the next one. if (drainedResult == null || drainedResult.amount <= 0 || !fluidStack.equals(drainedResult)) @@ -167,10 +173,12 @@ protected int doKeepExact(final int transferLimit, // Account for potential error states from the drain if (drainedActual == null) - throw new RuntimeException("Misbehaving fluid container: drain produced null after simulation succeeded"); + throw new RuntimeException( + "Misbehaving fluid container: drain produced null after simulation succeeded"); if (!fluidStack.equals(drainedActual)) - throw new RuntimeException("Misbehaving fluid container: drain produced a different fluid than the simulation"); + throw new RuntimeException( + "Misbehaving fluid container: drain produced a different fluid than the simulation"); if (drainedActual.amount != fluidToMove) throw new RuntimeException(new FormattedMessage( @@ -178,7 +186,6 @@ protected int doKeepExact(final int transferLimit, fluidToMove, drainedActual.amount).getFormattedMessage()); - // Perform Fill int filledActual = destHandler.fill(copyFluidStackWithAmount(fluidStack, fluidToMove), true); @@ -213,7 +220,6 @@ private static FluidStack copyFluidStackWithAmount(FluidStack fs, int amount) { private static Map collectDistinctFluids(IFluidHandler handler, Predicate tankTypeFilter, Predicate fluidTypeFilter) { - final Map summedFluids = new Object2IntOpenHashMap<>(); Arrays.stream(handler.getTankProperties()) .filter(tankTypeFilter) @@ -258,7 +264,8 @@ private String getTransferSizeString() { protected void getHoverString(List textList) { ITextComponent keepComponent = new TextComponentString(getTransferSizeString()); - TextComponentTranslation hoverKeep = new TextComponentTranslation("cover.fluid_regulator." + transferMode.name().toLowerCase(), this.transferAmount); + TextComponentTranslation hoverKeep = new TextComponentTranslation( + "cover.fluid_regulator." + transferMode.name().toLowerCase(), this.transferAmount); keepComponent.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverKeep)); textList.add(keepComponent); } @@ -275,8 +282,8 @@ private void adjustTransferSize(int amount) { if (bucketMode == BucketMode.BUCKET) amount *= 1000; switch (this.transferMode) { - case TRANSFER_EXACT -> - setTransferAmount(MathHelper.clamp(this.transferAmount + amount, 0, this.maxFluidTransferRate)); + case TRANSFER_EXACT -> setTransferAmount( + MathHelper.clamp(this.transferAmount + amount, 0, this.maxFluidTransferRate)); case KEEP_EXACT -> setTransferAmount(MathHelper.clamp(this.transferAmount + amount, 0, Integer.MAX_VALUE)); } } @@ -297,7 +304,7 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { WidgetGroup filterGroup = new WidgetGroup(); filterGroup.addWidget(new CycleButtonWidget(92, 43, 75, 18, TransferMode.class, this::getTransferMode, this::setTransferMode) - .setTooltipHoverString("cover.fluid_regulator.transfer_mode.description")); + .setTooltipHoverString("cover.fluid_regulator.transfer_mode.description")); ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(this::shouldDisplayAmountSlider); stackSizeGroup.addWidget(new ImageWidget(110, 64, 38, 18, GuiTextures.DISPLAY)); @@ -306,10 +313,11 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { .setDefaultTooltip() .setTextScale(0.7f) .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(92, 64, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); + stackSizeGroup + .addWidget(new IncrementButtonWidget(92, 64, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); stackSizeGroup.addWidget(new TextFieldWidget2(111, 70, 36, 11, this::getTransferAmountString, val -> { if (val != null && !val.isEmpty()) { @@ -321,16 +329,17 @@ protected ModularUI buildUI(ModularUI.Builder builder, EntityPlayer player) { } }) .setCentered(true) - .setNumbersOnly(1, transferMode == TransferMode.TRANSFER_EXACT ? maxFluidTransferRate : Integer.MAX_VALUE) + .setNumbersOnly(1, + transferMode == TransferMode.TRANSFER_EXACT ? maxFluidTransferRate : Integer.MAX_VALUE) .setMaxLength(10) .setScale(0.6f)); - stackSizeGroup.addWidget(new SimpleTextWidget(129, 78, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); + stackSizeGroup + .addWidget(new SimpleTextWidget(129, 78, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); return super.buildUI(builder.widget(filterGroup).widget(stackSizeGroup), player); } - @Override public void writeToNBT(@NotNull NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); @@ -343,7 +352,7 @@ public void writeToNBT(@NotNull NBTTagCompound tagCompound) { public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.transferMode = TransferMode.values()[tagCompound.getInteger("TransferMode")]; - //legacy NBT tag + // legacy NBT tag if (!tagCompound.hasKey("filterv2") && tagCompound.hasKey("TransferAmount")) { FluidFilter filter = getFluidFilterContainer().getFilterWrapper().getFluidFilter(); if (filter != null) { diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java index af25c07ea1b..4c1f097ccee 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; @@ -16,6 +11,7 @@ import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumActionResult; @@ -27,13 +23,20 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverFluidVoiding extends CoverPump { protected final NullFluidTank nullFluidTank = new NullFluidTank(); - public CoverFluidVoiding(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverFluidVoiding(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide, 0, Integer.MAX_VALUE); this.isWorkingAllowed = false; this.fluidFilter = new FluidFilterContainer(this, this::shouldShowTip, Integer.MAX_VALUE); @@ -47,7 +50,8 @@ public void update() { } protected void doTransferFluids() { - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (myFluidHandler == null) { return; } @@ -68,11 +72,11 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(10, 92, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100 + 82 + 16 + 24) .widget(primaryGroup) @@ -81,12 +85,14 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.FLUID_VOIDING.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isWorkingEnabled() ? diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java index c76ede3ad5d..4d2290aa13b 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -12,6 +8,7 @@ import gregtech.api.gui.widgets.*; import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -21,6 +18,11 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; @@ -31,7 +33,8 @@ public class CoverFluidVoidingAdvanced extends CoverFluidVoiding { protected VoidingMode voidingMode = VoidingMode.VOID_ANY; protected int transferAmount = 0; - public CoverFluidVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverFluidVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -42,13 +45,14 @@ protected boolean shouldShowTip() { @Override protected void doTransferFluids() { - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (myFluidHandler == null) { return; } switch (voidingMode) { - case VOID_ANY -> - GTTransferUtils.transferFluids(myFluidHandler, nullFluidTank, Integer.MAX_VALUE, fluidFilter::testFluidStack); + case VOID_ANY -> GTTransferUtils.transferFluids(myFluidHandler, nullFluidTank, Integer.MAX_VALUE, + fluidFilter::testFluidStack); case VOID_OVERFLOW -> voidOverflow(myFluidHandler, fluidFilter::testFluidStack, this.transferAmount); } } @@ -68,10 +72,13 @@ protected void voidOverflow(final IFluidHandler sourceHandler, for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { FluidStack sourceFluid = tankProperties.getContents(); - if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && voidingMode == VoidingMode.VOID_OVERFLOW) { + if (this.fluidFilter.getFilterWrapper().getFluidFilter() != null && + voidingMode == VoidingMode.VOID_OVERFLOW) { keepAmount = this.fluidFilter.getFilterWrapper().getFluidFilter().getFluidTransferLimit(sourceFluid); } - if (sourceFluid == null || sourceFluid.amount == 0 || !getFluidFilterContainer().testFluidStack(sourceFluid, true)) continue; + if (sourceFluid == null || sourceFluid.amount == 0 || + !getFluidFilterContainer().testFluidStack(sourceFluid, true)) + continue; sourceFluid.amount = sourceFluid.amount - keepAmount; sourceHandler.drain(sourceFluid, true); } @@ -135,17 +142,17 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(92, 15, 75, 18, VoidingMode.class, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString("cover.voiding.voiding_mode.description")); + .setTooltipHoverString("cover.voiding.voiding_mode.description")); this.initFilterUI(20, primaryGroup::addWidget); primaryGroup.addWidget(new CycleButtonWidget(10, 92, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 100 + 82 + 16 + 24) .widget(primaryGroup) @@ -153,7 +160,7 @@ public ModularUI createUI(EntityPlayer player) { return buildUI(builder, player); } - public void initFilterUI(int y, Consumer widgetGroup){ + public void initFilterUI(int y, Consumer widgetGroup) { widgetGroup.accept(new LabelWidget(10, y, "cover.pump.fluid_filter.title")); widgetGroup.accept(new SlotWidget(fluidFilter.getFilterInventory(), 0, 10, y + 15) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); @@ -165,10 +172,11 @@ public void initFilterUI(int y, Consumer widgetGroup){ .setDefaultTooltip() .setTextScale(0.7f) .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(92, 34, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); + stackSizeGroup + .addWidget(new IncrementButtonWidget(92, 34, 18, 18, -1, -10, -100, -1000, this::adjustTransferSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); stackSizeGroup.addWidget(new TextFieldWidget2(111, 39, 37, 11, this::getTransferAmountString, val -> { if (val != null && !val.isEmpty()) { @@ -184,23 +192,26 @@ public void initFilterUI(int y, Consumer widgetGroup){ .setMaxLength(10) .setScale(0.6f)); - stackSizeGroup.addWidget(new SimpleTextWidget(129, 47, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); + stackSizeGroup + .addWidget(new SimpleTextWidget(129, 47, "", 0xFFFFFF, () -> bucketMode.localeName).setScale(0.6f)); stackSizeGroup.addWidget(new CycleButtonWidget(114, 53, 30, 20, BucketMode.class, this::getBucketMode, mode -> { - if (mode != bucketMode) { - setBucketMode(mode); - } - })); + if (mode != bucketMode) { + setBucketMode(mode); + } + })); widgetGroup.accept(stackSizeGroup); this.fluidFilter.getFilterWrapper().initUI(y + 15, widgetGroup); - this.fluidFilter.getFilterWrapper().blacklistUI(y + 15, widgetGroup, () -> voidingMode != VoidingMode.VOID_OVERFLOW); + this.fluidFilter.getFilterWrapper().blacklistUI(y + 15, widgetGroup, + () -> voidingMode != VoidingMode.VOID_OVERFLOW); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.FLUID_VOIDING_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -217,5 +228,4 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { this.voidingMode = VoidingMode.values()[tagCompound.getInteger("VoidingMode")]; this.transferAmount = tagCompound.getInteger("TransferAmount"); } - } diff --git a/src/main/java/gregtech/common/covers/CoverInfiniteWater.java b/src/main/java/gregtech/common/covers/CoverInfiniteWater.java index fd6e6afcfa0..808308ecabb 100644 --- a/src/main/java/gregtech/common/covers/CoverInfiniteWater.java +++ b/src/main/java/gregtech/common/covers/CoverInfiniteWater.java @@ -1,13 +1,10 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; @@ -15,11 +12,17 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverInfiniteWater extends CoverBase implements ITickable { - public CoverInfiniteWater(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverInfiniteWater(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -29,14 +32,17 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState ccRenderState, @NotNull Matrix4 matrix4, IVertexOperation[] iVertexOperations, @NotNull Cuboid6 cuboid6, @NotNull BlockRenderLayer blockRenderLayer) { + public void renderCover(@NotNull CCRenderState ccRenderState, @NotNull Matrix4 matrix4, + IVertexOperation[] iVertexOperations, @NotNull Cuboid6 cuboid6, + @NotNull BlockRenderLayer blockRenderLayer) { Textures.INFINITE_WATER.renderSided(getAttachedSide(), cuboid6, ccRenderState, iVertexOperations, matrix4); } @Override public void update() { if (!getWorld().isRemote && getOffsetTimer() % 20 == 0) { - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = getCoverableView() + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); if (fluidHandler != null) { fluidHandler.fill(new FluidStack(FluidRegistry.WATER, 16000), true); } diff --git a/src/main/java/gregtech/common/covers/CoverItemFilter.java b/src/main/java/gregtech/common/covers/CoverItemFilter.java index 29e435e3a59..b427397432f 100644 --- a/src/main/java/gregtech/common/covers/CoverItemFilter.java +++ b/src/main/java/gregtech/common/covers/CoverItemFilter.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.ItemHandlerDelegate; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; @@ -19,6 +14,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.ItemFilter; import gregtech.common.covers.filter.ItemFilterWrapper; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -30,6 +26,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -77,7 +79,8 @@ public boolean canPipePassThrough() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!playerIn.world.isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -104,7 +107,8 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { this.texture.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverItemVoiding.java b/src/main/java/gregtech/common/covers/CoverItemVoiding.java index d845d30b987..d0119f6939f 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoiding.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; @@ -24,6 +20,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -46,7 +48,8 @@ public void update() { } protected void doTransferItems() { - IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getAttachedSide()); + IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + getAttachedSide()); if (myItemHandler == null) { return; } @@ -77,13 +80,14 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new LabelWidget(10, 5, getUITitle())); this.itemFilterContainer.initUI(20, primaryGroup::addWidget); - primaryGroup.addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, - "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + primaryGroup + .addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, + "cover.voiding.label.disabled", "cover.voiding.label.enabled") + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112 + 23, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 125 + 82 + 16 + 24) .widget(primaryGroup) @@ -92,12 +96,14 @@ public ModularUI createUI(EntityPlayer player) { } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { Textures.ITEM_VOIDING.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendStatusMessage(new TextComponentTranslation(isWorkingEnabled() ? @@ -118,6 +124,7 @@ public T getCapability(Capability capability, T defaultValue) { } class NullItemHandler implements IItemHandler { + @Override public int getSlots() { return 9; diff --git a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java index bcb294839b5..62d2844aaa3 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -11,6 +7,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.*; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -19,6 +16,11 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -37,7 +39,8 @@ public CoverItemVoidingAdvanced(@NotNull CoverDefinition definition, @NotNull Co @Override protected void doTransferItems() { - IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getAttachedSide()); + IItemHandler myItemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + getAttachedSide()); if (myItemHandler == null) { return; } @@ -68,7 +71,8 @@ protected void voidOverflow(IItemHandler myItemHandler) { for (int srcIndex = 0; srcIndex < myItemHandler.getSlots(); srcIndex++) { ItemStack is = myItemHandler.getStackInSlot(srcIndex); - if (!is.isEmpty() && ItemStack.areItemsEqual(is, typeItemInfo.itemStack) && ItemStack.areItemStackTagsEqual(is, typeItemInfo.itemStack)) { + if (!is.isEmpty() && ItemStack.areItemsEqual(is, typeItemInfo.itemStack) && + ItemStack.areItemStackTagsEqual(is, typeItemInfo.itemStack)) { ItemStack extracted = myItemHandler.extractItem(srcIndex, itemToVoidAmount, false); if (!extracted.isEmpty()) { itemToVoidAmount -= extracted.getCount(); @@ -93,17 +97,18 @@ public ModularUI createUI(EntityPlayer player) { primaryGroup.addWidget(new CycleButtonWidget(91, 14, 75, 20, VoidingMode.class, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString("cover.voiding.voiding_mode.description")); + .setTooltipHoverString("cover.voiding.voiding_mode.description")); this.initFilterUI(20, primaryGroup::addWidget); - primaryGroup.addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, - "cover.voiding.label.disabled", "cover.voiding.label.enabled") - .setTooltipHoverString("cover.voiding.tooltip")); + primaryGroup + .addWidget(new CycleButtonWidget(10, 92 + 23, 80, 18, this::isWorkingEnabled, this::setWorkingEnabled, + "cover.voiding.label.disabled", "cover.voiding.label.enabled") + .setTooltipHoverString("cover.voiding.tooltip")); primaryGroup.addWidget(new CycleButtonWidget(10, 112 + 23, 116, 18, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 125 + 82 + 16 + 24) .widget(primaryGroup) @@ -111,43 +116,50 @@ public ModularUI createUI(EntityPlayer player) { return buildUI(builder, player); } - //Basically the item filter container GUI code, with different Y widget positioning + // Basically the item filter container GUI code, with different Y widget positioning public void initFilterUI(int y, Consumer widgetGroup) { widgetGroup.accept(new LabelWidget(10, y, "cover.conveyor.item_filter.title")); widgetGroup.accept(new SlotWidget(itemFilterContainer.getFilterInventory(), 0, 10, y + 15) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); - ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(() -> itemFilterContainer.getFilterWrapper().getItemFilter() == null && voidingMode == VoidingMode.VOID_OVERFLOW); + ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup( + () -> itemFilterContainer.getFilterWrapper().getItemFilter() == null && + voidingMode == VoidingMode.VOID_OVERFLOW); stackSizeGroup.addWidget(new ImageWidget(111, 34, 35, 20, GuiTextures.DISPLAY)); - stackSizeGroup.addWidget(new IncrementButtonWidget(146, 34, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(91, 34, 20, 20, -1, -8, -64, -512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - - stackSizeGroup.addWidget(new TextFieldWidget2(113, 41, 31, 20, () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { + stackSizeGroup.addWidget( + new IncrementButtonWidget(146, 34, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + stackSizeGroup.addWidget(new IncrementButtonWidget(91, 34, 20, 20, -1, -8, -64, -512, + itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + + stackSizeGroup.addWidget(new TextFieldWidget2(113, 41, 31, 20, + () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { if (val != null && !val.isEmpty()) - itemFilterContainer.setTransferStackSize(MathHelper.clamp(Integer.parseInt(val), 1, voidingMode.maxStackSize)); + itemFilterContainer.setTransferStackSize( + MathHelper.clamp(Integer.parseInt(val), 1, voidingMode.maxStackSize)); }) .setCentered(true) .setNumbersOnly(1, Integer.MAX_VALUE) .setMaxLength(10) - .setScale(0.9f) - ); + .setScale(0.9f)); widgetGroup.accept(stackSizeGroup); this.itemFilterContainer.getFilterWrapper().initUI(y + 38, widgetGroup); - this.itemFilterContainer.getFilterWrapper().blacklistUI(y + 38, widgetGroup, () -> voidingMode != VoidingMode.VOID_OVERFLOW); + this.itemFilterContainer.getFilterWrapper().blacklistUI(y + 38, widgetGroup, + () -> voidingMode != VoidingMode.VOID_OVERFLOW); } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { Textures.ITEM_VOIDING_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverMachineController.java b/src/main/java/gregtech/common/covers/CoverMachineController.java index 873a7f1abf9..58532319279 100644 --- a/src/main/java/gregtech/common/covers/CoverMachineController.java +++ b/src/main/java/gregtech/common/covers/CoverMachineController.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.*; @@ -12,19 +7,27 @@ import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.*; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class CoverMachineController extends CoverBase implements CoverWithUI { private int minRedstoneStrength; @@ -105,7 +108,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -126,12 +130,13 @@ public ModularUI createUI(EntityPlayer player) { .setBackgroundTexture(GuiTextures.SLOT)) .widget(new CycleButtonWidget(48, 70, 80, 18, this::isInverted, this::setInverted, "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.machine_controller.inverted.description")) + .setTooltipHoverString("cover.machine_controller.inverted.description")) .build(this, player); } @Override - public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { + public void onAttachment(@NotNull CoverableView coverableView, @NotNull EnumFacing side, + @Nullable EntityPlayer player, @NotNull ItemStack itemStack) { super.onAttachment(coverableView, side, player, itemStack); this.controllerMode = getAllowedModes(getCoverableView(), getAttachedSide()).iterator().next(); updateRedstoneStatus(); @@ -144,8 +149,10 @@ public void onRemoval() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { - Textures.MACHINE_CONTROLLER_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + Textures.MACHINE_CONTROLLER_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } @Override @@ -173,7 +180,8 @@ private void updateDisplayInventory() { private @Nullable IControllable getControllable() { EnumFacing side = controllerMode.side; if (side == null) { - return getCoverableView().getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, getAttachedSide()); + return getCoverableView().getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, + getAttachedSide()); } else { Cover cover = getCoverableView().getCoverAtSide(side); if (cover == null) { @@ -198,8 +206,9 @@ private void updateRedstoneStatus() { } private boolean shouldAllowWorking() { - boolean shouldAllowWorking = getCoverableView().getInputRedstoneSignal(getAttachedSide(), true) < minRedstoneStrength; - //noinspection SimplifiableConditionalExpression + boolean shouldAllowWorking = getCoverableView().getInputRedstoneSignal(getAttachedSide(), true) < + minRedstoneStrength; + // noinspection SimplifiableConditionalExpression return isInverted ? !shouldAllowWorking : shouldAllowWorking; } @@ -209,7 +218,8 @@ private boolean doesOtherAllowingWork() { EnumFacing attachedSide = getAttachedSide(); CoverableView coverable = getCoverableView(); for (EnumFacing side : EnumFacing.values()) { - if (side != attachedSide && coverable.getCoverAtSide(side) instanceof CoverMachineController machineController) { + if (side != attachedSide && + coverable.getCoverAtSide(side) instanceof CoverMachineController machineController) { cover = machineController; otherAllow = otherAllow && cover.controllerMode == controllerMode && cover.shouldAllowWorking(); } @@ -234,6 +244,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum ControllerMode implements IStringSerializable { + MACHINE("cover.machine_controller.mode.machine", null), COVER_UP("cover.machine_controller.mode.cover_up", EnumFacing.UP), COVER_DOWN("cover.machine_controller.mode.cover_down", EnumFacing.DOWN), @@ -250,7 +261,6 @@ public enum ControllerMode implements IStringSerializable { this.side = side; } - @Nonnull @Override public String getName() { diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index bbf9b29f772..b0e9018f396 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -1,11 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import com.google.common.math.IntMath; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -22,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -36,13 +31,21 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; +import com.google.common.math.IntMath; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.function.Function; import java.util.function.IntSupplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CoverPump extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -132,19 +135,24 @@ public void update() { protected int doTransferFluids(int transferLimit) { TileEntity tileEntity = getNeighbor(getAttachedSide()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide().getOpposite()); - IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getAttachedSide().getOpposite()); + IFluidHandler myFluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getAttachedSide()); if (fluidHandler == null || myFluidHandler == null) { return 0; } return doTransferFluidsInternal(myFluidHandler, fluidHandler, transferLimit); } - protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, int transferLimit) { + protected int doTransferFluidsInternal(IFluidHandler myFluidHandler, IFluidHandler fluidHandler, + int transferLimit) { if (pumpMode == PumpMode.IMPORT) { - return GTTransferUtils.transferFluids(fluidHandler, myFluidHandler, transferLimit, fluidFilter::testFluidStack); + return GTTransferUtils.transferFluids(fluidHandler, myFluidHandler, transferLimit, + fluidFilter::testFluidStack); } else if (pumpMode == PumpMode.EXPORT) { - return GTTransferUtils.transferFluids(myFluidHandler, fluidHandler, transferLimit, fluidFilter::testFluidStack); + return GTTransferUtils.transferFluids(myFluidHandler, fluidHandler, transferLimit, + fluidFilter::testFluidStack); } return 0; } @@ -176,33 +184,35 @@ public ModularUI createUI(EntityPlayer player) { .setDefaultTooltip() .setShouldClientCallback(false)); - TextFieldWidget2 textField = new TextFieldWidget2(45, 26, 60, 20, () -> bucketMode == BucketMode.BUCKET ? Integer.toString(transferRate / 1000) : Integer.toString(transferRate), val -> { - if (val != null && !val.isEmpty()) { - int amount = Integer.parseInt(val); - if (this.bucketMode == BucketMode.BUCKET) { - amount = IntMath.saturatedMultiply(amount, 1000); - } - setTransferRate(amount); - } - }) - .setCentered(true) - .setNumbersOnly(1, bucketMode == BucketMode.BUCKET ? maxFluidTransferRate / 1000 : maxFluidTransferRate) - .setMaxLength(8); + TextFieldWidget2 textField = new TextFieldWidget2(45, 26, 60, 20, () -> bucketMode == BucketMode.BUCKET ? + Integer.toString(transferRate / 1000) : Integer.toString(transferRate), val -> { + if (val != null && !val.isEmpty()) { + int amount = Integer.parseInt(val); + if (this.bucketMode == BucketMode.BUCKET) { + amount = IntMath.saturatedMultiply(amount, 1000); + } + setTransferRate(amount); + } + }) + .setCentered(true) + .setNumbersOnly(1, + bucketMode == BucketMode.BUCKET ? maxFluidTransferRate / 1000 : maxFluidTransferRate) + .setMaxLength(8); primaryGroup.addWidget(textField); primaryGroup.addWidget(new CycleButtonWidget(106, 20, 30, 20, BucketMode.class, this::getBucketMode, mode -> { - if (mode != bucketMode) { - setBucketMode(mode); - } - })); + if (mode != bucketMode) { + setBucketMode(mode); + } + })); primaryGroup.addWidget(new CycleButtonWidget(10, 43, 75, 18, PumpMode.class, this::getPumpMode, this::setPumpMode)); primaryGroup.addWidget(new CycleButtonWidget(7, 160, 116, 20, ManualImportExportMode.class, this::getManualImportExportMode, this::setManualImportExportMode) - .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); + .setTooltipHoverString("cover.universal.manual_import_export.mode.description")); this.fluidFilter.initUI(88, primaryGroup::addWidget); @@ -236,7 +246,8 @@ public static Function getTextFieldValidator(IntSupplier maxSupp } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -280,7 +291,8 @@ public void onRemoval() { } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { if (pumpMode == PumpMode.EXPORT) { Textures.PUMP_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { @@ -345,6 +357,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { } public enum PumpMode implements IStringSerializable, IIOMode { + IMPORT("cover.pump.mode.import"), EXPORT("cover.pump.mode.export"); @@ -367,6 +380,7 @@ public boolean isImport() { } public enum BucketMode implements IStringSerializable { + BUCKET("cover.bucket.mode.bucket"), MILLI_BUCKET("cover.bucket.mode.milli_bucket"); diff --git a/src/main/java/gregtech/common/covers/CoverRoboticArm.java b/src/main/java/gregtech/common/covers/CoverRoboticArm.java index e75441bc27a..902ffcd62f4 100644 --- a/src/main/java/gregtech/common/covers/CoverRoboticArm.java +++ b/src/main/java/gregtech/common/covers/CoverRoboticArm.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; @@ -13,6 +9,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.SmartItemFilter; import gregtech.common.pipelike.itempipe.net.ItemNetHandler; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,6 +17,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.Iterator; @@ -38,7 +40,8 @@ public CoverRoboticArm(@NotNull CoverDefinition definition, @NotNull CoverableVi } @Override - public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) { + public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, + Cuboid6 plateBox, BlockRenderLayer layer) { if (conveyorMode == ConveyorMode.EXPORT) { Textures.ARM_OVERLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } else { @@ -48,10 +51,12 @@ public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexO @Override protected int doTransferItems(IItemHandler itemHandler, IItemHandler myItemHandler, int maxTransferAmount) { - if (conveyorMode == ConveyorMode.EXPORT && itemHandler instanceof ItemNetHandler && transferMode == TransferMode.KEEP_EXACT) { + if (conveyorMode == ConveyorMode.EXPORT && itemHandler instanceof ItemNetHandler && + transferMode == TransferMode.KEEP_EXACT) { return 0; } - if (conveyorMode == ConveyorMode.IMPORT && myItemHandler instanceof ItemNetHandler && transferMode == TransferMode.KEEP_EXACT) { + if (conveyorMode == ConveyorMode.IMPORT && myItemHandler instanceof ItemNetHandler && + transferMode == TransferMode.KEEP_EXACT) { return 0; } return switch (transferMode) { @@ -99,19 +104,21 @@ protected int doTransferExact(IItemHandler itemHandler, IItemHandler myItemHandl notEnoughTransferRate = true; } } - //if we didn't transfer anything because of too small transfer rate, buffer it + // if we didn't transfer anything because of too small transfer rate, buffer it if (itemsTransferred == 0 && notEnoughTransferRate) { itemsTransferBuffered += maxTransferAmount; } else { - //otherwise, if transfer succeed, empty transfer buffer value + // otherwise, if transfer succeed, empty transfer buffer value itemsTransferBuffered = 0; } return Math.min(itemsTransferred, maxTransferAmount); } protected int doKeepExact(IItemHandler itemHandler, IItemHandler myItemHandler, int maxTransferAmount) { - Map currentItemAmount = doCountDestinationInventoryItemsByMatchIndex(itemHandler, myItemHandler); - Map sourceItemAmounts = doCountDestinationInventoryItemsByMatchIndex(myItemHandler, itemHandler); + Map currentItemAmount = doCountDestinationInventoryItemsByMatchIndex(itemHandler, + myItemHandler); + Map sourceItemAmounts = doCountDestinationInventoryItemsByMatchIndex(myItemHandler, + itemHandler); Iterator iterator = sourceItemAmounts.keySet().iterator(); while (iterator.hasNext()) { Object filterSlotIndex = iterator.next(); @@ -182,28 +189,31 @@ protected ModularUI buildUI(Builder builder, EntityPlayer player) { WidgetGroup primaryGroup = new WidgetGroup(); primaryGroup.addWidget(new CycleButtonWidget(91, 45, 75, 20, TransferMode.class, this::getTransferMode, this::setTransferMode) - .setTooltipHoverString("cover.robotic_arm.transfer_mode.description")); + .setTooltipHoverString("cover.robotic_arm.transfer_mode.description")); ServerWidgetGroup stackSizeGroup = new ServerWidgetGroup(this::shouldDisplayAmountSlider); stackSizeGroup.addWidget(new ImageWidget(111, 70, 35, 20, GuiTextures.DISPLAY)); - stackSizeGroup.addWidget(new IncrementButtonWidget(146, 70, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - stackSizeGroup.addWidget(new IncrementButtonWidget(91, 70, 20, 20, -1, -8, -64, -512, itemFilterContainer::adjustTransferStackSize) - .setDefaultTooltip() - .setTextScale(0.7f) - .setShouldClientCallback(false)); - - stackSizeGroup.addWidget(new TextFieldWidget2(113, 77, 31, 20, () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { + stackSizeGroup.addWidget( + new IncrementButtonWidget(146, 70, 20, 20, 1, 8, 64, 512, itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + stackSizeGroup.addWidget(new IncrementButtonWidget(91, 70, 20, 20, -1, -8, -64, -512, + itemFilterContainer::adjustTransferStackSize) + .setDefaultTooltip() + .setTextScale(0.7f) + .setShouldClientCallback(false)); + + stackSizeGroup.addWidget(new TextFieldWidget2(113, 77, 31, 20, + () -> String.valueOf(itemFilterContainer.getTransferStackSize()), val -> { if (val != null && !val.isEmpty()) - itemFilterContainer.setTransferStackSize(MathHelper.clamp(Integer.parseInt(val), 1, transferMode.maxStackSize)); + itemFilterContainer.setTransferStackSize( + MathHelper.clamp(Integer.parseInt(val), 1, transferMode.maxStackSize)); }) .setNumbersOnly(1, transferMode.maxStackSize) .setMaxLength(4) - .setScale(0.9f) - ); + .setScale(0.9f)); primaryGroup.addWidget(stackSizeGroup); @@ -221,5 +231,4 @@ public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.transferMode = TransferMode.values()[tagCompound.getInteger("TransferMode")]; } - } diff --git a/src/main/java/gregtech/common/covers/CoverScreen.java b/src/main/java/gregtech/common/covers/CoverScreen.java index 2d70d9d4d48..723741b006f 100644 --- a/src/main/java/gregtech/common/covers/CoverScreen.java +++ b/src/main/java/gregtech/common/covers/CoverScreen.java @@ -1,20 +1,23 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverScreen extends CoverBase { - public CoverScreen(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverScreen(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -24,7 +27,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DISPLAY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/CoverShutter.java b/src/main/java/gregtech/common/covers/CoverShutter.java index 28a2c676928..2a279b65cff 100644 --- a/src/main/java/gregtech/common/covers/CoverShutter.java +++ b/src/main/java/gregtech/common/covers/CoverShutter.java @@ -1,16 +1,12 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockRenderLayer; @@ -19,6 +15,12 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverShutter extends CoverBase implements IControllable { @@ -31,7 +33,8 @@ public CoverShutter(@NotNull CoverDefinition definition, @NotNull CoverableView } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.SHUTTER.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -41,12 +44,14 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.FAIL; } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { return EnumActionResult.FAIL; } @@ -69,7 +74,8 @@ public boolean canPipePassThrough() { } @Override - public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onSoftMalletClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { this.isWorkingAllowed = !this.isWorkingAllowed; if (!playerIn.world.isRemote) { playerIn.sendMessage(new TextComponentTranslation(isWorkingEnabled() ? diff --git a/src/main/java/gregtech/common/covers/CoverSolarPanel.java b/src/main/java/gregtech/common/covers/CoverSolarPanel.java index ee6de34871d..7e2e750439a 100644 --- a/src/main/java/gregtech/common/covers/CoverSolarPanel.java +++ b/src/main/java/gregtech/common/covers/CoverSolarPanel.java @@ -1,9 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverBase; @@ -12,6 +8,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; @@ -20,6 +17,11 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverSolarPanel extends CoverBase implements ITickable { @@ -34,11 +36,13 @@ public CoverSolarPanel(@NotNull CoverDefinition definition, @NotNull CoverableVi @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return getAttachedSide() == EnumFacing.UP && coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null; + return getAttachedSide() == EnumFacing.UP && + coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null; } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.SOLAR_PANEL.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -48,7 +52,8 @@ public void update() { World world = coverable.getWorld(); BlockPos blockPos = coverable.getPos(); if (GTUtility.canSeeSunClearly(world, blockPos)) { - IEnergyContainer energyContainer = coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + null); if (energyContainer != null) { energyContainer.acceptEnergyFromNetwork(null, EUt, 1); } @@ -58,6 +63,7 @@ public void update() { @Override @SideOnly(Side.CLIENT) protected @NotNull TextureAtlasSprite getPlateSprite() { - return Textures.VOLTAGE_CASINGS[GTUtility.getTierByVoltage(this.EUt)].getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.SIDE); + return Textures.VOLTAGE_CASINGS[GTUtility.getTierByVoltage(this.EUt)] + .getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.SIDE); } } diff --git a/src/main/java/gregtech/common/covers/CoverStorage.java b/src/main/java/gregtech/common/covers/CoverStorage.java index cccec691fa1..5d34cb33b17 100644 --- a/src/main/java/gregtech/common/covers/CoverStorage.java +++ b/src/main/java/gregtech/common/covers/CoverStorage.java @@ -1,10 +1,5 @@ package gregtech.common.covers; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; @@ -12,6 +7,7 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -21,6 +17,12 @@ import net.minecraft.util.EnumHand; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -31,7 +33,8 @@ public class CoverStorage extends CoverBase implements CoverWithUI { private static final int MAX_HEIGHT = 126; private static final int SLOT_SIZE = 18; - public CoverStorage(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverStorage(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -41,7 +44,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.STORAGE.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -51,7 +55,8 @@ public void onRemoval() { } @Override - public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onRightClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getCoverableView().getWorld().isRemote) { openUI((EntityPlayerMP) player); } @@ -59,7 +64,8 @@ public void onRemoval() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer player, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) player); } @@ -71,7 +77,8 @@ public ModularUI createUI(EntityPlayer player) { ModularUI.Builder builder = new ModularUI.Builder(GuiTextures.BACKGROUND, MAX_WIDTH, MAX_HEIGHT); builder.label(5, 5, "cover.storage.title"); for (int index = 0; index < storageHandler.getSlots(); index++) { - builder.slot(storageHandler, index, (index * SLOT_SIZE) + 7, (MAX_HEIGHT - SLOT_SIZE * 5) / 2, true, true, GuiTextures.SLOT); + builder.slot(storageHandler, index, (index * SLOT_SIZE) + 7, (MAX_HEIGHT - SLOT_SIZE * 5) / 2, true, true, + GuiTextures.SLOT); } builder.bindPlayerInventory(player.inventory, (MAX_HEIGHT - SLOT_SIZE * 2) / 2 - 1); @@ -81,7 +88,7 @@ public ModularUI createUI(EntityPlayer player) { /** * @deprecated Only exists for compatibility with the crafting table cover and will be removed in the future. - * Do not depend on this method. + * Do not depend on this method. */ @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @ApiStatus.Internal diff --git a/src/main/java/gregtech/common/covers/DistributionMode.java b/src/main/java/gregtech/common/covers/DistributionMode.java index 63efe6d6051..0372f3c1540 100644 --- a/src/main/java/gregtech/common/covers/DistributionMode.java +++ b/src/main/java/gregtech/common/covers/DistributionMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum DistributionMode implements IStringSerializable { + ROUND_ROBIN_GLOBAL("cover.conveyor.distribution.round_robin_enhanced"), ROUND_ROBIN_PRIO("cover.conveyor.distribution.round_robin"), INSERT_FIRST("cover.conveyor.distribution.first_insert"); diff --git a/src/main/java/gregtech/common/covers/TransferMode.java b/src/main/java/gregtech/common/covers/TransferMode.java index 87f6243973a..69e47b0e2cc 100644 --- a/src/main/java/gregtech/common/covers/TransferMode.java +++ b/src/main/java/gregtech/common/covers/TransferMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum TransferMode implements IStringSerializable { + TRANSFER_ANY("cover.robotic_arm.transfer_mode.transfer_any", 1), TRANSFER_EXACT("cover.robotic_arm.transfer_mode.transfer_exact", 1024), KEEP_EXACT("cover.robotic_arm.transfer_mode.keep_exact", 1024); @@ -17,11 +18,9 @@ public enum TransferMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull @Override public String getName() { return localeName; } } - diff --git a/src/main/java/gregtech/common/covers/VoidingMode.java b/src/main/java/gregtech/common/covers/VoidingMode.java index c73ad7ea42c..7049f0031c6 100644 --- a/src/main/java/gregtech/common/covers/VoidingMode.java +++ b/src/main/java/gregtech/common/covers/VoidingMode.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum VoidingMode implements IStringSerializable { + VOID_ANY("cover.voiding.voiding_mode.void_any", 1), VOID_OVERFLOW("cover.voiding.voiding_mode.void_overflow", 1024); @@ -16,7 +17,6 @@ public enum VoidingMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull @Override public String getName() { diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java index 311ce74746e..f4f6eb25a7b 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivity.java @@ -1,22 +1,25 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorActivity extends CoverDetectorBase implements ITickable { - public CoverDetectorActivity(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorActivity(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -26,7 +29,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ACTIVITY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java index 8d58a624793..cd13c60c0c6 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorActivityAdvanced.java @@ -1,28 +1,33 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorActivityAdvanced extends CoverDetectorActivity { - public CoverDetectorActivityAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorActivityAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { - Textures.DETECTOR_ACTIVITY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + Textures.DETECTOR_ACTIVITY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, + translation); } @Override @@ -34,9 +39,10 @@ public void update() { if (workable.getMaxProgress() == 0) return; - int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), isInverted()); + int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), + isInverted()); - //nonstandard logic for handling off state + // nonstandard logic for handling off state if (!workable.isWorkingEnabled()) { outputAmount = 0; } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java index bc58a2f3f5c..b4df7c1822a 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java @@ -1,9 +1,9 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.cover.CoverBase; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -11,11 +11,14 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentTranslation; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; import static gregtech.api.capability.GregtechDataCodes.UPDATE_INVERTED; public abstract class CoverDetectorBase extends CoverBase { + protected static final String NBT_KEY_IS_INVERTED = "isInverted"; private boolean isInverted = false; @@ -68,7 +71,7 @@ public void writeToNBT(@NotNull NBTTagCompound tagCompound) { @Override public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - if (tagCompound.hasKey(NBT_KEY_IS_INVERTED)) { //compatibility check + if (tagCompound.hasKey(NBT_KEY_IS_INVERTED)) { // compatibility check setInverted(tagCompound.getBoolean(NBT_KEY_IS_INVERTED)); } this.redstoneSignalOutput = tagCompound.getInteger("RedstoneSignal"); @@ -92,14 +95,14 @@ public boolean canConnectRedstone() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { return EnumActionResult.SUCCESS; } - String translationKey = isInverted() - ? "gregtech.cover.detector_base.message_inverted_state" - : "gregtech.cover.detector_base.message_normal_state"; + String translationKey = isInverted() ? "gregtech.cover.detector_base.message_inverted_state" : + "gregtech.cover.detector_base.message_normal_state"; playerIn.sendStatusMessage(new TextComponentTranslation(translationKey), true); toggleInvertedWithNotification(); diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java index f3c3db26f48..5363b7a48ca 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergy.java @@ -1,9 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverDefinition; @@ -11,9 +7,15 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorEnergy extends CoverDetectorBase implements ITickable { @@ -25,15 +27,16 @@ public CoverDetectorEnergy(@NotNull CoverDefinition definition, @NotNull Coverab @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null - || coverable instanceof MetaTileEntityPowerSubstation; // todo check this + return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null || + coverable instanceof MetaTileEntityPowerSubstation; // todo check this } public long getCoverHolderCapacity() { if (getCoverableView() instanceof MetaTileEntityPowerSubstation pss) { return pss.getCapacityLong(); } else { - IEnergyContainer energyContainer = getCoverableView().getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = getCoverableView() + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); if (energyContainer != null) return energyContainer.getEnergyCapacity(); } return 0; @@ -43,14 +46,16 @@ public long getCoverHolderStored() { if (getCoverableView() instanceof MetaTileEntityPowerSubstation pss) { return pss.getStoredLong(); } else { - IEnergyContainer energyContainer = getCoverableView().getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer energyContainer = getCoverableView() + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); if (energyContainer != null) return energyContainer.getEnergyStored(); } return 0; } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ENERGY.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java index 1eed566063e..bae050fd172 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java @@ -1,12 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import gregtech.api.capability.GregtechCapabilities; -import gregtech.api.capability.IEnergyContainer; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -16,6 +9,7 @@ import gregtech.api.gui.widgets.*; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -24,6 +18,12 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; @@ -41,17 +41,20 @@ public class CoverDetectorEnergyAdvanced extends CoverDetectorEnergy implements private boolean usePercent = false; private WidgetGroup widgetsToUpdate; - public CoverDetectorEnergyAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorEnergyAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ENERGY_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -68,7 +71,8 @@ public void update() { if (usePercent) { if (energyCapacity > 0) { float ratio = (float) storedEnergy / energyCapacity; - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, this.minValue, isInverted(), this.outputAmount); + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, + this.minValue, isInverted(), this.outputAmount); } else { this.outputAmount = isInverted() ? 0 : 15; } @@ -98,17 +102,17 @@ public ModularUI createUI(EntityPlayer player) { // change modes between percent and discrete EU group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.advanced_energy_detector.modes_label")); - group.addWidget(new CycleButtonWidget(72, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isUsePercent, this::setUsePercent, - "cover.advanced_energy_detector.mode_eu", "cover.advanced_energy_detector.mode_percent") - .setTooltipHoverString("cover.advanced_energy_detector.modes_tooltip") - ); + group.addWidget( + new CycleButtonWidget(72, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isUsePercent, this::setUsePercent, + "cover.advanced_energy_detector.mode_eu", "cover.advanced_energy_detector.mode_percent") + .setTooltipHoverString("cover.advanced_energy_detector.modes_tooltip")); // invert logic button group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(72, 4 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.advanced_energy_detector.invert_tooltip") - ); + group.addWidget( + new CycleButtonWidget(72, 4 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.advanced_energy_detector.invert_tooltip")); return ModularUI.builder(GuiTextures.BACKGROUND, 176 + (3 * SIZE), 108 + (SIZE)) .widget(group) @@ -119,14 +123,16 @@ public ModularUI createUI(EntityPlayer player) { private WidgetGroup constructWidgetsToUpdate() { WidgetGroup sync = new WidgetGroup(); - sync.addWidget(new TextFieldWidget2(76, 5 + (SIZE + PADDING), 8 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) - .setMaxLength(this.getLength()) - .setPostFix(this.getPostFix())); - sync.addWidget(new TextFieldWidget2(76, 5 + 2 * (SIZE + PADDING), 8 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) - .setMaxLength(this.getLength()) - .setPostFix(this.getPostFix())); + sync.addWidget( + new TextFieldWidget2(76, 5 + (SIZE + PADDING), 8 * SIZE, SIZE, this::getMinValue, this::setMinValue) + .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) + .setMaxLength(this.getLength()) + .setPostFix(this.getPostFix())); + sync.addWidget( + new TextFieldWidget2(76, 5 + 2 * (SIZE + PADDING), 8 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) + .setAllowedChars(TextFieldWidget2.NATURAL_NUMS) + .setMaxLength(this.getLength()) + .setPostFix(this.getPostFix())); return sync; } @@ -206,7 +212,7 @@ public void readFromNBT(@Nonnull NBTTagCompound tagCompound) { readDeprecatedInvertedKeyFromNBT(tagCompound); } - //inverted here was saved using different key, now it is normalized but construction is for compatibility + // inverted here was saved using different key, now it is normalized but construction is for compatibility private void readDeprecatedInvertedKeyFromNBT(@Nonnull NBTTagCompound tagCompound) { String oldInvertedKey = "inverted"; if (!tagCompound.hasKey(NBT_KEY_IS_INVERTED) && tagCompound.hasKey(oldInvertedKey)) { diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java index f18db72ee42..e3b0a26db68 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluid.java @@ -1,13 +1,10 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; @@ -15,11 +12,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorFluid extends CoverDetectorBase implements ITickable { - public CoverDetectorFluid(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorFluid(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -29,7 +32,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_FLUID.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -37,7 +41,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra public void update() { if (getOffsetTimer() % 20 != 0) return; - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + null); if (fluidHandler == null) return; IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java index 9b42f2b94f4..32239be9036 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java @@ -1,10 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.FluidFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -26,6 +22,12 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorFluidAdvanced extends CoverDetectorFluid implements CoverWithUI { @@ -41,13 +43,15 @@ public class CoverDetectorFluidAdvanced extends CoverDetectorFluid implements Co protected FluidFilterContainer fluidFilter; - public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.fluidFilter = new FluidFilterContainer(this); } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -55,7 +59,8 @@ public CoverDetectorFluidAdvanced(@NotNull CoverDefinition definition, @NotNull } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_FLUID_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -69,31 +74,30 @@ public ModularUI createUI(EntityPlayer player) { group.addWidget(new ImageWidget(98 - 4, (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + (SIZE + PADDING), 4 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - .setPostFix("L") - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) + .setPostFix("L")); // set max fluid amount group.addWidget(new LabelWidget(10, 5 + 2 * (SIZE + PADDING), "cover.advanced_fluid_detector.max")); group.addWidget(new ImageWidget(98 - 4, 2 * (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + 2 * (SIZE + PADDING), 4 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - .setPostFix("L") - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) + .setPostFix("L")); // invert logic button -// group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip") - ); - group.addWidget(new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, - "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") - .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip") - ); + // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), + // "cover.generic.advanced_detector.invert_label")); + group.addWidget( + new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip")); + group.addWidget( + new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, + "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") + .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip")); this.fluidFilter.initUI(5 + 4 * (SIZE + PADDING), group::addWidget); @@ -131,7 +135,8 @@ public boolean isLatched() { public void update() { if (getOffsetTimer() % 20 != 0) return; - IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); + IFluidHandler fluidHandler = getCoverableView().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + null); if (fluidHandler == null) return; IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); @@ -145,7 +150,8 @@ public void update() { } if (isLatched) { - outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedFluid, max, min, isInverted(), outputAmount); + outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedFluid, max, min, isInverted(), + outputAmount); } else { outputAmount = RedstoneUtil.computeRedstoneBetweenValues(storedFluid, max, min, isInverted()); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java index eca5ce69970..00df1e03792 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorItem.java @@ -1,23 +1,26 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorItem extends CoverDetectorBase implements ITickable { - public CoverDetectorItem(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorItem(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @@ -27,7 +30,8 @@ public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing s } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ITEM.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -35,7 +39,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra public void update() { if (getOffsetTimer() % 20 != 0) return; - IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + null); if (itemHandler == null) return; int storedItems = 0; diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java index 5d21c484b1c..7d992674a93 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java @@ -1,10 +1,5 @@ package gregtech.common.covers.detector; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; @@ -14,6 +9,7 @@ import gregtech.api.util.RedstoneUtil; import gregtech.client.renderer.texture.Textures; import gregtech.common.covers.filter.ItemFilterContainer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; @@ -24,6 +20,12 @@ import net.minecraft.util.EnumHand; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorItemAdvanced extends CoverDetectorItem implements CoverWithUI { @@ -38,13 +40,15 @@ public class CoverDetectorItemAdvanced extends CoverDetectorItem implements Cove private boolean isLatched = false; protected ItemFilterContainer itemFilter; - public CoverDetectorItemAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorItemAdvanced(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); this.itemFilter = new ItemFilterContainer(this); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_ITEM_ADVANCED.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } @@ -58,30 +62,30 @@ public ModularUI createUI(EntityPlayer player) { group.addWidget(new ImageWidget(98 - 4, (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + (SIZE + PADDING), 4 * SIZE, SIZE, this::getMinValue, this::setMinValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS)); // set max fluid amount group.addWidget(new LabelWidget(10, 5 + 2 * (SIZE + PADDING), "cover.advanced_item_detector.max")); group.addWidget(new ImageWidget(98 - 4, 2 * (SIZE + PADDING), 4 * SIZE, SIZE, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget2(98, 5 + 2 * (SIZE + PADDING), 4 * SIZE, SIZE, this::getMaxValue, this::setMaxValue) - .setMaxLength(10) - .setAllowedChars(TextFieldWidget2.WHOLE_NUMS) - ); + .setMaxLength(10) + .setAllowedChars(TextFieldWidget2.WHOLE_NUMS)); // invert logic button - // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), "cover.generic.advanced_detector.invert_label")); - group.addWidget(new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, - "cover.machine_controller.normal", "cover.machine_controller.inverted") - .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip") - ); - // group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), "cover.generic.advanced_detector.latch_label")); - group.addWidget(new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, - "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") - .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip") - ); + // group.addWidget(new LabelWidget(10, 5 + 3 * (SIZE + PADDING), + // "cover.generic.advanced_detector.invert_label")); + group.addWidget( + new CycleButtonWidget(10, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isInverted, this::setInverted, + "cover.machine_controller.normal", "cover.machine_controller.inverted") + .setTooltipHoverString("cover.generic.advanced_detector.invert_tooltip")); + // group.addWidget(new LabelWidget(10, 5 + 4 * (SIZE + PADDING), + // "cover.generic.advanced_detector.latch_label")); + group.addWidget( + new CycleButtonWidget(94, 3 * (SIZE + PADDING), 4 * SIZE, SIZE, this::isLatched, this::setLatched, + "cover.generic.advanced_detector.continuous", "cover.generic.advanced_detector.latched") + .setTooltipHoverString("cover.generic.advanced_detector.latch_tooltip")); this.itemFilter.initUI(5 + 4 * (SIZE + PADDING), group::addWidget); @@ -128,7 +132,8 @@ public boolean isLatched() { } @Override - public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull CuboidRayTraceResult hitResult) { + public @NotNull EnumActionResult onScrewdriverClick(@NotNull EntityPlayer playerIn, @NotNull EnumHand hand, + @NotNull CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { openUI((EntityPlayerMP) playerIn); } @@ -139,7 +144,8 @@ public boolean isLatched() { public void update() { if (getOffsetTimer() % 20 != 0) return; - IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + IItemHandler itemHandler = getCoverableView().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + null); if (itemHandler == null) return; int storedItems = 0; @@ -150,7 +156,8 @@ public void update() { } if (isLatched) { - outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedItems, max, min, isInverted(), outputAmount); + outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(storedItems, max, min, isInverted(), + outputAmount); } else { outputAmount = RedstoneUtil.computeRedstoneBetweenValues(storedItems, max, min, isInverted()); } diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java index db3705f5272..85bb2b17dce 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorMaintenance.java @@ -1,34 +1,37 @@ package gregtech.common.covers.detector; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.multiblock.IMaintenance; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; public class CoverDetectorMaintenance extends CoverDetectorBase implements ITickable { - public CoverDetectorMaintenance(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, @NotNull EnumFacing attachedSide) { + public CoverDetectorMaintenance(@NotNull CoverDefinition definition, @NotNull CoverableView coverableView, + @NotNull EnumFacing attachedSide) { super(definition, coverableView, attachedSide); } @Override public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { - return ConfigHolder.machines.enableMaintenance - && coverable instanceof IMaintenance maintenance - && maintenance.hasMaintenanceMechanics(); + return ConfigHolder.machines.enableMaintenance && coverable instanceof IMaintenance maintenance && + maintenance.hasMaintenanceMechanics(); } @Override - public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { + public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 translation, + IVertexOperation[] pipeline, @NotNull Cuboid6 plateBox, @NotNull BlockRenderLayer layer) { Textures.DETECTOR_MAINTENANCE.renderSided(getAttachedSide(), plateBox, renderState, pipeline, translation); } diff --git a/src/main/java/gregtech/common/covers/facade/FacadeHelper.java b/src/main/java/gregtech/common/covers/facade/FacadeHelper.java index 53a8d712d1c..890f1a22afe 100644 --- a/src/main/java/gregtech/common/covers/facade/FacadeHelper.java +++ b/src/main/java/gregtech/common/covers/facade/FacadeHelper.java @@ -1,16 +1,16 @@ package gregtech.common.covers.facade; -import com.google.common.collect.ImmutableList; import gregtech.api.util.GTUtility; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.NonNullList; + +import com.google.common.collect.ImmutableList; public class FacadeHelper { @@ -35,7 +35,7 @@ public static ImmutableList getValidFacadeItems() { public static boolean isValidFacade(ItemStack itemStack) { IBlockState rawBlockState = lookupBlockForItemUnsafe(itemStack); - //noinspection deprecation + // noinspection deprecation return rawBlockState != null && !rawBlockState.getBlock().hasTileEntity(rawBlockState) && !rawBlockState.getBlock().hasTileEntity() && @@ -58,7 +58,7 @@ private static IBlockState lookupBlockForItemUnsafe(ItemStack itemStack) { Block block = ((ItemBlock) itemStack.getItem()).getBlock(); int blockMetadata = itemStack.getItem().getMetadata(itemStack); try { - //noinspection deprecation + // noinspection deprecation return block.getStateFromMeta(blockMetadata); } catch (Throwable e) { return null; diff --git a/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java b/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java index e0d75d70c86..633242b05d2 100644 --- a/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java +++ b/src/main/java/gregtech/common/covers/filter/FilterTypeRegistry.java @@ -1,13 +1,15 @@ package gregtech.common.covers.filter; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import gregtech.api.unification.stack.ItemAndMetadata; import gregtech.api.util.GTLog; import gregtech.common.items.MetaItems; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Map; public class FilterTypeRegistry { diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilter.java b/src/main/java/gregtech/common/covers/filter/FluidFilter.java index 89ba98a55f1..6d6dc23254b 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java index 6f9d61952e7..85f663561a6 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java @@ -5,16 +5,18 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class FluidFilterContainer implements INBTSerializable { private final ItemStackHandler filterInventory; @@ -23,6 +25,7 @@ public class FluidFilterContainer implements INBTSerializable { public FluidFilterContainer(IDirtyNotifiable dirtyNotifiable, int capacity) { this.filterWrapper = new FluidFilterWrapper(dirtyNotifiable, capacity); this.filterInventory = new ItemStackHandler(1) { + @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return FilterTypeRegistry.getFluidFilterForStack(stack) != null; @@ -74,7 +77,7 @@ public void initUI(int y, Consumer widgetGroup) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY)); this.filterWrapper.initUI(y + 15, widgetGroup); - this.filterWrapper.blacklistUI(y + 15, widgetGroup, ()-> true); + this.filterWrapper.blacklistUI(y + 15, widgetGroup, () -> true); } protected void onFilterSlotChange(boolean notify) { @@ -88,9 +91,9 @@ protected void onFilterSlotChange(boolean notify) { } } else if (currentFluidFilter == null || newFluidFilter.getClass() != currentFluidFilter.getClass()) { - filterWrapper.setFluidFilter(newFluidFilter); - if (notify) filterWrapper.onFilterInstanceChange(); - } + filterWrapper.setFluidFilter(newFluidFilter); + if (notify) filterWrapper.onFilterInstanceChange(); + } } public boolean testFluidStack(FluidStack fluidStack) { diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java b/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java index 4bf7485ab6f..2ef1f76a32e 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilterWrapper.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.ServerWidgetGroup; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraftforge.fluids.FluidStack; import java.util.function.BooleanSupplier; @@ -35,7 +36,8 @@ public void initUI(int y, Consumer widgetGroup) { public void blacklistUI(int y, Consumer widgetGroup, BooleanSupplier showBlacklistButton) { ServerWidgetGroup blacklistButton = new ServerWidgetGroup(() -> getFluidFilter() != null); blacklistButton.addWidget(new ToggleButtonWidget(144, y, 18, 18, GuiTextures.BUTTON_BLACKLIST, - this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton).setTooltipText("cover.filter.blacklist")); + this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton) + .setTooltipText("cover.filter.blacklist")); widgetGroup.accept(blacklistButton); } diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilter.java b/src/main/java/gregtech/common/covers/filter/ItemFilter.java index f947283ee14..a5b350da33d 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -21,8 +22,7 @@ public final void setMaxStackSize(int maxStackSize) { onMaxStackSizeChange(); } - protected void onMaxStackSizeChange() { - } + protected void onMaxStackSizeChange() {} public abstract boolean showGlobalTransferLimitSlider(); diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java index 2cccb67d255..21aaaa56b01 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java @@ -5,15 +5,17 @@ import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ItemFilterContainer implements INBTSerializable { private final ItemStackHandler filterInventory; @@ -25,6 +27,7 @@ public ItemFilterContainer(IDirtyNotifiable dirtyNotifiable) { this.filterWrapper = new ItemFilterWrapper(dirtyNotifiable); this.filterWrapper.setOnFilterInstanceChange(this::onFilterInstanceChange); this.filterInventory = new ItemStackHandler(1) { + @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return FilterTypeRegistry.getItemFilterForStack(stack) != null; @@ -100,9 +103,9 @@ protected void onFilterSlotChange(boolean notify) { } } else if (currentItemFilter == null || newItemFilter.getClass() != currentItemFilter.getClass()) { - filterWrapper.setItemFilter(newItemFilter); - if (notify) filterWrapper.onFilterInstanceChange(); - } + filterWrapper.setItemFilter(newItemFilter); + if (notify) filterWrapper.onFilterInstanceChange(); + } } public void setMaxStackSize(int maxStackSizeLimit) { @@ -159,5 +162,4 @@ public void deserializeNBT(NBTTagCompound tagCompound) { this.filterWrapper.getItemFilter().readFromNBT(tagCompound.getCompoundTag("Filter")); } } - } diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java b/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java index c0f7b99bbeb..d11905e00b5 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilterWrapper.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.ServerWidgetGroup; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.IDirtyNotifiable; + import net.minecraft.item.ItemStack; import java.util.function.BooleanSupplier; @@ -30,7 +31,8 @@ public void initUI(int y, Consumer widgetGroup) { public void blacklistUI(int y, Consumer widgetGroup, BooleanSupplier showBlacklistButton) { ServerWidgetGroup blacklistButton = new ServerWidgetGroup(() -> getItemFilter() != null); blacklistButton.addWidget(new ToggleButtonWidget(144, y, 20, 20, GuiTextures.BUTTON_BLACKLIST, - this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton).setTooltipText("cover.filter.blacklist")); + this::isBlacklistFilter, this::setBlacklistFilter).setPredicate(showBlacklistButton) + .setTooltipText("cover.filter.blacklist")); widgetGroup.accept(blacklistButton); } diff --git a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java index 095e27ce06d..95cc2f172e0 100644 --- a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java @@ -14,12 +14,14 @@ import gregtech.common.gui.widget.HighlightedTextField; import gregtech.common.gui.widget.orefilter.ItemOreFilterTestSlot; import gregtech.common.gui.widget.orefilter.OreGlobCompileStatusWidget; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.text.TextFormatting; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import java.util.Set; import java.util.function.Consumer; @@ -116,7 +118,8 @@ public void initUI(Consumer widgetGroup) { @Override public Object matchItemStack(ItemStack itemStack) { - return matchesItemStack(itemStack) ? "wtf is this system?? i can put any non null object here and it i will work??? $arch" : null; + return matchesItemStack(itemStack) ? + "wtf is this system?? i can put any non null object here and it i will work??? $arch" : null; } public boolean matchesItemStack(ItemStack itemStack) { diff --git a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java index b6998378659..16a62e6821e 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java @@ -3,15 +3,17 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.PhantomFluidWidget; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import javax.annotation.Nullable; import java.util.function.Consumer; +import javax.annotation.Nullable; + public class SimpleFluidFilter extends FluidFilter { private static final int MAX_FLUID_SLOTS = 9; @@ -21,6 +23,7 @@ public class SimpleFluidFilter extends FluidFilter { public SimpleFluidFilter() { for (int i = 0; i < MAX_FLUID_SLOTS; ++i) { fluidFilterTanks[i] = new FluidTank(1000) { + @Override public void setFluid(@Nullable FluidStack fluid) { super.setFluid(fluid); @@ -61,7 +64,7 @@ public void initUI(Consumer widgetGroup) { for (int i = 0; i < 9; ++i) { widgetGroup.accept((new PhantomFluidWidget(10 + 18 * (i % 3), 18 * (i / 3), 18, 18, this.fluidFilterTanks[i])) - .setBackgroundTexture(GuiTextures.SLOT).showTipSupplier(this::shouldShowTip)); + .setBackgroundTexture(GuiTextures.SLOT).showTipSupplier(this::shouldShowTip)); } } @@ -112,5 +115,4 @@ public int getFluidTransferLimit(FluidStack fluidStack) { } return limit; } - } diff --git a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java index f539b4a3e1e..864986ca805 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java @@ -5,6 +5,7 @@ import gregtech.api.gui.widgets.PhantomSlotWidget; import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.util.LargeStackSizeItemStackHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.items.IItemHandler; @@ -22,6 +23,7 @@ public class SimpleItemFilter extends ItemFilter { public SimpleItemFilter() { this.itemFilterSlots = new LargeStackSizeItemStackHandler(MAX_MATCH_SLOTS) { + @Override public int getSlotLimit(int slot) { return getMaxStackSize(); @@ -87,13 +89,13 @@ public int getTotalOccupiedHeight() { @Override public void initUI(Consumer widgetGroup) { for (int i = 0; i < 9; i++) { - widgetGroup.accept(new PhantomSlotWidget(itemFilterSlots, i, 10 + 18 * (i % 3), 18 * (i / 3)).setBackgroundTexture(GuiTextures.SLOT)); + widgetGroup.accept(new PhantomSlotWidget(itemFilterSlots, i, 10 + 18 * (i % 3), 18 * (i / 3)) + .setBackgroundTexture(GuiTextures.SLOT)); } widgetGroup.accept(new ToggleButtonWidget(74, 0, 20, 20, GuiTextures.BUTTON_FILTER_DAMAGE, () -> ignoreDamage, this::setIgnoreDamage).setTooltipText("cover.item_filter.ignore_damage")); widgetGroup.accept(new ToggleButtonWidget(99, 0, 20, 20, GuiTextures.BUTTON_FILTER_NBT, () -> ignoreNBT, this::setIgnoreNBT).setTooltipText("cover.item_filter.ignore_nbt")); - } @Override @@ -110,7 +112,8 @@ public void readFromNBT(NBTTagCompound tagCompound) { this.ignoreNBT = tagCompound.getBoolean("IgnoreNBT"); } - public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage, boolean ignoreNBTData, ItemStack itemStack) { + public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage, boolean ignoreNBTData, + ItemStack itemStack) { for (int i = 0; i < filterSlots.getSlots(); i++) { ItemStack filterStack = filterSlots.getStackInSlot(i); if (!filterStack.isEmpty() && areItemsEqual(ignoreDamage, ignoreNBTData, filterStack, itemStack)) { @@ -120,7 +123,8 @@ public static int itemFilterMatch(IItemHandler filterSlots, boolean ignoreDamage return -1; } - private static boolean areItemsEqual(boolean ignoreDamage, boolean ignoreNBTData, ItemStack filterStack, ItemStack itemStack) { + private static boolean areItemsEqual(boolean ignoreDamage, boolean ignoreNBTData, ItemStack filterStack, + ItemStack itemStack) { if (ignoreDamage) { if (!filterStack.isItemEqualIgnoreDurability(itemStack)) { return false; diff --git a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java index cb816baa899..df44ad98b78 100644 --- a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java @@ -7,16 +7,19 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.api.unification.stack.ItemAndMetadata; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Collections; import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class SmartItemFilter extends ItemFilter { private SmartFilteringMode filteringMode = SmartFilteringMode.ELECTROLYZER; @@ -45,7 +48,8 @@ public Object matchItemStack(ItemStack itemStack) { ItemStack infinitelyBigStack = itemStack.copy(); infinitelyBigStack.setCount(Integer.MAX_VALUE); - Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, Collections.singletonList(infinitelyBigStack), Collections.emptyList()); + Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, + Collections.singletonList(infinitelyBigStack), Collections.emptyList()); if (recipe == null) { filteringMode.transferStackSizesCache.put(itemAndMetadata, 0); cachedTransferRateValue = 0; @@ -66,7 +70,7 @@ public Object matchItemStack(ItemStack itemStack) { public void initUI(Consumer widgetGroup) { widgetGroup.accept(new CycleButtonWidget(10, 0, 75, 20, SmartFilteringMode.class, this::getFilteringMode, this::setFilteringMode) - .setTooltipHoverString("cover.smart_item_filter.filtering_mode.description")); + .setTooltipHoverString("cover.smart_item_filter.filtering_mode.description")); } @Override @@ -90,6 +94,7 @@ public void readFromNBT(NBTTagCompound tagCompound) { } private static class ItemAndMetadataAndStackSize { + public final ItemAndMetadata itemAndMetadata; public final int transferStackSize; @@ -113,6 +118,7 @@ public int hashCode() { } public enum SmartFilteringMode implements IStringSerializable { + ELECTROLYZER("cover.smart_item_filter.filtering_mode.electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES), CENTRIFUGE("cover.smart_item_filter.filtering_mode.centrifuge", RecipeMaps.CENTRIFUGE_RECIPES), SIFTER("cover.smart_item_filter.filtering_mode.sifter", RecipeMaps.SIFTER_RECIPES); @@ -132,6 +138,4 @@ public String getName() { return localeName; } } - - } diff --git a/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java b/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java index 85c79ef13fa..f2c08f856b3 100644 --- a/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/WidgetGroupFluidFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; @@ -12,7 +13,8 @@ public class WidgetGroupFluidFilter extends AbstractWidgetGroup { private final Supplier showTipSupplier; private FluidFilter fluidFilter; - public WidgetGroupFluidFilter(int yPosition, Supplier fluidFilterSupplier, Supplier showTipSupplier) { + public WidgetGroupFluidFilter(int yPosition, Supplier fluidFilterSupplier, + Supplier showTipSupplier) { super(new Position(18 + 5, yPosition)); this.fluidFilterSupplier = fluidFilterSupplier; this.showTipSupplier = showTipSupplier; diff --git a/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java b/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java index 5ad2a3dede3..d5601f2b2ab 100644 --- a/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/WidgetGroupItemFilter.java @@ -2,6 +2,7 @@ import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.network.PacketBuffer; import java.util.function.Supplier; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java index c2ddfd701d4..35ef46bd4aa 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeInterpreter.java @@ -3,6 +3,7 @@ import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; + import it.unimi.dsi.fastutil.ints.*; import java.util.List; @@ -18,6 +19,7 @@ *

* For example, matching the input {@code "ingotIron"} with string {@code "i"} and * input state of {@code [ 0, 1, 2, 3, 4, 5 ]} would each produce these output states. + * *

  *     0  =>  [ 1 ]  (the first "i" matches the string match node "i")
  *     1  =>  [ ]    (no match; "n" does not match the string match node "i")
@@ -26,6 +28,7 @@
  *     4  =>  [ ]    (no match; "t" does not match the string match node "i")
  *     5  =>  [ 6 ]  (the "I" matches the string match node "i"; oreglob is by default case insensitive.)
  * 
+ * * When the next node gets evaluated, the input state will be the last evaluation result * from the last node; in the example above, input state for the node after {@code "i"} * will be {@code [ 1, 6 ]}. @@ -35,6 +38,7 @@ * without using surrogate pairs. */ class NodeInterpreter implements NodeVisitor { + private final String input; private IntSet inputStates; private IntSet outputStates = new IntLinkedOpenHashSet(); @@ -171,7 +175,8 @@ public void branch(BranchType type, List nodes, boolean not) { IntSet out2 = new IntOpenHashSet(branchState.outputStates); out2.removeAll(this.outputStates); // out2 = { x in out2 AND x !in out } this.outputStates.removeAll(branchState.outputStates); // out = { x in out AND x !in out2 } - this.outputStates.addAll(out2); // out = { ( x in out AND x !in out2 ) OR ( x in out2 AND x !in out ) } + this.outputStates.addAll(out2); // out = { ( x in out AND x !in out2 ) OR ( x in out2 AND x !in out + // ) } } } default -> throw new IllegalStateException("Unknown BranchType '" + type + "'"); diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java index 8af400e4b7b..4d6fe44298d 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java @@ -1,10 +1,11 @@ package gregtech.common.covers.filter.oreglob.impl; -import com.google.common.annotations.VisibleForTesting; import gregtech.api.util.oreglob.OreGlob; import gregtech.api.util.oreglob.OreGlobTextBuilder; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; +import com.google.common.annotations.VisibleForTesting; + import javax.annotation.Nonnull; /** diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java index 8475fe47572..f779cc94429 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java @@ -2,15 +2,18 @@ import gregtech.api.util.oreglob.OreGlobTextBuilder; import gregtech.api.util.oreglob.VisualizationHint; + import net.minecraft.util.text.TextFormatting; + import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + final class NodeVisualXMLHandler extends DefaultHandler { private final OreGlobTextBuilder builder; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java index 24365e243aa..448ebc176ff 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java @@ -6,17 +6,19 @@ import gregtech.common.covers.filter.oreglob.node.BranchType; import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; + import org.xml.sax.SAXException; -import javax.annotation.Nullable; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; +import javax.annotation.Nullable; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + class NodeVisualizer implements NodeVisitor { private static boolean xmlParserErrorReported; @@ -62,7 +64,8 @@ public void chars(int amount, boolean not) { @Override public void charsOrMore(int amount, boolean not) { - appendNodeXML(visualizer, not ? OreGlobMessages.PREVIEW_CHARS_OR_MORE_NOT : OreGlobMessages.PREVIEW_CHARS_OR_MORE, amount); + appendNodeXML(visualizer, + not ? OreGlobMessages.PREVIEW_CHARS_OR_MORE_NOT : OreGlobMessages.PREVIEW_CHARS_OR_MORE, amount); } @Override @@ -84,7 +87,8 @@ public void branch(BranchType type, List nodes, boolean not) { for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_OR_ENTRY_START : OreGlobMessages.PREVIEW_OR_ENTRY); + appendNodeXML(visualizer, + i == 0 ? OreGlobMessages.PREVIEW_OR_ENTRY_START : OreGlobMessages.PREVIEW_OR_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } } @@ -93,7 +97,8 @@ public void branch(BranchType type, List nodes, boolean not) { for (int i = 0; i < nodes.size(); i++) { OreGlobNode node = nodes.get(i); visualizer.newLine(indents); - appendNodeXML(visualizer, i == 0 ? OreGlobMessages.PREVIEW_AND_ENTRY_START : OreGlobMessages.PREVIEW_AND_ENTRY); + appendNodeXML(visualizer, + i == 0 ? OreGlobMessages.PREVIEW_AND_ENTRY_START : OreGlobMessages.PREVIEW_AND_ENTRY); new NodeVisualizer(visualizer, indents + 1).visit(node); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java index 48bb123464b..602cde45011 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java @@ -5,14 +5,16 @@ import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.common.covers.filter.oreglob.impl.OreGlobParser.TokenType.*; /** * Top-down parser for oreGlob expression. + * *
  * oreGlob = [ FLAG ], [ or ], EOF
  *
@@ -185,8 +187,7 @@ private void addFlag(int flag, int index) {
                 }
             }
             default -> warn(OreGlobMessages.compileErrorUnknownCompilationFlag(
-                    new StringBuilder().appendCodePoint(flag).toString()
-            ), index, 1);
+                    new StringBuilder().appendCodePoint(flag).toString()), index, 1);
         }
     }
 
@@ -219,7 +220,7 @@ private OreGlobNode or() {
             // Eat through OR tokens as much as we can, to prevent scenario where
             // a disgusting C like lang users type || and complain their filter is broken
             // noinspection StatementWithEmptyBody
-            while (advanceIf(OR)) ;
+            while (advanceIf(OR));
             nodes.add(and());
         } while (advanceIf(OR));
         return OreGlobNodes.or(nodes);
@@ -234,7 +235,7 @@ private OreGlobNode and() {
             // Eat through AND tokens as much as we can, to prevent scenario where
             // a disgusting C like lang users type && and complain their filter is broken
             // noinspection StatementWithEmptyBody
-            while (advanceIf(AND)) ;
+            while (advanceIf(AND));
             nodes.add(xor());
         } while (advanceIf(AND));
         return OreGlobNodes.and(nodes);
@@ -282,7 +283,8 @@ private OreGlobNode not(boolean nested) {
                 int tokenStart = this.tokenStart;
                 OreGlobNode node = not(nested || not);
                 if (OreGlobNodes.isNegatedMatch(root) && OreGlobNodes.isNegatedMatch(node)) {
-                    warn(OreGlobMessages.compileWarnConsecutiveNegation(), tokenStart, tokenStart + tokenLength - tokenStart);
+                    warn(OreGlobMessages.compileWarnConsecutiveNegation(), tokenStart,
+                            tokenStart + tokenLength - tokenStart);
                 }
                 root = OreGlobNodes.append(root, node);
             }
@@ -311,11 +313,12 @@ yield switch (tokenType) {
                         advance();
                         yield OreGlobNodes.empty();
                     }
-                    // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match is also optional
+                    // To preserve consistency between grouped expression below, enclosing parenthesis of nothing match
+                    // is also optional
                     // For example, this is totally valid ore expression
-                    //    (
+                    // (
                     // ...in the same logic the ore expression below is valid
-                    //    ( ore* | ingot*
+                    // ( ore* | ingot*
                     case EOF -> OreGlobNodes.empty();
                     default -> {
                         OreGlobNode result = or();
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
index 7eddaeafd5f..b7b856756f2 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java
@@ -1,8 +1,9 @@
 package gregtech.common.covers.filter.oreglob.node;
 
-import javax.annotation.Nonnull;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 class BranchNode extends OreGlobNode {
 
     final BranchType type;
@@ -28,28 +29,28 @@ protected MatchDescription getIndividualNodeMatchDescription() {
             case 0 -> this.type == BranchType.AND ? MatchDescription.EVERYTHING : MatchDescription.NOTHING;
             case 1 -> this.expressions.get(0).getMatchDescription();
             default -> switch (this.type) {
-                case OR -> {
-                    MatchDescription union = MatchDescription.NOTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        union = union.or(node.getMatchDescription());
+                    case OR -> {
+                        MatchDescription union = MatchDescription.NOTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            union = union.or(node.getMatchDescription());
+                        }
+                        yield union;
                     }
-                    yield union;
-                }
-                case AND -> {
-                    MatchDescription intersection = MatchDescription.EVERYTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        intersection = intersection.and(node.getMatchDescription());
+                    case AND -> {
+                        MatchDescription intersection = MatchDescription.EVERYTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            intersection = intersection.and(node.getMatchDescription());
+                        }
+                        yield intersection;
                     }
-                    yield intersection;
-                }
-                case XOR -> {
-                    MatchDescription disjunction = MatchDescription.NOTHING;
-                    for (OreGlobNode node : this.expressions) {
-                        disjunction = disjunction.xor(node.getMatchDescription());
+                    case XOR -> {
+                        MatchDescription disjunction = MatchDescription.NOTHING;
+                        for (OreGlobNode node : this.expressions) {
+                            disjunction = disjunction.xor(node.getMatchDescription());
+                        }
+                        yield disjunction;
                     }
-                    yield disjunction;
-                }
-            };
+                };
         };
         return isNegated() ? description.complement() : description;
     }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
index d75481e7934..4ee7e1a6da9 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchType.java
@@ -1,5 +1,7 @@
 package gregtech.common.covers.filter.oreglob.node;
 
 public enum BranchType {
-    OR, AND, XOR
+    OR,
+    AND,
+    XOR
 }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
index 93b8fc3d225..0a655cb5b17 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchDescription.java
@@ -1,6 +1,7 @@
 package gregtech.common.covers.filter.oreglob.node;
 
 public enum MatchDescription {
+
     /**
      * Matches all possible inputs.
      */
@@ -43,7 +44,7 @@ public boolean isComplete() {
 
     /**
      * @return If this description is incomplete; {@code OTHER_EXCLUDING_NOTHING} and
-     * {@code OTHER_INCLUDING_NOTHING} does not fully describe the match result.
+     *         {@code OTHER_INCLUDING_NOTHING} does not fully describe the match result.
      */
     public boolean isIncomplete() {
         return this == OTHER_EXCLUDING_EMPTY || this == OTHER_INCLUDING_EMPTY;
@@ -62,16 +63,16 @@ public MatchDescription append(MatchDescription another) {
         if (another == NOTHING) return NOTHING;
         return switch (this) {
             case EVERYTHING -> switch (another) {
-                case NONEMPTY -> NONEMPTY;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                case OTHER_INCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                default -> EVERYTHING;
-            };
+                    case NONEMPTY -> NONEMPTY;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    case OTHER_INCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    default -> EVERYTHING;
+                };
             case NOTHING -> NOTHING;
             case NONEMPTY -> switch (another) { // 2 or more
-                case NONEMPTY, OTHER_EXCLUDING_EMPTY, OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> NONEMPTY;
-            };
+                    case NONEMPTY, OTHER_EXCLUDING_EMPTY, OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> NONEMPTY;
+                };
             case EMPTY -> another;
             case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
             case OTHER_INCLUDING_EMPTY -> another.canMatchNothing() ? OTHER_INCLUDING_EMPTY : OTHER_EXCLUDING_EMPTY;
@@ -86,15 +87,15 @@ public MatchDescription or(MatchDescription desc) {
             case NOTHING -> desc;
             case NONEMPTY -> desc.canMatchNothing() ? EVERYTHING : NONEMPTY;
             case EMPTY -> switch (desc) {
-                case NONEMPTY -> EVERYTHING;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                default -> desc;
-            };
+                    case NONEMPTY -> EVERYTHING;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    default -> desc;
+                };
             case OTHER_EXCLUDING_EMPTY -> switch (desc) {
-                case NONEMPTY -> NONEMPTY;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> OTHER_INCLUDING_EMPTY;
-            };
+                    case NONEMPTY -> NONEMPTY;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> OTHER_INCLUDING_EMPTY;
+                };
             case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? EVERYTHING : OTHER_INCLUDING_EMPTY;
         };
     }
@@ -121,15 +122,17 @@ public MatchDescription xor(MatchDescription desc) {
         return switch (this) {
             case NONEMPTY -> desc == MatchDescription.EMPTY ? EVERYTHING : desc;
             case EMPTY -> switch (desc) {
-                case NONEMPTY -> EVERYTHING;
-                case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
-                case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
-                default -> throw new IllegalStateException("Unreachable");
-            };
+                    case NONEMPTY -> EVERYTHING;
+                    case OTHER_EXCLUDING_EMPTY -> OTHER_INCLUDING_EMPTY;
+                    case OTHER_INCLUDING_EMPTY -> OTHER_EXCLUDING_EMPTY;
+                    default -> throw new IllegalStateException("Unreachable");
+                };
             // technically an incomplete descriptions can produce other results
             // but we can't factor them in currently
-            case OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY;
-            case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? OTHER_EXCLUDING_EMPTY : OTHER_INCLUDING_EMPTY;
+            case OTHER_EXCLUDING_EMPTY -> desc == MatchDescription.NONEMPTY ? OTHER_EXCLUDING_EMPTY :
+                    OTHER_INCLUDING_EMPTY;
+            case OTHER_INCLUDING_EMPTY -> desc == MatchDescription.EMPTY ? OTHER_EXCLUDING_EMPTY :
+                    OTHER_INCLUDING_EMPTY;
             default -> throw new IllegalStateException("Unreachable");
         };
     }
diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
index 429eb1599d5..886fef9a830 100644
--- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
+++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java
@@ -55,7 +55,8 @@ final void setNegated(boolean negated) {
     /**
      * Whether this node shares same structure and content with given node.
      * The check includes types, type specific states, negation flag and
-     * the next node's structural equality.

+ * the next node's structural equality. + *

* Note that this check does not account for logical equivalency outside * structural equality. * @@ -107,4 +108,3 @@ public static boolean isStructurallyEqualTo(@Nullable OreGlobNode node1, @Nullab return node1.isStructurallyEqualTo(node2); } } - diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java index 1b34da20afc..a87aeb61a96 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNodes.java @@ -5,7 +5,8 @@ import java.util.List; /** - * Entry point for accessing all oreGlobNode instances outside package. Thanks to Java for the superior visibility system. + * Entry point for accessing all oreGlobNode instances outside package. Thanks to Java for the superior visibility + * system. */ public class OreGlobNodes { diff --git a/src/main/java/gregtech/common/crafting/FacadeRecipe.java b/src/main/java/gregtech/common/crafting/FacadeRecipe.java index af2dabce700..ec4d0ca26d9 100644 --- a/src/main/java/gregtech/common/crafting/FacadeRecipe.java +++ b/src/main/java/gregtech/common/crafting/FacadeRecipe.java @@ -3,6 +3,7 @@ import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.FacadeItem; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -36,11 +37,11 @@ public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { if (itemStack.isEmpty()) continue; for (int j = 0; j < matched.length; j++) { if (!ingredients.get(j).apply(itemStack)) continue; - if (matched[j]) return false; //already matched + if (matched[j]) return false; // already matched matched[j] = true; continue mainLoop; } - //reached there, no match + // reached there, no match return false; } for (boolean b : matched) { @@ -95,6 +96,7 @@ public String getGroup() { } private static class FacadeIngredient extends Ingredient { + public static final FacadeIngredient INSTANCE = new FacadeIngredient(); private FacadeIngredient() { diff --git a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java index a83db538527..4a25c6e238d 100644 --- a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java @@ -48,15 +48,18 @@ public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) @Override public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { IFluidHandlerItem recipeCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (recipeCap == null) throw new IllegalStateException("FluidReplaceRecipe output did not have an IFluidHandlerItem capability"); + if (recipeCap == null) + throw new IllegalStateException("FluidReplaceRecipe output did not have an IFluidHandlerItem capability"); FluidStack outputFluid = recipeCap.drain(Integer.MAX_VALUE, false); if (outputFluid == null) throw new IllegalStateException("FluidReplaceRecipe output did not have a fluid"); - if (outputFluid.amount != 1000) throw new IllegalStateException("FluidReplaceRecipe output must have exactly 1000mB of fluid"); + if (outputFluid.amount != 1000) + throw new IllegalStateException("FluidReplaceRecipe output must have exactly 1000mB of fluid"); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack input = inv.getStackInSlot(i); - IFluidHandlerItem inputCap = input.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem inputCap = input.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (inputCap == null) continue; // if the input has a fluid, it must only hold 1000mB @@ -73,7 +76,8 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { isBucket = false; } - IFluidHandlerItem outputCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem outputCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (outputCap == null) return ItemStack.EMPTY; outputCap.drain(Integer.MAX_VALUE, true); // ensure the output is empty @@ -98,6 +102,7 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { } private static boolean isBucket(@Nonnull Item item) { - return item == Items.WATER_BUCKET || item == Items.LAVA_BUCKET || item == Items.MILK_BUCKET || item == ForgeModContainer.getInstance().universalBucket; + return item == Items.WATER_BUCKET || item == Items.LAVA_BUCKET || item == Items.MILK_BUCKET || + item == ForgeModContainer.getInstance().universalBucket; } } diff --git a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java index 48fc05d0d6f..dcfdd434abf 100644 --- a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java +++ b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; public class GTFluidCraftingIngredient extends Ingredient { + private final FluidStack fluidStack; GTFluidCraftingIngredient(ItemStack... stacks) { diff --git a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java index 04c5948fd8b..c69e7c66b2b 100644 --- a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java @@ -1,11 +1,8 @@ package gregtech.common.crafting; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.JsonElement; -import com.google.gson.JsonSyntaxException; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -23,23 +20,31 @@ import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.ShapedOreRecipe; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import com.google.gson.JsonSyntaxException; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Set; +import javax.annotation.Nonnull; + public class GTShapedOreRecipe extends ShapedOreRecipe { + boolean isClearing; - public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); + public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, + ItemStack.class); public GTShapedOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { super(group, result, parseShaped(isClearing, recipe)); this.isClearing = isClearing; } - //a copy of the CraftingHelper.ShapedPrimer.parseShaped method. - //the on difference is calling getIngredient of this class. + // a copy of the CraftingHelper.ShapedPrimer.parseShaped method. + // the on difference is calling getIngredient of this class. public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object... recipe) { CraftingHelper.ShapedPrimer ret = new CraftingHelper.ShapedPrimer(); @@ -108,7 +113,8 @@ public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object for (char chr : shape.toString().toCharArray()) { Ingredient ing = itemMap.get(chr); if (ing == null) { - throw new IllegalArgumentException("Pattern references symbol '" + chr + "' but it's not defined in the key"); + throw new IllegalArgumentException( + "Pattern references symbol '" + chr + "' but it's not defined in the key"); } ret.input.set(x++, ing); keys.remove(chr); @@ -121,15 +127,16 @@ public static CraftingHelper.ShapedPrimer parseShaped(boolean isClearing, Object return ret; } - //a copy of the CraftingHelper getIngredient method. - //the only difference is checking for a filled bucket and making - //it an GTFluidCraftingIngredient + // a copy of the CraftingHelper getIngredient method. + // the only difference is checking for a filled bucket and making + // it an GTFluidCraftingIngredient protected static Ingredient getIngredient(boolean isClearing, Object obj) { if (obj instanceof Ingredient) return (Ingredient) obj; else if (obj instanceof ItemStack) { ItemStack ing = (ItemStack) obj; if (ing.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(Integer.MAX_VALUE, false); if (drained != null && drained.amount > 0) { diff --git a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java index e18e5735eae..758976fd20d 100644 --- a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java @@ -1,8 +1,8 @@ package gregtech.common.crafting; -import com.google.gson.JsonElement; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; + import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -19,16 +19,21 @@ import net.minecraftforge.oredict.OreIngredient; import net.minecraftforge.oredict.ShapelessOreRecipe; -import javax.annotation.Nonnull; +import com.google.gson.JsonElement; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import javax.annotation.Nonnull; + public class GTShapelessOreRecipe extends ShapelessOreRecipe { boolean isClearing; - public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); + public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, + ItemStack.class); - public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { + public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, + Object... recipe) { super(group, result); this.isClearing = isClearing; for (Object in : recipe) { @@ -47,15 +52,16 @@ public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull } } - //a copy of the CraftingHelper getIngredient method. - //the only difference is checking for a filled bucket and making - //it an GTFluidCraftingIngredient + // a copy of the CraftingHelper getIngredient method. + // the only difference is checking for a filled bucket and making + // it an GTFluidCraftingIngredient private static Ingredient getIngredient(boolean isClearing, Object obj) { if (obj instanceof Ingredient) return (Ingredient) obj; else if (obj instanceof ItemStack) { ItemStack ing = (ItemStack) obj; if (ing.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem handler = ing.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (handler != null) { FluidStack drained = handler.drain(Integer.MAX_VALUE, false); if (drained != null && drained.amount > 0) { @@ -87,8 +93,7 @@ else if (obj instanceof JsonElement) public @Nonnull NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { if (isClearing) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); - } - else { + } else { return super.getRemainingItems(inv); } } diff --git a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java index a97c300e0ab..535da4bc35d 100644 --- a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java +++ b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java @@ -4,6 +4,7 @@ import gregtech.api.capability.IElectricItem; import gregtech.api.capability.impl.ElectricItem; import gregtech.api.items.toolitem.IGTTool; + import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; @@ -11,17 +12,20 @@ import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.oredict.ShapedOreRecipe; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Objects; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class ShapedOreEnergyTransferRecipe extends ShapedOreRecipe { private final Predicate chargePredicate; private final boolean transferMaxCharge; - public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack result, Predicate chargePredicate, boolean overrideCharge, boolean transferMaxCharge, Object... recipe) { + public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack result, + Predicate chargePredicate, boolean overrideCharge, + boolean transferMaxCharge, Object... recipe) { super(group, result, CraftingHelper.parseShaped(recipe)); this.chargePredicate = chargePredicate; this.transferMaxCharge = transferMaxCharge; @@ -30,7 +34,7 @@ public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack } } - //transfer initial max charge for correct display in JEI + // transfer initial max charge for correct display in JEI private void fixOutputItemMaxCharge() { long totalMaxCharge = getIngredients().stream() .mapToLong(it -> Arrays.stream(it.getMatchingStacks()) @@ -38,7 +42,8 @@ private void fixOutputItemMaxCharge() { .map(stack -> stack.copy().getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null)) .filter(Objects::nonNull) .mapToLong(IElectricItem::getMaxCharge) - .max().orElse(0L)).sum(); + .max().orElse(0L)) + .sum(); IElectricItem electricItem = output.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (totalMaxCharge > 0L && electricItem instanceof ElectricItem) { ((ElectricItem) electricItem).setMaxChargeOverride(totalMaxCharge); @@ -53,7 +58,8 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inventoryCrafting) return resultStack; } - public static void chargeStackFromComponents(ItemStack toolStack, IInventory ingredients, Predicate chargePredicate, boolean transferMaxCharge) { + public static void chargeStackFromComponents(ItemStack toolStack, IInventory ingredients, + Predicate chargePredicate, boolean transferMaxCharge) { IElectricItem electricItem = toolStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); long totalMaxCharge = 0L; long toCharge = 0L; @@ -63,7 +69,8 @@ public static void chargeStackFromComponents(ItemStack toolStack, IInventory ing if (!chargePredicate.test(stackInSlot)) { continue; } - IElectricItem batteryItem = stackInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem batteryItem = stackInSlot.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (batteryItem == null) { continue; } @@ -74,7 +81,7 @@ public static void chargeStackFromComponents(ItemStack toolStack, IInventory ing if (electricItem instanceof ElectricItem && transferMaxCharge) { ((ElectricItem) electricItem).setMaxChargeOverride(totalMaxCharge); } - //noinspection DataFlowIssue + // noinspection DataFlowIssue electricItem.charge(toCharge, Integer.MAX_VALUE, true, false); } } diff --git a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java index cc9e5d14ea3..2bc3a7c9b86 100644 --- a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java @@ -5,6 +5,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -12,12 +13,13 @@ import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + // basically a modified RecipeRepairItem public class ToolHeadReplaceRecipe extends IForgeRegistryEntry.Impl implements IRecipe { diff --git a/src/main/java/gregtech/common/entities/DynamiteEntity.java b/src/main/java/gregtech/common/entities/DynamiteEntity.java index 17a8afac750..dfbefa11e25 100644 --- a/src/main/java/gregtech/common/entities/DynamiteEntity.java +++ b/src/main/java/gregtech/common/entities/DynamiteEntity.java @@ -59,7 +59,8 @@ public void onUpdate() { ticksUntilExplosion--; if (world.rand.nextInt(3) == 2) { - world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, -this.motionX * 0.05f, this.inGround ? 0.05f : -this.motionY * 0.05f, -this.motionZ * 0.05f); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, -this.motionX * 0.05f, + this.inGround ? 0.05f : -this.motionY * 0.05f, -this.motionZ * 0.05f); } if (ticksUntilExplosion < 0 && !world.isRemote) { @@ -81,11 +82,14 @@ public void onUpdate() { } Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); - Vec3d vec3d1 = new Vec3d(this.posX + this.motionX + (this.motionX > 0 ? 0.5f : -0.5f), this.posY + this.motionY + (this.motionY > 0 ? 0.2f : -0.2f), this.posZ + this.motionZ + (this.motionZ > 0 ? 0.2f : -0.2f)); + Vec3d vec3d1 = new Vec3d(this.posX + this.motionX + (this.motionX > 0 ? 0.5f : -0.5f), + this.posY + this.motionY + (this.motionY > 0 ? 0.2f : -0.2f), + this.posZ + this.motionZ + (this.motionZ > 0 ? 0.2f : -0.2f)); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1); if (raytraceresult != null) { - if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL) { + if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && + this.world.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.PORTAL) { this.setPortal(raytraceresult.getBlockPos()); } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onImpact(raytraceresult); @@ -122,7 +126,9 @@ public void onUpdate() { if (this.isInWater()) { for (int j = 0; j < 4; ++j) { - this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ); + this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, + this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, + this.motionZ); } f1 = 0.8F; diff --git a/src/main/java/gregtech/common/entities/GTBoatEntity.java b/src/main/java/gregtech/common/entities/GTBoatEntity.java index 6bfda9b743f..00168af694b 100644 --- a/src/main/java/gregtech/common/entities/GTBoatEntity.java +++ b/src/main/java/gregtech/common/entities/GTBoatEntity.java @@ -3,6 +3,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.wood.BlockGregPlanks; import gregtech.common.items.MetaItems; + import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityBoat; @@ -21,7 +22,8 @@ public class GTBoatEntity extends EntityBoat { - private static final DataParameter GT_BOAT_TYPE = EntityDataManager.createKey(GTBoatEntity.class, DataSerializers.VARINT); + private static final DataParameter GT_BOAT_TYPE = EntityDataManager.createKey(GTBoatEntity.class, + DataSerializers.VARINT); public GTBoatEntity(World world) { super(world); @@ -60,14 +62,16 @@ public boolean attackEntityFrom(DamageSource source, float amount) { return false; } if (!this.world.isRemote && !this.isDead) { - if (source instanceof EntityDamageSourceIndirect && source.getTrueSource() != null && this.isPassenger(source.getTrueSource())) { + if (source instanceof EntityDamageSourceIndirect && source.getTrueSource() != null && + this.isPassenger(source.getTrueSource())) { return false; } this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() + amount * 10); this.markVelocityChanged(); - boolean flag = source.getTrueSource() instanceof EntityPlayer && ((EntityPlayer) source.getTrueSource()).capabilities.isCreativeMode; + boolean flag = source.getTrueSource() instanceof EntityPlayer && + ((EntityPlayer) source.getTrueSource()).capabilities.isCreativeMode; if (flag || this.getDamageTaken() > 40) { if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) { @@ -124,7 +128,8 @@ public ItemStack getPickedResult(RayTraceResult ray) { } /** - * @deprecated Vanilla boat types do not affect GTBoat instances; use {@link GTBoatEntity#setGTBoatType(GTBoatType)}. + * @deprecated Vanilla boat types do not affect GTBoat instances; use + * {@link GTBoatEntity#setGTBoatType(GTBoatType)}. */ @Deprecated @Override diff --git a/src/main/java/gregtech/common/entities/PortalEntity.java b/src/main/java/gregtech/common/entities/PortalEntity.java index 559445a41aa..6186bdc80b3 100644 --- a/src/main/java/gregtech/common/entities/PortalEntity.java +++ b/src/main/java/gregtech/common/entities/PortalEntity.java @@ -3,6 +3,7 @@ import gregtech.api.util.GTTeleporter; import gregtech.api.util.TeleportHandler; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -23,22 +24,22 @@ public class PortalEntity extends Entity { private int timeToDespawn = 200; - public PortalEntity(World worldIn){ + public PortalEntity(World worldIn) { super(worldIn); rideCooldown = -1; } - public PortalEntity(World worldIn, double x, double y, double z){ + public PortalEntity(World worldIn, double x, double y, double z) { super(worldIn); this.setPosition(x, y, z); rideCooldown = -1; } @Override - protected void entityInit(){} + protected void entityInit() {} @Override - public void readEntityFromNBT(NBTTagCompound nbtTagCompound){ + public void readEntityFromNBT(NBTTagCompound nbtTagCompound) { this.targetX = nbtTagCompound.getDouble("targetX"); this.targetY = nbtTagCompound.getDouble("targetY"); this.targetZ = nbtTagCompound.getDouble("targetZ"); @@ -46,7 +47,7 @@ public void readEntityFromNBT(NBTTagCompound nbtTagCompound){ } @Override - public void writeEntityToNBT(NBTTagCompound nbtTagCompound){ + public void writeEntityToNBT(NBTTagCompound nbtTagCompound) { nbtTagCompound.setDouble("targetX", this.targetX); nbtTagCompound.setDouble("targetY", this.targetY); nbtTagCompound.setDouble("targetZ", this.targetZ); @@ -55,27 +56,29 @@ public void writeEntityToNBT(NBTTagCompound nbtTagCompound){ @Override public void onUpdate() { - if(timeToDespawn <= 0){ + if (timeToDespawn <= 0) { this.setDead(); } if (!this.world.isRemote) { this.setFlag(6, this.isGlowing()); } - if(timeToDespawn == 200){ + if (timeToDespawn == 200) { this.playSound(GTSoundEvents.PORTAL_OPENING, 0.7F, 1.F); - }else if(timeToDespawn == 10){ + } else if (timeToDespawn == 10) { this.playSound(GTSoundEvents.PORTAL_CLOSING, 0.7F, 1.F); } this.onEntityUpdate(); - if(!this.world.isRemote) { + if (!this.world.isRemote) { List list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), null); for (Entity entity : list) { if (!(entity instanceof PortalEntity)) { - GTTeleporter teleporter = new GTTeleporter(TeleportHandler.getWorldByDimensionID(targetDim), targetX, targetY, targetZ); - TeleportHandler.teleport(entity, targetDim, teleporter, targetX + entity.getLookVec().x, targetY, targetZ + entity.getLookVec().z); + GTTeleporter teleporter = new GTTeleporter(TeleportHandler.getWorldByDimensionID(targetDim), + targetX, targetY, targetZ); + TeleportHandler.teleport(entity, targetDim, teleporter, targetX + entity.getLookVec().x, targetY, + targetZ + entity.getLookVec().z); } } } @@ -83,7 +86,7 @@ public void onUpdate() { } @Override - public void setRotation(float yaw, float pitch){ + public void setRotation(float yaw, float pitch) { super.setRotation(yaw, pitch); } @@ -99,11 +102,11 @@ public boolean shouldRenderInPass(int pass) { return pass == RENDER_PASS_TRANSLUCENT; } - public boolean isOpening(){ + public boolean isOpening() { return timeToDespawn >= 190; } - public boolean isClosing(){ + public boolean isClosing() { return timeToDespawn <= 10; } @@ -113,7 +116,7 @@ public int getTimeToDespawn() { @SideOnly(Side.CLIENT) @Override - public int getBrightnessForRender(){ + public int getBrightnessForRender() { return 15728880; } } diff --git a/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java b/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java index e24444eb407..af569788b80 100644 --- a/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java +++ b/src/main/java/gregtech/common/gui/impl/FakeModularUIContainerClipboard.java @@ -1,19 +1,21 @@ package gregtech.common.gui.impl; -import com.google.common.collect.Lists; import gregtech.api.GregTechAPI; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; import gregtech.api.gui.impl.FakeModularGuiContainer; -import gregtech.core.network.packets.PacketClipboardUIWidgetUpdate; import gregtech.common.metatileentities.MetaTileEntityClipboard; -import io.netty.buffer.Unpooled; +import gregtech.core.network.packets.PacketClipboardUIWidgetUpdate; + import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.NonNullList; import net.minecraft.util.Tuple; +import com.google.common.collect.Lists; +import io.netty.buffer.Unpooled; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -21,6 +23,7 @@ import static gregtech.api.capability.GregtechDataCodes.UPDATE_UI; public class FakeModularUIContainerClipboard extends FakeModularGuiContainer { + private final NonNullList inventoryItemStacks = NonNullList.create(); public final List inventorySlots = Lists.newArrayList(); public int windowId; diff --git a/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java b/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java index 8e57edfd8b7..6d3bcd7ebef 100644 --- a/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java +++ b/src/main/java/gregtech/common/gui/impl/FakeModularUIPluginContainer.java @@ -5,6 +5,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.impl.FakeModularGuiContainer; import gregtech.common.items.behaviors.monitorplugin.FakeGuiPluginBehavior; + import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.Tuple; @@ -14,6 +15,7 @@ import java.util.function.Consumer; public class FakeModularUIPluginContainer extends FakeModularGuiContainer { + protected int windowId; private final FakeGuiPluginBehavior behavior; public int syncId; @@ -73,7 +75,7 @@ public void writeClientAction(Widget widget, int updateId, Consumer payloadWriter) { - if(behavior != null) { + if (behavior != null) { behavior.writePluginData(GregtechDataCodes.UPDATE_FAKE_GUI, buf -> { buf.writeVarInt(windowId); buf.writeVarInt(modularUI.guiWidgets.inverse().get(widget)); diff --git a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java index 07c36082299..cb34ca111e2 100644 --- a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java +++ b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java @@ -1,14 +1,17 @@ package gregtech.common.gui.widget; import gregtech.api.gui.widgets.TextFieldWidget2; + +import net.minecraft.util.text.TextFormatting; + import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nullable; + public class HighlightedTextField extends TextFieldWidget2 { @Nullable @@ -16,7 +19,8 @@ public class HighlightedTextField extends TextFieldWidget2 { @Nullable private TextHighlighter formatResult; - public HighlightedTextField(int x, int y, int width, int height, Supplier supplier, Consumer setter) { + public HighlightedTextField(int x, int y, int width, int height, Supplier supplier, + Consumer setter) { super(x, y, width, height, supplier, setter); } diff --git a/src/main/java/gregtech/common/gui/widget/WidgetARGB.java b/src/main/java/gregtech/common/gui/widget/WidgetARGB.java index 161443ddfbc..2e5f2c72e27 100644 --- a/src/main/java/gregtech/common/gui/widget/WidgetARGB.java +++ b/src/main/java/gregtech/common/gui/widget/WidgetARGB.java @@ -4,6 +4,7 @@ import gregtech.api.gui.widgets.TextFieldWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; + import net.minecraft.client.gui.Gui; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -13,6 +14,7 @@ import java.util.function.Predicate; public class WidgetARGB extends WidgetGroup { + public int color; private final int height; @@ -20,34 +22,44 @@ public WidgetARGB(int x, int y, int height, int initColor, Consumer onC super(new Position(x, y)); this.color = initColor; this.height = height; - Predicate validator = (data)->{ + Predicate validator = (data) -> { if (data.isEmpty()) return true; - try { int num = Integer.parseInt(data, 16); if (num > 255 || num < 0) return false; } catch (Exception e) { return false; } return true; + try { + int num = Integer.parseInt(data, 16); + if (num > 255 || num < 0) return false; + } catch (Exception e) { + return false; + } + return true; }; - Consumer update = (buf)->{ + Consumer update = (buf) -> { buf.writeInt(color); }; TextFieldWidget[] ARGB = new TextFieldWidget[4]; - ARGB[0] = new TextFieldWidget(0, 0, 20, height, true, ()->Integer.toHexString(color >> 24 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 24 | (color & 0X00FFFFFF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[1] = new TextFieldWidget(22, 0, 20, height, true, ()->Integer.toHexString(color >> 16 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 16 | (color & 0XFF00FFFF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[2] = new TextFieldWidget(44, 0, 20, height, true, ()->Integer.toHexString(color >> 8 & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 8 | (color & 0X00FF00FF); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); - ARGB[3] = new TextFieldWidget(66, 0, 20, height, true, ()->Integer.toHexString(color & 0XFF).toUpperCase(), (data)->{ - this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) | (color & 0XFFFFFF00); - onColorChanged.accept(color); - writeUpdateInfo(2, update); - }).setValidator(validator); + ARGB[0] = new TextFieldWidget(0, 0, 20, height, true, + () -> Integer.toHexString(color >> 24 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 24 | (color & 0X00FFFFFF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[1] = new TextFieldWidget(22, 0, 20, height, true, + () -> Integer.toHexString(color >> 16 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 16 | (color & 0XFF00FFFF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[2] = new TextFieldWidget(44, 0, 20, height, true, + () -> Integer.toHexString(color >> 8 & 0XFF).toUpperCase(), (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) << 8 | (color & 0X00FF00FF); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); + ARGB[3] = new TextFieldWidget(66, 0, 20, height, true, () -> Integer.toHexString(color & 0XFF).toUpperCase(), + (data) -> { + this.color = (data.isEmpty() ? 0 : Integer.parseInt(data, 16)) | (color & 0XFFFFFF00); + onColorChanged.accept(color); + writeUpdateInfo(2, update); + }).setValidator(validator); this.addWidget(ARGB[0]); this.addWidget(ARGB[1]); this.addWidget(ARGB[2]); @@ -67,6 +79,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); - Gui.drawRect(this.getPosition().x + 88, this.getPosition().y, this.getPosition().x + 100, this.getPosition().y + height, color); + Gui.drawRect(this.getPosition().x + 88, this.getPosition().y, this.getPosition().x + 100, + this.getPosition().y + height, color); } } diff --git a/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java b/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java index 4b5986916ca..76dcf8a3cee 100644 --- a/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java +++ b/src/main/java/gregtech/common/gui/widget/WidgetScrollBar.java @@ -6,8 +6,9 @@ import gregtech.api.gui.resources.SizedTextureArea; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -17,6 +18,7 @@ import java.util.function.Consumer; public class WidgetScrollBar extends Widget { + protected final float min; protected final float max; protected final float dur; @@ -30,7 +32,6 @@ public class WidgetScrollBar extends Widget { protected int titleColor; protected Consumer onChanged; - public WidgetScrollBar(int x, int y, int width, float min, float max, float dur, Consumer onChanged) { super(new Position(x, y), new Size(width, 20)); this.max = max; @@ -78,25 +79,29 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender Size size = this.getSize(); RenderUtil.renderRect(position.x, position.y + 15 - 0.5f, size.width, 1, 0, lineColor); if (this.buttonTexture instanceof SizedTextureArea) { - ((SizedTextureArea)this.buttonTexture).drawHorizontalCutSubArea(position.x + xOffset - buttonWidth / 2, position.y + 15 - buttonHeight / 2, buttonWidth, buttonHeight, 0.0D, 1.0D); + ((SizedTextureArea) this.buttonTexture).drawHorizontalCutSubArea(position.x + xOffset - buttonWidth / 2, + position.y + 15 - buttonHeight / 2, buttonWidth, buttonHeight, 0.0D, 1.0D); } else { - this.buttonTexture.drawSubArea(position.x + xOffset - buttonWidth * 0.5f, position.y + 15 - buttonHeight * 0.5f, buttonWidth, buttonHeight, 0.0D, 0.0D, 1.0D, 1.0D); + this.buttonTexture.drawSubArea(position.x + xOffset - buttonWidth * 0.5f, + position.y + 15 - buttonHeight * 0.5f, buttonWidth, buttonHeight, 0.0D, 0.0D, 1.0D, 1.0D); } FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; String text = I18n.format(this.title); text += ": " + new DecimalFormat("#.00").format(getValue()); - fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, position.y - 3 + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, this.titleColor); + fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, + position.y - 3 + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, this.titleColor); } private boolean isOnScrollPane(int mouseX, int mouseY) { Position position = this.getPosition(); Size size = this.getSize(); - return isMouseOver(position.x - buttonWidth / 2, position.y + 15 - buttonHeight / 2, size.width + buttonWidth / 2, buttonHeight, mouseX, mouseY); + return isMouseOver(position.x - buttonWidth / 2, position.y + 15 - buttonHeight / 2, + size.width + buttonWidth / 2, buttonHeight, mouseX, mouseY); } private float getValue() { - return (float) (min + Math.floor((max - min) * xOffset * 1.0f / this.getSize().width / dur) * dur) ; + return (float) (min + Math.floor((max - min) * xOffset * 1.0f / this.getSize().width / dur) * dur); } @Override @@ -115,7 +120,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged Size size = this.getSize(); if (mouseX > position.x + size.width) { this.xOffset = size.width; - } else if(mouseX < position.x) { + } else if (mouseX < position.x) { this.xOffset = 0; } else { this.xOffset = mouseX - this.getPosition().x; @@ -130,7 +135,7 @@ public boolean mouseDragged(int mouseX, int mouseY, int button, long timeDragged @Override public boolean mouseReleased(int mouseX, int mouseY, int button) { - if(this.draggedOnScrollBar) { + if (this.draggedOnScrollBar) { this.writeClientAction(2, packetBuffer -> packetBuffer.writeFloat(getValue())); } this.draggedOnScrollBar = false; @@ -142,7 +147,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 2) { float value = buffer.readFloat(); - if(this.onChanged != null) { + if (this.onChanged != null) { onChanged.accept(value); } } diff --git a/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java b/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java index 37b64663acf..bd946b1e39d 100644 --- a/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java +++ b/src/main/java/gregtech/common/gui/widget/among_us/FixWiringTaskWidget.java @@ -4,6 +4,7 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -16,9 +17,11 @@ public class FixWiringTaskWidget extends Widget { - private final static TextureArea background = TextureArea.fullImage("textures/gui/widget/electricity_wires_baseback.png"); + private final static TextureArea background = TextureArea + .fullImage("textures/gui/widget/electricity_wires_baseback.png"); private final static TextureArea wire = TextureArea.fullImage("textures/gui/widget/electricity_wires.png"); - private final static TextureArea wire_base = TextureArea.fullImage("textures/gui/widget/electricity_wires_base.png"); + private final static TextureArea wire_base = TextureArea + .fullImage("textures/gui/widget/electricity_wires_base.png"); private final int[] colors = new int[4]; private final boolean[] connect = new boolean[4]; private final int[] init = new int[4]; @@ -79,11 +82,13 @@ public int isMouseOverWire(int mouseX, int mouseY, boolean isLeft) { for (int i = 0; i < 4; i++) { double y1 = y + yScale * ((i + 1) * 104 - 10); if (isLeft) { - if (isMouseOver(x, (int)(y1 - yScale * 16), (int)(xScale * 38 * 1.5), (int)(yScale * 64), mouseX, mouseY)) { + if (isMouseOver(x, (int) (y1 - yScale * 16), (int) (xScale * 38 * 1.5), (int) (yScale * 64), mouseX, + mouseY)) { return i; } } else { - if (isMouseOver(x + width - (int)(xScale * 38 * 1.5), (int)(y1 - yScale * 16), (int)(xScale * 38 * 1.5), (int)(yScale * 64), mouseX, mouseY)) { + if (isMouseOver(x + width - (int) (xScale * 38 * 1.5), (int) (y1 - yScale * 16), + (int) (xScale * 38 * 1.5), (int) (yScale * 64), mouseX, mouseY)) { return i; } } @@ -91,8 +96,6 @@ public int isMouseOverWire(int mouseX, int mouseY, boolean isLeft) { return -1; } - - @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { int x = getPosition().x; @@ -109,9 +112,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (connect[i]) { for (int j = 0; j < init.length; j++) { if (init[j] == i) { - double y2 = y + yScale * ((j + 1) * 104 - 10); + double y2 = y + yScale * ((j + 1) * 104 - 10); drawLines(Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), - new Vec2f(x+ width - (int)(xScale * 25), (float) y2 + yScale * 12)), color, color, 5); + new Vec2f(x + width - (int) (xScale * 25), (float) y2 + yScale * 12)), color, color, 5); break; } } @@ -122,20 +125,25 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int color = colors[i]; if (dragged == i) { - drawLines(Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), new Vec2f(mouseX, mouseY)), color, color, 5); + drawLines( + Arrays.asList(new Vec2f(x + xScale * 25, (float) y1 + yScale * 12), new Vec2f(mouseX, mouseY)), + color, color, 5); } // left - wire.drawSubArea(x + (int)(xScale * 25), y1 - yScale * 5, (int)(xScale * 38), (int)(yScale * 32), 0, 0, 0.5,1); + wire.drawSubArea(x + (int) (xScale * 25), y1 - yScale * 5, (int) (xScale * 38), (int) (yScale * 32), 0, 0, + 0.5, 1); setColor(color); - wire_base.drawSubArea(x, (int)y1, (int)(xScale * 50), (int)(yScale * 32), 0, 0, 0.5, 1); - GlStateManager.color(1,1,1,1); + wire_base.drawSubArea(x, (int) y1, (int) (xScale * 50), (int) (yScale * 32), 0, 0, 0.5, 1); + GlStateManager.color(1, 1, 1, 1); - //right - wire.drawSubArea(x + width - (int)(xScale * (25 + 38)), y1 - yScale * 5, (int)(xScale * 38), (int)(yScale * 32), 0.5, 0, 0.5, 1); + // right + wire.drawSubArea(x + width - (int) (xScale * (25 + 38)), y1 - yScale * 5, (int) (xScale * 38), + (int) (yScale * 32), 0.5, 0, 0.5, 1); setColor(colors[init[i]]); - wire_base.drawSubArea(x + width - (int)(xScale * 50), (int)y1, (int)(xScale * 50), (int)(yScale * 32), 0.5, 0, 0.5, 1); - GlStateManager.color(1,1,1,1); + wire_base.drawSubArea(x + width - (int) (xScale * 50), (int) y1, (int) (xScale * 50), (int) (yScale * 32), + 0.5, 0, 0.5, 1); + GlStateManager.color(1, 1, 1, 1); } } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java index 49da74133d6..59005459893 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEConfigWidget.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.AbstractWidgetGroup; import gregtech.api.util.Position; @@ -8,6 +7,8 @@ import gregtech.common.gui.widget.appeng.slot.AEConfigSlot; import gregtech.common.gui.widget.appeng.slot.AmountSetSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; + +import appeng.api.storage.data.IAEStack; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -72,7 +73,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void detectAndSendChanges() { super.detectAndSendChanges(); this.changeMap.clear(); - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { IConfigurableSlot newSlot = this.config[index]; IConfigurableSlot oldSlot = this.cached[index]; T nConfig = newSlot.getConfig(); @@ -106,8 +107,7 @@ public void detectAndSendChanges() { buf.writeBoolean(false); } } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} }); } } @@ -129,5 +129,4 @@ protected final boolean areAEStackCountEquals(T s1, T s2) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java index f55b0e24d58..1599217290c 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidConfigWidget.java @@ -1,12 +1,14 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEFluidStack; import gregtech.common.gui.widget.appeng.slot.AEFluidConfigSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEFluidStack; + /** * @Author GlodBlock * @Description Display {@link IAEFluidStack} config @@ -24,7 +26,7 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MetaTileEntityMEInputHatch.ExportOnlyAEFluid(); this.cached[index] = new MetaTileEntityMEInputHatch.ExportOnlyAEFluid(); line = index / 8; @@ -37,7 +39,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { super.readUpdateInfo(id, buffer); if (id == UPDATE_ID) { int size = buffer.readVarInt(); - for (int i = 0; i < size; i ++) { + for (int i = 0; i < size; i++) { int index = buffer.readVarInt(); IConfigurableSlot slot = this.displayList[index]; if (buffer.readBoolean()) { diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java index 33a125d07b4..3f7d1358e99 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEFluidGridWidget.java @@ -1,16 +1,18 @@ package gregtech.common.gui.widget.appeng; +import gregtech.api.gui.Widget; +import gregtech.common.gui.widget.appeng.slot.AEFluidDisplayWidget; + +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IItemList; import appeng.fluids.util.AEFluidStack; import appeng.fluids.util.FluidList; -import gregtech.api.gui.Widget; -import gregtech.common.gui.widget.appeng.slot.AEFluidDisplayWidget; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; /** * @Author GlodBlock @@ -34,7 +36,7 @@ public IAEFluidStack getAt(int index) { if (cnt == index) { return fluid; } - cnt ++; + cnt++; } return null; } @@ -83,7 +85,7 @@ protected void writeListChange() { @Override protected void readListChange(PacketBuffer buffer) { int size = buffer.readVarInt(); - for (int i = 0; i < size ; i ++) { + for (int i = 0; i < size; i++) { FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), 1); long delta = buffer.readVarLong(); if (fluid != null) { diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java index 8861e87e030..c3707d4afaf 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEItemConfigWidget.java @@ -1,12 +1,14 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEItemStack; import gregtech.common.gui.widget.appeng.slot.AEItemConfigSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputBus; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEItemStack; + /** * @Author GlodBlock * @Description Display {@link IAEItemStack} config @@ -24,7 +26,7 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MetaTileEntityMEInputBus.ExportOnlyAEItem(); this.cached[index] = new MetaTileEntityMEInputBus.ExportOnlyAEItem(); line = index / 8; @@ -37,7 +39,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { super.readUpdateInfo(id, buffer); if (id == UPDATE_ID) { int size = buffer.readVarInt(); - for (int i = 0; i < size; i ++) { + for (int i = 0; i < size; i++) { int index = buffer.readVarInt(); IConfigurableSlot slot = this.displayList[index]; if (buffer.readBoolean()) { @@ -53,5 +55,4 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java index c158d8df148..7b036eee6af 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEItemGridWidget.java @@ -1,15 +1,17 @@ package gregtech.common.gui.widget.appeng; +import gregtech.api.gui.Widget; +import gregtech.common.gui.widget.appeng.slot.AEItemDisplayWidget; + +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; + import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.util.item.AEItemStack; import appeng.util.item.ItemList; -import gregtech.api.gui.Widget; -import gregtech.common.gui.widget.appeng.slot.AEItemDisplayWidget; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketBuffer; import java.io.IOException; @@ -35,7 +37,7 @@ public IAEItemStack getAt(int index) { if (cnt == index) { return item; } - cnt ++; + cnt++; } return null; } @@ -85,7 +87,7 @@ protected void writeListChange() { protected void readListChange(PacketBuffer buffer) { int size = buffer.readVarInt(); try { - for (int i = 0; i < size ; i ++) { + for (int i = 0; i < size; i++) { ItemStack item = buffer.readItemStack(); item.setCount(1); long delta = buffer.readVarLong(); @@ -93,8 +95,6 @@ protected void readListChange(PacketBuffer buffer) { this.displayList.add(AEItemStack.fromItemStack(item).setStackSize(delta)); } } - } catch (IOException ignore) { - } + } catch (IOException ignore) {} } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java index 4a89ec21b44..1cdcdf4804b 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/AEListGridWidget.java @@ -1,11 +1,13 @@ package gregtech.common.gui.widget.appeng; -import appeng.api.storage.data.IAEStack; -import appeng.api.storage.data.IItemList; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.ScrollableListWidget; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + /** * @Author GlodBlock * @Description A display only widget for {@link IItemList} @@ -74,5 +76,4 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { } protected abstract void readListChange(PacketBuffer buffer); - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java index 6bc3e52afd0..ed1b9145bd7 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEConfigSlot.java @@ -1,16 +1,18 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.Widget; import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEStack; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -67,5 +69,4 @@ protected boolean mouseOverStock(int mouseX, int mouseY) { public List> getPhantomTargets(Object ingredient) { return Collections.emptyList(); } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java index fb26dfb1408..d21bc00b38f 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java @@ -1,7 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEFluidStack; -import com.google.common.collect.Lists; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.util.FluidTooltipUtil; @@ -12,7 +10,7 @@ import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -22,13 +20,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import appeng.api.storage.data.IAEFluidStack; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.LOAD_PHANTOM_FLUID_STACK_FROM_NBT; import static gregtech.api.util.GTUtility.getFluidFromContainer; @@ -64,7 +67,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawStringFixedCorner(amountStr, stackX + 17, stackY + 17, 16777215, true, 0.5f); } if (stock != null) { - RenderUtil.drawFluidForGui(stock.getFluidStack(), stock.getFluidStack().amount, stackX, stackY + 18, 17, 17); + RenderUtil.drawFluidForGui(stock.getFluidStack(), stock.getFluidStack().amount, stackX, stackY + 18, 17, + 17); String amountStr = TextFormattingUtil.formatLongToCompactString(stock.getStackSize(), 4) + "L"; drawStringFixedCorner(amountStr, stackX + 17, stackY + 18 + 17, 16777215, true, 0.5f); } @@ -140,7 +144,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { writeUpdateInfo(REMOVE_ID, buf -> {}); } if (id == UPDATE_ID) { - FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), buffer.readVarInt()); + FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), + buffer.readVarInt()); slot.setConfig(WrappedFluidStack.fromFluidStack(fluid)); this.parentWidget.enableAmount(this.index); if (fluid != null) { @@ -182,7 +187,8 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { slot.setConfig(null); } if (id == UPDATE_ID) { - FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), buffer.readVarInt()); + FluidStack fluid = FluidRegistry.getFluidStack(buffer.readString(Integer.MAX_VALUE / 16), + buffer.readVarInt()); slot.setConfig(WrappedFluidStack.fromFluidStack(fluid)); } if (id == AMOUNT_CHANGE_ID) { @@ -243,5 +249,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java index bf387d8e350..6aa47927c36 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidDisplayWidget.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEFluidStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -9,8 +8,11 @@ import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; import gregtech.common.gui.widget.appeng.AEListGridWidget; + import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEFluidStack; + import java.util.ArrayList; import java.util.List; @@ -68,5 +70,4 @@ public void drawInForeground(int mouseX, int mouseY) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java index 18e90d4702b..7fba8bf1eae 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java @@ -1,7 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEItemStack; -import com.google.common.collect.Lists; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.util.Position; @@ -10,18 +8,23 @@ import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import appeng.api.storage.data.IAEItemStack; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.io.IOException; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Description A configurable slot for {@link IAEItemStack} @@ -123,8 +126,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { if (!item.isEmpty()) { writeUpdateInfo(UPDATE_ID, buf -> buf.writeItemStack(item)); } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } if (id == AMOUNT_CHANGE_ID) { if (slot.getConfig() != null) { @@ -146,8 +148,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { try { ItemStack item = buffer.readItemStack(); slot.setConfig(WrappedItemStack.fromItemStack(item)); - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } if (id == AMOUNT_CHANGE_ID) { if (slot.getConfig() != null) { @@ -203,5 +204,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java index d4bc53161c6..62ffe78c113 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemDisplayWidget.java @@ -1,14 +1,16 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEItemStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; import gregtech.api.util.Size; import gregtech.common.gui.widget.appeng.AEListGridWidget; + import net.minecraft.item.ItemStack; +import appeng.api.storage.data.IAEItemStack; + /** * @Author GlodBlock * @Description Display a certain {@link IAEItemStack} element. @@ -55,5 +57,4 @@ public void drawInForeground(int mouseX, int mouseY) { } } } - } diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java index 80cbd724dab..ccec8521dd7 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AmountSetSlot.java @@ -1,6 +1,5 @@ package gregtech.common.gui.widget.appeng.slot; -import appeng.api.storage.data.IAEStack; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -8,8 +7,11 @@ import gregtech.api.util.Position; import gregtech.common.gui.widget.appeng.AEConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.IConfigurableSlot; + import net.minecraft.network.PacketBuffer; +import appeng.api.storage.data.IAEStack; + /** * @Author GlodBlock * @Description The amount set widget for config slot @@ -53,8 +55,7 @@ public void setNewAmount(String amount) { try { long newAmount = Long.parseLong(amount); writeClientAction(1, buf -> buf.writeVarLong(newAmount)); - } catch (NumberFormatException ignore) { - } + } catch (NumberFormatException ignore) {} } @Override @@ -82,5 +83,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawStringSized("Amount", position.x + 3, position.y + 3, 0x404040, false, 1f, false); GuiTextures.DISPLAY.draw(position.x + 3, position.y + 11, 65, 14); } - } diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java index 27babb582c3..973ef3c478b 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/CraftingSlotWidget.java @@ -1,19 +1,21 @@ package gregtech.common.gui.widget.craftingstation; -import com.google.common.base.Preconditions; import gregtech.api.gui.impl.ModularUIContainer; import gregtech.api.gui.ingredient.IRecipeTransferHandlerWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.util.OverlayedItemHandler; import gregtech.common.metatileentities.storage.CraftingRecipeLogic; -import mezz.jei.api.gui.IGuiIngredient; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; + +import com.google.common.base.Preconditions; +import mezz.jei.api.gui.IGuiIngredient; +import mezz.jei.api.gui.IRecipeLayout; import org.lwjgl.input.Mouse; import java.io.IOException; @@ -58,16 +60,18 @@ public void handleClientAction(int id, PacketBuffer buffer) { boolean isRightClick = clickData.button == 1; EntityPlayer player = gui.entityPlayer; if (isShiftDown) { - OverlayedItemHandler playerInventory = new OverlayedItemHandler(new PlayerMainInvWrapper(gui.entityPlayer.inventory)); + OverlayedItemHandler playerInventory = new OverlayedItemHandler( + new PlayerMainInvWrapper(gui.entityPlayer.inventory)); ItemStack toMerge = slotReference.getStack(); int crafts = this.slotReference.getStack().getCount(); if (isLeftClick) { if (crafts != 0) { - //limit shift click to one stack at a time + // limit shift click to one stack at a time int totalCrafts = 0; int maxCrafts = toMerge.getMaxStackSize() / crafts; for (int i = 0; i < maxCrafts; i++) { - if (canMergeToInv(playerInventory, toMerge, crafts) && recipeResolver.performRecipe(gui.entityPlayer)) { + if (canMergeToInv(playerInventory, toMerge, crafts) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); totalCrafts += crafts; @@ -79,7 +83,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } else if (isRightClick) { int totalCrafts = 0; - while (canMergeToInv(playerInventory, toMerge, crafts) && recipeResolver.performRecipe(gui.entityPlayer)) { + while (canMergeToInv(playerInventory, toMerge, crafts) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); totalCrafts += crafts; @@ -90,15 +95,17 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } else { if (isLeftClick) { - if (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && recipeResolver.performRecipe(gui.entityPlayer)) { + if (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); - //send slot changes now, both of consumed items in inventory and result slot + // send slot changes now, both of consumed items in inventory and result slot ItemStack result = this.slotReference.getStack(); mergeToHand(result); } } else if (isRightClick) { - while (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && recipeResolver.performRecipe(gui.entityPlayer)) { + while (canMerge(player.inventory.getItemStack(), this.slotReference.getStack()) && + recipeResolver.performRecipe(gui.entityPlayer)) { this.recipeResolver.refreshOutputSlot(); recipeResolver.handleItemCraft(this.slotReference.getStack(), gui.entityPlayer); ItemStack result = this.slotReference.getStack(); @@ -107,7 +114,7 @@ public void handleClientAction(int id, PacketBuffer buffer) { } } uiAccess.sendHeldItemUpdate(); - //send slot changes now, both of consumed items in inventory and result slot + // send slot changes now, both of consumed items in inventory and result slot gui.entityPlayer.openContainer.detectAndSendChanges(); uiAccess.sendSlotUpdate(this); } @@ -132,14 +139,15 @@ private void mergeToHand(ItemStack toMerge) { if (itemInHand.isEmpty()) { itemInHand = toMerge; player.inventory.setItemStack(itemInHand); - } else if (ItemStack.areItemsEqual(itemInHand, toMerge) && ItemStack.areItemStackTagsEqual(itemInHand, toMerge)) { - //if the hand is not empty, try to merge the result with the hand - if (itemInHand.getCount() + toMerge.getCount() <= itemInHand.getMaxStackSize()) { - //if the result of the merge is smaller than the max stack size, merge - itemInHand.grow(toMerge.getCount()); - player.inventory.setItemStack(itemInHand); + } else + if (ItemStack.areItemsEqual(itemInHand, toMerge) && ItemStack.areItemStackTagsEqual(itemInHand, toMerge)) { + // if the hand is not empty, try to merge the result with the hand + if (itemInHand.getCount() + toMerge.getCount() <= itemInHand.getMaxStackSize()) { + // if the result of the merge is smaller than the max stack size, merge + itemInHand.grow(toMerge.getCount()); + player.inventory.setItemStack(itemInHand); + } } - } } @Override @@ -178,11 +186,13 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } @Override - public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (!doTransfer) { return null; } - Map> ingredients = new HashMap<>(recipeLayout.getItemStacks().getGuiIngredients()); + Map> ingredients = new HashMap<>( + recipeLayout.getItemStacks().getGuiIngredients()); ingredients.values().removeIf(it -> it.getAllIngredients().isEmpty() || !it.isInput()); writeClientAction(1, buf -> { buf.writeVarInt(ingredients.size()); diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java index 16af45ff053..ed75af27bd4 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java @@ -9,15 +9,18 @@ import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; import gregtech.common.inventory.SimpleItemInfo; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import java.io.IOException; import java.util.*; +import javax.annotation.Nullable; + public class ItemListGridWidget extends ScrollableListWidget { private static final Comparator COMPARATOR = Comparator.comparing( @@ -33,7 +36,8 @@ public class ItemListGridWidget extends ScrollableListWidget { private final int slotAmountX; private final int slotAmountY; private int slotRowsAmount = 0; - private final Map cachedItemList = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private final Map cachedItemList = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final List itemsChanged = new ArrayList<>(); private final List itemsRemoved = new ArrayList<>(); @@ -80,7 +84,8 @@ private void handleSlotShiftClick(INativeWidget clickedSlot) { ItemStack itemStack = clickedSlot.getHandle().getStack(); if (clickedSlot.getHandle().canTakeStack(gui.entityPlayer) && !itemStack.isEmpty()) { itemStack = clickedSlot.onItemTake(gui.entityPlayer, itemStack, true); - int amountInserted = getItemList().insertItem(itemStack, itemStack.getCount(), false, InsertMode.LOWEST_PRIORITY); + int amountInserted = getItemList().insertItem(itemStack, itemStack.getCount(), false, + InsertMode.LOWEST_PRIORITY); if (amountInserted > 0) { clickedSlot.onItemTake(gui.entityPlayer, itemStack, false); itemStack.shrink(amountInserted); @@ -200,14 +205,16 @@ public void readUpdateInfo(int id, PacketBuffer buffer) { int itemsRemoved = buffer.readVarInt(); for (int i = 0; i < itemsRemoved; i++) { ItemStack itemStack = buffer.readItemStack(); - this.displayItemList.removeIf(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)); + this.displayItemList.removeIf( + it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)); } int itemsChanged = buffer.readVarInt(); for (int i = 0; i < itemsChanged; i++) { ItemStack itemStack = buffer.readItemStack(); int newTotalAmount = buffer.readVarInt(); SimpleItemInfo itemInfo = displayItemList.stream() - .filter(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), itemStack)) + .filter(it -> ItemStackHashStrategy.comparingAllButCount().equals(it.getItemStack(), + itemStack)) .findAny() .orElse(null); if (itemInfo == null) { diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java index 291fe76f7c6..aeb7cb80ba7 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java @@ -9,17 +9,19 @@ import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.IItemList.InsertMode; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemListSlotWidget extends Widget { private final ItemListGridWidget gridWidget; @@ -86,22 +88,23 @@ private static int getAmountToTake(@Nonnull ItemStack itemStack, int maxAmount, return button == 0 ? maxStackSize : (maxStackSize >= 2 ? maxStackSize / 2 : 1); } - //returns true if something actually happened + // returns true if something actually happened private boolean insertHeldItemStack(int button, boolean isClient) { InventoryPlayer inventory = gui.entityPlayer.inventory; int amountToInsert = button == 1 ? 1 : Integer.MAX_VALUE; if (!inventory.getItemStack().isEmpty()) { if (!isClient) { - //on server, we lookup item list to see how much we can actually insert + // on server, we lookup item list to see how much we can actually insert ItemStack heldItemStack = inventory.getItemStack(); IItemList itemList = gridWidget.getItemList(); - int amountInserted = itemList.insertItem(heldItemStack, Math.min(heldItemStack.getCount(), amountToInsert), false, InsertMode.LOWEST_PRIORITY); + int amountInserted = itemList.insertItem(heldItemStack, + Math.min(heldItemStack.getCount(), amountToInsert), false, InsertMode.LOWEST_PRIORITY); heldItemStack.shrink(amountInserted); uiAccess.sendHeldItemUpdate(); gui.entityPlayer.openContainer.detectAndSendChanges(); return amountInserted > 0; } else { - //on client we assume we can insert full stack into the network + // on client we assume we can insert full stack into the network inventory.getItemStack().shrink(amountToInsert); return true; } @@ -113,7 +116,7 @@ private void extractItemStack(ItemStack itemStack, int amount, boolean isClient) InventoryPlayer inventory = gui.entityPlayer.inventory; if (inventory.getItemStack().isEmpty()) { if (!isClient) { - //on server, we try to extract from the network + // on server, we try to extract from the network IItemList itemList = gridWidget.getItemList(); int amountExtracted = itemList.extractItem(itemStack, amount, false); if (amountExtracted > 0) { @@ -123,7 +126,7 @@ private void extractItemStack(ItemStack itemStack, int amount, boolean isClient) } uiAccess.sendHeldItemUpdate(); } else { - //on client we assume we can extract as much items as user wishes + // on client we assume we can extract as much items as user wishes ItemStack resultStack = itemStack.copy(); resultStack.setCount(amount); inventory.setItemStack(resultStack); diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java index b7e01694808..4bbf93311b8 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/MemorizedRecipeWidget.java @@ -6,6 +6,7 @@ import gregtech.api.util.Position; import gregtech.common.metatileentities.storage.CraftingRecipeMemory; import gregtech.common.metatileentities.storage.CraftingRecipeMemory.MemorizedRecipe; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +25,8 @@ public class MemorizedRecipeWidget extends SlotWidget { private boolean recipeLocked = false; private final IItemHandlerModifiable craftingGrid; - public MemorizedRecipeWidget(CraftingRecipeMemory recipeMemory, int index, IItemHandlerModifiable craftingGrid, int xPosition, int yPosition) { + public MemorizedRecipeWidget(CraftingRecipeMemory recipeMemory, int index, IItemHandlerModifiable craftingGrid, + int xPosition, int yPosition) { super(new ItemStackHandler(1), 0, xPosition, yPosition, false, false); this.recipeMemory = recipeMemory; this.recipeIndex = index; @@ -95,5 +97,4 @@ public ItemStack slotClick(int dragType, ClickType clickTypeIn, EntityPlayer pla } return ItemStack.EMPTY; } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java index 8921eb5c239..5706c8a6787 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetCoverList.java @@ -13,6 +13,7 @@ import gregtech.client.renderer.handler.BlockPosHighlightRenderer; import gregtech.client.utils.RenderUtil; import gregtech.common.covers.CoverDigitalInterface; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -39,7 +40,8 @@ public class WidgetCoverList extends ScrollableListWidget { private final Map widgetMap; public Consumer onSelected; - public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, List covers, CoverDigitalInterface bindCover, Consumer onSelected) { + public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, List covers, + CoverDigitalInterface bindCover, Consumer onSelected) { super(xPosition, yPosition, width, slotSize * 18); widgetMap = new HashMap<>(); this.onSelected = onSelected; @@ -60,7 +62,8 @@ public WidgetCoverList(int xPosition, int yPosition, int width, int slotSize, Li itemStackHandler.insertItem(0, itemStack, false); WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.addWidget(new SlotWidget(itemStackHandler, 0, 0, 0, false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, String.format("(%d, %d, %d)", pos.getX(), pos.getY(), pos.getZ()), 0XFFFFFFFF)); + widgetGroup.addWidget(new LabelWidget(20, 5, + String.format("(%d, %d, %d)", pos.getX(), pos.getY(), pos.getZ()), 0XFFFFFFFF)); widgetMap.put(widgetGroup, cover); if (widgetGroup.getSize().width + scrollPaneWidth > this.getSize().width) this.setSize(new Size(widgetGroup.getSize().width + scrollPaneWidth, this.getSize().height)); @@ -87,22 +90,23 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { public boolean mouseClicked(int mouseX, int mouseY, int button) { boolean result = super.mouseClicked(mouseX, mouseY, button); if (!result && mouseY >= this.getPosition().y && mouseY <= this.getPosition().y + this.getSize().height) { - Widget widget = this.widgets.stream().filter(it -> it.isMouseOverElement(mouseX, mouseY)).findFirst().orElse(null); + Widget widget = this.widgets.stream().filter(it -> it.isMouseOverElement(mouseX, mouseY)).findFirst() + .orElse(null); if (widget instanceof WidgetGroup) { List children = ((WidgetGroup) widget).getContainedWidgets(true); if (children.get(0).isMouseOverElement(mouseX, mouseY)) { try { - String posString = ObfuscationReflectionHelper.getPrivateValue(LabelWidget.class, (LabelWidget) children.get(1), "text"); + String posString = ObfuscationReflectionHelper.getPrivateValue(LabelWidget.class, + (LabelWidget) children.get(1), "text"); String[] posSplit = PARENTHESIS_PATTERN.split(posString); BlockPosHighlightRenderer.renderBlockBoxHighLight( - new BlockPos(Integer.parseInt(posSplit[1]), Integer.parseInt(posSplit[3]) - , Integer.parseInt(posSplit[5])), 5000); + new BlockPos(Integer.parseInt(posSplit[1]), Integer.parseInt(posSplit[3]), + Integer.parseInt(posSplit[5])), + 5000); Minecraft.getMinecraft().player.closeScreen(); Minecraft.getMinecraft().player.sendMessage(new TextComponentString( ((SlotWidget) children.get(0)).getHandle().getStack().getDisplayName() + - ": " - + posString - )); + ": " + posString)); return false; } catch (Throwable e) { GTLog.logger.error("Could not reflect GregTech WidgetLabel text", e); @@ -173,19 +177,22 @@ private boolean isOnScrollPane(int mouseX, int mouseY) { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { - RenderUtil.useScissor(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, () -> { - widgets.forEach(widget -> { - if (widget instanceof WidgetGroup) { - Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); - SlotWidget slotWidget = (SlotWidget) widget1; - slotWidget.setActive(widget.getPosition().y >= this.getPosition().y - 9 && widget.getPosition().y <= this.getPosition().y + this.getSize().height - 9); - } - }); - if (selected != null) { - Gui.drawRect(selected.getPosition().x, selected.getPosition().y, selected.getPosition().x + this.getSize().width - this.scrollPaneWidth, selected.getPosition().y + selected.getSize().height, 0x4BFFFFFF); - } - super.drawInBackground(mouseX, mouseY, partialTicks, context); - }); + RenderUtil.useScissor(this.getPosition().x, this.getPosition().y, this.getSize().width, this.getSize().height, + () -> { + widgets.forEach(widget -> { + if (widget instanceof WidgetGroup) { + Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); + SlotWidget slotWidget = (SlotWidget) widget1; + slotWidget.setActive(widget.getPosition().y >= this.getPosition().y - 9 && + widget.getPosition().y <= this.getPosition().y + this.getSize().height - 9); + } + }); + if (selected != null) { + Gui.drawRect(selected.getPosition().x, selected.getPosition().y, + selected.getPosition().x + this.getSize().width - this.scrollPaneWidth, + selected.getPosition().y + selected.getSize().height, 0x4BFFFFFF); + } + super.drawInBackground(mouseX, mouseY, partialTicks, context); + }); } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java index 5fe2b017915..f3d0bc7cf02 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetMonitorScreen.java @@ -3,12 +3,14 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.Size; +import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.client.renderer.GlStateManager; public class WidgetMonitorScreen extends Widget { + private final MetaTileEntityMonitorScreen screen; public WidgetMonitorScreen(int x, int y, int w, MetaTileEntityMonitorScreen screen) { @@ -25,14 +27,14 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (screen != null && screen.isActive()) { GlStateManager.pushMatrix(); - GlStateManager.translate(position.x + 2 + 0.5 * (size.width - 4), position.y + 2 + 0.5 * (size.height - 4),0); + GlStateManager.translate(position.x + 2 + 0.5 * (size.width - 4), position.y + 2 + 0.5 * (size.height - 4), + 0); GlStateManager.scale(size.getWidth(), size.getWidth(), 1.0f / size.getWidth()); - GlStateManager.scale(1 / screen.scale,1 / screen.scale,1 / screen.scale); + GlStateManager.scale(1 / screen.scale, 1 / screen.scale, 1 / screen.scale); GlStateManager.translate(-(screen.scale - 1) * 0.5, -(screen.scale - 1) * 0.5, 0); - screen.renderScreen(0,null); + screen.renderScreen(0, null); GlStateManager.popMatrix(); } - } } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java index 01c656a7c17..1fa2cee2bb9 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetPluginConfig.java @@ -8,11 +8,13 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.entity.player.InventoryPlayer; public class WidgetPluginConfig extends WidgetGroup { + protected TextureArea textureArea; - int width,height; + int width, height; public WidgetPluginConfig setSize(int width, int height) { setSize(new Size(width, height)); @@ -33,12 +35,12 @@ public void setGui(ModularUI gui) { onPositionUpdate(); } - public WidgetPluginConfig setBackGround(TextureArea textureArea){ + public WidgetPluginConfig setBackGround(TextureArea textureArea) { this.textureArea = textureArea; return this; } - public WidgetPluginConfig widget(Widget widget){ + public WidgetPluginConfig widget(Widget widget) { addWidget(widget); return this; } @@ -47,19 +49,23 @@ public void removePluginWidget() { clearAllWidgets(); } - public WidgetPluginConfig bindPlayerInventory(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { - for(int row = 0; row < 3; ++row) { - for(int col = 0; col < 9; ++col) { - this.widget((new SlotWidget(inventoryPlayer, col + (row + 1) * 9, x + col * 18, y + row * 18)).setBackgroundTexture(new TextureArea[]{imageLocation}).setLocationInfo(true, false)); + public WidgetPluginConfig bindPlayerInventory(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, + int y) { + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 9; ++col) { + this.widget((new SlotWidget(inventoryPlayer, col + (row + 1) * 9, x + col * 18, y + row * 18)) + .setBackgroundTexture(new TextureArea[] { imageLocation }).setLocationInfo(true, false)); } } return this.bindPlayerHotbar(inventoryPlayer, imageLocation, x, y + 58); } - public WidgetPluginConfig bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { - for(int slot = 0; slot < 9; ++slot) { - this.widget((new SlotWidget(inventoryPlayer, slot, x + slot * 18, y)).setBackgroundTexture(new TextureArea[]{imageLocation}).setLocationInfo(true, true)); + public WidgetPluginConfig bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, + int y) { + for (int slot = 0; slot < 9; ++slot) { + this.widget((new SlotWidget(inventoryPlayer, slot, x + slot * 18, y)) + .setBackgroundTexture(new TextureArea[] { imageLocation }).setLocationInfo(true, true)); } return this; @@ -74,5 +80,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender } super.drawInBackground(mouseX, mouseY, partialTicks, context); } - } diff --git a/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java b/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java index 67a635d0577..45a7904362f 100644 --- a/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java +++ b/src/main/java/gregtech/common/gui/widget/monitor/WidgetScreenGrid.java @@ -7,16 +7,19 @@ import gregtech.api.util.Size; import gregtech.client.utils.RenderUtil; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.input.Mouse; public class WidgetScreenGrid extends Widget { - public int x,y; + + public int x, y; public static final int width = 20; public static final int height = 20; MetaTileEntityMonitorScreen monitorScreen; @@ -24,12 +27,13 @@ public class WidgetScreenGrid extends Widget { public WidgetScreenGrid(int xPosition, int yPosition, int x, int y) { super(new Position(xPosition + x * width, yPosition + y * height), new Size(width, height)); - this.x = x; this.y = y; + this.x = x; + this.y = y; } public void setScreen(MetaTileEntityMonitorScreen monitorScreen) { this.monitorScreen = monitorScreen; - color = (monitorScreen != null && monitorScreen.isActive())? 0XFF4F66FF : 0XFF000000; + color = (monitorScreen != null && monitorScreen.isActive()) ? 0XFF4F66FF : 0XFF000000; } @SideOnly(Side.CLIENT) @@ -39,19 +43,19 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int y = this.getPosition().y; int width = this.getSize().width; int height = this.getSize().height; - int color = (monitorScreen != null && monitorScreen.isActive())? monitorScreen.frameColor:this.color; + int color = (monitorScreen != null && monitorScreen.isActive()) ? monitorScreen.frameColor : this.color; Gui.drawRect(x + 1, y + 1, x + width - 2, y + height - 2, color); -// if (monitorScreen.scale > 1) { -// width = (int) (monitorScreen.scale * width); -// height = (int) (monitorScreen.scale * height); -// Gui.drawRect(x, y, x + width - 1, y + 1, color); -// Gui.drawRect(x, y + height - 1, x + width - 1, y + height, color); -// Gui.drawRect(x, y, x + 1, y + height, color); -// Gui.drawRect(x + width - 1, y, x + width, y + height, color); -// } -// if (this.isMouseOverElement(mouseX, mouseY)) { -// Gui.drawRect(x, y, x + width, y + height, 0x4B6C6C6C); -// } + // if (monitorScreen.scale > 1) { + // width = (int) (monitorScreen.scale * width); + // height = (int) (monitorScreen.scale * height); + // Gui.drawRect(x, y, x + width - 1, y + 1, color); + // Gui.drawRect(x, y + height - 1, x + width - 1, y + height, color); + // Gui.drawRect(x, y, x + 1, y + height, color); + // Gui.drawRect(x + width - 1, y, x + width, y + height, color); + // } + // if (this.isMouseOverElement(mouseX, mouseY)) { + // Gui.drawRect(x, y, x + width, y + height, 0x4B6C6C6C); + // } } @SideOnly(Side.CLIENT) @@ -91,7 +95,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { super.handleClientAction(id, buffer); if (id == 1) { if (monitorScreen != null) { - MetaTileEntityUIFactory.INSTANCE.openUI(monitorScreen.getHolder(), (EntityPlayerMP) this.gui.entityPlayer); + MetaTileEntityUIFactory.INSTANCE.openUI(monitorScreen.getHolder(), + (EntityPlayerMP) this.gui.entityPlayer); } } } diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java index 0b4a850400a..ff2481feb9b 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java @@ -1,11 +1,10 @@ package gregtech.common.gui.widget.orefilter; -import com.google.common.collect.Lists; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.Position; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; @@ -15,13 +14,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class ItemOreFilterTestSlot extends OreFilterTestSlot implements IGhostIngredientTarget { @Nonnull @@ -56,7 +59,8 @@ protected void renderSlotContents(float partialTicks, IRenderContext context) { GlStateManager.pushMatrix(); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(testStack, pos.x + 1, pos.y + 1); - itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, testStack, pos.x + 1, pos.y + 1, null); + itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, testStack, pos.x + 1, pos.y + 1, + null); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); } @@ -75,7 +79,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void putItem(ItemStack stack) { ItemStack testStack = getTestStack(); - if ((stack.isEmpty() ^ testStack.isEmpty()) || !testStack.isItemEqual(stack) || !ItemStack.areItemStackTagsEqual(testStack, stack)) { + if ((stack.isEmpty() ^ testStack.isEmpty()) || !testStack.isItemEqual(stack) || + !ItemStack.areItemStackTagsEqual(testStack, stack)) { ItemStack copy = stack.copy(); copy.setCount(1); setTestStack(copy); @@ -89,6 +94,7 @@ public List> getPhantomTargets(Object ingredie } Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new IGhostIngredientHandler.Target() { + @Nonnull @Override public Rectangle getArea() { diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java index b1d939ac8a8..b8a276ed17d 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java @@ -9,22 +9,25 @@ import gregtech.api.util.Position; import gregtech.api.util.function.BooleanConsumer; import gregtech.api.util.oreglob.OreGlob; -import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Nullable; + /** * @author brachy84 */ @@ -177,8 +180,8 @@ public void drawInForeground(int mouseX, int mouseY) { list = this.testResult.object2BooleanEntrySet().stream().map( e -> I18n.format(e.getBooleanValue() ? "cover.ore_dictionary_filter.test_slot.matches" : - "cover.ore_dictionary_filter.test_slot.matches_not", e.getKey()) - ).collect(Collectors.toList()); + "cover.ore_dictionary_filter.test_slot.matches_not", e.getKey())) + .collect(Collectors.toList()); break; case INVALID: default: diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java index 39a4c756410..730ef11b13f 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java @@ -6,14 +6,16 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.TextFieldWidget2; import gregtech.api.util.oreglob.OreGlobCompileResult; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class OreGlobCompileStatusWidget extends Widget { @Nullable diff --git a/src/main/java/gregtech/common/inventory/IItemList.java b/src/main/java/gregtech/common/inventory/IItemList.java index ebcc961df73..037db382c43 100644 --- a/src/main/java/gregtech/common/inventory/IItemList.java +++ b/src/main/java/gregtech/common/inventory/IItemList.java @@ -2,9 +2,10 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nullable; import java.util.Set; +import javax.annotation.Nullable; + public interface IItemList { Set getStoredItems(); diff --git a/src/main/java/gregtech/common/inventory/SimpleItemInfo.java b/src/main/java/gregtech/common/inventory/SimpleItemInfo.java index f413c6da66e..56775d0beee 100644 --- a/src/main/java/gregtech/common/inventory/SimpleItemInfo.java +++ b/src/main/java/gregtech/common/inventory/SimpleItemInfo.java @@ -1,6 +1,7 @@ package gregtech.common.inventory; import gregtech.api.util.ItemStackHashStrategy; + import net.minecraft.item.ItemStack; public class SimpleItemInfo implements IItemInfo { diff --git a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java index 5a7fd6f54c0..e47157302c0 100644 --- a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java +++ b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java @@ -1,5 +1,12 @@ package gregtech.common.inventory.appeng; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IItemList; @@ -7,18 +14,13 @@ import appeng.fluids.util.MeaningfulFluidIterator; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Description A serializable {@link IItemList} from AE2, specially improved for fluid. @@ -28,8 +30,7 @@ public class SerializableFluidList implements IItemList, INBTSeri private final Reference2ObjectMap records = new Reference2ObjectOpenHashMap<>(); - public SerializableFluidList() { - } + public SerializableFluidList() {} @Override public void add(IAEFluidStack fluid) { @@ -59,7 +60,8 @@ public boolean isEmpty() { } private IAEFluidStack getOrCreateRecord(@Nonnull IAEFluidStack fluid) { - return this.records.computeIfAbsent(fluid.getFluid(), key -> AEFluidStack.fromFluidStack(new FluidStack(key, 0))); + return this.records.computeIfAbsent(fluid.getFluid(), + key -> AEFluidStack.fromFluidStack(new FluidStack(key, 0))); } private IAEFluidStack getRecord(@Nonnull IAEFluidStack fluid) { diff --git a/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java b/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java index 2b1b879f265..ad09fa2e5b6 100644 --- a/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java +++ b/src/main/java/gregtech/common/inventory/appeng/SerializableItemList.java @@ -1,14 +1,15 @@ package gregtech.common.inventory.appeng; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.util.INBTSerializable; + import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; import appeng.util.item.AEItemStack; import appeng.util.item.ItemList; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.INBTSerializable; import java.util.Collection; import java.util.Iterator; @@ -22,8 +23,7 @@ public class SerializableItemList implements IItemList, INBTSerial private final ItemList parent = new ItemList(); - public SerializableItemList() { - } + public SerializableItemList() {} @Override public void addStorage(IAEItemStack stack) { @@ -104,5 +104,4 @@ public void deserializeNBT(NBTTagList list) { } } } - } diff --git a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java index 0f6000d33f5..e8eb21d9e3f 100644 --- a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java @@ -1,6 +1,5 @@ package gregtech.common.inventory.handlers; - import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.items.ItemStackHandler; @@ -16,6 +15,7 @@ public CycleItemStackHandler(NonNullList stacks) { @Nonnull @Override public ItemStack getStackInSlot(int slot) { - return stacks.isEmpty() ? ItemStack.EMPTY : super.getStackInSlot(Math.abs((int)(System.currentTimeMillis() / 1000) % stacks.size())); + return stacks.isEmpty() ? ItemStack.EMPTY : + super.getStackInSlot(Math.abs((int) (System.currentTimeMillis() / 1000) % stacks.size())); } } diff --git a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java index f0e61c9f01a..22a0569b87a 100644 --- a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java @@ -3,6 +3,7 @@ import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java index 8c327117af2..ab9191f8bfc 100644 --- a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.IGTTool; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; @@ -16,7 +17,8 @@ public ToolItemStackHandler(int size) { @Nonnull public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { if (stack.getItem().getToolClasses(stack).isEmpty()) return stack; - if (stack.getItem() instanceof IGTTool && ((IGTTool) stack.getItem()).getToolStats().isSuitableForCrafting(stack)) { + if (stack.getItem() instanceof IGTTool && + ((IGTTool) stack.getItem()).getToolStats().isSuitableForCrafting(stack)) { return super.insertItem(slot, stack, simulate); } diff --git a/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java index facc0242cde..a45329c604c 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/ItemSource.java @@ -1,8 +1,9 @@ package gregtech.common.inventory.itemsource; -import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.item.ItemStack; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + public abstract class ItemSource { public abstract int getPriority(); diff --git a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java index ff41f26a2f5..5c9d512059d 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java +++ b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java @@ -3,20 +3,24 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.inventory.IItemInfo; import gregtech.common.inventory.IItemList; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenCustomHashMap; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.*; +import javax.annotation.Nullable; + public class ItemSources implements IItemList { protected final World world; protected final List handlerInfoList = new ArrayList<>(); - protected final Map itemInfoMap = new Object2ObjectLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + protected final Map itemInfoMap = new Object2ObjectLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final Comparator comparator = Comparator.comparing(ItemSource::getPriority); private final Set storedItemsView = Collections.unmodifiableSet(itemInfoMap.keySet()); diff --git a/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java b/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java index f9f6323de83..ad60895347b 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java +++ b/src/main/java/gregtech/common/inventory/itemsource/NetworkItemInfo.java @@ -1,16 +1,20 @@ package gregtech.common.inventory.itemsource; import gregtech.common.inventory.IItemInfo; + +import net.minecraft.item.ItemStack; + import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; -import net.minecraft.item.ItemStack; import java.util.Comparator; + public class NetworkItemInfo implements IItemInfo { private final ItemStack itemStack; private int totalItemAmount = 0; - private final Object2IntMap inventories = new Object2IntAVLTreeMap<>(Comparator.comparingInt(ItemSource::getPriority)); + private final Object2IntMap inventories = new Object2IntAVLTreeMap<>( + Comparator.comparingInt(ItemSource::getPriority)); public NetworkItemInfo(ItemStack itemStack) { this.itemStack = itemStack; diff --git a/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java index 49639ed3535..fae123f74a6 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/sources/InventoryItemSource.java @@ -2,20 +2,23 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.inventory.itemsource.ItemSource; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntMaps; + import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.EmptyHandler; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; + public class InventoryItemSource extends ItemSource { protected final World world; protected final int priority; protected IItemHandler itemHandler = EmptyHandler.INSTANCE; - private Object2IntMap itemStackByAmountMap = new Object2IntLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private Object2IntMap itemStackByAmountMap = new Object2IntLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); public InventoryItemSource(World world, int priority) { this.world = world; @@ -27,8 +30,7 @@ public InventoryItemSource(World world, IItemHandler itemHandler1, int priority) this.itemHandler = itemHandler1; } - public void computeItemHandler() { - } + public void computeItemHandler() {} @Override public int getPriority() { @@ -91,7 +93,8 @@ public Object2IntMap getStoredItems() { } private void recomputeItemStackCount() { - Object2IntMap amountMap = new Object2IntLinkedOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Object2IntMap amountMap = new Object2IntLinkedOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); if (itemHandler == null) { this.itemStackByAmountMap = amountMap; return; @@ -104,4 +107,3 @@ private void recomputeItemStackCount() { this.itemStackByAmountMap = amountMap; } } - diff --git a/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java b/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java index 01ba9db290b..987b815a5df 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java +++ b/src/main/java/gregtech/common/inventory/itemsource/sources/TileItemSource.java @@ -39,28 +39,28 @@ public BlockPos getAccessedBlockPos() { @Override public void computeItemHandler() { if (!world.isBlockLoaded(accessedBlockPos)) { - //we handle unloaded blocks as empty item handlers - //so when they are loaded, they are refreshed and handled correctly + // we handle unloaded blocks as empty item handlers + // so when they are loaded, they are refreshed and handled correctly itemHandler = EmptyHandler.INSTANCE; return; } - //use cached tile entity as long as it's valid and has same position (just in case of frames etc) + // use cached tile entity as long as it's valid and has same position (just in case of frames etc) TileEntity tileEntity = cachedTileEntity.get(); if (tileEntity == null || tileEntity.isInvalid() || !tileEntity.getPos().equals(accessedBlockPos)) { tileEntity = world.getTileEntity(accessedBlockPos); if (tileEntity == null) { - //if tile entity doesn't exist anymore, we are invalid now - //return null which will be handled as INVALID + // if tile entity doesn't exist anymore, we are invalid now + // return null which will be handled as INVALID itemHandler = null; return; } - //update cached tile entity + // update cached tile entity this.cachedTileEntity = new WeakReference<>(tileEntity); } - //fetch capability from tile entity - //if it returns null, item handler info will be removed - //block should emit block update once it obtains capability again, - //so handler info will be recreated accordingly + // fetch capability from tile entity + // if it returns null, item handler info will be removed + // block should emit block update once it obtains capability again, + // so handler info will be recreated accordingly itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, accessSide.getOpposite()); } diff --git a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java index 134663f7cf4..e2c8cadd6b5 100644 --- a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java +++ b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java @@ -8,6 +8,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTLog; import gregtech.api.util.SlotDelegate; + import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerEnchantment; @@ -42,8 +43,8 @@ public static void onGuiOpen(GuiOpenEvent event) { private static void onContainerOpen(Container container) { if (container instanceof ContainerEnchantment) { - //wrap in try-catch because such kind of tweaks is subject to breaking - //don't let it crash game if some mod borked it + // wrap in try-catch because such kind of tweaks is subject to breaking + // don't let it crash game if some mod borked it try { int index = getEnchantmentSlotIndex((ContainerEnchantment) container); if (index != -1) { @@ -91,5 +92,4 @@ public boolean isItemValid(@Nonnull ItemStack stack) { return super.isItemValid(stack) || isValidForEnchantment(stack); } } - } diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 7259f715d46..78650965336 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -29,6 +29,7 @@ import gregtech.common.items.behaviors.monitorplugin.OnlinePicPluginBehavior; import gregtech.common.items.behaviors.monitorplugin.TextPluginBehavior; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; @@ -60,51 +61,87 @@ public void registerSubItems() { CREDIT_NEUTRONIUM = addItem(7, "credit.neutronium").setRarity(EnumRarity.EPIC); COIN_GOLD_ANCIENT = addItem(8, "coin.gold.ancient") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))).setRarity(EnumRarity.RARE); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))) + .setRarity(EnumRarity.RARE); COIN_DOGE = addItem(9, "coin.doge") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Brass, M / 4))).setRarity(EnumRarity.EPIC); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Brass, M / 4))) + .setRarity(EnumRarity.EPIC); COIN_CHOCOLATE = addItem(10, "coin.chocolate") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 4))) - .addComponents(new FoodStats(1, 0.1F, false, true, OreDictUnifier.get(OrePrefix.foil, Materials.Gold), new RandomPotionEffect(MobEffects.SPEED, 200, 1, 10))); + .addComponents(new FoodStats(1, 0.1F, false, true, OreDictUnifier.get(OrePrefix.foil, Materials.Gold), + new RandomPotionEffect(MobEffects.SPEED, 200, 1, 10))); // Solidifier Shapes: ID 11-30 - SHAPE_EMPTY = addItem(11, "shape.empty").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - - SHAPE_MOLDS[0] = SHAPE_MOLD_PLATE = addItem(12, "shape.mold.plate").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[1] = SHAPE_MOLD_GEAR = addItem(13, "shape.mold.gear").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[2] = SHAPE_MOLD_CREDIT = addItem(14, "shape.mold.credit").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[3] = SHAPE_MOLD_BOTTLE = addItem(15, "shape.mold.bottle").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[4] = SHAPE_MOLD_INGOT = addItem(16, "shape.mold.ingot").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[5] = SHAPE_MOLD_BALL = addItem(17, "shape.mold.ball").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[6] = SHAPE_MOLD_BLOCK = addItem(18, "shape.mold.block").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[7] = SHAPE_MOLD_NUGGET = addItem(19, "shape.mold.nugget").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[8] = SHAPE_MOLD_CYLINDER = addItem(20, "shape.mold.cylinder").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[9] = SHAPE_MOLD_ANVIL = addItem(21, "shape.mold.anvil").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[10] = SHAPE_MOLD_NAME = addItem(22, "shape.mold.name").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[11] = SHAPE_MOLD_GEAR_SMALL = addItem(23, "shape.mold.gear.small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_MOLDS[12] = SHAPE_MOLD_ROTOR = addItem(24, "shape.mold.rotor").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EMPTY = addItem(11, "shape.empty") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + + SHAPE_MOLDS[0] = SHAPE_MOLD_PLATE = addItem(12, "shape.mold.plate") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[1] = SHAPE_MOLD_GEAR = addItem(13, "shape.mold.gear") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[2] = SHAPE_MOLD_CREDIT = addItem(14, "shape.mold.credit") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[3] = SHAPE_MOLD_BOTTLE = addItem(15, "shape.mold.bottle") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[4] = SHAPE_MOLD_INGOT = addItem(16, "shape.mold.ingot") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[5] = SHAPE_MOLD_BALL = addItem(17, "shape.mold.ball") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[6] = SHAPE_MOLD_BLOCK = addItem(18, "shape.mold.block") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[7] = SHAPE_MOLD_NUGGET = addItem(19, "shape.mold.nugget") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[8] = SHAPE_MOLD_CYLINDER = addItem(20, "shape.mold.cylinder") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[9] = SHAPE_MOLD_ANVIL = addItem(21, "shape.mold.anvil") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[10] = SHAPE_MOLD_NAME = addItem(22, "shape.mold.name") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[11] = SHAPE_MOLD_GEAR_SMALL = addItem(23, "shape.mold.gear.small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_MOLDS[12] = SHAPE_MOLD_ROTOR = addItem(24, "shape.mold.rotor") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Extruder Shapes: ID 31-59 - SHAPE_EXTRUDERS[0] = SHAPE_EXTRUDER_PLATE = addItem(31, "shape.extruder.plate").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[1] = SHAPE_EXTRUDER_ROD = addItem(32, "shape.extruder.rod").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[2] = SHAPE_EXTRUDER_BOLT = addItem(33, "shape.extruder.bolt").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[3] = SHAPE_EXTRUDER_RING = addItem(34, "shape.extruder.ring").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[4] = SHAPE_EXTRUDER_CELL = addItem(35, "shape.extruder.cell").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[5] = SHAPE_EXTRUDER_INGOT = addItem(36, "shape.extruder.ingot").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[6] = SHAPE_EXTRUDER_WIRE = addItem(37, "shape.extruder.wire").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[7] = SHAPE_EXTRUDER_PIPE_TINY = addItem(38, "shape.extruder.pipe.tiny").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[8] = SHAPE_EXTRUDER_PIPE_SMALL = addItem(39, "shape.extruder.pipe.small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[9] = SHAPE_EXTRUDER_PIPE_NORMAL = addItem(40, "shape.extruder.pipe.normal").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[10] = SHAPE_EXTRUDER_PIPE_LARGE = addItem(41, "shape.extruder.pipe.large").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[11] = SHAPE_EXTRUDER_PIPE_HUGE = addItem(42, "shape.extruder.pipe.huge").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[12] = SHAPE_EXTRUDER_BLOCK = addItem(43, "shape.extruder.block").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[0] = SHAPE_EXTRUDER_PLATE = addItem(31, "shape.extruder.plate") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[1] = SHAPE_EXTRUDER_ROD = addItem(32, "shape.extruder.rod") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[2] = SHAPE_EXTRUDER_BOLT = addItem(33, "shape.extruder.bolt") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[3] = SHAPE_EXTRUDER_RING = addItem(34, "shape.extruder.ring") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[4] = SHAPE_EXTRUDER_CELL = addItem(35, "shape.extruder.cell") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[5] = SHAPE_EXTRUDER_INGOT = addItem(36, "shape.extruder.ingot") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[6] = SHAPE_EXTRUDER_WIRE = addItem(37, "shape.extruder.wire") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[7] = SHAPE_EXTRUDER_PIPE_TINY = addItem(38, "shape.extruder.pipe.tiny") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[8] = SHAPE_EXTRUDER_PIPE_SMALL = addItem(39, "shape.extruder.pipe.small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[9] = SHAPE_EXTRUDER_PIPE_NORMAL = addItem(40, "shape.extruder.pipe.normal") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[10] = SHAPE_EXTRUDER_PIPE_LARGE = addItem(41, "shape.extruder.pipe.large") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[11] = SHAPE_EXTRUDER_PIPE_HUGE = addItem(42, "shape.extruder.pipe.huge") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[12] = SHAPE_EXTRUDER_BLOCK = addItem(43, "shape.extruder.block") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Extruder Shapes index 13-20 (inclusive), id 44-51 (inclusive) are unused - SHAPE_EXTRUDERS[21] = SHAPE_EXTRUDER_GEAR = addItem(52, "shape.extruder.gear").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[22] = SHAPE_EXTRUDER_BOTTLE = addItem(53, "shape.extruder.bottle").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[23] = SHAPE_EXTRUDER_FOIL = addItem(54, "shape.extruder.foil").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[24] = SHAPE_EXTRUDER_GEAR_SMALL = addItem(55, "shape.extruder.gear_small").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[25] = SHAPE_EXTRUDER_ROD_LONG = addItem(56, "shape.extruder.rod_long").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); - SHAPE_EXTRUDERS[26] = SHAPE_EXTRUDER_ROTOR = addItem(57, "shape.extruder.rotor").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[21] = SHAPE_EXTRUDER_GEAR = addItem(52, "shape.extruder.gear") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[22] = SHAPE_EXTRUDER_BOTTLE = addItem(53, "shape.extruder.bottle") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[23] = SHAPE_EXTRUDER_FOIL = addItem(54, "shape.extruder.foil") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[24] = SHAPE_EXTRUDER_GEAR_SMALL = addItem(55, "shape.extruder.gear_small") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[25] = SHAPE_EXTRUDER_ROD_LONG = addItem(56, "shape.extruder.rod_long") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); + SHAPE_EXTRUDERS[26] = SHAPE_EXTRUDER_ROTOR = addItem(57, "shape.extruder.rotor") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))); // Spray Cans: ID 60-77 SPRAY_EMPTY = addItem(61, "spray.empty"); @@ -123,41 +160,54 @@ public void registerSubItems() { // Fluid Cells: ID 78-88 FLUID_CELL = addItem(78, "fluid_cell") - .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, false), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, false), + new ItemFluidContainer()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_UNIVERSAL = addItem(79, "fluid_cell.universal") - .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1800, true, false, false, false, true), + new ItemFluidContainer()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_STEEL = addItem(80, "large_fluid_cell.steel") - .addComponents(new FilteredFluidStats(8000, Materials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(8000, + Materials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 4))) // ingot * 4 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_ALUMINIUM = addItem(81, "large_fluid_cell.aluminium") - .addComponents(new FilteredFluidStats(32000, Materials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(32000, + Materials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Aluminium, M * 4))) // ingot * 4 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_STAINLESS_STEEL = addItem(82, "large_fluid_cell.stainless_steel") - .addComponents(new FilteredFluidStats(64000, Materials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, true, true, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(64000, + Materials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + true, true, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.StainlessSteel, M * 6))) // ingot * 6 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_TITANIUM = addItem(83, "large_fluid_cell.titanium") - .addComponents(new FilteredFluidStats(128000, Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(128000, + Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Titanium, M * 6))) // ingot * 6 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_LARGE_TUNGSTEN_STEEL = addItem(84, "large_fluid_cell.tungstensteel") - .addComponents(new FilteredFluidStats(512000, Materials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(512000, + Materials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + false, false, false, true), new ItemFluidContainer()) .setMaxStackSize(32) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 8))) // ingot * 8 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); FLUID_CELL_GLASS_VIAL = addItem(85, "fluid_cell.glass_vial") - .addComponents(new FilteredFluidStats(1000, 1200, false, true, false, false, true), new ItemFluidContainer()) + .addComponents(new FilteredFluidStats(1000, 1200, false, true, false, false, true), + new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 4))) // small dust .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); @@ -184,18 +234,29 @@ public void registerSubItems() { .setRarity(EnumRarity.UNCOMMON) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BOTTLE_PURPLE_DRINK = addItem(93, "bottle.purple.drink").addComponents(new FoodStats(8, 0.2F, true, true, new ItemStack(Items.GLASS_BOTTLE), new RandomPotionEffect(MobEffects.HASTE, 800, 1, 90))); + BOTTLE_PURPLE_DRINK = addItem(93, "bottle.purple.drink").addComponents(new FoodStats(8, 0.2F, true, true, + new ItemStack(Items.GLASS_BOTTLE), new RandomPotionEffect(MobEffects.HASTE, 800, 1, 90))); // Voltage Coils: ID 96-110 - VOLTAGE_COIL_ULV = addItem(96, "voltage_coil.ulv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Lead, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); - VOLTAGE_COIL_LV = addItem(97, "voltage_coil.lv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); - VOLTAGE_COIL_MV = addItem(98, "voltage_coil.mv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Aluminium, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); - VOLTAGE_COIL_HV = addItem(99, "voltage_coil.hv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlackSteel, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); - VOLTAGE_COIL_EV = addItem(100, "voltage_coil.ev").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); - VOLTAGE_COIL_IV = addItem(101, "voltage_coil.iv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iridium, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); - VOLTAGE_COIL_LuV = addItem(102, "voltage_coil.luv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Osmiridium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); - VOLTAGE_COIL_ZPM = addItem(103, "voltage_coil.zpm").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); - VOLTAGE_COIL_UV = addItem(104, "voltage_coil.uv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tritanium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_ULV = addItem(96, "voltage_coil.ulv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Lead, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); + VOLTAGE_COIL_LV = addItem(97, "voltage_coil.lv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Steel, M * 2), new MaterialStack(Materials.IronMagnetic, M / 2))); + VOLTAGE_COIL_MV = addItem(98, "voltage_coil.mv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Aluminium, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); + VOLTAGE_COIL_HV = addItem(99, "voltage_coil.hv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.BlackSteel, M * 2), new MaterialStack(Materials.SteelMagnetic, M / 2))); + VOLTAGE_COIL_EV = addItem(100, "voltage_coil.ev") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 2), + new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); + VOLTAGE_COIL_IV = addItem(101, "voltage_coil.iv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Iridium, M * 2), new MaterialStack(Materials.NeodymiumMagnetic, M / 2))); + VOLTAGE_COIL_LuV = addItem(102, "voltage_coil.luv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Osmiridium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_ZPM = addItem(103, "voltage_coil.zpm").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Europium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); + VOLTAGE_COIL_UV = addItem(104, "voltage_coil.uv").setMaterialInfo(new ItemMaterialInfo( + new MaterialStack(Materials.Tritanium, M * 2), new MaterialStack(Materials.SamariumMagnetic, M / 2))); // ???: ID 111-125 @@ -477,12 +538,16 @@ public void registerSubItems() { // Special Machine Components: ID 266-280 COMPONENT_GRINDER_DIAMOND = addItem(266, "component.grinder.diamond") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 8), new MaterialStack(Materials.Diamond, M * 5))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M * 8), + new MaterialStack(Materials.Diamond, M * 5))); COMPONENT_GRINDER_TUNGSTEN = addItem(267, "component.grinder.tungsten") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tungsten, M * 4), new MaterialStack(Materials.VanadiumSteel, M * 8), new MaterialStack(Materials.Diamond, M))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Tungsten, M * 4), + new MaterialStack(Materials.VanadiumSteel, M * 8), new MaterialStack(Materials.Diamond, M))); - IRON_MINECART_WHEELS = addItem(268, "minecart_wheels.iron").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); - STEEL_MINECART_WHEELS = addItem(269, "minecart_wheels.steel").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M))); + IRON_MINECART_WHEELS = addItem(268, "minecart_wheels.iron") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); + STEEL_MINECART_WHEELS = addItem(269, "minecart_wheels.steel") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Steel, M))); // Special Eyes/Stars: ID 281-289 QUANTUM_EYE = addItem(281, "quantumeye"); @@ -493,7 +558,8 @@ public void registerSubItems() { FLUID_FILTER = addItem(290, "fluid_filter") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2))); ITEM_FILTER = addItem(291, "item_filter") - .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2), new MaterialStack(Materials.Steel, M))); + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2), + new MaterialStack(Materials.Steel, M))); ORE_DICTIONARY_FILTER = addItem(292, "ore_dictionary_filter") .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Zinc, M * 2))); SMART_FILTER = addItem(293, "smart_item_filter") @@ -537,47 +603,56 @@ public void registerSubItems() { COVER_SOLAR_PANEL_ULV = addItem(332, "cover.solar.panel.ulv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], GTValues.VNF[GTValues.ULV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], + GTValues.VNF[GTValues.ULV])); })); COVER_SOLAR_PANEL_LV = addItem(333, "cover.solar.panel.lv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], GTValues.VNF[GTValues.LV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], + GTValues.VNF[GTValues.LV])); })); COVER_SOLAR_PANEL_MV = addItem(334, "cover.solar.panel.mv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], GTValues.VNF[GTValues.MV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], + GTValues.VNF[GTValues.MV])); })); COVER_SOLAR_PANEL_HV = addItem(335, "cover.solar.panel.hv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], GTValues.VNF[GTValues.HV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], + GTValues.VNF[GTValues.HV])); })); COVER_SOLAR_PANEL_EV = addItem(336, "cover.solar.panel.ev").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], GTValues.VNF[GTValues.EV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], + GTValues.VNF[GTValues.EV])); })); COVER_SOLAR_PANEL_IV = addItem(337, "cover.solar.panel.iv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], GTValues.VNF[GTValues.IV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], + GTValues.VNF[GTValues.IV])); })); COVER_SOLAR_PANEL_LUV = addItem(338, "cover.solar.panel.luv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], GTValues.VNF[GTValues.LuV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], + GTValues.VNF[GTValues.LuV])); })); COVER_SOLAR_PANEL_ZPM = addItem(339, "cover.solar.panel.zpm").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], GTValues.VNF[GTValues.ZPM])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], + GTValues.VNF[GTValues.ZPM])); })); COVER_SOLAR_PANEL_UV = addItem(340, "cover.solar.panel.uv").addComponents(new TooltipBehavior(lines -> { lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.1")); lines.add(I18n.format("metaitem.cover.solar.panel.tooltip.2")); - lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], GTValues.VNF[GTValues.UV])); + lines.add(I18n.format("gregtech.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], + GTValues.VNF[GTValues.UV])); })); // MAX-tier solar panel? @@ -592,11 +667,16 @@ public void registerSubItems() { IItemContainerItemProvider selfContainerItemProvider = itemStack -> itemStack; WOODEN_FORM_EMPTY = addItem(347, "wooden_form.empty"); WOODEN_FORM_BRICK = addItem(348, "wooden_form.brick").addComponents(selfContainerItemProvider); - COMPRESSED_CLAY = addItem(349, "compressed.clay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); - COMPRESSED_COKE_CLAY = addItem(350, "compressed.coke_clay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); - COMPRESSED_FIRECLAY = addItem(351, "compressed.fireclay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); - FIRECLAY_BRICK = addItem(352, "brick.fireclay").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); - COKE_OVEN_BRICK = addItem(353, "brick.coke").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_CLAY = addItem(349, "compressed.clay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_COKE_CLAY = addItem(350, "compressed.coke_clay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); + COMPRESSED_FIRECLAY = addItem(351, "compressed.fireclay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); + FIRECLAY_BRICK = addItem(352, "brick.fireclay") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M))); + COKE_OVEN_BRICK = addItem(353, "brick.coke") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Clay, M))); if (!ConfigHolder.recipes.harderBrickRecipes) COMPRESSED_CLAY.setInvisible(); @@ -643,17 +723,23 @@ public void registerSubItems() { BIO_CHAFF = addItem(440, "bio_chaff").setBurnValue(200); // Power Units: ID 446-459 - POWER_UNIT_LV = addItem(446, "power_unit.lv").addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)).setMaxStackSize(8); - POWER_UNIT_MV = addItem(447, "power_unit.mv").addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)).setMaxStackSize(8); - POWER_UNIT_HV = addItem(448, "power_unit.hv").addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)).setMaxStackSize(8); - POWER_UNIT_EV = addItem(449, "power_unit.ev").addComponents(ElectricStats.createElectricItem(6400000L, GTValues.EV)).setMaxStackSize(8); - POWER_UNIT_IV = addItem(450, "power_unit.iv").addComponents(ElectricStats.createElectricItem(25600000L, GTValues.IV)).setMaxStackSize(8); + POWER_UNIT_LV = addItem(446, "power_unit.lv") + .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)).setMaxStackSize(8); + POWER_UNIT_MV = addItem(447, "power_unit.mv") + .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)).setMaxStackSize(8); + POWER_UNIT_HV = addItem(448, "power_unit.hv") + .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)).setMaxStackSize(8); + POWER_UNIT_EV = addItem(449, "power_unit.ev") + .addComponents(ElectricStats.createElectricItem(6400000L, GTValues.EV)).setMaxStackSize(8); + POWER_UNIT_IV = addItem(450, "power_unit.iv") + .addComponents(ElectricStats.createElectricItem(25600000L, GTValues.IV)).setMaxStackSize(8); // Usable Items: ID 460-490 DYNAMITE = addItem(460, "dynamite") .addComponents(new DynamiteBehaviour()) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - INTEGRATED_CIRCUIT = addItem(461, "circuit.integrated").addComponents(new IntCircuitBehaviour()).setModelAmount(33); + INTEGRATED_CIRCUIT = addItem(461, "circuit.integrated").addComponents(new IntCircuitBehaviour()) + .setModelAmount(33); FOAM_SPRAYER = addItem(462, "foam_sprayer").addComponents(new FoamSprayerBehavior()) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); @@ -662,7 +748,8 @@ public void registerSubItems() { .addComponents(new NanoSaberBehavior()) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - NANO_SABER.getMetaItem().addPropertyOverride(NanoSaberBehavior.OVERRIDE_KEY_LOCATION, (stack, worldIn, entityIn) -> NanoSaberBehavior.isItemActive(stack) ? 1.0f : 0.0f); + NANO_SABER.getMetaItem().addPropertyOverride(NanoSaberBehavior.OVERRIDE_KEY_LOCATION, + (stack, worldIn, entityIn) -> NanoSaberBehavior.isItemActive(stack) ? 1.0f : 0.0f); CLIPBOARD = addItem(464, "clipboard") .addComponents(new ClipboardBehavior()) @@ -673,15 +760,18 @@ public void registerSubItems() { .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_LV = addItem(466, "prospector.lv") - .addComponents(ElectricStats.createElectricItem(100_000L, GTValues.LV), new ProspectorScannerBehavior(2, GTValues.LV)) + .addComponents(ElectricStats.createElectricItem(100_000L, GTValues.LV), + new ProspectorScannerBehavior(2, GTValues.LV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_HV = addItem(467, "prospector.hv") - .addComponents(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), new ProspectorScannerBehavior(3, GTValues.HV)) + .addComponents(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), + new ProspectorScannerBehavior(3, GTValues.HV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); PROSPECTOR_LUV = addItem(468, "prospector.luv") - .addComponents(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), new ProspectorScannerBehavior(5, GTValues.LuV)) + .addComponents(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), + new ProspectorScannerBehavior(5, GTValues.LuV)) .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); TRICORDER_SCANNER = addItem(469, "tricorder_scanner") @@ -701,15 +791,20 @@ public void registerSubItems() { .setMaxStackSize(1) .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - RUBBER_WOOD_BOAT = addItem(473, "rubber_wood_boat").addComponents(new GTBoatBehavior(GTBoatType.RUBBER_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); - TREATED_WOOD_BOAT = addItem(474, "treated_wood_boat").addComponents(new GTBoatBehavior(GTBoatType.TREATED_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); - RUBBER_WOOD_DOOR = addItem(475, "rubber_wood_door").addComponents(new DoorBehavior(MetaBlocks.RUBBER_WOOD_DOOR)).setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); - TREATED_WOOD_DOOR = addItem(476, "treated_wood_door").addComponents(new DoorBehavior(MetaBlocks.TREATED_WOOD_DOOR)).setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); + RUBBER_WOOD_BOAT = addItem(473, "rubber_wood_boat") + .addComponents(new GTBoatBehavior(GTBoatType.RUBBER_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); + TREATED_WOOD_BOAT = addItem(474, "treated_wood_boat") + .addComponents(new GTBoatBehavior(GTBoatType.TREATED_WOOD_BOAT)).setMaxStackSize(1).setBurnValue(400); + RUBBER_WOOD_DOOR = addItem(475, "rubber_wood_door").addComponents(new DoorBehavior(MetaBlocks.RUBBER_WOOD_DOOR)) + .setBurnValue(200).setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); + TREATED_WOOD_DOOR = addItem(476, "treated_wood_door") + .addComponents(new DoorBehavior(MetaBlocks.TREATED_WOOD_DOOR)).setBurnValue(200) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_DECORATIONS); // Misc Crafting Items: ID 491-515 ENERGIUM_DUST = addItem(491, "energium_dust"); ENGRAVED_LAPOTRON_CHIP = addItem(492, "engraved.lapotron_chip"); - //Free ID: 493, 494, 495, 496 + // Free ID: 493, 494, 495, 496 NEUTRON_REFLECTOR = addItem(497, "neutron_reflector"); GELLED_TOLUENE = addItem(498, "gelled_toluene"); CARBON_FIBERS = addItem(499, "carbon.fibers"); @@ -728,11 +823,15 @@ public void registerSubItems() { CAPACITOR = addItem(520, "component.capacitor").setUnificationData(OrePrefix.component, Component.Capacitor); DIODE = addItem(521, "component.diode").setUnificationData(OrePrefix.component, Component.Diode); INDUCTOR = addItem(522, "component.inductor").setUnificationData(OrePrefix.component, Component.Inductor); - SMD_TRANSISTOR = addItem(523, "component.smd.transistor").setUnificationData(OrePrefix.component, Component.Transistor); - SMD_RESISTOR = addItem(524, "component.smd.resistor").setUnificationData(OrePrefix.component, Component.Resistor); - SMD_CAPACITOR = addItem(525, "component.smd.capacitor").setUnificationData(OrePrefix.component, Component.Capacitor); + SMD_TRANSISTOR = addItem(523, "component.smd.transistor").setUnificationData(OrePrefix.component, + Component.Transistor); + SMD_RESISTOR = addItem(524, "component.smd.resistor").setUnificationData(OrePrefix.component, + Component.Resistor); + SMD_CAPACITOR = addItem(525, "component.smd.capacitor").setUnificationData(OrePrefix.component, + Component.Capacitor); SMD_DIODE = addItem(526, "component.smd.diode").setUnificationData(OrePrefix.component, Component.Diode); - SMD_INDUCTOR = addItem(527, "component.smd.inductor").setUnificationData(OrePrefix.component, Component.Inductor); + SMD_INDUCTOR = addItem(527, "component.smd.inductor").setUnificationData(OrePrefix.component, + Component.Inductor); ADVANCED_SMD_TRANSISTOR = addItem(528, "component.advanced_smd.transistor"); ADVANCED_SMD_RESISTOR = addItem(529, "component.advanced_smd.resistor"); ADVANCED_SMD_CAPACITOR = addItem(530, "component.advanced_smd.capacitor"); @@ -786,7 +885,8 @@ public void registerSubItems() { // T2: Integrated INTEGRATED_CIRCUIT_LV = addItem(623, "circuit.basic_integrated").setUnificationData(OrePrefix.circuit, Tier.LV); INTEGRATED_CIRCUIT_MV = addItem(624, "circuit.good_integrated").setUnificationData(OrePrefix.circuit, Tier.MV); - INTEGRATED_CIRCUIT_HV = addItem(625, "circuit.advanced_integrated").setUnificationData(OrePrefix.circuit, Tier.HV); + INTEGRATED_CIRCUIT_HV = addItem(625, "circuit.advanced_integrated").setUnificationData(OrePrefix.circuit, + Tier.HV); // Misc Unlocks NAND_CHIP_ULV = addItem(626, "circuit.nand_chip").setUnificationData(OrePrefix.circuit, Tier.ULV); @@ -800,7 +900,8 @@ public void registerSubItems() { // T4: Nano NANO_PROCESSOR_HV = addItem(632, "circuit.nano_processor").setUnificationData(OrePrefix.circuit, Tier.HV); - NANO_PROCESSOR_ASSEMBLY_EV = addItem(633, "circuit.nano_assembly").setUnificationData(OrePrefix.circuit, Tier.EV); + NANO_PROCESSOR_ASSEMBLY_EV = addItem(633, "circuit.nano_assembly").setUnificationData(OrePrefix.circuit, + Tier.EV); NANO_COMPUTER_IV = addItem(634, "circuit.nano_computer").setUnificationData(OrePrefix.circuit, Tier.IV); NANO_MAINFRAME_LUV = addItem(635, "circuit.nano_mainframe").setUnificationData(OrePrefix.circuit, Tier.LuV); @@ -808,7 +909,8 @@ public void registerSubItems() { QUANTUM_PROCESSOR_EV = addItem(636, "circuit.quantum_processor").setUnificationData(OrePrefix.circuit, Tier.EV); QUANTUM_ASSEMBLY_IV = addItem(637, "circuit.quantum_assembly").setUnificationData(OrePrefix.circuit, Tier.IV); QUANTUM_COMPUTER_LUV = addItem(638, "circuit.quantum_computer").setUnificationData(OrePrefix.circuit, Tier.LuV); - QUANTUM_MAINFRAME_ZPM = addItem(639, "circuit.quantum_mainframe").setUnificationData(OrePrefix.circuit, Tier.ZPM); + QUANTUM_MAINFRAME_ZPM = addItem(639, "circuit.quantum_mainframe").setUnificationData(OrePrefix.circuit, + Tier.ZPM); // T6: Crystal CRYSTAL_PROCESSOR_IV = addItem(640, "circuit.crystal_processor").setUnificationData(OrePrefix.circuit, Tier.IV); @@ -817,10 +919,14 @@ public void registerSubItems() { CRYSTAL_MAINFRAME_UV = addItem(643, "circuit.crystal_mainframe").setUnificationData(OrePrefix.circuit, Tier.UV); // T7: Wetware - WETWARE_PROCESSOR_LUV = addItem(644, "circuit.wetware_processor").setUnificationData(OrePrefix.circuit, Tier.LuV); - WETWARE_PROCESSOR_ASSEMBLY_ZPM = addItem(645, "circuit.wetware_assembly").setUnificationData(OrePrefix.circuit, Tier.ZPM); - WETWARE_SUPER_COMPUTER_UV = addItem(646, "circuit.wetware_computer").setUnificationData(OrePrefix.circuit, Tier.UV); - WETWARE_MAINFRAME_UHV = addItem(647, "circuit.wetware_mainframe").setUnificationData(OrePrefix.circuit, Tier.UHV); + WETWARE_PROCESSOR_LUV = addItem(644, "circuit.wetware_processor").setUnificationData(OrePrefix.circuit, + Tier.LuV); + WETWARE_PROCESSOR_ASSEMBLY_ZPM = addItem(645, "circuit.wetware_assembly").setUnificationData(OrePrefix.circuit, + Tier.ZPM); + WETWARE_SUPER_COMPUTER_UV = addItem(646, "circuit.wetware_computer").setUnificationData(OrePrefix.circuit, + Tier.UV); + WETWARE_MAINFRAME_UHV = addItem(647, "circuit.wetware_mainframe").setUnificationData(OrePrefix.circuit, + Tier.UHV); // T8: Bioware @@ -850,61 +956,140 @@ public void registerSubItems() { TURBINE_ROTOR = addItem(711, "turbine_rotor").addComponents(new TurbineRotorBehavior()); // Battery Hulls: ID 716-730 - BATTERY_HULL_LV = addItem(717, "battery.hull.lv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M))); // plate - BATTERY_HULL_MV = addItem(718, "battery.hull.mv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 3))); // plate * 3 - BATTERY_HULL_HV = addItem(719, "battery.hull.hv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 9))); // plate * 9 - BATTERY_HULL_SMALL_VANADIUM = addItem(720, "battery.hull.ev").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlueSteel, M * 2))); - BATTERY_HULL_MEDIUM_VANADIUM = addItem(721, "battery.hull.iv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RoseGold, M * 6))); - BATTERY_HULL_LARGE_VANADIUM = addItem(722, "battery.hull.luv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RedSteel, M * 18))); - BATTERY_HULL_MEDIUM_NAQUADRIA = addItem(723, "battery.hull.zpm").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 6))); - BATTERY_HULL_LARGE_NAQUADRIA = addItem(724, "battery.hull.uv").setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Americium, M * 18))); + BATTERY_HULL_LV = addItem(717, "battery.hull.lv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M))); // plate + BATTERY_HULL_MV = addItem(718, "battery.hull.mv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 3))); // plate * 3 + BATTERY_HULL_HV = addItem(719, "battery.hull.hv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BatteryAlloy, M * 9))); // plate * 9 + BATTERY_HULL_SMALL_VANADIUM = addItem(720, "battery.hull.ev") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.BlueSteel, M * 2))); + BATTERY_HULL_MEDIUM_VANADIUM = addItem(721, "battery.hull.iv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RoseGold, M * 6))); + BATTERY_HULL_LARGE_VANADIUM = addItem(722, "battery.hull.luv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.RedSteel, M * 18))); + BATTERY_HULL_MEDIUM_NAQUADRIA = addItem(723, "battery.hull.zpm") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Europium, M * 6))); + BATTERY_HULL_LARGE_NAQUADRIA = addItem(724, "battery.hull.uv") + .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Americium, M * 18))); // Batteries: 731-775 - BATTERY_ULV_TANTALUM = addItem(731, "battery.re.ulv.tantalum").addComponents(ElectricStats.createRechargeableBattery(1000, GTValues.ULV)).setUnificationData(OrePrefix.battery, Tier.ULV).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_ULV_TANTALUM = addItem(731, "battery.re.ulv.tantalum") + .addComponents(ElectricStats.createRechargeableBattery(1000, GTValues.ULV)) + .setUnificationData(OrePrefix.battery, Tier.ULV).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_SODIUM = addItem(732, "battery.re.lv.sodium").addComponents(ElectricStats.createRechargeableBattery(80000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_SODIUM = addItem(733, "battery.re.mv.sodium").addComponents(ElectricStats.createRechargeableBattery(360000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_SODIUM = addItem(734, "battery.re.hv.sodium").addComponents(ElectricStats.createRechargeableBattery(1200000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_SODIUM = addItem(732, "battery.re.lv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(80000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_SODIUM = addItem(733, "battery.re.mv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(360000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_SODIUM = addItem(734, "battery.re.hv.sodium") + .addComponents(ElectricStats.createRechargeableBattery(1200000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_LITHIUM = addItem(735, "battery.re.lv.lithium").addComponents(ElectricStats.createRechargeableBattery(120000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_LITHIUM = addItem(736, "battery.re.mv.lithium").addComponents(ElectricStats.createRechargeableBattery(420000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_LITHIUM = addItem(737, "battery.re.hv.lithium").addComponents(ElectricStats.createRechargeableBattery(1800000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_LITHIUM = addItem(735, "battery.re.lv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(120000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_LITHIUM = addItem(736, "battery.re.mv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(420000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_LITHIUM = addItem(737, "battery.re.hv.lithium") + .addComponents(ElectricStats.createRechargeableBattery(1800000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LV_CADMIUM = addItem(738, "battery.re.lv.cadmium").addComponents(ElectricStats.createRechargeableBattery(100000, GTValues.LV)).setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_MV_CADMIUM = addItem(739, "battery.re.mv.cadmium").addComponents(ElectricStats.createRechargeableBattery(400000, GTValues.MV)).setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_HV_CADMIUM = addItem(740, "battery.re.hv.cadmium").addComponents(ElectricStats.createRechargeableBattery(1600000, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LV_CADMIUM = addItem(738, "battery.re.lv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(100000, GTValues.LV)) + .setUnificationData(OrePrefix.battery, Tier.LV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_MV_CADMIUM = addItem(739, "battery.re.mv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(400000, GTValues.MV)) + .setUnificationData(OrePrefix.battery, Tier.MV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_HV_CADMIUM = addItem(740, "battery.re.hv.cadmium") + .addComponents(ElectricStats.createRechargeableBattery(1600000, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGIUM_CRYSTAL = addItem(741, "energy_crystal").addComponents(ElectricStats.createRechargeableBattery(6_400_000L, GTValues.HV)).setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - LAPOTRON_CRYSTAL = addItem(742, "lapotron_crystal").addComponents(ElectricStats.createRechargeableBattery(25_000_000L, GTValues.EV)).setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGIUM_CRYSTAL = addItem(741, "energy_crystal") + .addComponents(ElectricStats.createRechargeableBattery(6_400_000L, GTValues.HV)) + .setUnificationData(OrePrefix.battery, Tier.HV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + LAPOTRON_CRYSTAL = addItem(742, "lapotron_crystal") + .addComponents(ElectricStats.createRechargeableBattery(25_000_000L, GTValues.EV)) + .setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_EV_VANADIUM = addItem(743, "battery.ev.vanadium").addComponents(ElectricStats.createRechargeableBattery(10_240_000L, GTValues.EV)).setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_IV_VANADIUM = addItem(744, "battery.iv.vanadium").addComponents(ElectricStats.createRechargeableBattery(40_960_000L, GTValues.IV)).setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_LUV_VANADIUM = addItem(745, "battery.luv.vanadium").addComponents(ElectricStats.createRechargeableBattery(163_840_000L, GTValues.LuV)).setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_EV_VANADIUM = addItem(743, "battery.ev.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(10_240_000L, GTValues.EV)) + .setUnificationData(OrePrefix.battery, Tier.EV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_IV_VANADIUM = addItem(744, "battery.iv.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(40_960_000L, GTValues.IV)) + .setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_LUV_VANADIUM = addItem(745, "battery.luv.vanadium") + .addComponents(ElectricStats.createRechargeableBattery(163_840_000L, GTValues.LuV)) + .setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_ZPM_NAQUADRIA = addItem(746, "battery.zpm.naquadria").addComponents(ElectricStats.createRechargeableBattery(655_360_000L, GTValues.ZPM)).setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - BATTERY_UV_NAQUADRIA = addItem(747, "battery.uv.naquadria").addComponents(ElectricStats.createRechargeableBattery(2_621_440_000L, GTValues.UV)).setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_ZPM_NAQUADRIA = addItem(746, "battery.zpm.naquadria") + .addComponents(ElectricStats.createRechargeableBattery(655_360_000L, GTValues.ZPM)) + .setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + BATTERY_UV_NAQUADRIA = addItem(747, "battery.uv.naquadria") + .addComponents(ElectricStats.createRechargeableBattery(2_621_440_000L, GTValues.UV)) + .setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_LAPOTRONIC_ORB = addItem(748, "energy.lapotronic_orb").addComponents(ElectricStats.createRechargeableBattery(250_000_000L, GTValues.IV)).setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_LAPOTRONIC_ORB_CLUSTER = addItem(749, "energy.lapotronic_orb_cluster").addComponents(ElectricStats.createRechargeableBattery(1_000_000_000L, GTValues.LuV)).setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_LAPOTRONIC_ORB = addItem(748, "energy.lapotronic_orb") + .addComponents(ElectricStats.createRechargeableBattery(250_000_000L, GTValues.IV)) + .setUnificationData(OrePrefix.battery, Tier.IV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_LAPOTRONIC_ORB_CLUSTER = addItem(749, "energy.lapotronic_orb_cluster") + .addComponents(ElectricStats.createRechargeableBattery(1_000_000_000L, GTValues.LuV)) + .setUnificationData(OrePrefix.battery, Tier.LuV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_MODULE = addItem(750, "energy.module").addComponents(new IItemComponent[]{ElectricStats.createRechargeableBattery(4_000_000_000L, GTValues.ZPM)}).setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ENERGY_CLUSTER = addItem(751, "energy.cluster").addComponents(new IItemComponent[]{ElectricStats.createRechargeableBattery(20_000_000_000L, GTValues.UV)}).setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_MODULE = addItem(750, "energy.module") + .addComponents( + new IItemComponent[] { ElectricStats.createRechargeableBattery(4_000_000_000L, GTValues.ZPM) }) + .setUnificationData(OrePrefix.battery, Tier.ZPM).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ENERGY_CLUSTER = addItem(751, "energy.cluster") + .addComponents( + new IItemComponent[] { ElectricStats.createRechargeableBattery(20_000_000_000L, GTValues.UV) }) + .setUnificationData(OrePrefix.battery, Tier.UV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ZERO_POINT_MODULE = addItem(752, "zpm").addComponents(ElectricStats.createBattery(2000000000000L, GTValues.ZPM, true)).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); - ULTIMATE_BATTERY = addItem(753, "max.battery").addComponents(ElectricStats.createRechargeableBattery(Long.MAX_VALUE, GTValues.UHV)).setUnificationData(OrePrefix.battery, Tier.UHV).setModelAmount(8).setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ZERO_POINT_MODULE = addItem(752, "zpm") + .addComponents(ElectricStats.createBattery(2000000000000L, GTValues.ZPM, true)).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); + ULTIMATE_BATTERY = addItem(753, "max.battery") + .addComponents(ElectricStats.createRechargeableBattery(Long.MAX_VALUE, GTValues.UHV)) + .setUnificationData(OrePrefix.battery, Tier.UHV).setModelAmount(8) + .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); POWER_THRUSTER = addItem(776, "power_thruster").setRarity(EnumRarity.UNCOMMON); POWER_THRUSTER_ADVANCED = addItem(777, "power_thruster_advanced").setRarity(EnumRarity.RARE); GRAVITATION_ENGINE = addItem(778, "gravitation_engine").setRarity(EnumRarity.EPIC); // Plugins: 780-799 - PLUGIN_ADVANCED_MONITOR = addItem(780, "plugin.advanced_monitor").addComponents(new AdvancedMonitorPluginBehavior()); + PLUGIN_ADVANCED_MONITOR = addItem(780, "plugin.advanced_monitor") + .addComponents(new AdvancedMonitorPluginBehavior()); PLUGIN_FAKE_GUI = addItem(781, "plugin.fake_gui").addComponents(new FakeGuiPluginBehavior()); PLUGIN_ONLINE_PIC = addItem(782, "plugin.online_pic").addComponents(new OnlinePicPluginBehavior()); PLUGIN_TEXT = addItem(783, "plugin.text").addComponents(new TextPluginBehavior()); // Records: 800-819 - SUS_RECORD = addItem(800, "record.sus").addComponents(new MusicDiscStats(GTSoundEvents.SUS_RECORD)).setRarity(EnumRarity.RARE).setMaxStackSize(1).setInvisible(); + SUS_RECORD = addItem(800, "record.sus").addComponents(new MusicDiscStats(GTSoundEvents.SUS_RECORD)) + .setRarity(EnumRarity.RARE).setMaxStackSize(1).setInvisible(); // Dyed Glass Lenses: 820-840 for (int i = 0; i < MarkerMaterials.Color.VALUES.length; i++) { @@ -922,6 +1107,7 @@ public void registerSubItems() { LOGO = addItem(1003, "logo").setInvisible(); LOGO.getMetaItem().addPropertyOverride(new ResourceLocation("xmas"), (s, w, e) -> GTValues.XMAS.get() ? 1 : 0); - MULTIBLOCK_BUILDER = addItem(1004, "tool.multiblock_builder").addComponents(new MultiblockBuilderBehavior()).setMaxStackSize(1); + MULTIBLOCK_BUILDER = addItem(1004, "tool.multiblock_builder").addComponents(new MultiblockBuilderBehavior()) + .setMaxStackSize(1); } } diff --git a/src/main/java/gregtech/common/items/MetaItems.java b/src/main/java/gregtech/common/items/MetaItems.java index f8a1f518a90..303588e6dc8 100644 --- a/src/main/java/gregtech/common/items/MetaItems.java +++ b/src/main/java/gregtech/common/items/MetaItems.java @@ -1,6 +1,5 @@ package gregtech.common.items; -import com.google.common.base.CaseFormat; import gregtech.api.GregTechAPI; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.materialitem.MetaPrefixItem; @@ -13,6 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.handler.FacadeRenderer; import gregtech.common.items.armor.MetaArmor; + import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.EnumDyeColor; @@ -23,12 +23,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import com.google.common.base.CaseFormat; + import java.util.*; public final class MetaItems { - private MetaItems() { - } + private MetaItems() {} public static final List> ITEMS = MetaItem.getMetaItems(); @@ -459,7 +460,6 @@ private MetaItems() { public static MetaItem.MetaValueItem COVER_SOLAR_PANEL_ZPM; public static MetaItem.MetaValueItem COVER_SOLAR_PANEL_UV; - public static MetaItem.MetaValueItem PLUGIN_TEXT; public static MetaItem.MetaValueItem PLUGIN_ONLINE_PIC; public static MetaItem.MetaValueItem PLUGIN_FAKE_GUI; @@ -504,8 +504,10 @@ private MetaItems() { public static MetaItem.MetaValueItem CAMERA; public static MetaItem.MetaValueItem TERMINAL; - public static final MetaItem.MetaValueItem[] DYE_ONLY_ITEMS = new MetaItem.MetaValueItem[EnumDyeColor.values().length]; - public static final MetaItem.MetaValueItem[] SPRAY_CAN_DYES = new MetaItem.MetaValueItem[EnumDyeColor.values().length]; + public static final MetaItem.MetaValueItem[] DYE_ONLY_ITEMS = new MetaItem.MetaValueItem[EnumDyeColor + .values().length]; + public static final MetaItem.MetaValueItem[] SPRAY_CAN_DYES = new MetaItem.MetaValueItem[EnumDyeColor + .values().length]; public static MetaItem.MetaValueItem TURBINE_ROTOR; @@ -630,7 +632,8 @@ public static void registerOreDict() { // Register "craftingLensWhite" for example OreDictUnifier.registerOre(entry.getValue().getStackForm(), OrePrefix.craftingLens, entry.getKey()); // Register "craftingLensGlass", intended only for recipes to dye lenses and not in the Engraver - OreDictUnifier.registerOre(entry.getValue().getStackForm(), String.format("%s%s", OrePrefix.craftingLens.name(), "Glass")); + OreDictUnifier.registerOre(entry.getValue().getStackForm(), + String.format("%s%s", OrePrefix.craftingLens.name(), "Glass")); } } @@ -658,9 +661,10 @@ public static void registerBakedModels(ModelBakeEvent event) { } @SideOnly(Side.CLIENT) - @SuppressWarnings({"unchecked", "rawtypes"}) - private static void registerSpecialItemModel(ModelBakeEvent event, MetaValueItem metaValueItem, IBakedModel bakedModel) { - //noinspection RedundantCast + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static void registerSpecialItemModel(ModelBakeEvent event, MetaValueItem metaValueItem, + IBakedModel bakedModel) { + // noinspection RedundantCast ResourceLocation modelPath = ((MetaItem) metaValueItem.getMetaItem()).createItemModelPath(metaValueItem, ""); ModelResourceLocation modelResourceLocation = new ModelResourceLocation(modelPath, "inventory"); event.getModelRegistry().putObject(modelResourceLocation, bakedModel); diff --git a/src/main/java/gregtech/common/items/ToolItems.java b/src/main/java/gregtech/common/items/ToolItems.java index f70516fd7ac..f967aefd6e4 100644 --- a/src/main/java/gregtech/common/items/ToolItems.java +++ b/src/main/java/gregtech/common/items/ToolItems.java @@ -6,6 +6,7 @@ import gregtech.api.unification.material.Materials; import gregtech.common.items.tool.*; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.entity.monster.EntityGolem; @@ -15,10 +16,11 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public final class ToolItems { private static final List TOOLS = new ArrayList<>(); @@ -180,7 +182,8 @@ public static void init() { .toolStats(b -> b.blockBreaking().attacking() .attackDamage(5.0F).attackSpeed(-3.0F).durabilityMultiplier(3.0F) .aoe(2, 2, 2) - .behaviors(HoeGroundBehavior.INSTANCE, HarvestCropsBehavior.INSTANCE).canApplyEnchantment(EnumEnchantmentType.DIGGER)) + .behaviors(HoeGroundBehavior.INSTANCE, HarvestCropsBehavior.INSTANCE) + .canApplyEnchantment(EnumEnchantmentType.DIGGER)) .oreDict(ToolOreDict.toolScythe) .toolClasses(ToolClasses.SCYTHE, ToolClasses.HOE)); KNIFE = register(ItemGTSword.Builder.of(GTValues.MODID, "knife") @@ -250,7 +253,8 @@ public static void init() { .efficiencyMultiplier(2.0F) .attackDamage(5.0F).attackSpeed(-3.2F) .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) - .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, TreeFellingBehavior.INSTANCE)) + .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, + TreeFellingBehavior.INSTANCE)) .oreDict(ToolOreDict.toolAxe) .secondaryOreDicts(ToolOreDict.toolChainsaw) .sound(GTSoundEvents.CHAINSAW_TOOL, true) @@ -333,7 +337,8 @@ public static void registerModels() { } public static void registerColors() { - TOOLS.forEach(tool -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(tool::getColor, tool.get())); + TOOLS.forEach( + tool -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(tool::getColor, tool.get())); } public static void registerOreDict() { diff --git a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java index 4e8ad7a490f..ff3634b2110 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java @@ -1,10 +1,10 @@ package gregtech.common.items.armor; - import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; @@ -25,7 +25,7 @@ public AdvancedJetpack(int energyPerUse, long capacity, int tier) { @Override public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack item) { IElectricItem cont = item.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - if(cont == null) { + if (cont == null) { return; } NBTTagCompound data = GTUtility.getOrCreateNbtCompound(item); @@ -103,4 +103,3 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo return "gregtech:textures/armor/advanced_jetpack.png"; } } - diff --git a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java index 56d82e6a674..fae06b7281f 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -17,14 +18,17 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class AdvancedNanoMuscleSuite extends NanoMuscleSuite implements IJetpack { - //A replacement for checking the current world time, to get around the gamerule that stops it + + // A replacement for checking the current world time, to get around the gamerule that stops it private long timer = 0L; private List, List>> inventoryIndexMap; @@ -88,7 +92,8 @@ else if (canShare) Iterator inventoryIterator = inventoryMap.getValue().iterator(); while (inventoryIterator.hasNext()) { int slot = inventoryIterator.next(); - IElectricItem chargable = inventoryMap.getKey().get(slot).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem chargable = inventoryMap.getKey().get(slot) + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); // Safety check the null, it should not actually happen. Also don't try and charge itself if (chargable == null || chargable == cont) { @@ -99,7 +104,8 @@ else if (canShare) long attemptedChargeAmount = chargable.getTransferLimit() * 10; // Accounts for tick differences when charging items - if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && timer % 10 == 0) { + if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && + timer % 10 == 0) { long delta = chargable.charge(attemptedChargeAmount, cont.getTier(), true, false); if (delta > 0) { cont.discharge(delta, cont.getTier(), true, false, false); @@ -134,7 +140,8 @@ public void addInfo(ItemStack itemStack, List lines) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); String state; if (data.hasKey("canShare")) { - state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled"); + state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled"); } else { state = I18n.format("metaarmor.hud.status.disabled"); } @@ -157,7 +164,8 @@ public ActionResult onRightClick(World world, @Nonnull EntityPlayer p if (armor.getItem() instanceof ArmorMetaItem && player.isSneaking()) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(player.getHeldItem(hand)); boolean canShare = data.hasKey("canShare") && data.getBoolean("canShare"); - IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (cont == null) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); } @@ -191,12 +199,14 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("canShare")) { - String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("mataarmor.hud.supply_mode", I18n.format(status))); } if (data.hasKey("hover")) { - String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("metaarmor.hud.hover_mode", I18n.format(status))); } } diff --git a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java index aa144febe60..755a1802b59 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -19,14 +20,17 @@ import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class AdvancedQuarkTechSuite extends QuarkTechSuite implements IJetpack { - //A replacement for checking the current world time, to get around the gamerule that stops it + + // A replacement for checking the current world time, to get around the gamerule that stops it private long timer = 0L; private List, List>> inventoryIndexMap; @@ -93,7 +97,8 @@ else if (canShare) Iterator inventoryIterator = inventoryMap.getValue().iterator(); while (inventoryIterator.hasNext()) { int slot = inventoryIterator.next(); - IElectricItem chargable = inventoryMap.getKey().get(slot).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem chargable = inventoryMap.getKey().get(slot) + .getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); // Safety check the null, it should not actually happen. Also don't try and charge itself if (chargable == null || chargable == cont) { @@ -104,7 +109,8 @@ else if (canShare) long attemptedChargeAmount = chargable.getTransferLimit() * 10; // Accounts for tick differences when charging items - if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && timer % 10 == 0) { + if (chargable.getCharge() < chargable.getMaxCharge() && cont.canUse(attemptedChargeAmount) && + timer % 10 == 0) { long delta = chargable.charge(attemptedChargeAmount, cont.getTier(), true, false); if (delta > 0) { cont.discharge(delta, cont.getTier(), true, false, false); @@ -139,7 +145,8 @@ public void addInfo(ItemStack itemStack, List lines) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); String state; if (data.hasKey("canShare")) { - state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled"); + state = data.getBoolean("canShare") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled"); } else { state = I18n.format("metaarmor.hud.status.disabled"); } @@ -159,7 +166,8 @@ public ActionResult onRightClick(World world, EntityPlayer player, En if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem && player.isSneaking()) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(player.getHeldItem(hand)); boolean canShare = data.hasKey("canShare") && data.getBoolean("canShare"); - IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem cont = player.getHeldItem(hand).getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (cont == null) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); } @@ -193,12 +201,14 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("canShare")) { - String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("canShare") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("mataarmor.hud.supply_mode", I18n.format(status))); } if (data.hasKey("hover")) { - String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : "metaarmor.hud.status.disabled"; + String status = data.getBoolean("hover") ? "metaarmor.hud.status.enabled" : + "metaarmor.hud.status.disabled"; this.HUD.newString(I18n.format("metaarmor.hud.hover_mode", I18n.format(status))); } } @@ -207,7 +217,8 @@ public void drawHUD(ItemStack item) { } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { @@ -220,7 +231,8 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE; } diff --git a/src/main/java/gregtech/common/items/armor/IJetpack.java b/src/main/java/gregtech/common/items/armor/IJetpack.java index 43bc6c58c96..eeb33f98260 100644 --- a/src/main/java/gregtech/common/items/armor/IJetpack.java +++ b/src/main/java/gregtech/common/items/armor/IJetpack.java @@ -2,15 +2,16 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.input.KeyBind; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import javax.annotation.Nonnull; - /** - * Logic from SimplyJetpacks2: https://github.com/Tomson124/SimplyJetpacks2/blob/1.12/src/main/java/tonius/simplyjetpacks/item/ItemJetpack.java + * Logic from SimplyJetpacks2: + * https://github.com/Tomson124/SimplyJetpacks2/blob/1.12/src/main/java/tonius/simplyjetpacks/item/ItemJetpack.java */ public interface IJetpack { @@ -66,14 +67,16 @@ default void performFlying(@Nonnull EntityPlayer player, boolean hover, ItemStac if (!player.isInWater() && !player.isInLava() && canUseEnergy(stack, getEnergyPerUse())) { if (flyKeyDown || hover && !player.onGround) { - drainEnergy(stack, (int) (player.isSprinting() ? Math.round(getEnergyPerUse() * getSprintEnergyModifier()) : getEnergyPerUse())); + drainEnergy(stack, (int) (player.isSprinting() ? + Math.round(getEnergyPerUse() * getSprintEnergyModifier()) : getEnergyPerUse())); if (hasEnergy(stack)) { if (flyKeyDown) { if (!hover) { player.motionY = Math.min(player.motionY + currentAccel, currentSpeedVertical); } else { - if (descendKeyDown) player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSlowSpeed()); + if (descendKeyDown) + player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSlowSpeed()); else player.motionY = Math.min(player.motionY + currentAccel, getVerticalHoverSpeed()); } } else if (descendKeyDown) { @@ -81,8 +84,10 @@ default void performFlying(@Nonnull EntityPlayer player, boolean hover, ItemStac } else { player.motionY = Math.min(player.motionY + currentAccel, -getVerticalHoverSlowSpeed()); } - float speedSideways = (float) (player.isSneaking() ? getSidewaysSpeed() * 0.5f : getSidewaysSpeed()); - float speedForward = (float) (player.isSprinting() ? speedSideways * getSprintSpeedModifier() : speedSideways); + float speedSideways = (float) (player.isSneaking() ? getSidewaysSpeed() * 0.5f : + getSidewaysSpeed()); + float speedForward = (float) (player.isSprinting() ? speedSideways * getSprintSpeedModifier() : + speedSideways); if (KeyBind.VANILLA_FORWARD.isKeyDown(player)) player.moveRelative(0, 0, speedForward, speedForward); diff --git a/src/main/java/gregtech/common/items/armor/IStepAssist.java b/src/main/java/gregtech/common/items/armor/IStepAssist.java index e59b2ceb5f3..9b4f57f9604 100644 --- a/src/main/java/gregtech/common/items/armor/IStepAssist.java +++ b/src/main/java/gregtech/common/items/armor/IStepAssist.java @@ -5,7 +5,8 @@ import javax.annotation.Nonnull; /** - * Logic from EnderIO: https://github.com/SleepyTrousers/EnderIO/blob/d6dfb9d3964946ceb9fd72a66a3cff197a51a1fe/enderio-base/src/main/java/crazypants/enderio/base/handler/darksteel/DarkSteelController.java + * Logic from EnderIO: + * https://github.com/SleepyTrousers/EnderIO/blob/d6dfb9d3964946ceb9fd72a66a3cff197a51a1fe/enderio-base/src/main/java/crazypants/enderio/base/handler/darksteel/DarkSteelController.java */ public interface IStepAssist { diff --git a/src/main/java/gregtech/common/items/armor/Jetpack.java b/src/main/java/gregtech/common/items/armor/Jetpack.java index 7d9a6eb90d5..de30fdda203 100644 --- a/src/main/java/gregtech/common/items/armor/Jetpack.java +++ b/src/main/java/gregtech/common/items/armor/Jetpack.java @@ -6,6 +6,7 @@ import gregtech.api.items.armor.ArmorUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -21,9 +22,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class Jetpack extends ArmorLogicSuite implements IJetpack { @SideOnly(Side.CLIENT) @@ -32,7 +34,7 @@ public class Jetpack extends ArmorLogicSuite implements IJetpack { public Jetpack(int energyPerUse, long capacity, int tier) { super(energyPerUse, capacity, tier, EntityEquipmentSlot.CHEST); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -100,7 +102,8 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return new ArmorProperties(0, 0, 0); } @@ -111,7 +114,8 @@ public void drawHUD(ItemStack item) { NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("hover")) { - String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled")); + String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled")); String result = I18n.format("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } diff --git a/src/main/java/gregtech/common/items/armor/MetaArmor.java b/src/main/java/gregtech/common/items/armor/MetaArmor.java index e3bf768a73f..1d53bbca1c9 100644 --- a/src/main/java/gregtech/common/items/armor/MetaArmor.java +++ b/src/main/java/gregtech/common/items/armor/MetaArmor.java @@ -3,6 +3,7 @@ import gregtech.api.items.armor.ArmorMetaItem; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; @@ -10,28 +11,61 @@ public class MetaArmor extends ArmorMetaItem.ArmorMetaValueItem @Override public void registerSubItems() { - MetaItems.NIGHTVISION_GOGGLES = addItem(1, "nightvision_goggles").setArmorLogic(new NightvisionGoggles(2, 80_000L * (long) Math.max(1, Math.pow(1, ConfigHolder.tools.voltageTierNightVision - 1)), ConfigHolder.tools.voltageTierNightVision, EntityEquipmentSlot.HEAD)); + MetaItems.NIGHTVISION_GOGGLES = addItem(1, "nightvision_goggles").setArmorLogic(new NightvisionGoggles(2, + 80_000L * (long) Math.max(1, Math.pow(1, ConfigHolder.tools.voltageTierNightVision - 1)), + ConfigHolder.tools.voltageTierNightVision, EntityEquipmentSlot.HEAD)); MetaItems.SEMIFLUID_JETPACK = addItem(2, "liquid_fuel_jetpack").setArmorLogic(new PowerlessJetpack()); - MetaItems.ELECTRIC_JETPACK = addItem(3, "electric_jetpack").setArmorLogic(new Jetpack(30, 1_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierImpeller - 2)), ConfigHolder.tools.voltageTierImpeller)).setModelAmount(8).setRarity(EnumRarity.UNCOMMON); - MetaItems.ELECTRIC_JETPACK_ADVANCED = addItem(4, "advanced_electric_jetpack").setArmorLogic(new AdvancedJetpack(512, 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvImpeller - 4)), ConfigHolder.tools.voltageTierAdvImpeller)).setRarity(EnumRarity.RARE); + MetaItems.ELECTRIC_JETPACK = addItem(3, "electric_jetpack").setArmorLogic(new Jetpack(30, + 1_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierImpeller - 2)), + ConfigHolder.tools.voltageTierImpeller)).setModelAmount(8).setRarity(EnumRarity.UNCOMMON); + MetaItems.ELECTRIC_JETPACK_ADVANCED = addItem(4, "advanced_electric_jetpack") + .setArmorLogic(new AdvancedJetpack(512, + 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvImpeller - 4)), + ConfigHolder.tools.voltageTierAdvImpeller)) + .setRarity(EnumRarity.RARE); int energyPerUse = 512; int tier = ConfigHolder.tools.voltageTierNanoSuit; long maxCapacity = 6_400_000L * (long) Math.max(1, Math.pow(4, tier - 3)); - MetaItems.NANO_HELMET = addItem(20, "nms.helmet").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_CHESTPLATE = addItem(21, "nms.chestplate").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_LEGGINGS = addItem(22, "nms.leggings").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_BOOTS = addItem(23, "nms.boots").setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.UNCOMMON); - MetaItems.NANO_CHESTPLATE_ADVANCED = addItem(30, "nms.advanced_chestplate").setArmorLogic(new AdvancedNanoMuscleSuite(energyPerUse, 12_800_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvNanoSuit - 3)), ConfigHolder.tools.voltageTierAdvNanoSuit)).setRarity(EnumRarity.RARE); + MetaItems.NANO_HELMET = addItem(20, "nms.helmet") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_CHESTPLATE = addItem(21, "nms.chestplate") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_LEGGINGS = addItem(22, "nms.leggings") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_BOOTS = addItem(23, "nms.boots") + .setArmorLogic(new NanoMuscleSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.UNCOMMON); + MetaItems.NANO_CHESTPLATE_ADVANCED = addItem(30, "nms.advanced_chestplate") + .setArmorLogic(new AdvancedNanoMuscleSuite(energyPerUse, + 12_800_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvNanoSuit - 3)), + ConfigHolder.tools.voltageTierAdvNanoSuit)) + .setRarity(EnumRarity.RARE); energyPerUse = 8192; tier = ConfigHolder.tools.voltageTierQuarkTech; maxCapacity = 100_000_000L * (long) Math.max(1, Math.pow(4, tier - 5)); - MetaItems.QUANTUM_HELMET = addItem(40, "qts.helmet").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_CHESTPLATE = addItem(41, "qts.chestplate").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_LEGGINGS = addItem(42, "qts.leggings").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_BOOTS = addItem(43, "qts.boots").setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)).setRarity(EnumRarity.RARE); - MetaItems.QUANTUM_CHESTPLATE_ADVANCED = addItem(50, "qts.advanced_chestplate").setArmorLogic(new AdvancedQuarkTechSuite(energyPerUse, 1_000_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvQuarkTech - 6)), ConfigHolder.tools.voltageTierAdvQuarkTech)).setRarity(EnumRarity.EPIC); + MetaItems.QUANTUM_HELMET = addItem(40, "qts.helmet") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.HEAD, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_CHESTPLATE = addItem(41, "qts.chestplate") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.CHEST, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_LEGGINGS = addItem(42, "qts.leggings") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.LEGS, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_BOOTS = addItem(43, "qts.boots") + .setArmorLogic(new QuarkTechSuite(EntityEquipmentSlot.FEET, energyPerUse, maxCapacity, tier)) + .setRarity(EnumRarity.RARE); + MetaItems.QUANTUM_CHESTPLATE_ADVANCED = addItem(50, "qts.advanced_chestplate") + .setArmorLogic(new AdvancedQuarkTechSuite(energyPerUse, + 1_000_000_000L * + (long) Math.max(1, Math.pow(4, ConfigHolder.tools.voltageTierAdvQuarkTech - 6)), + ConfigHolder.tools.voltageTierAdvQuarkTech)) + .setRarity(EnumRarity.EPIC); } } diff --git a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java index f077020f26d..a0c0f48d769 100644 --- a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java @@ -7,6 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; import gregtech.common.items.MetaItems; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; @@ -24,9 +25,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { @SideOnly(Side.CLIENT) @@ -35,7 +37,7 @@ public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { public NanoMuscleSuite(EntityEquipmentSlot slot, int energyPerUse, long maxCapacity, int tier) { super(energyPerUse, maxCapacity, tier, slot); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -55,7 +57,8 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack ite if (!nightvision && item.getCharge() >= 4) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); @@ -89,16 +92,19 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack ite public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.nms.nightvision.disabled"), true); } } - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { return source == DamageSource.FALL; } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { IElectricItem container = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); int damageLimit = Integer.MAX_VALUE; if (source == DamageSource.FALL && this.getEquipmentSlot(armor) == EntityEquipmentSlot.FEET) { @@ -116,7 +122,8 @@ public EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack) { } @Override - public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) { + public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, + EntityEquipmentSlot equipmentSlot) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item != null) { item.discharge((long) energyPerUse / 10 * damage, item.getTier(), true, false, false); @@ -125,7 +132,8 @@ public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSour @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { - ItemStack currentChest = Minecraft.getMinecraft().player.inventory.armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); + ItemStack currentChest = Minecraft.getMinecraft().player.inventory + .armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); ItemStack advancedChest = MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(); String armorTexture = "nano_muscule_suite"; if (advancedChest.isItemEqual(currentChest)) armorTexture = "advanced_nano_muscle_suite"; diff --git a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java index f0619660f70..73597d10a39 100644 --- a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java +++ b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java @@ -5,6 +5,7 @@ import gregtech.api.items.armor.ArmorLogicSuite; import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -16,9 +17,10 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class NightvisionGoggles extends ArmorLogicSuite { public NightvisionGoggles(int energyPerUse, long capacity, int voltageTier, EntityEquipmentSlot slot) { @@ -43,13 +45,15 @@ public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull Item if (!nightvision && item.getCharge() >= energyPerUse) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); } else { if (!world.isRemote) { - player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.error"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.error"), + true); } } @@ -74,7 +78,8 @@ public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull Item public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.message.nightvision.disabled"), true); } } diff --git a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java index 3ef025028f2..51c089dece1 100644 --- a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java +++ b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java @@ -13,6 +13,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.GradientUtil; import gregtech.api.util.input.KeyBind; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -32,15 +33,17 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Objects; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class PowerlessJetpack implements ISpecialArmorLogic, IJetpack, IItemHUDProvider { public static final int tankCapacity = 16000; @@ -54,13 +57,14 @@ public class PowerlessJetpack implements ISpecialArmorLogic, IJetpack, IItemHUDP public PowerlessJetpack() { if (ArmorUtils.SIDE.isClient()) - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } @Override public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack stack) { - IFluidHandlerItem internalTank = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem internalTank = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (internalTank == null) return; @@ -98,7 +102,6 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack sta data.setShort("burnTimer", (short) burnTimer); data.setByte("toggleTimer", toggleTimer); player.inventoryContainer.detectAndSendChanges(); - } @Override @@ -125,13 +128,15 @@ public void drawHUD(@Nonnull ItemStack item) { if (prop[0] != null) { if (prop[0].getContents() != null) { if (prop[0].getContents().amount == 0) return; - String formated = String.format("%.1f", (prop[0].getContents().amount * 100.0F / prop[0].getCapacity())); + String formated = String.format("%.1f", + (prop[0].getContents().amount * 100.0F / prop[0].getCapacity())); this.HUD.newString(I18n.format("metaarmor.hud.fuel_lvl", formated + "%")); NBTTagCompound data = item.getTagCompound(); if (data != null) { if (data.hasKey("hover")) { - String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : I18n.format("metaarmor.hud.status.disabled")); + String status = (data.getBoolean("hover") ? I18n.format("metaarmor.hud.status.enabled") : + I18n.format("metaarmor.hud.status.disabled")); String result = I18n.format("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } @@ -190,11 +195,14 @@ public void findNewRecipe(@Nonnull ItemStack stack) { IFluidHandlerItem internalTank = getIFluidHandlerItem(stack); if (internalTank != null) { FluidStack fluidStack = internalTank.drain(1, false); - if (previousRecipe != null && fluidStack != null && fluidStack.isFluidEqual(previousRecipe.getFluidInputs().get(0).getInputFluidStack()) && fluidStack.amount > 0) { + if (previousRecipe != null && fluidStack != null && + fluidStack.isFluidEqual(previousRecipe.getFluidInputs().get(0).getInputFluidStack()) && + fluidStack.amount > 0) { currentRecipe = previousRecipe; return; } else if (fluidStack != null) { - Recipe recipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), Collections.singletonList(fluidStack), (Objects::nonNull)); + Recipe recipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), + Collections.singletonList(fluidStack), (Objects::nonNull)); if (recipe != null) { previousRecipe = recipe; currentRecipe = previousRecipe; @@ -221,8 +229,10 @@ public FluidStack getFuel() { public ActionResult onRightClick(World world, EntityPlayer player, EnumHand hand) { if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem) { ItemStack armor = player.getHeldItem(hand); - if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory.get(getEquipmentSlot(player.getHeldItem(hand)).getIndex()).isEmpty() && !player.isSneaking()) { - player.inventory.armorInventory.set(getEquipmentSlot(player.getHeldItem(hand)).getIndex(), armor.copy()); + if (armor.getItem() instanceof ArmorMetaItem && player.inventory.armorInventory + .get(getEquipmentSlot(player.getHeldItem(hand)).getIndex()).isEmpty() && !player.isSneaking()) { + player.inventory.armorInventory.set(getEquipmentSlot(player.getHeldItem(hand)).getIndex(), + armor.copy()); player.setHeldItem(hand, ItemStack.EMPTY); player.playSound(new SoundEvent(new ResourceLocation("item.armor.equip_generic")), 1.0F, 1.0F); return ActionResult.newResult(EnumActionResult.SUCCESS, armor); @@ -233,7 +243,9 @@ public ActionResult onRightClick(World world, EntityPlayer player, En } @Override - public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, @Nonnull DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, + @Nonnull DamageSource source, double damage, + EntityEquipmentSlot equipmentSlot) { int damageLimit = (int) Math.min(Integer.MAX_VALUE, burnTimer * 1.0 / 32 * 25.0); if (source.isUnblockable()) return new ISpecialArmor.ArmorProperties(0, 0.0, 0); return new ISpecialArmor.ArmorProperties(0, 0, damageLimit); @@ -247,9 +259,11 @@ public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int sl public class Behaviour implements IItemDurabilityManager, IItemCapabilityProvider, IItemBehaviour, ISubItemHandler { private static final IFilter JETPACK_FUEL_FILTER = new IFilter<>() { + @Override public boolean test(@Nonnull FluidStack fluidStack) { - return RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), Collections.singletonList(fluidStack), (Objects::nonNull)) != null; + return RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), + Collections.singletonList(fluidStack), (Objects::nonNull)) != null; } @Override @@ -268,7 +282,8 @@ public Behaviour(int internalCapacity) { @Override public double getDurabilityForDisplay(@Nonnull ItemStack itemStack) { - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; IFluidTankProperties fluidTankProperties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = fluidTankProperties.getContents(); @@ -312,7 +327,8 @@ public String getItemSubType(ItemStack itemStack) { @Override public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems) { ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.Diesel.getFluid(tankCapacity), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java index 682899fed7b..93b914363ce 100644 --- a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java @@ -7,6 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.input.KeyBind; import gregtech.common.items.MetaItems; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; @@ -28,12 +29,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.IdentityHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + public class QuarkTechSuite extends ArmorLogicSuite implements IStepAssist { protected static final Map potionRemovalCost = new IdentityHashMap<>(); @@ -47,7 +49,7 @@ public QuarkTechSuite(EntityEquipmentSlot slot, int energyPerUse, long capacity, potionRemovalCost.put(MobEffects.POISON, 10000); potionRemovalCost.put(MobEffects.WITHER, 25000); if (ArmorUtils.SIDE.isClient() && this.shouldDrawHUD()) { - //noinspection NewExpressionSideOnly + // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } } @@ -61,12 +63,15 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(itemStack); byte toggleTimer = data.hasKey("toggleTimer") ? data.getByte("toggleTimer") : 0; - if (!player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isItemEqual(MetaItems.QUANTUM_HELMET.getStackForm())) { + if (!player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) + .isItemEqual(MetaItems.QUANTUM_HELMET.getStackForm())) { disableNightVision(world, player, false); - } else if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isItemEqual(MetaItems.QUANTUM_CHESTPLATE.getStackForm()) && - !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isItemEqual(MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm())) { - if (!world.isRemote) player.isImmuneToFire = false; - } + } else if (!player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) + .isItemEqual(MetaItems.QUANTUM_CHESTPLATE.getStackForm()) && + !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) + .isItemEqual(MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm())) { + if (!world.isRemote) player.isImmuneToFire = false; + } boolean ret = false; if (SLOT == EntityEquipmentSlot.HEAD) { @@ -119,7 +124,8 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (!nightvision && item.getCharge() >= 4) { nightvision = true; if (!world.isRemote) - player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.enabled"), true); + player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); @@ -149,7 +155,8 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (player.isBurning()) player.extinguish(); } else if (SLOT == EntityEquipmentSlot.LEGS) { - if (item.canUse(energyPerUse / 100) && (player.onGround || player.isInWater()) && KeyBind.VANILLA_FORWARD.isKeyDown(player) && (player.isSprinting())) { + if (item.canUse(energyPerUse / 100) && (player.onGround || player.isInWater()) && + KeyBind.VANILLA_FORWARD.isKeyDown(player) && (player.isSprinting())) { byte consumerTicks = data.getByte("consumerTicks"); ++consumerTicks; if (consumerTicks >= 10) { @@ -166,21 +173,23 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { } } player.moveRelative(0.0F, 0.0F, 1.0F, speed); - } else if (item.canUse(energyPerUse / 100) && player.isInWater() && KeyBind.VANILLA_SNEAK.isKeyDown(player) || KeyBind.VANILLA_JUMP.isKeyDown(player)) { - byte consumerTicks = data.getByte("consumerTicks"); - ++consumerTicks; - if (consumerTicks >= 10) { - consumerTicks = 0; - item.discharge(energyPerUse / 100, item.getTier(), true, false, false); - ret = true; - } - data.setByte("consumerTicks", consumerTicks); - double acceleration = 0.085D; - if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) - player.motionY -= acceleration; - if (KeyBind.VANILLA_JUMP.isKeyDown(player)) - player.motionY += acceleration; - } + } else + if (item.canUse(energyPerUse / 100) && player.isInWater() && KeyBind.VANILLA_SNEAK.isKeyDown(player) || + KeyBind.VANILLA_JUMP.isKeyDown(player)) { + byte consumerTicks = data.getByte("consumerTicks"); + ++consumerTicks; + if (consumerTicks >= 10) { + consumerTicks = 0; + item.discharge(energyPerUse / 100, item.getTier(), true, false, false); + ret = true; + } + data.setByte("consumerTicks", consumerTicks); + double acceleration = 0.085D; + if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) + player.motionY -= acceleration; + if (KeyBind.VANILLA_JUMP.isKeyDown(player)) + player.motionY += acceleration; + } } else if (SLOT == EntityEquipmentSlot.FEET) { if (!world.isRemote) { boolean onGround = !data.hasKey("onGround") || data.getBoolean("onGround"); @@ -222,12 +231,14 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.disabled"), true); + if (sendMsg) + player.sendStatusMessage(new TextComponentTranslation("metaarmor.qts.nightvision.disabled"), true); } } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { + public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { @@ -250,12 +261,15 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { - return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && source != DamageSource.OUT_OF_WORLD; + public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + double damage, EntityEquipmentSlot equipmentSlot) { + return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && + source != DamageSource.OUT_OF_WORLD; } @Override - public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) { + public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, DamageSource source, int damage, + EntityEquipmentSlot equipmentSlot) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { return; @@ -265,7 +279,8 @@ public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, D @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { - ItemStack currentChest = Minecraft.getMinecraft().player.inventory.armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); + ItemStack currentChest = Minecraft.getMinecraft().player.inventory + .armorItemInSlot(EntityEquipmentSlot.CHEST.getIndex()); ItemStack advancedChest = MetaItems.QUANTUM_CHESTPLATE_ADVANCED.getStackForm(); String armorTexture = "quark_tech_suite"; if (advancedChest.isItemEqual(currentChest)) armorTexture = "advanced_quark_tech_suite"; diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java index 1dfc3d10f62..9e110edccb3 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java @@ -9,15 +9,18 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.LocalizationUtils; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nonnull; import java.util.List; -public abstract class AbstractMaterialPartBehavior implements IItemBehaviour, IItemDurabilityManager, IItemColorProvider, IItemNameProvider { +import javax.annotation.Nonnull; + +public abstract class AbstractMaterialPartBehavior implements IItemBehaviour, IItemDurabilityManager, + IItemColorProvider, IItemNameProvider { protected static NBTTagCompound getPartStatsTag(ItemStack itemStack) { return itemStack.getSubCompound("GT.PartStats"); diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java b/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java index 441b8565e5e..1b7528c0c59 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractUsableBehaviour.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,10 +21,10 @@ public boolean useItemDurability(EntityPlayer player, EnumHand hand, ItemStack s if (!player.capabilities.isCreativeMode) { if (--usesLeft <= 0) { if (replacementStack.isEmpty()) { - //if replacement stack is empty, just shrink resulting stack + // if replacement stack is empty, just shrink resulting stack stack.shrink(1); } else { - //otherwise, update held item to replacement stack + // otherwise, update held item to replacement stack player.setHeldItem(hand, replacementStack); } return true; @@ -48,5 +49,4 @@ public static void setUsesLeft(ItemStack itemStack, int usesLeft) { } tagCompound.setInteger("GT.UsesLeft", usesLeft); } - } diff --git a/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java b/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java index 492a08d5d03..3100a76249e 100644 --- a/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ClipboardBehavior.java @@ -1,6 +1,5 @@ package gregtech.common.items.behaviors; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.ClickButtonWidget; @@ -13,6 +12,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntityClipboard; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -26,6 +26,8 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import codechicken.lib.raytracer.RayTracer; + import java.util.ArrayList; import java.util.List; @@ -33,6 +35,7 @@ import static gregtech.common.metatileentities.MetaTileEntities.CLIPBOARD_TILE; public class ClipboardBehavior implements IItemBehaviour, ItemUIFactory { + public static final int MAX_PAGES = 25; private static final int TEXT_COLOR = 0x1E1E1E; @@ -55,9 +58,10 @@ public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlaye () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x))); builder.image(32, 58 + 22 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX); - textFields.add(new TextFieldWidget2(34, 60 + 22 * i, 136, 9, () -> getString(holder, finalI), val -> setString(holder, finalI, val)) - .setMaxLength(23) - .setTextColor(TEXT_COLOR)); + textFields.add(new TextFieldWidget2(34, 60 + 22 * i, 136, 9, () -> getString(holder, finalI), + val -> setString(holder, finalI, val)) + .setMaxLength(23) + .setTextColor(TEXT_COLOR)); } for (TextFieldWidget2 textField : textFields) { @@ -79,20 +83,22 @@ public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlaye return builder.build(holder, entityPlayer); } - public static ModularUI createMTEUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { // So that people don't click on any text fields + public static ModularUI createMTEUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { // So that people + // don't click on any + // text fields initNBT(holder.getCurrentItem()); ModularUI.Builder builder = ModularUI.builder(GuiTextures.CLIPBOARD_PAPER_BACKGROUND, 170, 238); builder.image(18, 8, 130, 14, GuiTextures.CLIPBOARD_TEXT_BOX); builder.widget(new SimpleTextWidget(20, 10, "", TEXT_COLOR, () -> getTitle(holder), true).setCenter(false)); - for (int i = 0; i < 8; i++) { int finalI = i; builder.widget(new ImageCycleButtonWidget(6, 37 + 20 * i, 15, 15, GuiTextures.CLIPBOARD_BUTTON, 4, () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x))); builder.image(22, 38 + 20 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX); - builder.widget(new SimpleTextWidget(24, 40 + 20 * i, "", TEXT_COLOR, () -> getString(holder, finalI), true).setCenter(false)); + builder.widget(new SimpleTextWidget(24, 40 + 20 * i, "", TEXT_COLOR, () -> getString(holder, finalI), true) + .setCenter(false)); } builder.widget(new ClickButtonWidget(30, 200, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? -10 : -1)) @@ -227,7 +233,11 @@ private static void incrPageNum(PlayerInventoryHolder holder, int increment) { @Override public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack heldItem = player.getHeldItem(hand); - if (!world.isRemote && RayTracer.retrace(player).typeOfHit != RayTraceResult.Type.BLOCK) { // So that the player doesn't place a clipboard before suddenly getting the GUI + if (!world.isRemote && RayTracer.retrace(player).typeOfHit != RayTraceResult.Type.BLOCK) { // So that the player + // doesn't place a + // clipboard before + // suddenly getting + // the GUI PlayerInventoryHolder holder = new PlayerInventoryHolder(player, hand); holder.openUI(); } @@ -235,7 +245,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote && facing.getAxis() != EnumFacing.Axis.Y) { ItemStack heldItem = player.getHeldItem(hand).copy(); heldItem.setCount(1); // don't place multiple items at a time @@ -254,7 +265,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block // And manipulate it to our liking IGregTechTileEntity holder = (IGregTechTileEntity) world.getTileEntity(shiftedPos); if (holder != null) { - MetaTileEntityClipboard clipboard = (MetaTileEntityClipboard) holder.setMetaTileEntity(CLIPBOARD_TILE); + MetaTileEntityClipboard clipboard = (MetaTileEntityClipboard) holder + .setMetaTileEntity(CLIPBOARD_TILE); if (clipboard != null) { clipboard.initializeClipboard(heldItem); clipboard.setFrontFacing(facing.getOpposite()); diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 18bae3d88ca..a3b48ebc133 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,7 +1,5 @@ package gregtech.common.items.behaviors; -import appeng.api.util.AEColor; -import appeng.tile.networking.TileCableBus; import gregtech.api.GTValues; import gregtech.api.items.metaitem.stats.IItemDurabilityManager; import gregtech.api.metatileentity.MetaTileEntity; @@ -9,6 +7,7 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.util.GradientUtil; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.BlockStainedGlass; @@ -25,12 +24,16 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; + +import appeng.api.util.AEColor; +import appeng.tile.networking.TileCableBus; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; import java.util.List; +import javax.annotation.Nullable; + public class ColorSprayBehaviour extends AbstractUsableBehaviour implements IItemDurabilityManager { private final ItemStack empty; @@ -48,7 +51,8 @@ public ColorSprayBehaviour(ItemStack empty, int totalUses, int color) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (!player.canPlayerEdit(pos, facing, stack)) { return ActionResult.newResult(EnumActionResult.FAIL, player.getHeldItem(hand)); @@ -57,7 +61,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } useItemDurability(player, hand, stack, empty.copy()); - world.playSound(null, player.posX, player.posY, player.posZ, GTSoundEvents.SPRAY_CAN_TOOL, SoundCategory.PLAYERS, 1.0f, 1.0f); + world.playSound(null, player.posX, player.posY, player.posZ, GTSoundEvents.SPRAY_CAN_TOOL, + SoundCategory.PLAYERS, 1.0f, 1.0f); return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } @@ -104,7 +109,8 @@ private boolean tryPaintSpecialBlock(EntityPlayer player, World world, BlockPos } @SuppressWarnings("unchecked, rawtypes") - private static boolean tryStripBlockColor(EntityPlayer player, World world, BlockPos pos, Block block, EnumFacing side) { + private static boolean tryStripBlockColor(EntityPlayer player, World world, BlockPos pos, Block block, + EnumFacing side) { // MC special cases if (block == Blocks.STAINED_GLASS) { world.setBlockState(pos, Blocks.GLASS.getDefaultState()); diff --git a/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java b/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java index df452695dc8..44ae32d3a66 100644 --- a/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/CoverDigitalInterfaceWirelessPlaceBehaviour.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.handler.BlockPosHighlightRenderer; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -23,6 +24,7 @@ import java.util.List; public class CoverDigitalInterfaceWirelessPlaceBehaviour extends CoverItemBehavior { + public CoverDigitalInterfaceWirelessPlaceBehaviour(CoverDefinition coverDefinition) { super(coverDefinition); } @@ -59,9 +61,11 @@ public void onUpdate(ItemStack itemStack, Entity entity) { } @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityCentralMonitor) { ItemStack itemStack = player.getHeldItem(hand); itemStack.setTagCompound(NBTUtil.createPosTag(pos)); NBTTagCompound tag = itemStack.getTagCompound(); diff --git a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java index 2dd9805fbfe..04532515be4 100644 --- a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java @@ -6,14 +6,17 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.api.recipes.machines.IResearchRecipeMap; import gregtech.api.util.AssemblyLineManager; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.Collection; import java.util.List; +import javax.annotation.Nonnull; + public class DataItemBehavior implements IItemBehaviour, IDataItem { private final boolean requireDataBank; @@ -35,7 +38,8 @@ public boolean requireDataBank() { public void addInformation(@Nonnull ItemStack itemStack, List lines) { String researchId = AssemblyLineManager.readResearchId(itemStack); if (researchId == null) return; - Collection recipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection recipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (recipes != null && !recipes.isEmpty()) { lines.add(I18n.format("behavior.data_item.assemblyline.title")); Collection added = new ObjectOpenHashSet<>(); diff --git a/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java b/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java index 8c6e45bd159..d54b2e558a0 100644 --- a/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/DoorBehavior.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.entity.player.EntityPlayer; @@ -19,7 +20,8 @@ public DoorBehavior(Block block) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { // Copied from ItemDoor ItemStack stack = player.getHeldItem(hand); if (facing != EnumFacing.UP) { @@ -37,8 +39,10 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block playerFacing.getZOffset() < 0 && hitX > 0.5f || playerFacing.getZOffset() > 0 && hitX < 0.5f; ItemDoor.placeDoor(world, pos, playerFacing, this.block, isRightHinge); - SoundType soundType = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player); - world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1) / 2, soundType.getPitch() * 0.8f); + SoundType soundType = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, + player); + world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, + (soundType.getVolume() + 1) / 2, soundType.getPitch() * 0.8f); if (!player.isCreative()) { stack.shrink(1); } diff --git a/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java b/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java index f53dfd82cb2..d2684bc31e8 100644 --- a/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/DynamiteBehaviour.java @@ -2,6 +2,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.common.entities.DynamiteEntity; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; diff --git a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java index 1cdfe1f047d..81008400cd9 100644 --- a/src/main/java/gregtech/common/items/behaviors/FacadeItem.java +++ b/src/main/java/gregtech/common/items/behaviors/FacadeItem.java @@ -1,11 +1,11 @@ package gregtech.common.items.behaviors; -import com.google.common.collect.ImmutableList; import gregtech.api.items.metaitem.stats.IItemNameProvider; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.util.LocalizationUtils; import gregtech.common.ConfigHolder; import gregtech.common.covers.facade.FacadeHelper; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -15,6 +15,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.Constants.NBT; +import com.google.common.collect.ImmutableList; + import java.util.List; import java.util.Objects; @@ -46,7 +48,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi public String getItemSubType(ItemStack itemStack) { ItemStack facadeStack = getFacadeStack(itemStack); ResourceLocation registryName = Objects.requireNonNull(facadeStack.getItem().getRegistryName()); - return String.format("%s:%s@%d", registryName.getNamespace(), registryName.getPath(), Items.FEATHER.getDamage(facadeStack)); + return String.format("%s:%s@%d", registryName.getNamespace(), registryName.getPath(), + Items.FEATHER.getDamage(facadeStack)); } public static void setFacadeStack(ItemStack itemStack, ItemStack facadeStack) { diff --git a/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java b/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java index 4e2648f9266..2ac30b9d2aa 100644 --- a/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/FertilizerBehavior.java @@ -1,6 +1,7 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; @@ -14,7 +15,8 @@ public class FertilizerBehavior implements IItemBehaviour { @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!player.canPlayerEdit(pos.offset(facing), facing, heldItem)) { return ActionResult.newResult(EnumActionResult.FAIL, heldItem); diff --git a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java index 83304faf8d6..8d8d7541a25 100644 --- a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java @@ -11,7 +11,7 @@ import gregtech.api.util.GradientUtil; import gregtech.common.blocks.BlockFrame; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -25,16 +25,20 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.awt.*; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Set; -public class FoamSprayerBehavior implements IItemCapabilityProvider, IItemDurabilityManager, IItemBehaviour, ISubItemHandler { +import javax.annotation.Nullable; + +public class FoamSprayerBehavior implements IItemCapabilityProvider, IItemDurabilityManager, IItemBehaviour, + ISubItemHandler { private static final int FLUID_PER_BLOCK = 100; @@ -45,9 +49,11 @@ public FoamSprayerBehavior() { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack itemStack = player.getHeldItem(hand); - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) { return ActionResult.newResult(EnumActionResult.FAIL, itemStack); } @@ -80,7 +86,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block @Override public double getDurabilityForDisplay(ItemStack itemStack) { - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; IFluidTankProperties fluidTankProperties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = fluidTankProperties.getContents(); @@ -103,7 +110,7 @@ private static int foamAllFrameBlocks(World world, BlockPos pos, int maxBlocksTo List frameBlocks = gatherFrameBlocks(world, pos, 1024); frameBlocks = frameBlocks.subList(0, Math.min(frameBlocks.size(), maxBlocksToFoam)); - //replace blocks without updating physics + // replace blocks without updating physics for (BlockPos framePos : frameBlocks) { IBlockState blockState = world.getBlockState(framePos); boolean isNormalFrame = isSneaking || @@ -111,11 +118,12 @@ private static int foamAllFrameBlocks(World world, BlockPos pos, int maxBlocksTo if (isNormalFrame) { blockState.getBlock().dropBlockAsItem(world, framePos, blockState, 0); } - IBlockState foamToPlace = isNormalFrame ? MetaBlocks.FOAM.getDefaultState() : MetaBlocks.REINFORCED_FOAM.getDefaultState(); + IBlockState foamToPlace = isNormalFrame ? MetaBlocks.FOAM.getDefaultState() : + MetaBlocks.REINFORCED_FOAM.getDefaultState(); world.setBlockState(framePos, foamToPlace, 2); } - //perform block physics updates + // perform block physics updates for (BlockPos blockPos : frameBlocks) { IBlockState blockState = world.getBlockState(blockPos); world.notifyNeighborsRespectDebug(blockPos, blockState.getBlock(), true); @@ -128,11 +136,11 @@ private static int foamReplacableBlocks(World world, BlockPos pos, int maxBlocks replacableBlocks = replacableBlocks.subList(0, Math.min(replacableBlocks.size(), maxBlocksToFoam)); for (BlockPos blockPos : replacableBlocks) { - //foaming air blocks doesn't cause updates of other blocks, so just proceed + // foaming air blocks doesn't cause updates of other blocks, so just proceed world.setBlockState(blockPos, MetaBlocks.FOAM.getDefaultState(), 2); } - //perform block physics updates + // perform block physics updates for (BlockPos blockPos : replacableBlocks) { IBlockState blockState = world.getBlockState(blockPos); world.notifyNeighborsRespectDebug(pos, blockState.getBlock(), true); @@ -152,7 +160,8 @@ private static List gatherReplacableBlocks(World world, BlockPos cente for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); IBlockState blockStateHere = world.getBlockState(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current if (blockStateHere.getBlock().isReplaceable(world, currentPos) && currentPos.distanceSq(centerPos) <= maxRadiusSq && !observedSet.contains(currentPos)) { BlockPos immutablePos = currentPos.toImmutable(); @@ -183,7 +192,8 @@ private static List gatherFrameBlocks(World world, BlockPos centerPos, for (EnumFacing facing : EnumFacing.VALUES) { currentPos.move(facing); IBlockState blockStateHere = world.getBlockState(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current if (blockStateHere.getBlock() instanceof BlockFrame && currentPos.distanceSq(centerPos) <= maxRadiusSq && (frameState == null || frameState == blockStateHere) && !observedSet.contains(currentPos)) { @@ -211,7 +221,8 @@ public String getItemSubType(ItemStack itemStack) { @Override public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList subItems) { ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, + null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.ConstructionFoam.getFluid(10000), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java b/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java index 24cf2763414..2c89da1475d 100644 --- a/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/GTBoatBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.common.entities.GTBoatEntity; import gregtech.common.entities.GTBoatEntity.GTBoatType; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -27,7 +28,8 @@ public GTBoatBehavior(GTBoatType type) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { // almost exact copy of ItemBoat#onItemRightClick ItemStack stack = player.getHeldItem(hand); float realPitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch); @@ -68,7 +70,8 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block Block block = world.getBlockState(ray.getBlockPos()).getBlock(); boolean rayHitWater = block == Blocks.WATER || block == Blocks.FLOWING_WATER; - GTBoatEntity boat = new GTBoatEntity(world, ray.hitVec.x, rayHitWater ? ray.hitVec.y - 0.12 : ray.hitVec.y, ray.hitVec.z); + GTBoatEntity boat = new GTBoatEntity(world, ray.hitVec.x, rayHitWater ? ray.hitVec.y - 0.12 : ray.hitVec.y, + ray.hitVec.z); boat.setGTBoatType(this.type); boat.rotationYaw = player.rotationYaw; diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index 23a4bf7b059..0588cfc1b83 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -31,7 +32,8 @@ public void addInformation(ItemStack itemStack, List lines) { } @Override - public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { MetaTileEntity mte = GTUtility.getMetaTileEntity(world, pos); ItemStack stack = player.getHeldItem(hand); @@ -57,11 +59,17 @@ public ActionResult onItemRightClick(World world, EntityPlayer player public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { return ModularUI.builder(GuiTextures.BACKGROUND, 176, 60) .label(9, 8, "metaitem.circuit.integrated.gui") - .widget(new DynamicLabelWidget(82, 30, () -> Integer.toString(IntCircuitIngredient.getCircuitConfiguration(holder.getCurrentItem())), 0x4D4040)) - .widget(new ClickButtonWidget(15, 24, 20, 20, "-5", data -> IntCircuitIngredient.adjustConfiguration(holder, -5))) - .widget(new ClickButtonWidget(50, 24, 20, 20, "-1", data -> IntCircuitIngredient.adjustConfiguration(holder, -1))) - .widget(new ClickButtonWidget(104, 24, 20, 20, "+1", data -> IntCircuitIngredient.adjustConfiguration(holder, +1))) - .widget(new ClickButtonWidget(141, 24, 20, 20, "+5", data -> IntCircuitIngredient.adjustConfiguration(holder, +5))) + .widget(new DynamicLabelWidget(82, 30, + () -> Integer.toString(IntCircuitIngredient.getCircuitConfiguration(holder.getCurrentItem())), + 0x4D4040)) + .widget(new ClickButtonWidget(15, 24, 20, 20, "-5", + data -> IntCircuitIngredient.adjustConfiguration(holder, -5))) + .widget(new ClickButtonWidget(50, 24, 20, 20, "-1", + data -> IntCircuitIngredient.adjustConfiguration(holder, -1))) + .widget(new ClickButtonWidget(104, 24, 20, 20, "+1", + data -> IntCircuitIngredient.adjustConfiguration(holder, +1))) + .widget(new ClickButtonWidget(141, 24, 20, 20, "+5", + data -> IntCircuitIngredient.adjustConfiguration(holder, +5))) .build(holder, entityPlayer); } diff --git a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java index 215fc99755e..8d12bdc0f9b 100644 --- a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java @@ -6,6 +6,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.integration.baubles.BaublesModule; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -28,9 +29,10 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class ItemMagnetBehavior implements IItemBehaviour { private final int range; @@ -45,7 +47,8 @@ public ItemMagnetBehavior(int range) { @Override public ActionResult onItemRightClick(World world, @Nonnull EntityPlayer player, EnumHand hand) { if (!player.world.isRemote && player.isSneaking()) { - player.sendStatusMessage(new TextComponentTranslation(toggleActive(player.getHeldItem(hand)) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); + player.sendStatusMessage(new TextComponentTranslation(toggleActive(player.getHeldItem(hand)) ? + "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); } return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } @@ -69,7 +72,7 @@ private static boolean toggleActive(ItemStack stack) { if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } - //noinspection ConstantConditions + // noinspection ConstantConditions stack.getTagCompound().setBoolean("IsActive", !isActive); return !isActive; } @@ -78,13 +81,16 @@ private static boolean toggleActive(ItemStack stack) { public void onUpdate(ItemStack stack, Entity entity) { // Adapted logic from Draconic Evolution // https://github.com/Draconic-Inc/Draconic-Evolution/blob/1.12.2/src/main/java/com/brandon3055/draconicevolution/items/tools/Magnet.java - if (!entity.isSneaking() && entity.ticksExisted % 10 == 0 && isActive(stack) && entity instanceof EntityPlayer player) { + if (!entity.isSneaking() && entity.ticksExisted % 10 == 0 && isActive(stack) && + entity instanceof EntityPlayer player) { World world = entity.getEntityWorld(); if (!drainEnergy(true, stack, energyDraw)) { return; } - List items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).grow(range, range, range)); + List items = world.getEntitiesWithinAABB(EntityItem.class, + new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .grow(range, range, range)); boolean didMoveEntity = false; for (EntityItem itemEntity : items) { @@ -97,7 +103,8 @@ public void onUpdate(ItemStack stack, Entity entity) { continue; } - if (itemEntity.getThrower() != null && itemEntity.getThrower().equals(entity.getName()) && itemEntity.pickupDelay > 0) { + if (itemEntity.getThrower() != null && itemEntity.getThrower().equals(entity.getName()) && + itemEntity.pickupDelay > 0) { continue; } @@ -111,16 +118,21 @@ public void onUpdate(ItemStack stack, Entity entity) { itemEntity.pickupDelay = 0; } itemEntity.motionX = itemEntity.motionY = itemEntity.motionZ = 0; - itemEntity.setPosition(entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), entity.posY - 0.6, entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); + itemEntity.setPosition(entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), entity.posY - 0.6, + entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); didMoveEntity = true; } } if (didMoveEntity) { - world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); + world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, + SoundCategory.PLAYERS, 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); } - List xp = world.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).grow(4, 4, 4)); + List xp = world.getEntitiesWithinAABB(EntityXPOrb.class, + new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .grow(4, 4, 4)); for (EntityXPOrb orb : xp) { if (!world.isRemote && !orb.isDead) { @@ -128,7 +140,9 @@ public void onUpdate(ItemStack stack, Entity entity) { if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, orb))) { continue; } - world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); + world.playSound(null, entity.posX, entity.posY, entity.posZ, + SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); player.onItemPickup(orb, 1); player.addExperience(orb.xpValue); orb.setDead(); @@ -162,7 +176,7 @@ public void onItemToss(@Nonnull ItemTossEvent event) { } private boolean isMagnet(@Nonnull ItemStack stack) { - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (var behavior : metaItem.getBehaviours(stack)) { if (behavior instanceof ItemMagnetBehavior) { return true; diff --git a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java index 9b07671682f..807453d3333 100644 --- a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java @@ -7,6 +7,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.api.util.GradientUtil; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.Block; import net.minecraft.block.BlockTNT; @@ -30,13 +31,15 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; + import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class LighterBehaviour implements IItemBehaviour, IItemDurabilityManager, ISubItemHandler { private static final String LIGHTER_OPEN = "lighterOpen"; @@ -56,13 +59,15 @@ public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canO this(null, usesFluid, hasMultipleUses, canOpen); } - public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canOpen, Item destroyItem, int maxUses) { + public LighterBehaviour(boolean usesFluid, boolean hasMultipleUses, boolean canOpen, Item destroyItem, + int maxUses) { this(null, usesFluid, hasMultipleUses, canOpen); this.maxUses = maxUses; this.destroyItem = destroyItem; } - public LighterBehaviour(@Nullable ResourceLocation overrideLocation, boolean usesFluid, boolean hasMultipleUses, boolean canOpen) { + public LighterBehaviour(@Nullable ResourceLocation overrideLocation, boolean usesFluid, boolean hasMultipleUses, + boolean canOpen) { this.overrideLocation = overrideLocation; this.usesFluid = usesFluid; this.hasMultipleUses = hasMultipleUses; @@ -75,7 +80,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(stack); // If this item does not have opening mechanics, or if it does and is currently open if ((!canOpen || compound.getBoolean(LIGHTER_OPEN)) && consumeFuel(player, stack)) { - player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); + player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); ((EntityCreeper) entity).ignite(); return true; } @@ -84,7 +90,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en } @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, BlockPos pos, + EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(stack); @@ -97,7 +104,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo if (!player.canPlayerEdit(pos, side, player.getHeldItem(hand))) return EnumActionResult.FAIL; // If this item does not have opening mechanics, or if it does and is currently open if ((!canOpen || compound.getBoolean(LIGHTER_OPEN)) && consumeFuel(player, stack)) { - player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); + player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, GTValues.RNG.nextFloat() * 0.4F + 0.8F); IBlockState blockState = world.getBlockState(pos); Block block = blockState.getBlock(); if (block instanceof BlockTNT) { @@ -141,7 +149,8 @@ public boolean consumeFuel(EntityPlayer entity, ItemStack stack) { private int getUsesLeft(@Nonnull ItemStack stack) { if (usesFluid) { - IFluidHandlerItem fluidHandlerItem = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; @@ -162,7 +171,8 @@ private int getUsesLeft(@Nonnull ItemStack stack) { private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int usesLeft) { if (usesFluid) { - IFluidHandlerItem fluidHandlerItem = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = stack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { FluidStack drained = fluidHandlerItem.drain(Integer.MAX_VALUE, false); if (drained != null) { @@ -185,7 +195,8 @@ private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int uses public void addPropertyOverride(@Nonnull Item item) { if (overrideLocation != null) { item.addPropertyOverride(overrideLocation, - (stack, world, entity) -> GTUtility.getOrCreateNbtCompound(stack).getBoolean(LIGHTER_OPEN) ? 1.0F : 0.0F); + (stack, world, entity) -> GTUtility.getOrCreateNbtCompound(stack).getBoolean(LIGHTER_OPEN) ? 1.0F : + 0.0F); } } @@ -193,7 +204,8 @@ public void addPropertyOverride(@Nonnull Item item) { public double getDurabilityForDisplay(ItemStack itemStack) { if (usesFluid) { // Lighters - IFluidHandlerItem fluidHandlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0.0; IFluidTankProperties properties = fluidHandlerItem.getTankProperties()[0]; FluidStack fluidStack = properties.getContents(); @@ -242,7 +254,8 @@ public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullLi if (usesFluid) { // Show Lighters as filled in JEI ItemStack copy = itemStack.copy(); - IFluidHandlerItem fluidHandlerItem = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandlerItem fluidHandlerItem = copy + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem != null) { fluidHandlerItem.fill(Materials.Butane.getFluid(Integer.MAX_VALUE), true); subItems.add(copy); diff --git a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java index d854f679a49..91686747900 100644 --- a/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ModeSwitchBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.util.GTUtility; import gregtech.common.items.behaviors.ModeSwitchBehavior.ILocalizationKey; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -13,6 +14,7 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; + import org.apache.commons.lang3.ArrayUtils; import java.util.List; @@ -53,7 +55,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player T nextMode = enumConstants[(currentModeIndex + 1) % enumConstants.length]; setModeForItemStack(itemStack, nextMode); ITextComponent newModeComponent = new TextComponentTranslation(nextMode.getUnlocalizedName()); - ITextComponent textComponent = new TextComponentTranslation("metaitem.behavior.mode_switch.mode_switched", newModeComponent); + ITextComponent textComponent = new TextComponentTranslation("metaitem.behavior.mode_switch.mode_switched", + newModeComponent); player.sendStatusMessage(textComponent, true); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack); } @@ -64,10 +67,12 @@ public ActionResult onItemRightClick(World world, EntityPlayer player public void addInformation(ItemStack itemStack, List lines) { T currentMode = getModeFromItemStack(itemStack); lines.add(I18n.format("metaitem.behavior.mode_switch.tooltip")); - lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", I18n.format(currentMode.getUnlocalizedName()))); + lines.add(I18n.format("metaitem.behavior.mode_switch.current_mode", + I18n.format(currentMode.getUnlocalizedName()))); } public interface ILocalizationKey { + String getUnlocalizedName(); } } diff --git a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java index 9519e33cf71..2473d00ae53 100644 --- a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pattern.PatternError; import gregtech.api.util.GTUtility; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -21,13 +22,15 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MultiblockBuilderBehavior implements IItemBehaviour { @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { // Initial checks TileEntity tileEntity = world.getTileEntity(pos); if (!(tileEntity instanceof IGregTechTileEntity)) return EnumActionResult.PASS; @@ -50,7 +53,8 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo if (!multiblock.isStructureFormed()) { PatternError error = multiblock.structurePattern.getError(); if (error != null) { - player.sendMessage(new TextComponentTranslation("gregtech.multiblock.pattern.error_message_header")); + player.sendMessage( + new TextComponentTranslation("gregtech.multiblock.pattern.error_message_header")); player.sendMessage(new TextComponentString(error.getErrorInfo())); return EnumActionResult.SUCCESS; } diff --git a/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java b/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java index fb74b635a26..f6555636fa7 100644 --- a/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/NanoSaberBehavior.java @@ -1,10 +1,9 @@ package gregtech.common.items.behaviors; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import gregtech.api.items.metaitem.stats.IEnchantabilityHelper; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -14,6 +13,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + import java.util.UUID; public class NanoSaberBehavior extends ToggleEnergyConsumerBehavior implements IEnchantabilityHelper { @@ -36,8 +38,10 @@ public Multimap getAttributeModifiers(EntityEquipment HashMultimap modifiers = HashMultimap.create(); if (slot == EntityEquipmentSlot.MAINHAND) { double attackDamage = baseAttackDamage + (isItemActive(stack) ? additionalAttackDamage : 0.0D); - modifiers.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.0, 0)); - modifiers.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon Modifier", attackDamage, 0)); + modifiers.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), + new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.0, 0)); + modifiers.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), + new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon Modifier", attackDamage, 0)); } return modifiers; } diff --git a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java index 78bc38c653d..6e2360254b2 100644 --- a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java @@ -15,6 +15,7 @@ import gregtech.common.terminal.app.prospector.widget.WidgetOreList; import gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap; import gregtech.common.terminal.component.SearchComponent; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -27,12 +28,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import javax.annotation.Nonnull; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ProspectorScannerBehavior implements IItemBehaviour, ItemUIFactory, SearchComponent.IWidgetSearch { private static final long VOLTAGE_FACTOR = 16L; @@ -112,11 +114,13 @@ public ModularUI createUI(PlayerInventoryHolder holder, @Nonnull EntityPlayer en this.widgetOreList = new WidgetOreList(32 * radius - 6, 18, 332 - 32 * radius, 176); builder.widget(this.widgetOreList); builder.widget(new WidgetProspectingMap(6, 18, radius, this.widgetOreList, mode, 1)); - //Cardinal directions + // Cardinal directions builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14, "N", 0xAAAAAA).setShadow(true)); - builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14 + 16 * (radius * 2 - 1), "S", 0xAAAAAA).setShadow(true)); + builder.widget(new LabelWidget(3 + (16 * (radius * 2 - 1)) / 2, 14 + 16 * (radius * 2 - 1), "S", 0xAAAAAA) + .setShadow(true)); builder.widget(new LabelWidget(3, 15 + (16 * (radius * 2 - 1)) / 2, "W", 0xAAAAAA).setShadow(true)); - builder.widget(new LabelWidget(3 + 16 * (radius * 2 - 1), 15 + (16 * (radius * 2 - 1)) / 2, "E", 0xAAAAAA).setShadow(true)); + builder.widget(new LabelWidget(3 + 16 * (radius * 2 - 1), 15 + (16 * (radius * 2 - 1)) / 2, "E", 0xAAAAAA) + .setShadow(true)); return builder.label(6, 6, getTranslationKey()).build(holder, entityPlayer); } @@ -170,7 +174,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { if (player.openContainer instanceof ModularUIContainer) { ModularUIContainer modularUIContainer = (ModularUIContainer) player.openContainer; if (modularUIContainer.getModularUI().holder instanceof PlayerInventoryHolder) { - if (((PlayerInventoryHolder) (modularUIContainer).getModularUI().holder).getCurrentItem() == itemStack) { + if (((PlayerInventoryHolder) (modularUIContainer).getModularUI().holder).getCurrentItem() == + itemStack) { if (!player.isCreative()) { if (checkCanUseScanner(itemStack, player, true)) drainEnergy(itemStack, GTValues.V[tier] / VOLTAGE_FACTOR, false); diff --git a/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java b/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java index 4d490c087eb..6ffc8919a40 100644 --- a/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/TerminalBehaviour.java @@ -13,6 +13,7 @@ import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.common.terminal.hardware.BatteryHardware; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -30,7 +31,8 @@ public class TerminalBehaviour implements IItemBehaviour, ItemUIFactory, ISubItemHandler { @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { if (player.isSneaking()) { ItemStack itemStack = player.getHeldItem(hand); itemStack.getOrCreateSubCompound("terminal").removeTag("_click"); @@ -63,7 +65,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { if (entity.ticksExisted % 20 == 0 && tabletNBT.hasKey("_ar")) { if (entity instanceof EntityLivingBase) { EntityLivingBase livingBase = (EntityLivingBase) entity; - if (!livingBase.getHeldItemMainhand().isItemEqual(itemStack) && !livingBase.getHeldItemOffhand().isItemEqual(itemStack)) { + if (!livingBase.getHeldItemMainhand().isItemEqual(itemStack) && + !livingBase.getHeldItemOffhand().isItemEqual(itemStack)) { return; } } @@ -81,7 +84,8 @@ public void onUpdate(ItemStack itemStack, Entity entity) { } } if (cost > 0) { - IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { long back = electricItem.discharge(cost, 999, true, false, false); if (back != cost) { diff --git a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java index e2ba3d85ed0..d8ef0816dfa 100644 --- a/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ToggleEnergyConsumerBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -39,7 +40,8 @@ public ActionResult onItemRightClick(World world, EntityPlayer player } private boolean drainActivationEnergy(IElectricItem electricItem, boolean simulate) { - return electricItem.discharge(energyUsagePerTick, electricItem.getTier(), true, false, simulate) >= energyUsagePerTick; + return electricItem.discharge(energyUsagePerTick, electricItem.getTier(), true, false, simulate) >= + energyUsagePerTick; } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java index 979891fb825..3f2b455aa90 100644 --- a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java @@ -1,12 +1,14 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; + import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; + /** * Adds tooltips with multiple translation keys */ diff --git a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java index 5242fb3a456..9a33d1cfa1d 100644 --- a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java @@ -17,6 +17,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -39,12 +40,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; +import javax.annotation.Nonnull; + public class TricorderBehavior implements IItemBehaviour { private final int debugLevel; @@ -55,7 +57,8 @@ public TricorderBehavior(int debugLevel) { } @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, + float hitY, float hitZ, EnumHand hand) { if (!world.isRemote && !world.isAirBlock(pos)) { List info = getScannerInfo(player, world, pos); @@ -88,23 +91,29 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // coordinates of the block list.add(new TextComponentTranslation("behavior.tricorder.position", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getX())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getY())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getZ())).setStyle(new Style().setColor(TextFormatting.AQUA)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(world.provider.getDimension())).setStyle(new Style().setColor(TextFormatting.AQUA)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getX())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getY())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(pos.getZ())) + .setStyle(new Style().setColor(TextFormatting.AQUA)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(world.provider.getDimension())) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); // hardness and blast resistance list.add(new TextComponentTranslation("behavior.tricorder.block_hardness", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getBlockHardness(state, world, pos))).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getExplosionResistance(player))).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getBlockHardness(state, world, pos))) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getExplosionResistance(player))) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); if (debugLevel > 2) { for (Map.Entry, Comparable> prop : state.getProperties().entrySet()) { list.add(new TextComponentTranslation("behavior.tricorder.state", new TextComponentTranslation(prop.getKey().getName()), - new TextComponentTranslation(prop.getValue().toString()).setStyle(new Style().setColor(TextFormatting.AQUA)))); + new TextComponentTranslation(prop.getValue().toString()) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); } if (state instanceof IExtendedBlockState) { IExtendedBlockState extState = (IExtendedBlockState) state; @@ -112,7 +121,8 @@ public List getScannerInfo(EntityPlayer player, World world, Blo if (prop.getValue().isPresent()) { list.add(new TextComponentTranslation("behavior.tricorder.state", new TextComponentTranslation(prop.getKey().getName()), - new TextComponentTranslation(prop.getValue().get().toString()).setStyle(new Style().setColor(TextFormatting.AQUA)))); + new TextComponentTranslation(prop.getValue().get().toString()) + .setStyle(new Style().setColor(TextFormatting.AQUA)))); } } } @@ -126,9 +136,11 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // name of the machine list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(metaTileEntity.getMetaFullName())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(GregTechAPI.MTE_REGISTRY.getIdByObjectName(metaTileEntity.metaTileEntityId))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation(LocalizationUtils.format(metaTileEntity.getMetaFullName())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation(TextFormattingUtil + .formatNumbers(GregTechAPI.MTE_REGISTRY.getIdByObjectName(metaTileEntity.metaTileEntityId))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); list.add(new TextComponentTranslation("behavior.tricorder.divider")); @@ -145,10 +157,12 @@ public List getScannerInfo(EntityPlayer player, World world, Blo allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(tank.getFluid().getLocalizedName()).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(tank.getFluid().getLocalizedName()) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } tankIndex += tanks.getFluidTanks().size(); } @@ -162,10 +176,12 @@ public List getScannerInfo(EntityPlayer player, World world, Blo allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", tankIndex + i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(tank.getFluid().getLocalizedName()).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getFluid().amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(tank.getCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(tank.getFluid().getLocalizedName()) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } } @@ -175,48 +191,61 @@ public List getScannerInfo(EntityPlayer player, World world, Blo // sound muffling energyCost += 500; if (metaTileEntity.isMuffled()) - list.add(new TextComponentTranslation("behavior.tricorder.muffled").setStyle(new Style().setColor(TextFormatting.GREEN))); + list.add(new TextComponentTranslation("behavior.tricorder.muffled") + .setStyle(new Style().setColor(TextFormatting.GREEN))); // workable progress info IWorkable workable = metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, null); if (workable != null) { if (!workable.isWorkingEnabled()) { - list.add(new TextComponentTranslation("behavior.tricorder.machine_disabled").setStyle(new Style().setColor(TextFormatting.RED))); + list.add(new TextComponentTranslation("behavior.tricorder.machine_disabled") + .setStyle(new Style().setColor(TextFormatting.RED))); } - // if (workable.wasShutdown()) { //todo - // list.add(new TextComponentTranslation("behavior.tricorder.machine_power_loss").setStyle(new Style().setColor(TextFormatting.RED))); - // } + // if (workable.wasShutdown()) { //todo + // list.add(new TextComponentTranslation("behavior.tricorder.machine_power_loss").setStyle(new + // Style().setColor(TextFormatting.RED))); + // } energyCost += 400; if (workable.getMaxProgress() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.machine_progress", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getProgress())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(workable.getMaxProgress())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } } // energy container - IEnergyContainer container = metaTileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + IEnergyContainer container = metaTileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + null); if (container != null && container.getEnergyCapacity() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.divider")); if (container.getInputVoltage() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.energy_container_in", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputVoltage())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(container.getInputVoltage())]).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(container.getInputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getInputAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } if (container.getOutputVoltage() > 0) { list.add(new TextComponentTranslation("behavior.tricorder.energy_container_out", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputVoltage())).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(GTValues.VN[GTUtility.getTierByVoltage(container.getOutputVoltage())]).setStyle(new Style().setColor(TextFormatting.RED)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getOutputVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + GTValues.VN[GTUtility.getTierByVoltage(container.getOutputVoltage())]) + .setStyle(new Style().setColor(TextFormatting.RED)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(container.getOutputAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); } list.add(new TextComponentTranslation("behavior.tricorder.energy_container_storage", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyStored())).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyCapacity())).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyStored())) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(container.getEnergyCapacity())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } // machine-specific info @@ -238,9 +267,12 @@ else if (metaTileEntity instanceof IDataInfoProvider) if (pipeTile.getPipeBlock().getRegistryName() != null) { list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(pipeTile.getPipeBlock().getTranslationKey())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation( + LocalizationUtils.format(pipeTile.getPipeBlock().getTranslationKey())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); } // pipe-specific info @@ -264,42 +296,49 @@ else if (metaTileEntity instanceof IDataInfoProvider) list.addAll(provider.getDataInfo()); } else { list.add(new TextComponentTranslation("behavior.tricorder.block_name", - new TextComponentTranslation(LocalizationUtils.format(block.getLocalizedName())).setStyle(new Style().setColor(TextFormatting.BLUE)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))).setStyle(new Style().setColor(TextFormatting.BLUE)) - )); + new TextComponentTranslation(LocalizationUtils.format(block.getLocalizedName())) + .setStyle(new Style().setColor(TextFormatting.BLUE)), + new TextComponentTranslation( + TextFormattingUtil.formatNumbers(block.getMetaFromState(world.getBlockState(pos)))) + .setStyle(new Style().setColor(TextFormatting.BLUE)))); } - // crops (adds 1000EU) // bedrock fluids list.add(new TextComponentTranslation("behavior.tricorder.divider")); - Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, pos.getX() / 16, pos.getZ() / 16);//-# to only read + Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, pos.getX() / 16, pos.getZ() / 16);// -# to only + // read if (fluid != null) { - FluidStack stack = new FluidStack(fluid, BedrockFluidVeinHandler.getOperationsRemaining(world, pos.getX() / 16, pos.getZ() / 16)); + FluidStack stack = new FluidStack(fluid, + BedrockFluidVeinHandler.getOperationsRemaining(world, pos.getX() / 16, pos.getZ() / 16)); double fluidPercent = stack.amount * 100.0 / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; if (player.isCreative()) { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.amount", - new TextComponentTranslation(fluid.getLocalizedName(stack)).setStyle(new Style().setColor(TextFormatting.GOLD)), - new TextComponentTranslation(String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, pos.getX() / 16, pos.getZ() / 16))).setStyle(new Style().setColor(TextFormatting.GOLD)), - new TextComponentTranslation(String.valueOf(fluidPercent)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(fluid.getLocalizedName(stack)) + .setStyle(new Style().setColor(TextFormatting.GOLD)), + new TextComponentTranslation(String.valueOf( + BedrockFluidVeinHandler.getFluidYield(world, pos.getX() / 16, pos.getZ() / 16))) + .setStyle(new Style().setColor(TextFormatting.GOLD)), + new TextComponentTranslation(String.valueOf(fluidPercent)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } else { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.amount_unknown", - new TextComponentTranslation(String.valueOf(fluidPercent)).setStyle(new Style().setColor(TextFormatting.YELLOW)) - )); + new TextComponentTranslation(String.valueOf(fluidPercent)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); } } else { list.add(new TextComponentTranslation("behavior.tricorder.bedrock_fluid.nothing")); } // pollution -// if (GT_Pollution.hasPollution(currentChunk)) { -// list.add("Pollution in Chunk: " + TextFormatting.RED + GTUtility.formatNumbers(GT_Pollution.getPollution(currentChunk)) + TextFormatting.RESET + " gibbl"); -// } else { -// list.add(TextFormatting.GREEN + "No Pollution in Chunk! HAYO!" + TextFormatting.RESET); -// } + // if (GT_Pollution.hasPollution(currentChunk)) { + // list.add("Pollution in Chunk: " + TextFormatting.RED + + // GTUtility.formatNumbers(GT_Pollution.getPollution(currentChunk)) + TextFormatting.RESET + " gibbl"); + // } else { + // list.add(TextFormatting.GREEN + "No Pollution in Chunk! HAYO!" + TextFormatting.RESET); + // } // debug TODO if (tileEntity instanceof MetaTileEntityHolder) { diff --git a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java index 508764a1249..3b181f12548 100644 --- a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java @@ -6,16 +6,18 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.RotorProperty; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class TurbineRotorBehavior extends AbstractMaterialPartBehavior implements IItemMaxStackSizeProvider { - //TODO rework rotor stats once material stats are also reworked + // TODO rework rotor stats once material stats are also reworked @Override public int getPartMaxDurability(ItemStack itemStack) { Material material = getPartMaterial(itemStack); diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java index 21882bf830a..7c3da2f0166 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/AdvancedMonitorPluginBehavior.java @@ -1,10 +1,5 @@ package gregtech.common.items.behaviors.monitorplugin; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Translation; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.gui.IUIHolder; import gregtech.api.gui.widgets.LabelWidget; @@ -23,6 +18,7 @@ import gregtech.common.gui.widget.monitor.WidgetPluginConfig; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -43,16 +39,24 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Translation; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.vecmath.Vector3f; import java.util.*; import java.util.stream.Collectors; +import javax.vecmath.Vector3f; + public class AdvancedMonitorPluginBehavior extends ProxyHolderPluginBehavior { + @SideOnly(Side.CLIENT) private static Framebuffer FBO; private static final int RESOLUTION = 1080; @@ -63,7 +67,7 @@ public class AdvancedMonitorPluginBehavior extends ProxyHolderPluginBehavior { private float spin; private boolean connect; - //run-time + // run-time @SideOnly(Side.CLIENT) private FBOWorldSceneRenderer worldSceneRenderer; @SideOnly(Side.CLIENT) @@ -98,20 +102,22 @@ private void createWorldScene() { FBO = new Framebuffer(RESOLUTION, RESOLUTION, true); } TrackedDummyWorld dummyWorld = new TrackedDummyWorld(world); - dummyWorld.setRenderFilter(pos->validPos.contains(pos)); + dummyWorld.setRenderFilter(pos -> validPos.contains(pos)); worldSceneRenderer = new FBOWorldSceneRenderer(dummyWorld, FBO); worldSceneRenderer.addRenderedBlocks(validPos, null); center = new Vector3f((minX + maxX) / 2f + 0.5f, (minY + maxY) / 2f + 0.5f, (minZ + maxZ) / 2f + 0.5f); - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); worldSceneRenderer.setBeforeWorldRender(this::renderBefore); worldSceneRenderer.setAfterWorldRender(this::renderAfter); - worldSceneRenderer.setOnLookingAt(rayTrace->renderBlockOverLay(rayTrace.getBlockPos())); + worldSceneRenderer.setOnLookingAt(rayTrace -> renderBlockOverLay(rayTrace.getBlockPos())); } @SideOnly(Side.CLIENT) private void renderBefore(WorldSceneRenderer renderer) { if (spin > 0 && lastMouse == null) { - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } @@ -145,7 +151,8 @@ private void renderAfter(WorldSceneRenderer renderer) { } } if (connect && connections != null) { - for (Map.Entry, Vector3f>> entry : connections.entrySet()) { + for (Map.Entry, Vector3f>> entry : connections + .entrySet()) { BlockPos pos = entry.getKey(); Vector3f winPos = WorldSceneRenderer.project(pos); entry.getValue().setValue(winPos); @@ -184,7 +191,8 @@ private void renderBlockOverLay(BlockPos pos) { } public void setConfig(float scale, int rY, int rX, float spin, boolean connect) { - if (this.scale == scale && this.rotationPitch == rY && this.rotationYaw == rX && this.spin == spin && this.connect == connect) + if (this.scale == scale && this.rotationPitch == rY && this.rotationYaw == rX && this.spin == spin && + this.connect == connect) return; if (scale < 0.3 || scale > 2 || rY < 0 || rY > 360 || rX < -90 || rX > 90 || spin < 0 || spin > 2) return; @@ -217,16 +225,20 @@ public void update() { if (worldSceneRenderer == null && validPos != null && validPos.size() > 0) { createWorldScene(); } - if (this.connect && worldSceneRenderer != null && this.screen.getController() instanceof MetaTileEntityCentralMonitor) { + if (this.connect && worldSceneRenderer != null && + this.screen.getController() instanceof MetaTileEntityCentralMonitor) { if (connections == null) connections = new HashMap<>(); connections.clear(); - for (MetaTileEntityMonitorScreen[] monitorScreens : ((MetaTileEntityCentralMonitor) this.screen.getController()).screens) { + for (MetaTileEntityMonitorScreen[] monitorScreens : ((MetaTileEntityCentralMonitor) this.screen + .getController()).screens) { for (MetaTileEntityMonitorScreen screen : monitorScreens) { - if (screen != null && screen.plugin instanceof FakeGuiPluginBehavior && ((FakeGuiPluginBehavior) screen.plugin).getHolder() == this.holder) { + if (screen != null && screen.plugin instanceof FakeGuiPluginBehavior && + ((FakeGuiPluginBehavior) screen.plugin).getHolder() == this.holder) { MetaTileEntity met = ((FakeGuiPluginBehavior) screen.plugin).getRealMTE(); if (met != null) { BlockPos pos = met.getPos(); - Pair, Vector3f> tuple = connections.getOrDefault(pos, new MutablePair<>(new ArrayList<>(), null)); + Pair, Vector3f> tuple = connections + .getOrDefault(pos, new MutablePair<>(new ArrayList<>(), null)); tuple.getLeft().add(screen); connections.put(pos, tuple); } @@ -240,9 +252,11 @@ public void update() { if (entity.isStructureFormed()) { if (!isValid) { PatternMatchContext result = entity.structurePattern.checkPatternFastAt( - entity.getWorld(), entity.getPos(), entity.getFrontFacing().getOpposite(), entity.getUpwardsFacing(), entity.allowsFlip()); + entity.getWorld(), entity.getPos(), entity.getFrontFacing().getOpposite(), + entity.getUpwardsFacing(), entity.allowsFlip()); if (result != null) { - validPos = entity.structurePattern.cache.keySet().stream().map(BlockPos::fromLong).collect(Collectors.toSet()); + validPos = entity.structurePattern.cache.keySet().stream().map(BlockPos::fromLong) + .collect(Collectors.toSet()); writePluginData(GregtechDataCodes.UPDATE_ADVANCED_VALID_POS, buf -> { buf.writeVarInt(validPos.size()); for (BlockPos pos : validPos) { @@ -262,19 +276,28 @@ public void update() { } } if (this.screen.getWorld().isRemote && spin > 0 && lastMouse == null) { - rotationPitch = (int) ((rotationPitch + spin * 4)% 360); + rotationPitch = (int) ((rotationPitch + spin * 4) % 360); } } @Override public WidgetPluginConfig customUI(WidgetPluginConfig widgetGroup, IUIHolder holder, EntityPlayer entityPlayer) { return widgetGroup.setSize(260, 170) - .widget(new WidgetScrollBar(25, 20, 210, 0.3f, 2, 0.1f, value -> setConfig(value, this.rotationPitch, this.rotationYaw, this.spin, this.connect)).setTitle("zoom", 0XFFFFFFFF).setInitValue(this.scale)) - .widget(new WidgetScrollBar(25, 40, 210, 0, 360, 1, value -> setConfig(this.scale, value.intValue(), this.rotationYaw, this.spin, this.connect)).setTitle("rotationPitch", 0XFFFFFFFF).setInitValue(this.rotationPitch)) - .widget(new WidgetScrollBar(25, 60, 210, -90, 90, 1, value -> setConfig(this.scale, this.rotationPitch, value.intValue(), this.spin, this.connect)).setTitle("rotationYaw", 0XFFFFFFFF).setInitValue(this.rotationYaw)) - .widget(new WidgetScrollBar(25, 100, 210, 0, 2, 0.1f, value -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, value, this.connect)).setTitle("spinDur", 0XFFFFFFFF).setInitValue(this.spin)) + .widget(new WidgetScrollBar(25, 20, 210, 0.3f, 2, 0.1f, + value -> setConfig(value, this.rotationPitch, this.rotationYaw, this.spin, this.connect)) + .setTitle("zoom", 0XFFFFFFFF).setInitValue(this.scale)) + .widget(new WidgetScrollBar(25, 40, 210, 0, 360, 1, + value -> setConfig(this.scale, value.intValue(), this.rotationYaw, this.spin, this.connect)) + .setTitle("rotationPitch", 0XFFFFFFFF).setInitValue(this.rotationPitch)) + .widget(new WidgetScrollBar(25, 60, 210, -90, 90, 1, + value -> setConfig(this.scale, this.rotationPitch, value.intValue(), this.spin, this.connect)) + .setTitle("rotationYaw", 0XFFFFFFFF).setInitValue(this.rotationYaw)) + .widget(new WidgetScrollBar(25, 100, 210, 0, 2, 0.1f, + value -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, value, this.connect)) + .setTitle("spinDur", 0XFFFFFFFF).setInitValue(this.spin)) .widget(new LabelWidget(25, 135, "Fake GUI:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(80, 130, 20, 20, () -> this.connect, state -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, this.spin, state))); + .widget(new ToggleButtonWidget(80, 130, 20, 20, () -> this.connect, + state -> setConfig(this.scale, this.rotationPitch, this.rotationYaw, this.spin, state))); } @Override @@ -326,7 +349,8 @@ public void readPluginData(int id, PacketBuffer buf) { this.spin = buf.readFloat(); this.connect = buf.readBoolean(); if (worldSceneRenderer != null) { - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } } @@ -348,22 +372,26 @@ private void loadValidPos(PacketBuffer buf) { @Override public void readPluginAction(EntityPlayerMP player, int id, PacketBuffer buf) { - if (id == GregtechDataCodes.ACTION_PLUGIN_CONFIG) { //open GUI + if (id == GregtechDataCodes.ACTION_PLUGIN_CONFIG) { // open GUI BlockPos pos = buf.readBlockPos(); TileEntity tileEntity = this.screen.getWorld().getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).isValid()) { - ((IGregTechTileEntity) tileEntity).getMetaTileEntity().onRightClick(player, EnumHand.MAIN_HAND, ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(), null); + ((IGregTechTileEntity) tileEntity).getMetaTileEntity().onRightClick(player, EnumHand.MAIN_HAND, + ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(), null); } } } @Override - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.screen.getWorld().isRemote) { if (this.worldSceneRenderer != null) { - RayTraceResult rayTrace = this.worldSceneRenderer.screenPos2BlockPosFace((int) (x * RESOLUTION), (int) ((1 - y) * RESOLUTION)); + RayTraceResult rayTrace = this.worldSceneRenderer.screenPos2BlockPosFace((int) (x * RESOLUTION), + (int) ((1 - y) * RESOLUTION)); if (rayTrace != null && isRight) { - writePluginAction(GregtechDataCodes.ACTION_PLUGIN_CONFIG, buf -> buf.writeBlockPos(rayTrace.getBlockPos())); + writePluginAction(GregtechDataCodes.ACTION_PLUGIN_CONFIG, + buf -> buf.writeBlockPos(rayTrace.getBlockPos())); } } } @@ -391,14 +419,16 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { GlStateManager.translate(-0.5, -0.5, 0.01); double[] currentMouse = this.screen.checkLookingAt(rayTraceResult); if (currentMouse != null) { - worldSceneRenderer.render(0, 0, 1, 1, (float)currentMouse[0], (float)currentMouse[1]); + worldSceneRenderer.render(0, 0, 1, 1, (float) currentMouse[0], (float) currentMouse[1]); if (lastMouse != null) { if (Mouse.isButtonDown(0)) { rotationPitch += (currentMouse[0] - lastMouse[0]) * 300; rotationPitch = rotationPitch % 360; - rotationYaw = (int) MathHelper.clamp(rotationYaw + (currentMouse[1] - lastMouse[1]) * 300, -89.9, 89.9); + rotationYaw = (int) MathHelper.clamp(rotationYaw + (currentMouse[1] - lastMouse[1]) * 300, + -89.9, 89.9); } - worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + worldSceneRenderer.setCameraLookAt(center, 10 / scale, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); } } else { worldSceneRenderer.render(0, 0, 1, 1, 0, 0); @@ -420,12 +450,14 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { float dY = screen.getY() - this.screen.getY() + screen.scale / 2 - 0.025f; float rX = screen.getX() - this.screen.getX() + screen.scale - 0.025f; float rY = screen.getY() - this.screen.getY() + screen.scale / 2 - 0.025f; - if ((oX - dX) * (oX - dX) + (oY - dY) * (oY - dY) > (oX - rX) * (oX - rX) + (oY - rY) * (oY - rY)) { + if ((oX - dX) * (oX - dX) + (oY - dY) * (oY - dY) > + (oX - rX) * (oX - rX) + (oY - rY) * (oY - rY)) { dX = rX; dY = rY; } RenderUtil.renderRect(dX, dY, 0.05f, 0.05f, 0.002f, screen.frameColor); - RenderUtil.renderLine(oX + 0.025f, oY + 0.025f, dX + 0.025f, dY + 0.025f, 0.01f, screen.frameColor); + RenderUtil.renderLine(oX + 0.025f, oY + 0.025f, dX + 0.025f, dY + 0.025f, 0.01f, + screen.frameColor); } } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java index e2d674ecc4d..3328ee49a26 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/FakeGuiPluginBehavior.java @@ -20,6 +20,7 @@ import gregtech.api.util.GregFakePlayer; import gregtech.common.gui.impl.FakeModularUIPluginContainer; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -44,19 +45,20 @@ public class FakeGuiPluginBehavior extends ProxyHolderPluginBehavior { private int partIndex; - //run-time + // run-time @SideOnly(Side.CLIENT) private FakeModularGui fakeModularGui; private BlockPos partPos; private FakeModularUIPluginContainer fakeModularUIContainer; private GregFakePlayer fakePlayer; - private static final Method methodCreateUI = ObfuscationReflectionHelper.findMethod(MetaTileEntity.class, "createUI", ModularUI.class, EntityPlayer.class); - static{ + private static final Method methodCreateUI = ObfuscationReflectionHelper.findMethod(MetaTileEntity.class, + "createUI", ModularUI.class, EntityPlayer.class); + static { methodCreateUI.setAccessible(true); } public void setConfig(int partIndex) { - if(this.partIndex == partIndex || partIndex < 0) return; + if (this.partIndex == partIndex || partIndex < 0) return; this.partIndex = partIndex; this.partPos = null; writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, buffer -> buffer.writeVarInt(this.partIndex)); @@ -76,13 +78,14 @@ public MetaTileEntity getRealMTE() { } } PatternMatchContext context = multi.structurePattern.checkPatternFastAt( - target.getWorld(), target.getPos(), target.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), multi.allowsFlip()); + target.getWorld(), target.getPos(), target.getFrontFacing().getOpposite(), multi.getUpwardsFacing(), + multi.allowsFlip()); if (context == null) { return null; } Set rawPartsSet = context.getOrCreate("MultiblockParts", HashSet::new); List parts = new ArrayList<>(rawPartsSet); - parts.sort(Comparator.comparing((it) -> ((MetaTileEntity)it).getPos().hashCode())); + parts.sort(Comparator.comparing((it) -> ((MetaTileEntity) it).getPos().hashCode())); if (parts.size() > partIndex - 1 && parts.get(partIndex - 1) instanceof MetaTileEntity) { target = (MetaTileEntity) parts.get(partIndex - 1); partPos = target.getPos(); @@ -125,7 +128,8 @@ public void createFakeGui() { } widgets.add(widget); } - ModularUI.Builder builder = new ModularUI.Builder(ui.backgroundPath, ui.getWidth(), ui.getHeight() - (hasPlayerInventory? 80:0)); + ModularUI.Builder builder = new ModularUI.Builder(ui.backgroundPath, ui.getWidth(), + ui.getHeight() - (hasPlayerInventory ? 80 : 0)); for (Widget widget : widgets) { builder.widget(widget); } @@ -161,7 +165,7 @@ public void writeToNBT(NBTTagCompound data) { @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - partIndex = data.hasKey("part")? data.getInteger("part"):0; + partIndex = data.hasKey("part") ? data.getInteger("part") : 0; } @Override @@ -191,7 +195,8 @@ public void update() { } else { if (partIndex > 0 && this.screen.getOffsetTimer() % 20 == 0) { if (fakeModularUIContainer != null && getRealMTE() == null) { - this.writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, buf-> buf.writeVarInt(this.partIndex)); + this.writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CONFIG, + buf -> buf.writeVarInt(this.partIndex)); fakeModularUIContainer = null; } } @@ -218,23 +223,25 @@ public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { } @Override - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.screen.getWorld().isRemote) return true; - if (fakeModularUIContainer != null && fakeModularUIContainer.modularUI != null && !ToolHelper.isTool(playerIn.getHeldItemMainhand(), ToolClasses.SCREWDRIVER)) { + if (fakeModularUIContainer != null && fakeModularUIContainer.modularUI != null && + !ToolHelper.isTool(playerIn.getHeldItemMainhand(), ToolClasses.SCREWDRIVER)) { int width = fakeModularUIContainer.modularUI.getWidth(); int height = fakeModularUIContainer.modularUI.getHeight(); float halfW = width / 2f; float halfH = height / 2f; float scale = 0.5f / Math.max(halfW, halfH); - int mouseX = (int) ((x / scale) + (halfW > halfH? 0: (halfW - halfH))); - int mouseY = (int) ((y / scale) + (halfH > halfW? 0: (halfH - halfW))); + int mouseX = (int) ((x / scale) + (halfW > halfH ? 0 : (halfW - halfH))); + int mouseY = (int) ((y / scale) + (halfH > halfW ? 0 : (halfH - halfW))); MetaTileEntity mte = getRealMTE(); - if (mte != null && 0 <= mouseX && mouseX <= width && 0 <= mouseY&& mouseY <= height) { + if (mte != null && 0 <= mouseX && mouseX <= width && 0 <= mouseY && mouseY <= height) { if (playerIn.isSneaking()) { - writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CLICK, buf->{ + writePluginData(GregtechDataCodes.UPDATE_PLUGIN_CLICK, buf -> { buf.writeVarInt(mouseX); buf.writeVarInt(mouseY); - buf.writeVarInt(isRight?1:0); + buf.writeVarInt(isRight ? 1 : 0); buf.writeVarInt(fakeModularUIContainer.syncId); }); } else { @@ -251,8 +258,7 @@ public void readPluginData(int id, PacketBuffer buf) { this.partIndex = buf.readVarInt(); this.partPos = null; createFakeGui(); - } - else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { + } else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { int windowID = buf.readVarInt(); int widgetID = buf.readVarInt(); if (fakeModularGui != null) @@ -265,7 +271,7 @@ else if (id == GregtechDataCodes.UPDATE_FAKE_GUI) { int mouseY = buf.readVarInt(); int button = buf.readVarInt(); int syncID = buf.readVarInt(); - if (fakeModularGui != null && fakeModularUIContainer != null) { + if (fakeModularGui != null && fakeModularUIContainer != null) { fakeModularUIContainer.syncId = syncID; fakeModularGui.mouseClicked(mouseX, mouseY, button); } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java index 583a17aeb2a..ec033addc52 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/OnlinePicPluginBehavior.java @@ -8,6 +8,7 @@ import gregtech.api.items.behavior.MonitorPluginBaseBehavior; import gregtech.common.gui.widget.WidgetScrollBar; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -37,7 +38,9 @@ public class OnlinePicPluginBehavior extends MonitorPluginBaseBehavior { public String error; public void setConfig(String url, float rotation, float scaleX, float scaleY, boolean flippedX, boolean flippedY) { - if (url.length() > 200 || (this.url.equals(url) && this.rotation == rotation && this.scaleX == scaleX && this.scaleY == scaleY && this.flippedX == flippedX && this.flippedY == flippedY)) return; + if (url.length() > 200 || (this.url.equals(url) && this.rotation == rotation && this.scaleX == scaleX && + this.scaleY == scaleY && this.flippedX == flippedX && this.flippedY == flippedY)) + return; this.url = url; this.rotation = rotation; this.scaleX = scaleX; @@ -57,7 +60,7 @@ public void setConfig(String url, float rotation, float scaleX, float scaleY, bo @Override public void readPluginData(int id, PacketBuffer buf) { - if(id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG){ + if (id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG) { String _url = buf.readString(200); if (!this.url.equals(_url)) { this.url = _url; @@ -87,10 +90,10 @@ public void writeToNBT(NBTTagCompound data) { @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - this.url = data.hasKey("url")? data.getString("url"):""; - this.rotation = data.hasKey("rotation")? data.getFloat("rotation"):0; - this.scaleX = data.hasKey("scaleX")? data.getFloat("scaleX"):1; - this.scaleY = data.hasKey("scaleY")? data.getFloat("scaleY"):1; + this.url = data.hasKey("url") ? data.getString("url") : ""; + this.rotation = data.hasKey("rotation") ? data.getFloat("rotation") : 0; + this.scaleX = data.hasKey("scaleX") ? data.getFloat("scaleX") : 1; + this.scaleY = data.hasKey("scaleY") ? data.getFloat("scaleY") : 1; this.flippedX = data.hasKey("flippedX") && data.getBoolean("flippedX"); this.flippedY = data.hasKey("flippedY") && data.getBoolean("flippedY"); } @@ -104,24 +107,35 @@ public MonitorPluginBaseBehavior createPlugin() { public WidgetPluginConfig customUI(WidgetPluginConfig widgetGroup, IUIHolder holder, EntityPlayer entityPlayer) { tmpUrl = url; return widgetGroup.setSize(260, 150) - .widget(new DynamicLabelWidget(20, 20, ()->url.length() > 40?(url.substring(0, 39) + "..."):url,0XFFFFFFFF)) - .widget(new TextFieldWidget(20, 30, 175, 10, true, ()-> tmpUrl, (text)->{ + .widget(new DynamicLabelWidget(20, 20, () -> url.length() > 40 ? (url.substring(0, 39) + "...") : url, + 0XFFFFFFFF)) + .widget(new TextFieldWidget(20, 30, 175, 10, true, () -> tmpUrl, (text) -> { tmpUrl = text; - }).setValidator((data)->true).setMaxStringLength(200)) - .widget(new ClickButtonWidget(200, 30, 45, 10, "confirm", pressed-> setConfig(tmpUrl, this.rotation, this.scaleX, this.scaleY, this.flippedX, this.flippedY))) - .widget(new WidgetScrollBar(25, 40, 210, -180, 180, 1, value -> setConfig(this.url, value, this.scaleX, this.scaleY, this.flippedX, this.flippedY)).setTitle("rotation", 0XFFFFFFFF).setInitValue(this.rotation)) - .widget(new WidgetScrollBar(25, 60, 210, 0, 1, 0.05f, value -> setConfig(this.url, this.rotation, value, this.scaleY, this.flippedX, this.flippedY)).setTitle("scaleX", 0XFFFFFFFF).setInitValue(this.scaleX)) - .widget(new WidgetScrollBar(25, 80, 210, 0, 1, 0.05f, value -> setConfig(this.url, this.rotation, this.scaleX, value, this.flippedX, this.flippedY)).setTitle("scaleY", 0XFFFFFFFF).setInitValue(this.scaleY)) + }).setValidator((data) -> true).setMaxStringLength(200)) + .widget(new ClickButtonWidget(200, 30, 45, 10, "confirm", + pressed -> setConfig(tmpUrl, this.rotation, this.scaleX, this.scaleY, this.flippedX, + this.flippedY))) + .widget(new WidgetScrollBar(25, 40, 210, -180, 180, 1, + value -> setConfig(this.url, value, this.scaleX, this.scaleY, this.flippedX, this.flippedY)) + .setTitle("rotation", 0XFFFFFFFF).setInitValue(this.rotation)) + .widget(new WidgetScrollBar(25, 60, 210, 0, 1, 0.05f, + value -> setConfig(this.url, this.rotation, value, this.scaleY, this.flippedX, this.flippedY)) + .setTitle("scaleX", 0XFFFFFFFF).setInitValue(this.scaleX)) + .widget(new WidgetScrollBar(25, 80, 210, 0, 1, 0.05f, + value -> setConfig(this.url, this.rotation, this.scaleX, value, this.flippedX, this.flippedY)) + .setTitle("scaleY", 0XFFFFFFFF).setInitValue(this.scaleY)) .widget(new LabelWidget(40, 115, "flippedX:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(90, 110, 20, 20, ()->this.flippedX, state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, state, this.flippedY))) + .widget(new ToggleButtonWidget(90, 110, 20, 20, () -> this.flippedX, + state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, state, this.flippedY))) .widget(new LabelWidget(140, 115, "flippedY:", 0XFFFFFFFF)) - .widget(new ToggleButtonWidget(190, 110, 20, 20, ()->this.flippedY, state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, this.flippedX, state))); + .widget(new ToggleButtonWidget(190, 110, 20, 20, () -> this.flippedY, + state -> setConfig(this.url, this.rotation, this.scaleX, this.scaleY, this.flippedX, state))); } @Override public void update() { - if(this.screen != null && this.screen.getWorld().isRemote) { - if(this.texture != null) { + if (this.screen != null && this.screen.getWorld().isRemote) { + if (this.texture != null) { texture.tick(); // gif update } } @@ -131,7 +145,8 @@ public void update() { public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { if (!this.url.isEmpty()) { if (texture != null && texture.hasTexture()) { - texture.render(-0.5f, -0.5f, 1, 1, this.rotation, this.scaleX, this.scaleY, this.flippedX, this.flippedY); + texture.render(-0.5f, -0.5f, 1, 1, this.rotation, this.scaleX, this.scaleY, this.flippedX, + this.flippedY); } else this.loadTexture(); } @@ -158,7 +173,8 @@ public void loadTexture() { if (downloader.hasFailed()) { failed = true; error = downloader.getError(); - DownloadThread.LOGGER.error("Could not load image of " + (this.screen!=null?this.screen.getPos().toString():"") + " " + error); + DownloadThread.LOGGER.error("Could not load image of " + + (this.screen != null ? this.screen.getPos().toString() : "") + " " + error); } else { texture = DownloadThread.loadImage(downloader); } diff --git a/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java b/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java index 43dd37c57ad..4c1584cbe17 100644 --- a/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/monitorplugin/TextPluginBehavior.java @@ -7,6 +7,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.common.gui.widget.WidgetARGB; import gregtech.common.gui.widget.monitor.WidgetPluginConfig; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -17,6 +18,7 @@ import java.util.Arrays; public class TextPluginBehavior extends MonitorPluginBaseBehavior { + public String[] texts; public int[] colors; @@ -36,7 +38,7 @@ public void setText(int line, String text, int color) { @Override public void readPluginData(int id, PacketBuffer buf) { - if(id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG){ + if (id == GregtechDataCodes.UPDATE_PLUGIN_CONFIG) { texts = new String[buf.readInt()]; colors = new int[texts.length]; for (int i = 0; i < texts.length; i++) { @@ -48,7 +50,7 @@ public void readPluginData(int id, PacketBuffer buf) { @Override public MonitorPluginBaseBehavior createPlugin() { - TextPluginBehavior plugin = new TextPluginBehavior(); + TextPluginBehavior plugin = new TextPluginBehavior(); plugin.texts = new String[16]; plugin.colors = new int[16]; return plugin; @@ -67,9 +69,9 @@ public void writeToNBT(NBTTagCompound data) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); for (int i = 0; i < texts.length; i++) { - texts[i] = data.hasKey("t" + i)? data.getString("t" + i) : ""; + texts[i] = data.hasKey("t" + i) ? data.getString("t" + i) : ""; } - if(data.hasKey("color")) { + if (data.hasKey("color")) { colors = data.getIntArray("color"); } else { Arrays.fill(colors, 0XFFFFFFFF); @@ -80,7 +82,7 @@ public void readFromNBT(NBTTagCompound data) { @Override public void renderPlugin(float partialTicks, RayTraceResult rayTraceResult) { for (int i = 0; i < texts.length; i++) { - RenderUtil.renderText(-0.5f, -0.4625f + i / 16f, 0.002f, 1/128f, colors[i], texts[i], false); + RenderUtil.renderText(-0.5f, -0.4625f + i / 16f, 0.002f, 1 / 128f, colors[i], texts[i], false); } } @@ -94,10 +96,11 @@ public WidgetPluginConfig customUI(WidgetPluginConfig widgets, IUIHolder holder, widgets.setSize(260, 210); for (int i = 0; i < texts.length; i++) { int finalI = i; - widgets.addWidget(new TextFieldWidget(25, 25 + i * 10, 100, 10, true, ()-> this.texts[finalI], (text)-> setText(finalI, text, this.colors[finalI])).setValidator((data)->true)); - widgets.addWidget(new WidgetARGB(135, 25 + i * 10, 10, colors[i], color-> setText(finalI, this.texts[finalI], color))); + widgets.addWidget(new TextFieldWidget(25, 25 + i * 10, 100, 10, true, () -> this.texts[finalI], + (text) -> setText(finalI, text, this.colors[finalI])).setValidator((data) -> true)); + widgets.addWidget(new WidgetARGB(135, 25 + i * 10, 10, colors[i], + color -> setText(finalI, this.texts[finalI], color))); } return widgets; } - } diff --git a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java index ac3193aa5c6..3bacf7994a8 100644 --- a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java @@ -1,11 +1,11 @@ package gregtech.common.items.tool; -import codechicken.lib.raytracer.RayTracer; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.items.tool.rotation.CustomBlockRotations; import gregtech.common.items.tool.rotation.ICustomRotationBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockRailBase; import net.minecraft.block.state.IBlockState; @@ -20,9 +20,12 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.raytracer.RayTracer; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class BlockRotatingBehavior implements IToolBehavior { @@ -31,7 +34,9 @@ public class BlockRotatingBehavior implements IToolBehavior { protected BlockRotatingBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { TileEntity te = world.getTileEntity(pos); // MTEs have special handling on rotation if (te instanceof IGregTechTileEntity) { @@ -62,7 +67,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.block_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java index 18f5193ab7b..bd58c22f24c 100644 --- a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java +++ b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -9,9 +10,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class DisableShieldBehavior implements IToolBehavior { @@ -20,7 +22,8 @@ public class DisableShieldBehavior implements IToolBehavior { protected DisableShieldBehavior() {/**/} @Override - public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) { + public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, + EntityLivingBase attacker) { return true; } @@ -30,7 +33,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.shield_disable")); } } diff --git a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java index 7d07dc16b1e..3a2c446df87 100644 --- a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java +++ b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.damagesources.DamageSources; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -10,13 +11,14 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Add to tools to have them deal bonus damage to specific mobs. * Pass null for the mobType parameter to ignore the tooltip. @@ -51,20 +53,23 @@ public EntityDamageBehavior(String mobType, Map, Float> entities) { } @Override - public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, @Nonnull EntityLivingBase attacker) { - float damageBonus = shouldDoBonusList.stream().map(func -> func.apply(target)).filter(f -> f > 0).findFirst().orElse(0f); + public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, + @Nonnull EntityLivingBase attacker) { + float damageBonus = shouldDoBonusList.stream().map(func -> func.apply(target)).filter(f -> f > 0).findFirst() + .orElse(0f); if (damageBonus != 0f) { - DamageSource source = attacker instanceof EntityPlayer - ? DamageSources.getPlayerDamage((EntityPlayer) attacker) - : DamageSources.getMobDamage(attacker); + DamageSource source = attacker instanceof EntityPlayer ? + DamageSources.getPlayerDamage((EntityPlayer) attacker) : DamageSources.getMobDamage(attacker); target.attackEntityFrom(source, damageBonus); } } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { if (mobType != null && !mobType.isEmpty()) { - tooltip.add(I18n.format("item.gt.tool.behavior.damage_boost", I18n.format("item.gt.tool.behavior.damage_boost_" + mobType))); + tooltip.add(I18n.format("item.gt.tool.behavior.damage_boost", + I18n.format("item.gt.tool.behavior.damage_boost_" + mobType))); } } } diff --git a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java index e9e7d39fa40..ad4a2dee266 100644 --- a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java +++ b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java @@ -1,9 +1,9 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; @@ -19,11 +19,14 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class GrassPathBehavior implements IToolBehavior { public static final GrassPathBehavior INSTANCE = new GrassPathBehavior(); @@ -32,7 +35,9 @@ protected GrassPathBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; ItemStack stack = player.getHeldItem(hand); @@ -63,7 +68,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } if (pathed) { - world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_SHOVEL_FLATTEN, + SoundCategory.PLAYERS, 1.0F, 1.0F); player.swingArm(hand); return EnumActionResult.SUCCESS; } @@ -71,11 +77,14 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - public static Set getPathConvertibleBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, GrassPathBehavior::isBlockPathConvertible); + public static Set getPathConvertibleBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + GrassPathBehavior::isBlockPathConvertible); } - private static boolean isBlockPathConvertible(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockPathConvertible(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block == Blocks.GRASS || block == Blocks.DIRT; // native dirt to path @@ -84,7 +93,8 @@ private static boolean isBlockPathConvertible(ItemStack stack, World world, Enti } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.grass_path")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java index d8dd25a9bd0..94c665d5dcc 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java @@ -1,10 +1,10 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.block.state.IBlockState; @@ -21,11 +21,14 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class HarvestCropsBehavior implements IToolBehavior { public static final HarvestCropsBehavior INSTANCE = new HarvestCropsBehavior(); @@ -34,9 +37,10 @@ protected HarvestCropsBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { - - if(world.isRemote) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { + if (world.isRemote) { return EnumActionResult.PASS; } ItemStack stack = player.getHeldItem(hand); @@ -45,7 +49,7 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w Set blocks; - if(aoeDefinition == AoESymmetrical.none()) { + if (aoeDefinition == AoESymmetrical.none()) { blocks = ImmutableSet.of(pos); } else { RayTraceResult rayTraceResult = ToolHelper.getPlayerDefaultRaytrace(player); @@ -54,15 +58,16 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w if (rayTraceResult.typeOfHit != RayTraceResult.Type.BLOCK) return EnumActionResult.PASS; if (rayTraceResult.sideHit == null) return EnumActionResult.PASS; - blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.world, player, rayTraceResult, HarvestCropsBehavior::isBlockCrops); - if(isBlockCrops(stack, world, player, rayTraceResult.getBlockPos(), null)) { + blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.world, player, rayTraceResult, + HarvestCropsBehavior::isBlockCrops); + if (isBlockCrops(stack, world, player, rayTraceResult.getBlockPos(), null)) { blocks.add(rayTraceResult.getBlockPos()); } } boolean harvested = false; for (BlockPos blockPos : blocks) { - if(harvestBlockRoutine(stack, blockPos, player)) { + if (harvestBlockRoutine(stack, blockPos, player)) { harvested = true; } } @@ -70,7 +75,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return harvested ? EnumActionResult.SUCCESS : EnumActionResult.PASS; } - private static boolean isBlockCrops(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockCrops(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block instanceof BlockCrops; @@ -103,14 +109,16 @@ private static void dropListOfItems(World world, BlockPos pos, List d double offX = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; double offY = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; double offZ = (GTValues.RNG.nextFloat() * f) + (1.0F - f) * 0.5D; - EntityItem entityItem = new EntityItem(world, pos.getX() + offX, pos.getY() + offY, pos.getZ() + offZ, stack); + EntityItem entityItem = new EntityItem(world, pos.getX() + offX, pos.getY() + offY, pos.getZ() + offZ, + stack); entityItem.setDefaultPickupDelay(); world.spawnEntity(entityItem); } } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.crop_harvesting")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java index c38d9f20de1..aa31daa3138 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; @@ -9,9 +10,10 @@ import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** * @see gregtech.common.ToolEventHandlers#onHarvestDrops(BlockEvent.HarvestDropsEvent) @@ -30,7 +32,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.silk_ice")); } } diff --git a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java index e647d56db81..c771191d1cf 100644 --- a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java @@ -1,9 +1,9 @@ package gregtech.common.items.tool; -import com.google.common.collect.ImmutableSet; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.aoe.AoESymmetrical; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; @@ -22,13 +22,17 @@ import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableSet; + import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** - * Used to allow a tool to hoe the ground, only if it cannot extend the {@link gregtech.api.items.toolitem.ItemGTHoe} class. + * Used to allow a tool to hoe the ground, only if it cannot extend the {@link gregtech.api.items.toolitem.ItemGTHoe} + * class. */ public class HoeGroundBehavior implements IToolBehavior { @@ -38,7 +42,9 @@ protected HoeGroundBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; ItemStack stack = player.getHeldItem(hand); @@ -57,7 +63,7 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w if (rayTraceResult.sideHit == null) return EnumActionResult.PASS; blocks = getTillableBlocks(stack, aoeDefinition, world, player, rayTraceResult); - if(isBlockTillable(stack, world, player, rayTraceResult.getBlockPos(), null)) { + if (isBlockTillable(stack, world, player, rayTraceResult.getBlockPos(), null)) { blocks.add(rayTraceResult.getBlockPos()); } } @@ -81,7 +87,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w break; } case COARSE_DIRT: { - tillGround(world, player, stack, blockPos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + tillGround(world, player, stack, blockPos, + Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); tilled = true; break; } @@ -90,7 +97,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } if (tilled) { - world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_HOE_TILL, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_HOE_TILL, + SoundCategory.PLAYERS, 1.0F, 1.0F); player.swingArm(hand); return EnumActionResult.SUCCESS; } @@ -98,11 +106,14 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, EntityPlayer player, RayTraceResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, HoeGroundBehavior::isBlockTillable); + public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, World world, + EntityPlayer player, RayTraceResult rayTraceResult) { + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + HoeGroundBehavior::isBlockTillable); } - private static boolean isBlockTillable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, @Nullable BlockPos hitBlockPos) { + private static boolean isBlockTillable(ItemStack stack, World world, EntityPlayer player, BlockPos pos, + @Nullable BlockPos hitBlockPos) { if (world.isAirBlock(pos.up())) { Block block = world.getBlockState(pos).getBlock(); return block == Blocks.GRASS || block == Blocks.GRASS_PATH || block == Blocks.DIRT; @@ -110,7 +121,8 @@ private static boolean isBlockTillable(ItemStack stack, World world, EntityPlaye return false; } - private static void tillGround(@Nonnull World world, EntityPlayer player, ItemStack stack, BlockPos pos, IBlockState state) { + private static void tillGround(@Nonnull World world, EntityPlayer player, ItemStack stack, BlockPos pos, + IBlockState state) { world.setBlockState(pos, state, 11); if (!player.isCreative()) { ToolHelper.damageItem(stack, player); @@ -118,7 +130,8 @@ private static void tillGround(@Nonnull World world, EntityPlayer player, ItemSt } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.ground_tilling")); } } diff --git a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java index ebeb8399f79..ed75344db98 100644 --- a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java +++ b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java @@ -4,6 +4,7 @@ import gregtech.api.capability.impl.VoidFluidHandlerItemStack; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -19,9 +20,10 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class PlungerBehavior implements IToolBehavior { @@ -30,7 +32,9 @@ public class PlungerBehavior implements IToolBehavior { protected PlungerBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(world, pos, facing); if (fluidHandler == null) { return EnumActionResult.PASS; @@ -50,6 +54,7 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo @Override public ICapabilityProvider createProvider(ItemStack stack, @Nullable NBTTagCompound tag) { return new VoidFluidHandlerItemStack(stack) { + @Override public int fill(FluidStack resource, boolean doFill) { int result = super.fill(resource, doFill); @@ -62,7 +67,8 @@ public int fill(FluidStack resource, boolean doFill) { } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.plunger")); } } diff --git a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java index 483aab04252..262007f9643 100644 --- a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java +++ b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.block.BlockRailBase; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -15,9 +16,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class RotateRailBehavior implements IToolBehavior { @@ -27,7 +29,9 @@ protected RotateRailBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, + @Nonnull EnumHand hand) { IBlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockRailBase) { if (world.setBlockState(pos, state.withRotation(Rotation.CLOCKWISE_90))) { @@ -39,7 +43,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.rail_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java index 3dbaea43b4b..59cd4a2d44f 100644 --- a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java @@ -3,6 +3,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; @@ -21,9 +22,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.api.items.toolitem.ToolHelper.TORCH_PLACING_KEY; @@ -35,7 +37,9 @@ protected TorchPlaceBehavior() {/**/} @Nonnull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, + @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + float hitZ) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound behaviourTag = ToolHelper.getBehaviorsTag(stack); if (behaviourTag.getBoolean(ToolHelper.TORCH_PLACING_KEY)) { @@ -70,7 +74,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w return EnumActionResult.PASS; } - private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer player, World world, BlockPos pos, + EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!slotStack.isEmpty()) { Item slotItem = slotStack.getItem(); if (slotItem instanceof ItemBlock) { @@ -84,13 +89,17 @@ private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer play if (!block.isReplaceable(world, pos)) { pos = pos.offset(facing); } - if (player.canPlayerEdit(pos, facing, slotStack) && world.mayPlace(slotBlock, pos, false, facing, player)) { + if (player.canPlayerEdit(pos, facing, slotStack) && + world.mayPlace(slotBlock, pos, false, facing, player)) { int i = slotItemBlock.getMetadata(slotStack.getMetadata()); - IBlockState slotState = slotBlock.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand); - if (slotItemBlock.placeBlockAt(slotStack, player, world, pos, facing, hitX, hitY, hitZ, slotState)) { + IBlockState slotState = slotBlock.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, + player, hand); + if (slotItemBlock.placeBlockAt(slotStack, player, world, pos, facing, hitX, hitY, hitZ, + slotState)) { slotState = world.getBlockState(pos); SoundType soundtype = slotState.getBlock().getSoundType(slotState, world, pos, player); - world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); + world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, + (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); if (!player.isCreative()) slotStack.shrink(1); return true; } @@ -107,7 +116,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.torch_place")); } } diff --git a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java index 38cd033fcfc..06046b9c447 100644 --- a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; @@ -11,12 +12,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; /** - * The Tree Felling Behavior must be handled in a special way in {@link gregtech.api.items.toolitem.IGTTool#definition$onBlockStartBreak(ItemStack, BlockPos, EntityPlayer)} + * The Tree Felling Behavior must be handled in a special way in + * {@link gregtech.api.items.toolitem.IGTTool#definition$onBlockStartBreak(ItemStack, BlockPos, EntityPlayer)} * * @see gregtech.api.items.toolitem.ToolHelper#treeFellingRoutine(EntityPlayerMP, ItemStack, BlockPos) */ @@ -32,7 +35,8 @@ public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, @Nonnull ITooltipFlag flag) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, + @Nonnull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.tree_felling")); } } diff --git a/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java index 94cd7c3f8c3..c684ae749d9 100644 --- a/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java +++ b/src/main/java/gregtech/common/items/tool/rotation/CustomBlockRotations.java @@ -1,7 +1,7 @@ package gregtech.common.items.tool.rotation; import gregtech.api.cover.CoverRayTracer; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockHopper; @@ -12,6 +12,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.ApiStatus; import java.util.Map; @@ -35,6 +37,7 @@ public static ICustomRotationBehavior getCustomRotation(Block block) { } public static final ICustomRotationBehavior BLOCK_HORIZONTAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); @@ -56,6 +59,7 @@ public boolean showXOnSide(IBlockState state, EnumFacing facing) { }; public static final ICustomRotationBehavior BLOCK_DIRECTIONAL_BEHAVIOR = new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); @@ -97,6 +101,7 @@ private enum CustomRotations { // Cannot face up, and uses a custom BlockState property key HOPPER(Blocks.HOPPER, new ICustomRotationBehavior() { + @Override public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); diff --git a/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java index f39c3cdcb1d..0d4833617ce 100644 --- a/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java +++ b/src/main/java/gregtech/common/items/tool/rotation/ICustomRotationBehavior.java @@ -9,7 +9,10 @@ public interface ICustomRotationBehavior { - /** Custom implementation of {@link Block#rotateBlock(World, BlockPos, EnumFacing)} for when that behavior isn't ideal. */ + /** + * Custom implementation of {@link Block#rotateBlock(World, BlockPos, EnumFacing)} for when that behavior isn't + * ideal. + */ boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult); /** Whether to show the 9-sectioned highlight grid when looking at this block while holding a Wrench. */ diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 2bd9f3efa0a..912811fa70a 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -48,6 +48,7 @@ import gregtech.common.pipelike.fluidpipe.longdistance.MetaTileEntityLDFluidEndpoint; import gregtech.common.pipelike.itempipe.longdistance.MetaTileEntityLDItemEndpoint; import gregtech.integration.jei.multiblock.MultiblockInfoCategory; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Loader; @@ -60,62 +61,92 @@ public class MetaTileEntities { - //HULLS + // HULLS public static final MetaTileEntityHull[] HULL = new MetaTileEntityHull[GTValues.V.length]; - public static final MetaTileEntityTransformer[] TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no MAX - public static final MetaTileEntityTransformer[] HI_AMP_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; /// no MAX - public static final MetaTileEntityTransformer[] POWER_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no MAX + public static final MetaTileEntityTransformer[] TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - 1]; // no + // MAX + public static final MetaTileEntityTransformer[] HI_AMP_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - + 1]; /// no MAX + public static final MetaTileEntityTransformer[] POWER_TRANSFORMER = new MetaTileEntityTransformer[GTValues.V.length - + 1]; // no MAX public static final MetaTileEntityDiode[] DIODES = new MetaTileEntityDiode[GTValues.V.length]; public static final MetaTileEntityBatteryBuffer[][] BATTERY_BUFFER = new MetaTileEntityBatteryBuffer[3][GTValues.V.length]; public static final MetaTileEntityCharger[] CHARGER = new MetaTileEntityCharger[GTValues.V.length]; - //SIMPLE MACHINES SECTION - public static final SimpleMachineMetaTileEntity[] ELECTRIC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] MACERATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ALLOY_SMELTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ARC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] AUTOCLAVE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // SIMPLE MACHINES SECTION + public static final SimpleMachineMetaTileEntity[] ELECTRIC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] MACERATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ALLOY_SMELTER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ARC_FURNACE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] AUTOCLAVE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] BENDER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] BREWERY = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] CANNER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CHEMICAL_BATH = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CHEMICAL_REACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] COMPRESSOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] CHEMICAL_BATH = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] CHEMICAL_REACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] COMPRESSOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] CUTTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] DISTILLERY = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ELECTROLYZER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ELECTROMAGNETIC_SEPARATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] EXTRACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] DISTILLERY = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ELECTROLYZER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] ELECTROMAGNETIC_SEPARATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] EXTRACTOR = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] EXTRUDER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FERMENTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FLUID_HEATER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FLUID_SOLIDIFIER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FORGE_HAMMER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] FORMING_PRESS = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] FERMENTER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FLUID_HEATER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FLUID_SOLIDIFIER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FORGE_HAMMER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] FORMING_PRESS = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] LATHE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] MIXER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] ORE_WASHER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] ORE_WASHER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] PACKER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; public static final SimpleMachineMetaTileEntity[] UNPACKER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] POLARIZER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] LASER_ENGRAVER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] POLARIZER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; + public static final SimpleMachineMetaTileEntity[] LASER_ENGRAVER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] SIFTER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] THERMAL_CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] THERMAL_CENTRIFUGE = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; public static final SimpleMachineMetaTileEntity[] WIREMILL = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] CIRCUIT_ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] CIRCUIT_ASSEMBLER = new SimpleMachineMetaTileEntity[GTValues.V.length - + 1]; // TODO Replication system - //public static final SimpleMachineMetaTileEntity[] MASS_FABRICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - //public static final SimpleMachineMetaTileEntity[] REPLICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // public static final SimpleMachineMetaTileEntity[] MASS_FABRICATOR = new + // SimpleMachineMetaTileEntity[GTValues.V.length - 1]; + // public static final SimpleMachineMetaTileEntity[] REPLICATOR = new SimpleMachineMetaTileEntity[GTValues.V.length + // - 1]; public static final SimpleMachineMetaTileEntity[] SCANNER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1]; - public static final SimpleMachineMetaTileEntity[] GAS_COLLECTOR = new MetaTileEntityGasCollector[GTValues.V.length - 1]; + public static final SimpleMachineMetaTileEntity[] GAS_COLLECTOR = new MetaTileEntityGasCollector[GTValues.V.length - + 1]; public static final MetaTileEntityRockBreaker[] ROCK_BREAKER = new MetaTileEntityRockBreaker[GTValues.V.length - 1]; public static final MetaTileEntityMiner[] MINER = new MetaTileEntityMiner[GTValues.V.length - 1]; - //GENERATORS SECTION + // GENERATORS SECTION public static final SimpleGeneratorMetaTileEntity[] COMBUSTION_GENERATOR = new SimpleGeneratorMetaTileEntity[4]; public static final SimpleGeneratorMetaTileEntity[] STEAM_TURBINE = new SimpleGeneratorMetaTileEntity[4]; public static final SimpleGeneratorMetaTileEntity[] GAS_TURBINE = new SimpleGeneratorMetaTileEntity[4]; - //MULTIBLOCK PARTS SECTION + // MULTIBLOCK PARTS SECTION public static final MetaTileEntityItemBus[] ITEM_IMPORT_BUS = new MetaTileEntityItemBus[GTValues.UHV + 1]; // ULV-UHV public static final MetaTileEntityItemBus[] ITEM_EXPORT_BUS = new MetaTileEntityItemBus[GTValues.UHV + 1]; public static final MetaTileEntityFluidHatch[] FLUID_IMPORT_HATCH = new MetaTileEntityFluidHatch[GTValues.UHV + 1]; @@ -125,14 +156,39 @@ public class MetaTileEntities { public static final MetaTileEntityMultiFluidHatch[] QUADRUPLE_EXPORT_HATCH = new MetaTileEntityMultiFluidHatch[6]; // EV-UHV public static final MetaTileEntityMultiFluidHatch[] NONUPLE_EXPORT_HATCH = new MetaTileEntityMultiFluidHatch[6]; // EV-UHV public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH = new MetaTileEntityEnergyHatch[GTValues.V.length]; - public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, + // LuV, + // ZPM, + // UV, UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_INPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH = new MetaTileEntityEnergyHatch[GTValues.V.length]; - public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_INPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_OUTPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, LuV, ZPM, UV, UHV - public static final MetaTileEntityRotorHolder[] ROTOR_HOLDER = new MetaTileEntityRotorHolder[6]; //HV, EV, IV, LuV, ZPM, UV + public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_4A = new MetaTileEntityEnergyHatch[6]; // EV, + // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntityEnergyHatch[] ENERGY_OUTPUT_HATCH_16A = new MetaTileEntityEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_INPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntitySubstationEnergyHatch[] SUBSTATION_ENERGY_OUTPUT_HATCH = new MetaTileEntitySubstationEnergyHatch[5]; // IV, + // LuV, + // ZPM, + // UV, + // UHV + public static final MetaTileEntityRotorHolder[] ROTOR_HOLDER = new MetaTileEntityRotorHolder[6]; // HV, EV, IV, LuV, + // ZPM, UV public static final MetaTileEntityMufflerHatch[] MUFFLER_HATCH = new MetaTileEntityMufflerHatch[GTValues.UV]; // LV-UV public static final MetaTileEntityFusionReactor[] FUSION_REACTOR = new MetaTileEntityFusionReactor[3]; public static final MetaTileEntityQuantumChest[] QUANTUM_CHEST = new MetaTileEntityQuantumChest[10]; @@ -171,7 +227,7 @@ public class MetaTileEntities { // Used for addons if they wish to disable certain tiers of machines private static final Map MID_TIER = new HashMap<>(); private static final Map HIGH_TIER = new HashMap<>(); - //STEAM AGE SECTION + // STEAM AGE SECTION public static SteamCoalBoiler STEAM_BOILER_COAL_BRONZE; public static SteamCoalBoiler STEAM_BOILER_COAL_STEEL; public static SteamSolarBoiler STEAM_BOILER_SOLAR_BRONZE; @@ -204,7 +260,7 @@ public class MetaTileEntities { public static MetaTileEntityMaintenanceHatch CONFIGURABLE_MAINTENANCE_HATCH; public static MetaTileEntityAutoMaintenanceHatch AUTO_MAINTENANCE_HATCH; public static MetaTileEntityCleaningMaintenanceHatch CLEANING_MAINTENANCE_HATCH; - //MULTIBLOCKS SECTION + // MULTIBLOCKS SECTION public static MetaTileEntityPrimitiveBlastFurnace PRIMITIVE_BLAST_FURNACE; public static MetaTileEntityCokeOven COKE_OVEN; public static MetaTileEntityElectricBlastFurnace ELECTRIC_BLAST_FURNACE; @@ -244,7 +300,7 @@ public class MetaTileEntities { public static MetaTileEntityPowerSubstation POWER_SUBSTATION; public static MetaTileEntityActiveTransformer ACTIVE_TRANSFORMER; - //STORAGE SECTION + // STORAGE SECTION public static MetaTileEntityLockedSafe LOCKED_SAFE; public static MetaTileEntityTankValve WOODEN_TANK_VALVE; public static MetaTileEntityTankValve STEEL_TANK_VALVE; @@ -265,7 +321,7 @@ public class MetaTileEntities { public static MetaTileEntityCrate STAINLESS_STEEL_CRATE; public static MetaTileEntityCrate TITANIUM_CRATE; public static MetaTileEntityCrate TUNGSTENSTEEL_CRATE; - //MISC MACHINES SECTION + // MISC MACHINES SECTION public static MetaTileEntityWorkbench WORKBENCH; public static MetaTileEntityCreativeEnergy CREATIVE_ENERGY; public static MetaTileEntityCreativeTank CREATIVE_TANK; @@ -286,23 +342,35 @@ public class MetaTileEntities { public static void init() { GTLog.logger.info("Registering MetaTileEntities"); - STEAM_BOILER_COAL_BRONZE = registerMetaTileEntity(1, new SteamCoalBoiler(gregtechId("steam_boiler_coal_bronze"), false)); - STEAM_BOILER_COAL_STEEL = registerMetaTileEntity(2, new SteamCoalBoiler(gregtechId("steam_boiler_coal_steel"), true)); + STEAM_BOILER_COAL_BRONZE = registerMetaTileEntity(1, + new SteamCoalBoiler(gregtechId("steam_boiler_coal_bronze"), false)); + STEAM_BOILER_COAL_STEEL = registerMetaTileEntity(2, + new SteamCoalBoiler(gregtechId("steam_boiler_coal_steel"), true)); - STEAM_BOILER_SOLAR_BRONZE = registerMetaTileEntity(3, new SteamSolarBoiler(gregtechId("steam_boiler_solar_bronze"), false)); - STEAM_BOILER_SOLAR_STEEL = registerMetaTileEntity(4, new SteamSolarBoiler(gregtechId("steam_boiler_solar_steel"), true)); + STEAM_BOILER_SOLAR_BRONZE = registerMetaTileEntity(3, + new SteamSolarBoiler(gregtechId("steam_boiler_solar_bronze"), false)); + STEAM_BOILER_SOLAR_STEEL = registerMetaTileEntity(4, + new SteamSolarBoiler(gregtechId("steam_boiler_solar_steel"), true)); - STEAM_BOILER_LAVA_BRONZE = registerMetaTileEntity(5, new SteamLavaBoiler(gregtechId("steam_boiler_lava_bronze"), false)); - STEAM_BOILER_LAVA_STEEL = registerMetaTileEntity(6, new SteamLavaBoiler(gregtechId("steam_boiler_lava_steel"), true)); + STEAM_BOILER_LAVA_BRONZE = registerMetaTileEntity(5, + new SteamLavaBoiler(gregtechId("steam_boiler_lava_bronze"), false)); + STEAM_BOILER_LAVA_STEEL = registerMetaTileEntity(6, + new SteamLavaBoiler(gregtechId("steam_boiler_lava_steel"), true)); - STEAM_EXTRACTOR_BRONZE = registerMetaTileEntity(7, new SteamExtractor(gregtechId("steam_extractor_bronze"), false)); - STEAM_EXTRACTOR_STEEL = registerMetaTileEntity(8, new SteamExtractor(gregtechId("steam_extractor_steel"), true)); + STEAM_EXTRACTOR_BRONZE = registerMetaTileEntity(7, + new SteamExtractor(gregtechId("steam_extractor_bronze"), false)); + STEAM_EXTRACTOR_STEEL = registerMetaTileEntity(8, + new SteamExtractor(gregtechId("steam_extractor_steel"), true)); - STEAM_MACERATOR_BRONZE = registerMetaTileEntity(9, new SteamMacerator(gregtechId("steam_macerator_bronze"), false)); - STEAM_MACERATOR_STEEL = registerMetaTileEntity(10, new SteamMacerator(gregtechId("steam_macerator_steel"), true)); + STEAM_MACERATOR_BRONZE = registerMetaTileEntity(9, + new SteamMacerator(gregtechId("steam_macerator_bronze"), false)); + STEAM_MACERATOR_STEEL = registerMetaTileEntity(10, + new SteamMacerator(gregtechId("steam_macerator_steel"), true)); - STEAM_COMPRESSOR_BRONZE = registerMetaTileEntity(11, new SteamCompressor(gregtechId("steam_compressor_bronze"), false)); - STEAM_COMPRESSOR_STEEL = registerMetaTileEntity(12, new SteamCompressor(gregtechId("steam_compressor_steel"), true)); + STEAM_COMPRESSOR_BRONZE = registerMetaTileEntity(11, + new SteamCompressor(gregtechId("steam_compressor_bronze"), false)); + STEAM_COMPRESSOR_STEEL = registerMetaTileEntity(12, + new SteamCompressor(gregtechId("steam_compressor_steel"), true)); STEAM_HAMMER_BRONZE = registerMetaTileEntity(13, new SteamHammer(gregtechId("steam_hammer_bronze"), false)); STEAM_HAMMER_STEEL = registerMetaTileEntity(14, new SteamHammer(gregtechId("steam_hammer_steel"), true)); @@ -310,37 +378,43 @@ public static void init() { STEAM_FURNACE_BRONZE = registerMetaTileEntity(15, new SteamFurnace(gregtechId("steam_furnace_bronze"), false)); STEAM_FURNACE_STEEL = registerMetaTileEntity(16, new SteamFurnace(gregtechId("steam_furnace_steel"), true)); - STEAM_ALLOY_SMELTER_BRONZE = registerMetaTileEntity(17, new SteamAlloySmelter(gregtechId("steam_alloy_smelter_bronze"), false)); - STEAM_ALLOY_SMELTER_STEEL = registerMetaTileEntity(18, new SteamAlloySmelter(gregtechId("steam_alloy_smelter_steel"), true)); + STEAM_ALLOY_SMELTER_BRONZE = registerMetaTileEntity(17, + new SteamAlloySmelter(gregtechId("steam_alloy_smelter_bronze"), false)); + STEAM_ALLOY_SMELTER_STEEL = registerMetaTileEntity(18, + new SteamAlloySmelter(gregtechId("steam_alloy_smelter_steel"), true)); - STEAM_ROCK_BREAKER_BRONZE = registerMetaTileEntity(19, new SteamRockBreaker(gregtechId("steam_rock_breaker_bronze"), false)); - STEAM_ROCK_BREAKER_STEEL = registerMetaTileEntity(20, new SteamRockBreaker(gregtechId("steam_rock_breaker_steel"), true)); + STEAM_ROCK_BREAKER_BRONZE = registerMetaTileEntity(19, + new SteamRockBreaker(gregtechId("steam_rock_breaker_bronze"), false)); + STEAM_ROCK_BREAKER_STEEL = registerMetaTileEntity(20, + new SteamRockBreaker(gregtechId("steam_rock_breaker_steel"), true)); STEAM_MINER = registerMetaTileEntity(21, new SteamMiner(gregtechId("steam_miner"), 320, 4, 0)); // Electric Furnace, IDs 50-64 - registerSimpleMetaTileEntity(ELECTRIC_FURNACE, 50, "electric_furnace", RecipeMaps.FURNACE_RECIPES, Textures.ELECTRIC_FURNACE_OVERLAY, true); + registerSimpleMetaTileEntity(ELECTRIC_FURNACE, 50, "electric_furnace", RecipeMaps.FURNACE_RECIPES, + Textures.ELECTRIC_FURNACE_OVERLAY, true); // Macerator, IDs 65-79 - registerMetaTileEntities(MACERATOR, 65, "macerator", (tier, voltageName) -> - new SimpleMachineMetaTileEntityResizable( + registerMetaTileEntities(MACERATOR, 65, "macerator", + (tier, voltageName) -> new SimpleMachineMetaTileEntityResizable( gregtechId(String.format("%s.%s", "macerator", voltageName)), RecipeMaps.MACERATOR_RECIPES, -1, switch (tier) { - case 1, 2 -> 1; - case 3 -> 3; - default -> 4; + case 1, 2 -> 1; + case 3 -> 3; + default -> 4; }, tier <= GTValues.MV ? Textures.MACERATOR_OVERLAY : Textures.PULVERIZER_OVERLAY, tier)); // Alloy Smelter, IDs 80-94 - registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, Textures.ALLOY_SMELTER_OVERLAY, true); + registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, + Textures.ALLOY_SMELTER_OVERLAY, true); // Arc Furnace, IDs 95-109 - registerMetaTileEntities(ARC_FURNACE, 95, "arc_furnace", (tier, voltageName) -> - new SimpleMachineMetaTileEntityResizable( + registerMetaTileEntities(ARC_FURNACE, 95, "arc_furnace", + (tier, voltageName) -> new SimpleMachineMetaTileEntityResizable( gregtechId(String.format("%s.%s", "arc_furnace", voltageName)), RecipeMaps.ARC_FURNACE_RECIPES, -1, @@ -351,84 +425,107 @@ public static void init() { GTUtility.hvCappedTankSizeFunction)); // Assembler, IDs 110-124 - registerSimpleMetaTileEntity(ASSEMBLER, 110, "assembler", RecipeMaps.ASSEMBLER_RECIPES, Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(ASSEMBLER, 110, "assembler", RecipeMaps.ASSEMBLER_RECIPES, + Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Autoclave, IDs 125-139 - registerSimpleMetaTileEntity(AUTOCLAVE, 125, "autoclave", RecipeMaps.AUTOCLAVE_RECIPES, Textures.AUTOCLAVE_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(AUTOCLAVE, 125, "autoclave", RecipeMaps.AUTOCLAVE_RECIPES, + Textures.AUTOCLAVE_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); // Bender, IDs 140-154 registerSimpleMetaTileEntity(BENDER, 140, "bender", RecipeMaps.BENDER_RECIPES, Textures.BENDER_OVERLAY, true); // Brewery, IDs 155-169 - registerSimpleMetaTileEntity(BREWERY, 155, "brewery", RecipeMaps.BREWING_RECIPES, Textures.BREWERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(BREWERY, 155, "brewery", RecipeMaps.BREWING_RECIPES, Textures.BREWERY_OVERLAY, + true, GTUtility.hvCappedTankSizeFunction); // Canner, IDs 170-184 registerSimpleMetaTileEntity(CANNER, 170, "canner", RecipeMaps.CANNER_RECIPES, Textures.CANNER_OVERLAY, true); // Centrifuge, IDs 185-199 - registerSimpleMetaTileEntity(CENTRIFUGE, 185, "centrifuge", RecipeMaps.CENTRIFUGE_RECIPES, Textures.CENTRIFUGE_OVERLAY, false, GTUtility.largeTankSizeFunction); + registerSimpleMetaTileEntity(CENTRIFUGE, 185, "centrifuge", RecipeMaps.CENTRIFUGE_RECIPES, + Textures.CENTRIFUGE_OVERLAY, false, GTUtility.largeTankSizeFunction); // Chemical Bath, IDs 200-214 - registerSimpleMetaTileEntity(CHEMICAL_BATH, 200, "chemical_bath", RecipeMaps.CHEMICAL_BATH_RECIPES, Textures.CHEMICAL_BATH_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(CHEMICAL_BATH, 200, "chemical_bath", RecipeMaps.CHEMICAL_BATH_RECIPES, + Textures.CHEMICAL_BATH_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Chemical Reactor, IDs 215-229 - registerSimpleMetaTileEntity(CHEMICAL_REACTOR, 215, "chemical_reactor", RecipeMaps.CHEMICAL_RECIPES, Textures.CHEMICAL_REACTOR_OVERLAY, true, tier -> 16000); + registerSimpleMetaTileEntity(CHEMICAL_REACTOR, 215, "chemical_reactor", RecipeMaps.CHEMICAL_RECIPES, + Textures.CHEMICAL_REACTOR_OVERLAY, true, tier -> 16000); // Compressor, IDs 230-244 - registerSimpleMetaTileEntity(COMPRESSOR, 230, "compressor", RecipeMaps.COMPRESSOR_RECIPES, Textures.COMPRESSOR_OVERLAY, true); + registerSimpleMetaTileEntity(COMPRESSOR, 230, "compressor", RecipeMaps.COMPRESSOR_RECIPES, + Textures.COMPRESSOR_OVERLAY, true); // Cutter, IDs 245-259 registerSimpleMetaTileEntity(CUTTER, 245, "cutter", RecipeMaps.CUTTER_RECIPES, Textures.CUTTER_OVERLAY, true); // Distillery, IDs 260-274 - registerSimpleMetaTileEntity(DISTILLERY, 260, "distillery", RecipeMaps.DISTILLERY_RECIPES, Textures.DISTILLERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(DISTILLERY, 260, "distillery", RecipeMaps.DISTILLERY_RECIPES, + Textures.DISTILLERY_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Electrolyzer, IDs 275-289 - registerSimpleMetaTileEntity(ELECTROLYZER, 275, "electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES, Textures.ELECTROLYZER_OVERLAY, false, GTUtility.largeTankSizeFunction); + registerSimpleMetaTileEntity(ELECTROLYZER, 275, "electrolyzer", RecipeMaps.ELECTROLYZER_RECIPES, + Textures.ELECTROLYZER_OVERLAY, false, GTUtility.largeTankSizeFunction); // Electromagnetic Separator, IDs 290-304 - registerSimpleMetaTileEntity(ELECTROMAGNETIC_SEPARATOR, 290, "electromagnetic_separator", RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES, Textures.ELECTROMAGNETIC_SEPARATOR_OVERLAY, true); + registerSimpleMetaTileEntity(ELECTROMAGNETIC_SEPARATOR, 290, "electromagnetic_separator", + RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES, Textures.ELECTROMAGNETIC_SEPARATOR_OVERLAY, true); // Extractor, IDs 305-319 - registerSimpleMetaTileEntity(EXTRACTOR, 305, "extractor", RecipeMaps.EXTRACTOR_RECIPES, Textures.EXTRACTOR_OVERLAY, true); + registerSimpleMetaTileEntity(EXTRACTOR, 305, "extractor", RecipeMaps.EXTRACTOR_RECIPES, + Textures.EXTRACTOR_OVERLAY, true); // Extruder, IDs 320-334 - registerSimpleMetaTileEntity(EXTRUDER, 320, "extruder", RecipeMaps.EXTRUDER_RECIPES, Textures.EXTRUDER_OVERLAY, true); + registerSimpleMetaTileEntity(EXTRUDER, 320, "extruder", RecipeMaps.EXTRUDER_RECIPES, Textures.EXTRUDER_OVERLAY, + true); // Fermenter, IDs 335-349 - registerSimpleMetaTileEntity(FERMENTER, 335, "fermenter", RecipeMaps.FERMENTING_RECIPES, Textures.FERMENTER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FERMENTER, 335, "fermenter", RecipeMaps.FERMENTING_RECIPES, + Textures.FERMENTER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // TODO Replication system // Mass Fabricator, IDs 350-364 - //registerSimpleMetaTileEntity(MASS_FABRICATOR, 350, "mass_fabricator", RecipeMaps.MASS_FABRICATOR_RECIPES, Textures.MASS_FABRICATOR_OVERLAY, true); + // registerSimpleMetaTileEntity(MASS_FABRICATOR, 350, "mass_fabricator", RecipeMaps.MASS_FABRICATOR_RECIPES, + // Textures.MASS_FABRICATOR_OVERLAY, true); - // TODO Should anonymously override SimpleMachineMetaTileEntity#getCircuitSlotOverlay() to display the data stick overlay + // TODO Should anonymously override SimpleMachineMetaTileEntity#getCircuitSlotOverlay() to display the data + // stick overlay // Replicator, IDs 365-379 - //registerSimpleMetaTileEntity(REPLICATOR, 365, "replicator", RecipeMaps.REPLICATOR_RECIPES, Textures.REPLICATOR_OVERLAY, true); + // registerSimpleMetaTileEntity(REPLICATOR, 365, "replicator", RecipeMaps.REPLICATOR_RECIPES, + // Textures.REPLICATOR_OVERLAY, true); // Fluid Heater, IDs 380-394 - registerSimpleMetaTileEntity(FLUID_HEATER, 380, "fluid_heater", RecipeMaps.FLUID_HEATER_RECIPES, Textures.FLUID_HEATER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FLUID_HEATER, 380, "fluid_heater", RecipeMaps.FLUID_HEATER_RECIPES, + Textures.FLUID_HEATER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Fluid Solidifier, IDs 395-409 - registerSimpleMetaTileEntity(FLUID_SOLIDIFIER, 395, "fluid_solidifier", RecipeMaps.FLUID_SOLIDFICATION_RECIPES, Textures.FLUID_SOLIDIFIER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(FLUID_SOLIDIFIER, 395, "fluid_solidifier", RecipeMaps.FLUID_SOLIDFICATION_RECIPES, + Textures.FLUID_SOLIDIFIER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Forge Hammer, IDs 410-424 - registerSimpleMetaTileEntity(FORGE_HAMMER, 410, "forge_hammer", RecipeMaps.FORGE_HAMMER_RECIPES, Textures.FORGE_HAMMER_OVERLAY, true); + registerSimpleMetaTileEntity(FORGE_HAMMER, 410, "forge_hammer", RecipeMaps.FORGE_HAMMER_RECIPES, + Textures.FORGE_HAMMER_OVERLAY, true); // Forming Press, IDs 425-439 - registerSimpleMetaTileEntity(FORMING_PRESS, 425, "forming_press", RecipeMaps.FORMING_PRESS_RECIPES, Textures.FORMING_PRESS_OVERLAY, true); + registerSimpleMetaTileEntity(FORMING_PRESS, 425, "forming_press", RecipeMaps.FORMING_PRESS_RECIPES, + Textures.FORMING_PRESS_OVERLAY, true); // Lathe, IDs 440-454 registerSimpleMetaTileEntity(LATHE, 440, "lathe", RecipeMaps.LATHE_RECIPES, Textures.LATHE_OVERLAY, true); // Scanner, IDs 455-469 - registerSimpleMetaTileEntity(SCANNER, 455, "scanner", RecipeMaps.SCANNER_RECIPES, Textures.SCANNER_OVERLAY, true); + registerSimpleMetaTileEntity(SCANNER, 455, "scanner", RecipeMaps.SCANNER_RECIPES, Textures.SCANNER_OVERLAY, + true); // Mixer, IDs 470-484 - registerSimpleMetaTileEntity(MIXER, 470, "mixer", RecipeMaps.MIXER_RECIPES, Textures.MIXER_OVERLAY, false, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(MIXER, 470, "mixer", RecipeMaps.MIXER_RECIPES, Textures.MIXER_OVERLAY, false, + GTUtility.hvCappedTankSizeFunction); // Ore Washer, IDs 485-499 - registerSimpleMetaTileEntity(ORE_WASHER, 485, "ore_washer", RecipeMaps.ORE_WASHER_RECIPES, Textures.ORE_WASHER_OVERLAY, true); + registerSimpleMetaTileEntity(ORE_WASHER, 485, "ore_washer", RecipeMaps.ORE_WASHER_RECIPES, + Textures.ORE_WASHER_OVERLAY, true); // Packer, IDs 500-514 registerSimpleMetaTileEntity(PACKER, 500, "packer", RecipeMaps.PACKER_RECIPES, Textures.PACKER_OVERLAY, true); @@ -436,12 +533,18 @@ public static void init() { // FREE, IDs 515-529 // Gas Collectors, IDs 530-544 - registerMetaTileEntities(GAS_COLLECTOR, 530, "gas_collector", (tier, voltageName) -> new MetaTileEntityGasCollector(gregtechId(String.format("%s.%s", "gas_collector", voltageName)), RecipeMaps.GAS_COLLECTOR_RECIPES, Textures.GAS_COLLECTOR_OVERLAY, tier, false, GTUtility.largeTankSizeFunction)); + registerMetaTileEntities(GAS_COLLECTOR, 530, "gas_collector", + (tier, voltageName) -> new MetaTileEntityGasCollector( + gregtechId(String.format("%s.%s", "gas_collector", voltageName)), + RecipeMaps.GAS_COLLECTOR_RECIPES, Textures.GAS_COLLECTOR_OVERLAY, tier, false, + GTUtility.largeTankSizeFunction)); // Polarizer, IDs 545-559 - registerSimpleMetaTileEntity(POLARIZER, 545, "polarizer", RecipeMaps.POLARIZER_RECIPES, Textures.POLARIZER_OVERLAY, true); + registerSimpleMetaTileEntity(POLARIZER, 545, "polarizer", RecipeMaps.POLARIZER_RECIPES, + Textures.POLARIZER_OVERLAY, true); // Laser Engraver, IDs 560-574 - registerSimpleMetaTileEntity(LASER_ENGRAVER, 560, "laser_engraver", RecipeMaps.LASER_ENGRAVER_RECIPES, Textures.LASER_ENGRAVER_OVERLAY, true); + registerSimpleMetaTileEntity(LASER_ENGRAVER, 560, "laser_engraver", RecipeMaps.LASER_ENGRAVER_RECIPES, + Textures.LASER_ENGRAVER_OVERLAY, true); // Sifter, IDs 575-589 registerSimpleMetaTileEntity(SIFTER, 575, "sifter", RecipeMaps.SIFTER_RECIPES, Textures.SIFTER_OVERLAY, true); @@ -449,16 +552,22 @@ public static void init() { // FREE, IDs 590-604 // Thermal Centrifuge, IDs 605-619 - registerSimpleMetaTileEntity(THERMAL_CENTRIFUGE, 605, "thermal_centrifuge", RecipeMaps.THERMAL_CENTRIFUGE_RECIPES, Textures.THERMAL_CENTRIFUGE_OVERLAY, true); + registerSimpleMetaTileEntity(THERMAL_CENTRIFUGE, 605, "thermal_centrifuge", + RecipeMaps.THERMAL_CENTRIFUGE_RECIPES, Textures.THERMAL_CENTRIFUGE_OVERLAY, true); // Wire Mill, IDs 620-634 - registerSimpleMetaTileEntity(WIREMILL, 620, "wiremill", RecipeMaps.WIREMILL_RECIPES, Textures.WIREMILL_OVERLAY, true); + registerSimpleMetaTileEntity(WIREMILL, 620, "wiremill", RecipeMaps.WIREMILL_RECIPES, Textures.WIREMILL_OVERLAY, + true); // Circuit Assembler, IDs 650-664 - registerSimpleMetaTileEntity(CIRCUIT_ASSEMBLER, 635, "circuit_assembler", RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES, Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); + registerSimpleMetaTileEntity(CIRCUIT_ASSEMBLER, 635, "circuit_assembler", RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES, + Textures.ASSEMBLER_OVERLAY, true, GTUtility.hvCappedTankSizeFunction); // Rock Breaker, IDs 665-679 - registerMetaTileEntities(ROCK_BREAKER, 665, "rock_breaker", (tier, voltageName) -> new MetaTileEntityRockBreaker(gregtechId(String.format("%s.%s", "rock_breaker", voltageName)), RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, tier)); + registerMetaTileEntities(ROCK_BREAKER, 665, "rock_breaker", + (tier, voltageName) -> new MetaTileEntityRockBreaker( + gregtechId(String.format("%s.%s", "rock_breaker", voltageName)), + RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, tier)); // Some space here for more SimpleMachines @@ -471,27 +580,53 @@ public static void init() { MINER[2] = registerMetaTileEntity(922, new MetaTileEntityMiner(gregtechId("miner.hv"), 3, 40, 24, 3)); // Diesel Generator, IDs 935-949 - COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.lv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.mv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.hv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.lv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1, + GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.mv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2, + GTUtility.genericGeneratorTankSizeFunction)); + COMBUSTION_GENERATOR[2] = registerMetaTileEntity(937, + new MetaTileEntitySingleCombustion(gregtechId("combustion_generator.hv"), + RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 3, + GTUtility.genericGeneratorTankSizeFunction)); // Steam Turbine, IDs 950-964 - STEAM_TURBINE[0] = registerMetaTileEntity(950, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[1] = registerMetaTileEntity(951, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); - STEAM_TURBINE[2] = registerMetaTileEntity(952, new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[0] = registerMetaTileEntity(950, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.lv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 1, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[1] = registerMetaTileEntity(951, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.mv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 2, GTUtility.steamGeneratorTankSizeFunction)); + STEAM_TURBINE[2] = registerMetaTileEntity(952, + new MetaTileEntitySingleTurbine(gregtechId("steam_turbine.hv"), RecipeMaps.STEAM_TURBINE_FUELS, + Textures.STEAM_TURBINE_OVERLAY, 3, GTUtility.steamGeneratorTankSizeFunction)); // Gas Turbine, IDs 965-979 - GAS_TURBINE[0] = registerMetaTileEntity(965, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[1] = registerMetaTileEntity(966, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); - GAS_TURBINE[2] = registerMetaTileEntity(967, new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[0] = registerMetaTileEntity(965, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.lv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 1, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[1] = registerMetaTileEntity(966, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.mv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 2, GTUtility.genericGeneratorTankSizeFunction)); + GAS_TURBINE[2] = registerMetaTileEntity(967, + new MetaTileEntitySingleTurbine(gregtechId("gas_turbine.hv"), RecipeMaps.GAS_TURBINE_FUELS, + Textures.GAS_TURBINE_OVERLAY, 3, GTUtility.genericGeneratorTankSizeFunction)); // Item Collector, IDs 980-983 - ITEM_COLLECTOR[0] = registerMetaTileEntity(980, new MetaTileEntityItemCollector(gregtechId("item_collector.lv"), 1, 8)); - ITEM_COLLECTOR[1] = registerMetaTileEntity(981, new MetaTileEntityItemCollector(gregtechId("item_collector.mv"), 2, 16)); - ITEM_COLLECTOR[2] = registerMetaTileEntity(982, new MetaTileEntityItemCollector(gregtechId("item_collector.hv"), 3, 32)); - ITEM_COLLECTOR[3] = registerMetaTileEntity(983, new MetaTileEntityItemCollector(gregtechId("item_collector.ev"), 4, 64)); - - MAGIC_ENERGY_ABSORBER = registerMetaTileEntity(984, new MetaTileEntityMagicEnergyAbsorber(gregtechId("magic_energy_absorber"))); + ITEM_COLLECTOR[0] = registerMetaTileEntity(980, + new MetaTileEntityItemCollector(gregtechId("item_collector.lv"), 1, 8)); + ITEM_COLLECTOR[1] = registerMetaTileEntity(981, + new MetaTileEntityItemCollector(gregtechId("item_collector.mv"), 2, 16)); + ITEM_COLLECTOR[2] = registerMetaTileEntity(982, + new MetaTileEntityItemCollector(gregtechId("item_collector.hv"), 3, 32)); + ITEM_COLLECTOR[3] = registerMetaTileEntity(983, + new MetaTileEntityItemCollector(gregtechId("item_collector.ev"), 4, 64)); + + MAGIC_ENERGY_ABSORBER = registerMetaTileEntity(984, + new MetaTileEntityMagicEnergyAbsorber(gregtechId("magic_energy_absorber"))); // Hulls, IDs 985-999 int endPos = GregTechAPI.isHighTier() ? HULL.length : Math.min(HULL.length - 1, GTValues.UV + 2); @@ -501,63 +636,103 @@ public static void init() { } // MULTIBLOCK START: IDs 1000-1149. Space left for addons to register Multiblocks grouped with the rest in JEI - PRIMITIVE_BLAST_FURNACE = registerMetaTileEntity(1000, new MetaTileEntityPrimitiveBlastFurnace(gregtechId("primitive_blast_furnace.bronze"))); - ELECTRIC_BLAST_FURNACE = registerMetaTileEntity(1001, new MetaTileEntityElectricBlastFurnace(gregtechId("electric_blast_furnace"))); + PRIMITIVE_BLAST_FURNACE = registerMetaTileEntity(1000, + new MetaTileEntityPrimitiveBlastFurnace(gregtechId("primitive_blast_furnace.bronze"))); + ELECTRIC_BLAST_FURNACE = registerMetaTileEntity(1001, + new MetaTileEntityElectricBlastFurnace(gregtechId("electric_blast_furnace"))); VACUUM_FREEZER = registerMetaTileEntity(1002, new MetaTileEntityVacuumFreezer(gregtechId("vacuum_freezer"))); - IMPLOSION_COMPRESSOR = registerMetaTileEntity(1003, new MetaTileEntityImplosionCompressor(gregtechId("implosion_compressor"))); + IMPLOSION_COMPRESSOR = registerMetaTileEntity(1003, + new MetaTileEntityImplosionCompressor(gregtechId("implosion_compressor"))); PYROLYSE_OVEN = registerMetaTileEntity(1004, new MetaTileEntityPyrolyseOven(gregtechId("pyrolyse_oven"))); - DISTILLATION_TOWER = registerMetaTileEntity(1005, new MetaTileEntityDistillationTower(gregtechId("distillation_tower"))); + DISTILLATION_TOWER = registerMetaTileEntity(1005, + new MetaTileEntityDistillationTower(gregtechId("distillation_tower"))); MULTI_FURNACE = registerMetaTileEntity(1006, new MetaTileEntityMultiSmelter(gregtechId("multi_furnace"))); - LARGE_COMBUSTION_ENGINE = registerMetaTileEntity(1007, new MetaTileEntityLargeCombustionEngine(gregtechId("large_combustion_engine"), GTValues.EV)); - EXTREME_COMBUSTION_ENGINE = registerMetaTileEntity(1008, new MetaTileEntityLargeCombustionEngine(gregtechId("extreme_combustion_engine"), GTValues.IV)); + LARGE_COMBUSTION_ENGINE = registerMetaTileEntity(1007, + new MetaTileEntityLargeCombustionEngine(gregtechId("large_combustion_engine"), GTValues.EV)); + EXTREME_COMBUSTION_ENGINE = registerMetaTileEntity(1008, + new MetaTileEntityLargeCombustionEngine(gregtechId("extreme_combustion_engine"), GTValues.IV)); CRACKER = registerMetaTileEntity(1009, new MetaTileEntityCrackingUnit(gregtechId("cracker"))); - LARGE_STEAM_TURBINE = registerMetaTileEntity(1010, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.steam"), RecipeMaps.STEAM_TURBINE_FUELS, 3, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_GEARBOX), Textures.SOLID_STEEL_CASING, false, Textures.LARGE_STEAM_TURBINE_OVERLAY)); - LARGE_GAS_TURBINE = registerMetaTileEntity(1011, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.gas"), RecipeMaps.GAS_TURBINE_FUELS, 4, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX), Textures.CLEAN_STAINLESS_STEEL_CASING, true, Textures.LARGE_GAS_TURBINE_OVERLAY)); - LARGE_PLASMA_TURBINE = registerMetaTileEntity(1012, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.plasma"), RecipeMaps.PLASMA_GENERATOR_FUELS, 5, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING), MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_GEARBOX), Textures.ROBUST_TUNGSTENSTEEL_CASING, false, Textures.LARGE_PLASMA_TURBINE_OVERLAY)); - - LARGE_BRONZE_BOILER = registerMetaTileEntity(1013, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.bronze"), BoilerType.BRONZE)); - LARGE_STEEL_BOILER = registerMetaTileEntity(1014, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.steel"), BoilerType.STEEL)); - LARGE_TITANIUM_BOILER = registerMetaTileEntity(1015, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.titanium"), BoilerType.TITANIUM)); - LARGE_TUNGSTENSTEEL_BOILER = registerMetaTileEntity(1016, new MetaTileEntityLargeBoiler(gregtechId("large_boiler.tungstensteel"), BoilerType.TUNGSTENSTEEL)); + LARGE_STEAM_TURBINE = registerMetaTileEntity(1010, + new MetaTileEntityLargeTurbine(gregtechId("large_turbine.steam"), RecipeMaps.STEAM_TURBINE_FUELS, 3, + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_GEARBOX), + Textures.SOLID_STEEL_CASING, false, Textures.LARGE_STEAM_TURBINE_OVERLAY)); + LARGE_GAS_TURBINE = registerMetaTileEntity(1011, new MetaTileEntityLargeTurbine(gregtechId("large_turbine.gas"), + RecipeMaps.GAS_TURBINE_FUELS, 4, + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STAINLESS_STEEL_GEARBOX), + Textures.CLEAN_STAINLESS_STEEL_CASING, true, Textures.LARGE_GAS_TURBINE_OVERLAY)); + LARGE_PLASMA_TURBINE = registerMetaTileEntity(1012, + new MetaTileEntityLargeTurbine(gregtechId("large_turbine.plasma"), RecipeMaps.PLASMA_GENERATOR_FUELS, 5, + MetaBlocks.TURBINE_CASING + .getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING), + MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.TUNGSTENSTEEL_GEARBOX), + Textures.ROBUST_TUNGSTENSTEEL_CASING, false, Textures.LARGE_PLASMA_TURBINE_OVERLAY)); + + LARGE_BRONZE_BOILER = registerMetaTileEntity(1013, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.bronze"), BoilerType.BRONZE)); + LARGE_STEEL_BOILER = registerMetaTileEntity(1014, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.steel"), BoilerType.STEEL)); + LARGE_TITANIUM_BOILER = registerMetaTileEntity(1015, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.titanium"), BoilerType.TITANIUM)); + LARGE_TUNGSTENSTEEL_BOILER = registerMetaTileEntity(1016, + new MetaTileEntityLargeBoiler(gregtechId("large_boiler.tungstensteel"), BoilerType.TUNGSTENSTEEL)); COKE_OVEN = registerMetaTileEntity(1017, new MetaTileEntityCokeOven(gregtechId("coke_oven"))); COKE_OVEN_HATCH = registerMetaTileEntity(1018, new MetaTileEntityCokeOvenHatch(gregtechId("coke_oven_hatch"))); ASSEMBLY_LINE = registerMetaTileEntity(1019, new MetaTileEntityAssemblyLine(gregtechId("assembly_line"))); - FUSION_REACTOR[0] = registerMetaTileEntity(1020, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.luv"), GTValues.LuV)); - FUSION_REACTOR[1] = registerMetaTileEntity(1021, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.zpm"), GTValues.ZPM)); - FUSION_REACTOR[2] = registerMetaTileEntity(1022, new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.uv"), GTValues.UV)); + FUSION_REACTOR[0] = registerMetaTileEntity(1020, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.luv"), GTValues.LuV)); + FUSION_REACTOR[1] = registerMetaTileEntity(1021, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.zpm"), GTValues.ZPM)); + FUSION_REACTOR[2] = registerMetaTileEntity(1022, + new MetaTileEntityFusionReactor(gregtechId("fusion_reactor.uv"), GTValues.UV)); - LARGE_CHEMICAL_REACTOR = registerMetaTileEntity(1023, new MetaTileEntityLargeChemicalReactor(gregtechId("large_chemical_reactor"))); + LARGE_CHEMICAL_REACTOR = registerMetaTileEntity(1023, + new MetaTileEntityLargeChemicalReactor(gregtechId("large_chemical_reactor"))); STEAM_OVEN = registerMetaTileEntity(1024, new MetaTileEntitySteamOven(gregtechId("steam_oven"))); STEAM_GRINDER = registerMetaTileEntity(1025, new MetaTileEntitySteamGrinder(gregtechId("steam_grinder"))); - BASIC_LARGE_MINER = registerMetaTileEntity(1026, new MetaTileEntityLargeMiner(gregtechId("large_miner.ev"), GTValues.EV, 16, 3, 4, Materials.Steel, 8)); - LARGE_MINER = registerMetaTileEntity(1027, new MetaTileEntityLargeMiner(gregtechId("large_miner.iv"), GTValues.IV, 4, 5, 5, Materials.Titanium, 16)); - ADVANCED_LARGE_MINER = registerMetaTileEntity(1028, new MetaTileEntityLargeMiner(gregtechId("large_miner.luv"), GTValues.LuV, 1, 7, 6, Materials.TungstenSteel, 32)); + BASIC_LARGE_MINER = registerMetaTileEntity(1026, + new MetaTileEntityLargeMiner(gregtechId("large_miner.ev"), GTValues.EV, 16, 3, 4, Materials.Steel, 8)); + LARGE_MINER = registerMetaTileEntity(1027, new MetaTileEntityLargeMiner(gregtechId("large_miner.iv"), + GTValues.IV, 4, 5, 5, Materials.Titanium, 16)); + ADVANCED_LARGE_MINER = registerMetaTileEntity(1028, new MetaTileEntityLargeMiner(gregtechId("large_miner.luv"), + GTValues.LuV, 1, 7, 6, Materials.TungstenSteel, 32)); CENTRAL_MONITOR = registerMetaTileEntity(1029, new MetaTileEntityCentralMonitor(gregtechId("central_monitor"))); - PROCESSING_ARRAY = registerMetaTileEntity(1030, new MetaTileEntityProcessingArray(gregtechId("processing_array"), 0)); - ADVANCED_PROCESSING_ARRAY = registerMetaTileEntity(1031, new MetaTileEntityProcessingArray(gregtechId("advanced_processing_array"), 1)); + PROCESSING_ARRAY = registerMetaTileEntity(1030, + new MetaTileEntityProcessingArray(gregtechId("processing_array"), 0)); + ADVANCED_PROCESSING_ARRAY = registerMetaTileEntity(1031, + new MetaTileEntityProcessingArray(gregtechId("advanced_processing_array"), 1)); - BASIC_FLUID_DRILLING_RIG = registerMetaTileEntity(1032, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.mv"), 2)); - FLUID_DRILLING_RIG = registerMetaTileEntity(1033, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.hv"), 3)); - ADVANCED_FLUID_DRILLING_RIG = registerMetaTileEntity(1034, new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.ev"), 4)); + BASIC_FLUID_DRILLING_RIG = registerMetaTileEntity(1032, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.mv"), 2)); + FLUID_DRILLING_RIG = registerMetaTileEntity(1033, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.hv"), 3)); + ADVANCED_FLUID_DRILLING_RIG = registerMetaTileEntity(1034, + new MetaTileEntityFluidDrill(gregtechId("fluid_drilling_rig.ev"), 4)); CLEANROOM = registerMetaTileEntity(1035, new MetaTileEntityCleanroom(gregtechId("cleanroom"))); - CHARCOAL_PILE_IGNITER = registerMetaTileEntity(1036, new MetaTileEntityCharcoalPileIgniter(gregtechId("charcoal_pile"))); + CHARCOAL_PILE_IGNITER = registerMetaTileEntity(1036, + new MetaTileEntityCharcoalPileIgniter(gregtechId("charcoal_pile"))); DATA_BANK = registerMetaTileEntity(1037, new MetaTileEntityDataBank(gregtechId("data_bank"))); - RESEARCH_STATION = registerMetaTileEntity(1038, new MetaTileEntityResearchStation(gregtechId("research_station"))); - HIGH_PERFORMANCE_COMPUTING_ARRAY = registerMetaTileEntity(1039, new MetaTileEntityHPCA(gregtechId("high_performance_computing_array"))); + RESEARCH_STATION = registerMetaTileEntity(1038, + new MetaTileEntityResearchStation(gregtechId("research_station"))); + HIGH_PERFORMANCE_COMPUTING_ARRAY = registerMetaTileEntity(1039, + new MetaTileEntityHPCA(gregtechId("high_performance_computing_array"))); NETWORK_SWITCH = registerMetaTileEntity(1040, new MetaTileEntityNetworkSwitch(gregtechId("network_switch"))); - POWER_SUBSTATION = registerMetaTileEntity(1041, new MetaTileEntityPowerSubstation(gregtechId("power_substation"))); - ACTIVE_TRANSFORMER = registerMetaTileEntity(1042, new MetaTileEntityActiveTransformer(gregtechId("active_transformer"))); + POWER_SUBSTATION = registerMetaTileEntity(1041, + new MetaTileEntityPowerSubstation(gregtechId("power_substation"))); + ACTIVE_TRANSFORMER = registerMetaTileEntity(1042, + new MetaTileEntityActiveTransformer(gregtechId("active_transformer"))); // MISC MTE's START: IDs 1150-2000 @@ -566,8 +741,10 @@ public static void init() { String voltageName = GTValues.VN[i].toLowerCase(); ITEM_IMPORT_BUS[i] = new MetaTileEntityItemBus(gregtechId("item_bus.import." + voltageName), i, false); ITEM_EXPORT_BUS[i] = new MetaTileEntityItemBus(gregtechId("item_bus.export." + voltageName), i, true); - FLUID_IMPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import." + voltageName), i, false); - FLUID_EXPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export." + voltageName), i, true); + FLUID_IMPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import." + voltageName), i, + false); + FLUID_EXPORT_HATCH[i] = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export." + voltageName), i, + true); registerMetaTileEntity(1150 + i, ITEM_IMPORT_BUS[i]); registerMetaTileEntity(1165 + i, ITEM_EXPORT_BUS[i]); @@ -578,36 +755,53 @@ public static void init() { // IDs 1190, 1191, 1205, and 1206 reserved for multi-fluid hatches // Energy Input/Output Hatches, IDs 1210-1269 - endPos = GregTechAPI.isHighTier() ? ENERGY_INPUT_HATCH.length - 1 : Math.min(ENERGY_INPUT_HATCH.length - 1, GTValues.UV + 2); + endPos = GregTechAPI.isHighTier() ? ENERGY_INPUT_HATCH.length - 1 : + Math.min(ENERGY_INPUT_HATCH.length - 1, GTValues.UV + 2); for (int i = 0; i < endPos; i++) { String voltageName = GTValues.VN[i].toLowerCase(); - ENERGY_INPUT_HATCH[i] = registerMetaTileEntity(1210 + i, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input." + voltageName), i, 2, false)); - ENERGY_OUTPUT_HATCH[i] = registerMetaTileEntity(1225 + i, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output." + voltageName), i, 2, true)); + ENERGY_INPUT_HATCH[i] = registerMetaTileEntity(1210 + i, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input." + voltageName), i, 2, false)); + ENERGY_OUTPUT_HATCH[i] = registerMetaTileEntity(1225 + i, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output." + voltageName), i, 2, true)); if (i >= GTValues.IV && i <= GTValues.UHV) { - ENERGY_INPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1240 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a." + voltageName), i, 4, false)); - ENERGY_INPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1245 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_16a." + voltageName), i, 16, false)); - ENERGY_OUTPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1250 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a." + voltageName), i, 4, true)); - ENERGY_OUTPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1255 + i - GTValues.IV, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_16a." + voltageName), i, 16, true)); - SUBSTATION_ENERGY_INPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1260 + i - GTValues.IV, new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.input_64a." + voltageName), i, 64, false)); - SUBSTATION_ENERGY_OUTPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1265 + i - GTValues.IV, new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.output_64a." + voltageName), i, 64, true)); + ENERGY_INPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1240 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a." + voltageName), i, 4, false)); + ENERGY_INPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1245 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_16a." + voltageName), i, 16, + false)); + ENERGY_OUTPUT_HATCH_4A[i + 1 - GTValues.IV] = registerMetaTileEntity(1250 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a." + voltageName), i, 4, true)); + ENERGY_OUTPUT_HATCH_16A[i - GTValues.IV] = registerMetaTileEntity(1255 + i - GTValues.IV, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_16a." + voltageName), i, 16, + true)); + SUBSTATION_ENERGY_INPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1260 + i - GTValues.IV, + new MetaTileEntitySubstationEnergyHatch(gregtechId("substation_hatch.input_64a." + voltageName), + i, 64, false)); + SUBSTATION_ENERGY_OUTPUT_HATCH[i - GTValues.IV] = registerMetaTileEntity(1265 + i - GTValues.IV, + new MetaTileEntitySubstationEnergyHatch( + gregtechId("substation_hatch.output_64a." + voltageName), i, 64, true)); } } - ENERGY_INPUT_HATCH_4A[0] = registerMetaTileEntity(1399, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a.ev"), GTValues.EV, 4, false)); - ENERGY_OUTPUT_HATCH_4A[0] = registerMetaTileEntity(1400, new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a.ev"), GTValues.EV, 4, true)); - + ENERGY_INPUT_HATCH_4A[0] = registerMetaTileEntity(1399, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.input_4a.ev"), GTValues.EV, 4, false)); + ENERGY_OUTPUT_HATCH_4A[0] = registerMetaTileEntity(1400, + new MetaTileEntityEnergyHatch(gregtechId("energy_hatch.output_4a.ev"), GTValues.EV, 4, true)); // Transformer, IDs 1270-1299 endPos = GregTechAPI.isHighTier() ? TRANSFORMER.length - 1 : Math.min(TRANSFORMER.length - 1, GTValues.UV); for (int i = 0; i <= endPos; i++) { // 1A <-> 4A - MetaTileEntityTransformer transformer = new MetaTileEntityTransformer(gregtechId("transformer." + GTValues.VN[i].toLowerCase()), i); + MetaTileEntityTransformer transformer = new MetaTileEntityTransformer( + gregtechId("transformer." + GTValues.VN[i].toLowerCase()), i); TRANSFORMER[i] = registerMetaTileEntity(1270 + (i), transformer); // 2A <-> 8A and 4A <-> 16A - MetaTileEntityTransformer adjustableTransformer = new MetaTileEntityTransformer(gregtechId("transformer.hi_amp." + GTValues.VN[i].toLowerCase()), i, 2, 4); + MetaTileEntityTransformer adjustableTransformer = new MetaTileEntityTransformer( + gregtechId("transformer.hi_amp." + GTValues.VN[i].toLowerCase()), i, 2, 4); HI_AMP_TRANSFORMER[i] = registerMetaTileEntity(1730 + i, adjustableTransformer); // 16A <-> 64A (can do other amperages because of legacy compat) - adjustableTransformer = new MetaTileEntityTransformer(gregtechId("transformer.adjustable." + GTValues.VN[i].toLowerCase()), i, 1, 2, 4, 16); + adjustableTransformer = new MetaTileEntityTransformer( + gregtechId("transformer.adjustable." + GTValues.VN[i].toLowerCase()), i, 1, 2, 4, 16); POWER_TRANSFORMER[i] = registerMetaTileEntity(1285 + (i), adjustableTransformer); } @@ -620,14 +814,17 @@ public static void init() { } // Battery Buffer, IDs 1315-1360 - endPos = GregTechAPI.isHighTier() ? BATTERY_BUFFER[0].length - 1 : Math.min(BATTERY_BUFFER[0].length - 1, GTValues.UHV + 1); - int[] batteryBufferSlots = new int[]{4, 8, 16}; + endPos = GregTechAPI.isHighTier() ? BATTERY_BUFFER[0].length - 1 : + Math.min(BATTERY_BUFFER[0].length - 1, GTValues.UHV + 1); + int[] batteryBufferSlots = new int[] { 4, 8, 16 }; for (int slot = 0; slot < batteryBufferSlots.length; slot++) { BATTERY_BUFFER[slot] = new MetaTileEntityBatteryBuffer[endPos]; for (int i = 0; i < endPos; i++) { String bufferId = "battery_buffer." + GTValues.VN[i].toLowerCase() + "." + batteryBufferSlots[slot]; - MetaTileEntityBatteryBuffer batteryBuffer = new MetaTileEntityBatteryBuffer(gregtechId(bufferId), i, batteryBufferSlots[slot]); - BATTERY_BUFFER[slot][i] = registerMetaTileEntity(1315 + BATTERY_BUFFER[slot].length * slot + i, batteryBuffer); + MetaTileEntityBatteryBuffer batteryBuffer = new MetaTileEntityBatteryBuffer(gregtechId(bufferId), i, + batteryBufferSlots[slot]); + BATTERY_BUFFER[slot][i] = registerMetaTileEntity(1315 + BATTERY_BUFFER[slot].length * slot + i, + batteryBuffer); } } @@ -641,51 +838,83 @@ public static void init() { // World Accelerators, IDs 1390-1404 if (ConfigHolder.machines.enableWorldAccelerators) { - WORLD_ACCELERATOR[0] = registerMetaTileEntity(1390, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.lv"), 1)); - WORLD_ACCELERATOR[1] = registerMetaTileEntity(1391, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.mv"), 2)); - WORLD_ACCELERATOR[2] = registerMetaTileEntity(1392, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.hv"), 3)); - WORLD_ACCELERATOR[3] = registerMetaTileEntity(1393, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.ev"), 4)); - WORLD_ACCELERATOR[4] = registerMetaTileEntity(1394, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.iv"), 5)); - WORLD_ACCELERATOR[5] = registerMetaTileEntity(1395, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.luv"), 6)); - WORLD_ACCELERATOR[6] = registerMetaTileEntity(1396, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.zpm"), 7)); - WORLD_ACCELERATOR[7] = registerMetaTileEntity(1397, new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.uv"), 8)); + WORLD_ACCELERATOR[0] = registerMetaTileEntity(1390, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.lv"), 1)); + WORLD_ACCELERATOR[1] = registerMetaTileEntity(1391, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.mv"), 2)); + WORLD_ACCELERATOR[2] = registerMetaTileEntity(1392, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.hv"), 3)); + WORLD_ACCELERATOR[3] = registerMetaTileEntity(1393, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.ev"), 4)); + WORLD_ACCELERATOR[4] = registerMetaTileEntity(1394, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.iv"), 5)); + WORLD_ACCELERATOR[5] = registerMetaTileEntity(1395, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.luv"), 6)); + WORLD_ACCELERATOR[6] = registerMetaTileEntity(1396, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.zpm"), 7)); + WORLD_ACCELERATOR[7] = registerMetaTileEntity(1397, + new MetaTileEntityWorldAccelerator(gregtechId("world_accelerator.uv"), 8)); } MACHINE_HATCH = registerMetaTileEntity(1398, new MetaTileEntityMachineHatch(gregtechId("machine_hatch"), 5)); // 1399 and 1400 are taken by the EV 4A hatches, and are grouped near the other registration rather than here - // 1401 is taken by the Cleanroom Maintenance hatches, and is grouped with the maintenance hatch registration rather than here - - PASSTHROUGH_HATCH_ITEM = registerMetaTileEntity(1402, new MetaTileEntityPassthroughHatchItem(gregtechId("passthrough_hatch_item"), 3)); - PASSTHROUGH_HATCH_FLUID = registerMetaTileEntity(1403, new MetaTileEntityPassthroughHatchFluid(gregtechId("passthrough_hatch_fluid"), 3)); - - DATA_ACCESS_HATCH = registerMetaTileEntity(1404, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch"), GTValues.EV, false)); - ADVANCED_DATA_ACCESS_HATCH = registerMetaTileEntity(1405, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.advanced"), GTValues.LuV, false)); - CREATIVE_DATA_HATCH = registerMetaTileEntity(1406, new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.creative"), GTValues.MAX, true)); - OPTICAL_DATA_HATCH_RECEIVER = registerMetaTileEntity(1407, new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.receiver"), false)); - OPTICAL_DATA_HATCH_TRANSMITTER = registerMetaTileEntity(1408, new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.transmitter"), true)); - COMPUTATION_HATCH_RECEIVER = registerMetaTileEntity(1409, new MetaTileEntityComputationHatch(gregtechId("computation_hatch.receiver"), false)); - COMPUTATION_HATCH_TRANSMITTER = registerMetaTileEntity(1410, new MetaTileEntityComputationHatch(gregtechId("computation_hatch.transmitter"), true)); - OBJECT_HOLDER = registerMetaTileEntity(1411, new MetaTileEntityObjectHolder(gregtechId("research_station.object_holder"))); - HPCA_EMPTY_COMPONENT = registerMetaTileEntity(1412, new MetaTileEntityHPCAEmpty(gregtechId("hpca.empty_component"))); - HPCA_COMPUTATION_COMPONENT = registerMetaTileEntity(1413, new MetaTileEntityHPCAComputation(gregtechId("hpca.computation_component"), false)); - HPCA_ADVANCED_COMPUTATION_COMPONENT = registerMetaTileEntity(1414, new MetaTileEntityHPCAComputation(gregtechId("hpca.advanced_computation_component"), true)); - HPCA_HEAT_SINK_COMPONENT = registerMetaTileEntity(1415, new MetaTileEntityHPCACooler(gregtechId("hpca.heat_sink_component"), false)); - HPCA_ACTIVE_COOLER_COMPONENT = registerMetaTileEntity(1416, new MetaTileEntityHPCACooler(gregtechId("hpca.active_cooler_component"), true)); - HPCA_BRIDGE_COMPONENT = registerMetaTileEntity(1417, new MetaTileEntityHPCABridge(gregtechId("hpca.bridge_component"))); + // 1401 is taken by the Cleanroom Maintenance hatches, and is grouped with the maintenance hatch registration + // rather than here + + PASSTHROUGH_HATCH_ITEM = registerMetaTileEntity(1402, + new MetaTileEntityPassthroughHatchItem(gregtechId("passthrough_hatch_item"), 3)); + PASSTHROUGH_HATCH_FLUID = registerMetaTileEntity(1403, + new MetaTileEntityPassthroughHatchFluid(gregtechId("passthrough_hatch_fluid"), 3)); + + DATA_ACCESS_HATCH = registerMetaTileEntity(1404, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch"), GTValues.EV, false)); + ADVANCED_DATA_ACCESS_HATCH = registerMetaTileEntity(1405, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.advanced"), GTValues.LuV, false)); + CREATIVE_DATA_HATCH = registerMetaTileEntity(1406, + new MetaTileEntityDataAccessHatch(gregtechId("data_access_hatch.creative"), GTValues.MAX, true)); + OPTICAL_DATA_HATCH_RECEIVER = registerMetaTileEntity(1407, + new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.receiver"), false)); + OPTICAL_DATA_HATCH_TRANSMITTER = registerMetaTileEntity(1408, + new MetaTileEntityOpticalDataHatch(gregtechId("data_access_hatch.optical.transmitter"), true)); + COMPUTATION_HATCH_RECEIVER = registerMetaTileEntity(1409, + new MetaTileEntityComputationHatch(gregtechId("computation_hatch.receiver"), false)); + COMPUTATION_HATCH_TRANSMITTER = registerMetaTileEntity(1410, + new MetaTileEntityComputationHatch(gregtechId("computation_hatch.transmitter"), true)); + OBJECT_HOLDER = registerMetaTileEntity(1411, + new MetaTileEntityObjectHolder(gregtechId("research_station.object_holder"))); + HPCA_EMPTY_COMPONENT = registerMetaTileEntity(1412, + new MetaTileEntityHPCAEmpty(gregtechId("hpca.empty_component"))); + HPCA_COMPUTATION_COMPONENT = registerMetaTileEntity(1413, + new MetaTileEntityHPCAComputation(gregtechId("hpca.computation_component"), false)); + HPCA_ADVANCED_COMPUTATION_COMPONENT = registerMetaTileEntity(1414, + new MetaTileEntityHPCAComputation(gregtechId("hpca.advanced_computation_component"), true)); + HPCA_HEAT_SINK_COMPONENT = registerMetaTileEntity(1415, + new MetaTileEntityHPCACooler(gregtechId("hpca.heat_sink_component"), false)); + HPCA_ACTIVE_COOLER_COMPONENT = registerMetaTileEntity(1416, + new MetaTileEntityHPCACooler(gregtechId("hpca.active_cooler_component"), true)); + HPCA_BRIDGE_COMPONENT = registerMetaTileEntity(1417, + new MetaTileEntityHPCABridge(gregtechId("hpca.bridge_component"))); RESERVOIR_HATCH = registerMetaTileEntity(1418, new MetaTileEntityReservoirHatch(gregtechId("reservoir_hatch"))); // Free ID 1419 - endPos = GregTechAPI.isHighTier() ? LASER_INPUT_HATCH_256.length - 1 : Math.min(LASER_INPUT_HATCH_256.length - 1, GTValues.UHV - GTValues.IV); + endPos = GregTechAPI.isHighTier() ? LASER_INPUT_HATCH_256.length - 1 : + Math.min(LASER_INPUT_HATCH_256.length - 1, GTValues.UHV - GTValues.IV); for (int i = 0; i < endPos; i++) { int v = i + GTValues.IV; String voltageName = GTValues.VN[v].toLowerCase(); - LASER_INPUT_HATCH_256[i] = registerMetaTileEntity(1420 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_256a." + voltageName), false, v, 256)); - LASER_OUTPUT_HATCH_256[i] = registerMetaTileEntity(1429 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_256a." + voltageName), true, v, 256)); - LASER_INPUT_HATCH_1024[i] = registerMetaTileEntity(1438 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_1024a." + voltageName), false, v, 1024)); - LASER_OUTPUT_HATCH_1024[i] = registerMetaTileEntity(1447 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_1024a." + voltageName), true, v, 1024)); - LASER_INPUT_HATCH_4096[i] = registerMetaTileEntity(1456 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_4096a." + voltageName), false, v, 4096)); - LASER_OUTPUT_HATCH_4096[i] = registerMetaTileEntity(1465 + i, new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_4096a." + voltageName), true, v, 4096)); + LASER_INPUT_HATCH_256[i] = registerMetaTileEntity(1420 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.target_256a." + voltageName), false, v, 256)); + LASER_OUTPUT_HATCH_256[i] = registerMetaTileEntity(1429 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_256a." + voltageName), true, v, 256)); + LASER_INPUT_HATCH_1024[i] = registerMetaTileEntity(1438 + i, new MetaTileEntityLaserHatch( + gregtechId("laser_hatch.target_1024a." + voltageName), false, v, 1024)); + LASER_OUTPUT_HATCH_1024[i] = registerMetaTileEntity(1447 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_1024a." + voltageName), true, v, 1024)); + LASER_INPUT_HATCH_4096[i] = registerMetaTileEntity(1456 + i, new MetaTileEntityLaserHatch( + gregtechId("laser_hatch.target_4096a." + voltageName), false, v, 4096)); + LASER_OUTPUT_HATCH_4096[i] = registerMetaTileEntity(1465 + i, + new MetaTileEntityLaserHatch(gregtechId("laser_hatch.source_4096a." + voltageName), true, v, 4096)); } // Free Range: 1475-1509 @@ -711,7 +940,8 @@ public static void init() { // Super / Quantum Chests, IDs 1560-1574 for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - QUANTUM_CHEST[i] = new MetaTileEntityQuantumChest(gregtechId("super_chest." + voltageName), i + 1, 4000000L * (int) Math.pow(2, i)); + QUANTUM_CHEST[i] = new MetaTileEntityQuantumChest(gregtechId("super_chest." + voltageName), i + 1, + 4000000L * (int) Math.pow(2, i)); registerMetaTileEntity(1560 + i, QUANTUM_CHEST[i]); } @@ -725,7 +955,8 @@ public static void init() { // Super / Quantum Tanks, IDs 1575-1589 for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - QUANTUM_TANK[i] = new MetaTileEntityQuantumTank(gregtechId("super_tank." + voltageName), i + 1, 4000000 * (int) Math.pow(2, i)); + QUANTUM_TANK[i] = new MetaTileEntityQuantumTank(gregtechId("super_tank." + voltageName), i + 1, + 4000000 * (int) Math.pow(2, i)); registerMetaTileEntity(1575 + i, QUANTUM_TANK[i]); } @@ -744,56 +975,88 @@ public static void init() { } // Tanks, IDs 1595-1609 - WOODEN_TANK_VALVE = registerMetaTileEntity(1596, new MetaTileEntityTankValve(gregtechId("tank_valve.wood"), false)); - WOODEN_TANK = registerMetaTileEntity(1597, new MetaTileEntityMultiblockTank(gregtechId("tank.wood"), false, 250 * 1000)); + WOODEN_TANK_VALVE = registerMetaTileEntity(1596, + new MetaTileEntityTankValve(gregtechId("tank_valve.wood"), false)); + WOODEN_TANK = registerMetaTileEntity(1597, + new MetaTileEntityMultiblockTank(gregtechId("tank.wood"), false, 250 * 1000)); - STEEL_TANK_VALVE = registerMetaTileEntity(1598, new MetaTileEntityTankValve(gregtechId("tank_valve.steel"), true)); - STEEL_TANK = registerMetaTileEntity(1599, new MetaTileEntityMultiblockTank(gregtechId("tank.steel"), true, 1000 * 1000)); + STEEL_TANK_VALVE = registerMetaTileEntity(1598, + new MetaTileEntityTankValve(gregtechId("tank_valve.steel"), true)); + STEEL_TANK = registerMetaTileEntity(1599, + new MetaTileEntityMultiblockTank(gregtechId("tank.steel"), true, 1000 * 1000)); // Drums, IDs 1610-1624 - WOODEN_DRUM = registerMetaTileEntity(1610, new MetaTileEntityDrum(gregtechId("drum.wood"), Materials.Wood, 16000)); - BRONZE_DRUM = registerMetaTileEntity(1611, new MetaTileEntityDrum(gregtechId("drum.bronze"), Materials.Bronze, 32000)); - STEEL_DRUM = registerMetaTileEntity(1612, new MetaTileEntityDrum(gregtechId("drum.steel"), Materials.Steel, 64000)); - ALUMINIUM_DRUM = registerMetaTileEntity(1613, new MetaTileEntityDrum(gregtechId("drum.aluminium"), Materials.Aluminium, 128000)); - STAINLESS_STEEL_DRUM = registerMetaTileEntity(1614, new MetaTileEntityDrum(gregtechId("drum.stainless_steel"), Materials.StainlessSteel, 256000)); - TITANIUM_DRUM = registerMetaTileEntity(1615, new MetaTileEntityDrum(gregtechId("drum.titanium"), Materials.Titanium, 512000)); - TUNGSTENSTEEL_DRUM = registerMetaTileEntity(1616, new MetaTileEntityDrum(gregtechId("drum.tungstensteel"), Materials.TungstenSteel, 1024000)); - GOLD_DRUM = registerMetaTileEntity(1617, new MetaTileEntityDrum(gregtechId("drum.gold"), Materials.Gold, 32000)); + WOODEN_DRUM = registerMetaTileEntity(1610, + new MetaTileEntityDrum(gregtechId("drum.wood"), Materials.Wood, 16000)); + BRONZE_DRUM = registerMetaTileEntity(1611, + new MetaTileEntityDrum(gregtechId("drum.bronze"), Materials.Bronze, 32000)); + STEEL_DRUM = registerMetaTileEntity(1612, + new MetaTileEntityDrum(gregtechId("drum.steel"), Materials.Steel, 64000)); + ALUMINIUM_DRUM = registerMetaTileEntity(1613, + new MetaTileEntityDrum(gregtechId("drum.aluminium"), Materials.Aluminium, 128000)); + STAINLESS_STEEL_DRUM = registerMetaTileEntity(1614, + new MetaTileEntityDrum(gregtechId("drum.stainless_steel"), Materials.StainlessSteel, 256000)); + TITANIUM_DRUM = registerMetaTileEntity(1615, + new MetaTileEntityDrum(gregtechId("drum.titanium"), Materials.Titanium, 512000)); + TUNGSTENSTEEL_DRUM = registerMetaTileEntity(1616, + new MetaTileEntityDrum(gregtechId("drum.tungstensteel"), Materials.TungstenSteel, 1024000)); + GOLD_DRUM = registerMetaTileEntity(1617, + new MetaTileEntityDrum(gregtechId("drum.gold"), Materials.Gold, 32000)); // Crates, IDs 1625-1639 - WOODEN_CRATE = registerMetaTileEntity(1625, new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27)); - BRONZE_CRATE = registerMetaTileEntity(1626, new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54)); - STEEL_CRATE = registerMetaTileEntity(1627, new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72)); - ALUMINIUM_CRATE = registerMetaTileEntity(1628, new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90)); - STAINLESS_STEEL_CRATE = registerMetaTileEntity(1629, new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108)); - TITANIUM_CRATE = registerMetaTileEntity(1630, new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126)); - TUNGSTENSTEEL_CRATE = registerMetaTileEntity(1631, new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144)); + WOODEN_CRATE = registerMetaTileEntity(1625, + new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27)); + BRONZE_CRATE = registerMetaTileEntity(1626, + new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54)); + STEEL_CRATE = registerMetaTileEntity(1627, + new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72)); + ALUMINIUM_CRATE = registerMetaTileEntity(1628, + new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90)); + STAINLESS_STEEL_CRATE = registerMetaTileEntity(1629, + new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108)); + TITANIUM_CRATE = registerMetaTileEntity(1630, + new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126)); + TUNGSTENSTEEL_CRATE = registerMetaTileEntity(1631, + new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144)); // Rotor Holder, IDs 1640-1645 - ROTOR_HOLDER[0] = registerMetaTileEntity(1640, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.hv"), GTValues.HV)); - ROTOR_HOLDER[1] = registerMetaTileEntity(1641, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.ev"), GTValues.EV)); - ROTOR_HOLDER[2] = registerMetaTileEntity(1642, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.iv"), GTValues.IV)); - ROTOR_HOLDER[3] = registerMetaTileEntity(1643, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.luv"), GTValues.LuV)); - ROTOR_HOLDER[4] = registerMetaTileEntity(1644, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.zpm"), GTValues.ZPM)); - ROTOR_HOLDER[5] = registerMetaTileEntity(1645, new MetaTileEntityRotorHolder(gregtechId("rotor_holder.uv"), GTValues.UV)); + ROTOR_HOLDER[0] = registerMetaTileEntity(1640, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.hv"), GTValues.HV)); + ROTOR_HOLDER[1] = registerMetaTileEntity(1641, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.ev"), GTValues.EV)); + ROTOR_HOLDER[2] = registerMetaTileEntity(1642, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.iv"), GTValues.IV)); + ROTOR_HOLDER[3] = registerMetaTileEntity(1643, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.luv"), GTValues.LuV)); + ROTOR_HOLDER[4] = registerMetaTileEntity(1644, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.zpm"), GTValues.ZPM)); + ROTOR_HOLDER[5] = registerMetaTileEntity(1645, + new MetaTileEntityRotorHolder(gregtechId("rotor_holder.uv"), GTValues.UV)); // Misc, IDs 1646-1999 LOCKED_SAFE = registerMetaTileEntity(1646, new MetaTileEntityLockedSafe(gregtechId("locked_safe"))); WORKBENCH = registerMetaTileEntity(1647, new MetaTileEntityWorkbench(gregtechId("workbench"))); - PRIMITIVE_WATER_PUMP = registerMetaTileEntity(1648, new MetaTileEntityPrimitiveWaterPump(gregtechId("primitive_water_pump"))); + PRIMITIVE_WATER_PUMP = registerMetaTileEntity(1648, + new MetaTileEntityPrimitiveWaterPump(gregtechId("primitive_water_pump"))); PUMP_OUTPUT_HATCH = registerMetaTileEntity(1649, new MetaTileEntityPumpHatch(gregtechId("pump_hatch"))); CREATIVE_ENERGY = registerMetaTileEntity(1650, new MetaTileEntityCreativeEnergy()); // Steam Hatches/Buses - STEAM_EXPORT_BUS = registerMetaTileEntity(1651, new MetaTileEntitySteamItemBus(gregtechId("steam_export_bus"), true)); - STEAM_IMPORT_BUS = registerMetaTileEntity(1652, new MetaTileEntitySteamItemBus(gregtechId("steam_import_bus"), false)); + STEAM_EXPORT_BUS = registerMetaTileEntity(1651, + new MetaTileEntitySteamItemBus(gregtechId("steam_export_bus"), true)); + STEAM_IMPORT_BUS = registerMetaTileEntity(1652, + new MetaTileEntitySteamItemBus(gregtechId("steam_import_bus"), false)); STEAM_HATCH = registerMetaTileEntity(1653, new MetaTileEntitySteamHatch(gregtechId("steam_hatch"))); // Maintenance Hatches, IDs 1654-1656 - MAINTENANCE_HATCH = registerMetaTileEntity(1654, new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch"), false)); - CONFIGURABLE_MAINTENANCE_HATCH = registerMetaTileEntity(1655, new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch_configurable"), true)); - AUTO_MAINTENANCE_HATCH = registerMetaTileEntity(1656, new MetaTileEntityAutoMaintenanceHatch(gregtechId("maintenance_hatch_full_auto"))); - CLEANING_MAINTENANCE_HATCH = registerMetaTileEntity(1401, new MetaTileEntityCleaningMaintenanceHatch(gregtechId("maintenance_hatch_cleanroom_auto"))); + MAINTENANCE_HATCH = registerMetaTileEntity(1654, + new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch"), false)); + CONFIGURABLE_MAINTENANCE_HATCH = registerMetaTileEntity(1655, + new MetaTileEntityMaintenanceHatch(gregtechId("maintenance_hatch_configurable"), true)); + AUTO_MAINTENANCE_HATCH = registerMetaTileEntity(1656, + new MetaTileEntityAutoMaintenanceHatch(gregtechId("maintenance_hatch_full_auto"))); + CLEANING_MAINTENANCE_HATCH = registerMetaTileEntity(1401, + new MetaTileEntityCleaningMaintenanceHatch(gregtechId("maintenance_hatch_cleanroom_auto"))); // Muffler Hatches, IDs 1657- for (int i = 0; i < MUFFLER_HATCH.length; i++) { @@ -812,8 +1075,9 @@ public static void init() { CREATIVE_TANK = registerMetaTileEntity(1669, new MetaTileEntityCreativeTank(gregtechId("creative_tank"))); // Energy Converter, IDs 1670-1729 - endPos = GregTechAPI.isHighTier() ? ENERGY_CONVERTER[0].length - 1 : Math.min(ENERGY_CONVERTER[0].length - 1, GTValues.UHV + 1); - int[] amps = {1, 4, 8, 16}; + endPos = GregTechAPI.isHighTier() ? ENERGY_CONVERTER[0].length - 1 : + Math.min(ENERGY_CONVERTER[0].length - 1, GTValues.UHV + 1); + int[] amps = { 1, 4, 8, 16 }; for (int i = 0; i < endPos; i++) { for (int j = 0; j < 4; j++) { String id = "energy_converter." + GTValues.VN[i].toLowerCase() + "." + amps[j]; @@ -821,38 +1085,52 @@ public static void init() { ENERGY_CONVERTER[j][i] = registerMetaTileEntity(1670 + j + i * 4, converter); } } - // IDs 1730-1744 are taken by 4A <-> 16A Transformers. They are grouped with other transformers for organization. + // IDs 1730-1744 are taken by 4A <-> 16A Transformers. They are grouped with other transformers for + // organization. // ME Hatches, IDs 1745-1748 if (Loader.isModLoaded(GTValues.MODID_APPENG)) { - FLUID_EXPORT_HATCH_ME = registerMetaTileEntity(1745, new MetaTileEntityMEOutputHatch(gregtechId("me_export_fluid_hatch"))); - ITEM_EXPORT_BUS_ME = registerMetaTileEntity(1746, new MetaTileEntityMEOutputBus(gregtechId("me_export_item_bus"))); - FLUID_IMPORT_HATCH_ME = registerMetaTileEntity(1747, new MetaTileEntityMEInputHatch(gregtechId("me_import_fluid_hatch"))); - ITEM_IMPORT_BUS_ME = registerMetaTileEntity(1748, new MetaTileEntityMEInputBus(gregtechId("me_import_item_bus"))); + FLUID_EXPORT_HATCH_ME = registerMetaTileEntity(1745, + new MetaTileEntityMEOutputHatch(gregtechId("me_export_fluid_hatch"))); + ITEM_EXPORT_BUS_ME = registerMetaTileEntity(1746, + new MetaTileEntityMEOutputBus(gregtechId("me_export_item_bus"))); + FLUID_IMPORT_HATCH_ME = registerMetaTileEntity(1747, + new MetaTileEntityMEInputHatch(gregtechId("me_import_fluid_hatch"))); + ITEM_IMPORT_BUS_ME = registerMetaTileEntity(1748, + new MetaTileEntityMEInputBus(gregtechId("me_import_item_bus"))); } - LONG_DIST_ITEM_ENDPOINT = registerMetaTileEntity(1749, new MetaTileEntityLDItemEndpoint(gregtechId("ld_item_endpoint"))); - LONG_DIST_FLUID_ENDPOINT = registerMetaTileEntity(1750, new MetaTileEntityLDFluidEndpoint(gregtechId("ld_fluid_endpoint"))); + LONG_DIST_ITEM_ENDPOINT = registerMetaTileEntity(1749, + new MetaTileEntityLDItemEndpoint(gregtechId("ld_item_endpoint"))); + LONG_DIST_FLUID_ENDPOINT = registerMetaTileEntity(1750, + new MetaTileEntityLDFluidEndpoint(gregtechId("ld_fluid_endpoint"))); // Alarm, ID 1751 ALARM = registerMetaTileEntity(1751, new MetaTileEntityAlarm(gregtechId("alarm"))); // Multi-Fluid Hatches, IDs 1190, 1191, 1205, 1206, 1780-1799 // EV hatches separate because of old names/IDs - QUADRUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1190, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x"), GTValues.EV, 4, false)); - NONUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1191, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x"), GTValues.EV, 9, false)); - QUADRUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1205, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x"), GTValues.EV, 4, true)); - NONUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1206, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x"), GTValues.EV, 9, true)); + QUADRUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1190, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x"), GTValues.EV, 4, false)); + NONUPLE_IMPORT_HATCH[0] = registerMetaTileEntity(1191, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x"), GTValues.EV, 9, false)); + QUADRUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1205, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x"), GTValues.EV, 4, true)); + NONUPLE_EXPORT_HATCH[0] = registerMetaTileEntity(1206, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x"), GTValues.EV, 9, true)); for (int i = GTValues.IV; i <= GTValues.UHV; i++) { int index = i - GTValues.IV; String tierName = GTValues.VN[i].toLowerCase(); - QUADRUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1780 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x." + tierName), i, 4, false)); - NONUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1785 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x." + tierName), i, 9, false)); - QUADRUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1790 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x." + tierName), i, 4, true)); - NONUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1795 + index, new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x." + tierName), i, 9, true)); + QUADRUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1780 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_4x." + tierName), i, 4, false)); + NONUPLE_IMPORT_HATCH[index + 1] = registerMetaTileEntity(1785 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.import_9x." + tierName), i, 9, false)); + QUADRUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1790 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_4x." + tierName), i, 4, true)); + NONUPLE_EXPORT_HATCH[index + 1] = registerMetaTileEntity(1795 + index, + new MetaTileEntityMultiFluidHatch(gregtechId("fluid_hatch.export_9x." + tierName), i, 9, true)); } - /* * FOR ADDON DEVELOPERS: * @@ -883,7 +1161,8 @@ private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] m ICubeRenderer texture, boolean hasFrontFacing, Function tankScalingFunction) { - registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility::gregtechId, tankScalingFunction); + registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility::gregtechId, + tankScalingFunction); } private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] machines, @@ -892,7 +1171,8 @@ private static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] m RecipeMap map, ICubeRenderer texture, boolean hasFrontFacing) { - registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, GTUtility.defaultTankSizeFunction); + registerSimpleMetaTileEntity(machines, startId, name, map, texture, hasFrontFacing, + GTUtility.defaultTankSizeFunction); } public static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] machines, @@ -903,17 +1183,20 @@ public static void registerSimpleMetaTileEntity(SimpleMachineMetaTileEntity[] ma boolean hasFrontFacing, Function resourceId, Function tankScalingFunction) { - registerMetaTileEntities(machines, startId, name, (tier, voltageName) -> new SimpleMachineMetaTileEntity(resourceId.apply(String.format("%s.%s", name, voltageName)), map, texture, tier, hasFrontFacing, tankScalingFunction)); + registerMetaTileEntities(machines, startId, name, + (tier, voltageName) -> new SimpleMachineMetaTileEntity( + resourceId.apply(String.format("%s.%s", name, voltageName)), map, texture, tier, hasFrontFacing, + tankScalingFunction)); } /** * @param mteCreator Takes tier and voltage name for the machine, and outputs MTE to register */ public static void registerMetaTileEntities( - MetaTileEntity[] machines, - int startId, - String name, - BiFunction mteCreator) { + MetaTileEntity[] machines, + int startId, + String name, + BiFunction mteCreator) { for (int i = 0; i < machines.length - 1; i++) { if (i > 4 && !getMidTier(name)) continue; if (i > 7 && !getHighTier(name)) break; @@ -945,7 +1228,8 @@ public static void setMidTier(String key, boolean enabled) { public static void setHighTier(String key, boolean enabled) { HIGH_TIER.put(key, enabled); if (!GregTechAPI.isHighTier()) { - throw new IllegalArgumentException("Cannot set High-Tier machine without high tier being enabled in GregTechAPI."); + throw new IllegalArgumentException( + "Cannot set High-Tier machine without high tier being enabled in GregTechAPI."); } } diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java index 191cf952abf..99619665b4f 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; import gregtech.api.GregTechAPI; import gregtech.api.gui.ModularUI; import gregtech.api.gui.Widget; @@ -25,7 +19,7 @@ import gregtech.common.gui.impl.FakeModularUIContainerClipboard; import gregtech.common.items.behaviors.ClipboardBehavior; import gregtech.core.network.packets.PacketClipboardNBTUpdate; -import io.netty.buffer.Unpooled; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -48,30 +42,48 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static codechicken.lib.raytracer.RayTracer.*; import static gregtech.api.capability.GregtechDataCodes.*; import static gregtech.client.renderer.texture.Textures.CLIPBOARD_RENDERER; import static gregtech.common.items.MetaItems.CLIPBOARD; public class MetaTileEntityClipboard extends MetaTileEntity implements IFastRenderMetaTileEntity { - private static final AxisAlignedBB CLIPBOARD_AABB_NORTH = new AxisAlignedBB(2.75 / 16.0, 0, 0, 13.25 / 16.0, 16 / 16.0, 0.4 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_SOUTH = new AxisAlignedBB(13.25 / 16.0, 0, 16 / 16.0, 2.75 / 16.0, 16 / 16.0, 15.6 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_WEST = new AxisAlignedBB(0, 0, 13.25 / 16.0, 0.4 / 16.0, 16 / 16.0, 2.75 / 16.0); - private static final AxisAlignedBB CLIPBOARD_AABB_EAST = new AxisAlignedBB(16 / 16.0, 0, 2.75 / 16.0, 15.6 / 16.0, 16 / 16.0, 13.25 / 16.0); - private static final AxisAlignedBB PAGE_AABB_NORTH = new AxisAlignedBB(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); - private static final AxisAlignedBB PAGE_AABB_SOUTH = new AxisAlignedBB(13 / 16.0, 0.25 / 16.0, 15.75 / 16.0, 3 / 16.0, 14.25 / 16.0, 15.7 / 16.0); - private static final AxisAlignedBB PAGE_AABB_WEST = new AxisAlignedBB(0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, 0.3 / 16.0, 14.25 / 16.0, 3 / 16.0); - private static final AxisAlignedBB PAGE_AABB_EAST = new AxisAlignedBB(15.75 / 16.0, 0.25 / 16.0, 3 / 16.0, 15.7 / 16.0, 14.25 / 16.0, 13 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_NORTH = new AxisAlignedBB(2.75 / 16.0, 0, 0, 13.25 / 16.0, + 16 / 16.0, 0.4 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_SOUTH = new AxisAlignedBB(13.25 / 16.0, 0, 16 / 16.0, 2.75 / 16.0, + 16 / 16.0, 15.6 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_WEST = new AxisAlignedBB(0, 0, 13.25 / 16.0, 0.4 / 16.0, + 16 / 16.0, 2.75 / 16.0); + private static final AxisAlignedBB CLIPBOARD_AABB_EAST = new AxisAlignedBB(16 / 16.0, 0, 2.75 / 16.0, 15.6 / 16.0, + 16 / 16.0, 13.25 / 16.0); + + private static final AxisAlignedBB PAGE_AABB_NORTH = new AxisAlignedBB(3 / 16.0, 0.25 / 16.0, 0.25 / 16.0, + 13 / 16.0, 14.25 / 16.0, 0.3 / 16.0); + private static final AxisAlignedBB PAGE_AABB_SOUTH = new AxisAlignedBB(13 / 16.0, 0.25 / 16.0, 15.75 / 16.0, + 3 / 16.0, 14.25 / 16.0, 15.7 / 16.0); + private static final AxisAlignedBB PAGE_AABB_WEST = new AxisAlignedBB(0.25 / 16.0, 0.25 / 16.0, 13 / 16.0, + 0.3 / 16.0, 14.25 / 16.0, 3 / 16.0); + private static final AxisAlignedBB PAGE_AABB_EAST = new AxisAlignedBB(15.75 / 16.0, 0.25 / 16.0, 3 / 16.0, + 15.7 / 16.0, 14.25 / 16.0, 13 / 16.0); public static final float scale = 1; public FakeModularGui guiCache; @@ -105,7 +117,8 @@ public int getLightOpacity() { @Override public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - ClipboardRenderer.renderBoard(renderState, translation.copy(), new IVertexOperation[]{}, getFrontFacing(), this, partialTicks); + ClipboardRenderer.renderBoard(renderState, translation.copy(), new IVertexOperation[] {}, getFrontFacing(), + this, partialTicks); } @Override @@ -137,13 +150,16 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public ModularUI createUI(EntityPlayer entityPlayer) { if (getClipboard().isItemEqual(CLIPBOARD.getStackForm())) { List behaviours = ((MetaItem) getClipboard().getItem()).getBehaviours(getClipboard()); - Optional clipboardBehaviour = behaviours.stream().filter((x) -> x instanceof ClipboardBehavior).findFirst(); + Optional clipboardBehaviour = behaviours.stream() + .filter((x) -> x instanceof ClipboardBehavior).findFirst(); if (!clipboardBehaviour.isPresent()) return null; if (clipboardBehaviour.get() instanceof ClipboardBehavior) { - PlayerInventoryHolder holder = new PlayerInventoryHolder(new GregFakePlayer(entityPlayer.world), EnumHand.MAIN_HAND); // We can't have this actually set the player's hand + PlayerInventoryHolder holder = new PlayerInventoryHolder(new GregFakePlayer(entityPlayer.world), + EnumHand.MAIN_HAND); // We can't have this actually set the player's hand holder.setCustomValidityCheck(this::isValid).setCurrentItem(this.getClipboard()); - if (entityPlayer instanceof GregFakePlayer) { // This is how to tell if this is being called in-world or not + if (entityPlayer instanceof GregFakePlayer) { // This is how to tell if this is being called in-world or + // not return ClipboardBehavior.createMTEUI(holder, entityPlayer); } else { return ((ClipboardBehavior) clipboardBehaviour.get()).createUI(holder, entityPlayer); @@ -154,7 +170,8 @@ public ModularUI createUI(EntityPlayer entityPlayer) { } public void createFakeGui() { - // Basically just the original function from the PluginBehavior, but with a lot of now useless stuff stripped out. + // Basically just the original function from the PluginBehavior, but with a lot of now useless stuff stripped + // out. try { GregFakePlayer fakePlayer = new GregFakePlayer(this.getWorld()); fakePlayer.setHeldItem(EnumHand.MAIN_HAND, this.getClipboard()); @@ -179,7 +196,6 @@ public void createFakeGui() { } } - @Override protected void initializeInventory() { super.initializeInventory(); @@ -221,7 +237,8 @@ public int getHarvestLevel() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getWorld() != null && !getWorld().isRemote) { MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn); @@ -233,7 +250,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { return false; } @@ -258,7 +276,8 @@ public void onNeighborChanged() { if (!getWorld().isRemote && didSetFacing) { BlockPos pos = getPos().offset(getFrontFacing()); IBlockState state = getWorld().getBlockState(pos); - if (state.getBlock().isAir(state, getWorld(), pos) || !state.isSideSolid(getWorld(), pos, getFrontFacing())) { + if (state.getBlock().isAir(state, getWorld(), pos) || + !state.isSideSolid(getWorld(), pos, getFrontFacing())) { breakClipboard(null); } } @@ -321,10 +340,12 @@ public Pair checkLookingAt(EntityPlayer player) { if (this.getWorld() != null && player != null) { Vec3d startVec = getStartVec(player); Vec3d endVec = getEndVec(player); - CuboidRayTraceResult rayTraceResult = rayTrace(this.getPos(), new Vector3(startVec), new Vector3(endVec), getPageCuboid()); + CuboidRayTraceResult rayTraceResult = rayTrace(this.getPos(), new Vector3(startVec), new Vector3(endVec), + getPageCuboid()); if (rayTraceResult != null && rayTraceResult.sideHit == this.getFrontFacing().getOpposite()) { TileEntity tileEntity = this.getWorld().getTileEntity(rayTraceResult.getBlockPos()); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityClipboard) { double[] pos = handleRayTraceResult(rayTraceResult, this.getFrontFacing().getOpposite()); if (pos[0] >= 0 && pos[0] <= 1 && pos[1] >= 0 && pos[1] <= 1) return Pair.of(pos[0], pos[1]); @@ -336,12 +357,12 @@ public Pair checkLookingAt(EntityPlayer player) { private static double[] handleRayTraceResult(CuboidRayTraceResult rayTraceResult, EnumFacing spin) { double x, y; - double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); - double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); + double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); + double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); if (spin == EnumFacing.NORTH) { x = 1 - dX; } else if (spin == EnumFacing.SOUTH) { @@ -366,7 +387,7 @@ private static double[] handleRayTraceResult(CuboidRayTraceResult rayTraceResult x /= 14.0 / 16; y /= 14.0 / 16; - return new double[]{x, y}; + return new double[] { x, y }; } @Override @@ -384,7 +405,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { return data; } - @Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); @@ -476,8 +496,7 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - } + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {} public void readUIAction(EntityPlayerMP player, int id, PacketBuffer buf) { if (id == 1) { diff --git a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java index 3838fb1a910..7d49388a390 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java +++ b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java @@ -7,6 +7,7 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.MTETrait; import gregtech.api.util.GTUtility; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -122,7 +123,8 @@ protected void pushEnergy() { if (ampsToInsert == 0) return; // send out energy - energyInserted = container.acceptEnergyFromNetwork(metaTileEntity.getFrontFacing().getOpposite(), voltage, ampsToInsert) * voltage; + energyInserted = container.acceptEnergyFromNetwork(metaTileEntity.getFrontFacing().getOpposite(), voltage, + ampsToInsert) * voltage; } else { // push out FE // Get the FE capability in front of us IEnergyStorage storage = getCapabilityAtFront(CapabilityEnergy.ENERGY); diff --git a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java index 946ab130900..1aa2d2b0142 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java +++ b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.converter; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.FeCompat; import gregtech.api.capability.GregtechCapabilities; @@ -16,6 +11,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; @@ -30,12 +26,19 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.SYNC_TILE_MODE; public class MetaTileEntityConverter extends TieredMetaTileEntity { @@ -62,7 +65,8 @@ protected void reinitializeEnergyContainer() { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -129,12 +133,14 @@ public void receiveInitialSyncData(PacketBuffer buf) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[getTier()].render(renderState, translation, colouredPipeline); if (converterTrait.isFeToEu()) { for (EnumFacing facing : EnumFacing.VALUES) { if (facing == frontFacing) - Textures.ENERGY_OUT.renderSided(facing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(facing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); else Textures.CONVERTER_FE_IN.renderSided(facing, renderState, translation, pipeline); } @@ -143,7 +149,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (facing == frontFacing) Textures.CONVERTER_FE_OUT.renderSided(facing, renderState, translation, pipeline); else - Textures.ENERGY_IN.renderSided(facing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_IN.renderSided(facing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } } } @@ -190,8 +197,10 @@ public void addInformation(ItemStack stack, @Nullable World player, List long amps = converterTrait.getBaseAmps(); tooltip.add(I18n.format("gregtech.machine.energy_converter.description")); tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_tool_usage")); - tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_fe", FeCompat.toFe(voltage * amps, FeCompat.ratio(true)), amps, voltage, GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_eu", amps, voltage, GTValues.VNF[getTier()], FeCompat.toFe(voltage * amps, FeCompat.ratio(false)))); + tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_fe", + FeCompat.toFe(voltage * amps, FeCompat.ratio(true)), amps, voltage, GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.machine.energy_converter.tooltip_conversion_eu", amps, voltage, + GTValues.VNF[getTier()], FeCompat.toFe(voltage * amps, FeCompat.ratio(false)))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java index 0925e0ab727..cadf9768286 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityAlarm.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechDataCodes; @@ -15,10 +12,10 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.terminal.gui.widgets.SelectorWidget; -import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; @@ -28,6 +25,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,6 +37,7 @@ import java.util.stream.Collectors; public class MetaTileEntityAlarm extends TieredMetaTileEntity { + private SoundEvent selectedSound; private boolean isActive; private int radius = 64; @@ -52,10 +54,12 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", BASE_EU_CONSUMPTION)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { @@ -72,22 +76,25 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { return ModularUI.builder(GuiTextures.BACKGROUND, 240, 86) .widget(new LabelWidget(10, 5, getMetaFullName())) .widget(new SelectorWidget(10, 20, 220, 20, - getSounds().stream().map((event) -> event.getSoundName().toString()).collect(Collectors.toList()), + getSounds().stream().map((event) -> event.getSoundName().toString()) + .collect(Collectors.toList()), 0x555555, () -> this.selectedSound.getSoundName().toString(), true).setOnChanged((v) -> { - GregTechAPI.soundManager.stopTileSound(getPos()); - SoundEvent newSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); - if (this.selectedSound != newSound) { - this.selectedSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); - this.writeCustomData(GregtechDataCodes.UPDATE_SOUND, (writer) -> writer.writeResourceLocation(this.selectedSound.getSoundName())); - } - })) + GregTechAPI.soundManager.stopTileSound(getPos()); + SoundEvent newSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); + if (this.selectedSound != newSound) { + this.selectedSound = SoundEvent.REGISTRY.getObject(new ResourceLocation(v)); + this.writeCustomData(GregtechDataCodes.UPDATE_SOUND, + (writer) -> writer.writeResourceLocation(this.selectedSound.getSoundName())); + } + })) .widget(new ImageWidget(10, 54, 220, 20, GuiTextures.DISPLAY)) .label(10, 44, "gregtech.gui.alarm.radius") .widget(new TextFieldWidget2(12, 60, 216, 16, () -> String.valueOf(radius), value -> { if (!value.isEmpty()) { int newRadius = Integer.parseInt(value); if (newRadius != radius) { - this.writeCustomData(GregtechDataCodes.UPDATE_RADIUS, (writer) -> writer.writeInt(newRadius)); + this.writeCustomData(GregtechDataCodes.UPDATE_RADIUS, + (writer) -> writer.writeInt(newRadius)); radius = newRadius; } } @@ -114,7 +121,8 @@ public boolean isActive() { if (this.getWorld().isRemote) { return isActive; } - return this.isBlockRedstonePowered() && this.energyContainer.changeEnergy(-BASE_EU_CONSUMPTION) == -BASE_EU_CONSUMPTION; + return this.isBlockRedstonePowered() && + this.energyContainer.changeEnergy(-BASE_EU_CONSUMPTION) == -BASE_EU_CONSUMPTION; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index 620fbae4dc7..6c80ade0ec9 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -19,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -36,11 +34,16 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityBatteryBuffer extends TieredMetaTileEntity implements IControllable, IDataInfoProvider { private final int inventorySize; @@ -61,7 +64,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } @Override @@ -101,6 +105,7 @@ public boolean isValidFrontFacing(EnumFacing facing) { @Override protected IItemHandlerModifiable createImportItemHandler() { return new ItemStackHandler(inventorySize) { + @Override protected void onContentsChanged(int slot) { ((EnergyContainerBatteryBuffer) energyContainer).notifyEnergyListener(false); @@ -112,7 +117,8 @@ protected void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || - (ConfigHolder.compat.energy.nativeEUToFE && stack.hasCapability(CapabilityEnergy.ENERGY, null))) { + (ConfigHolder.compat.energy.nativeEUToFE && + stack.hasCapability(CapabilityEnergy.ENERGY, null))) { return super.insertItem(slot, stack, simulate); } return stack; @@ -140,7 +146,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { colSize = 2; } Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * colSize + 94) + 18 + 18 * colSize + 94) .label(6, 6, getMetaFullName()); int index = 0; @@ -160,7 +166,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List String tierName = GTValues.VNF[getTier()]; tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } @@ -192,9 +199,11 @@ public void readFromNBT(NBTTagCompound data) { public List getDataInfo() { List list = new ArrayList<>(); list.add(new TextComponentTranslation("gregtech.battery_buffer.average_input", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputPerSec() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getInputPerSec() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); list.add(new TextComponentTranslation("gregtech.battery_buffer.average_output", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputPerSec() / 20)).setStyle(new Style().setColor(TextFormatting.YELLOW)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(energyContainer.getOutputPerSec() / 20)) + .setStyle(new Style().setColor(TextFormatting.YELLOW)))); return list; } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index b53b1c49120..a8527b1eb99 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -18,6 +14,7 @@ import gregtech.api.util.GregFakePlayer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -37,10 +34,16 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_OUTPUT_FACING; public class MetaTileEntityBlockBreaker extends TieredMetaTileEntity { @@ -62,8 +65,10 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ROCK_BREAKER_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), false, false); - Textures.PIPE_OUT_OVERLAY.renderSided(getOutputFacing(), renderState, RenderUtil.adjustTrans(translation, getOutputFacing(), 2), pipeline); + Textures.ROCK_BREAKER_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), false, + false); + Textures.PIPE_OUT_OVERLAY.renderSided(getOutputFacing(), renderState, + RenderUtil.adjustTrans(translation, getOutputFacing(), 2), pipeline); } @Override @@ -122,7 +127,8 @@ private void addToInventoryOrDropItems(List drops) { } } - private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBlockState blockState, EntityPlayer entityPlayer) { + private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBlockState blockState, + EntityPlayer entityPlayer) { TileEntity tileEntity = getWorld().getTileEntity(blockPos); boolean result = blockState.getBlock().removedByPlayer(blockState, getWorld(), blockPos, entityPlayer, true); if (result) { @@ -130,14 +136,16 @@ private List attemptBreakBlockAndObtainDrops(BlockPos blockPos, IBloc blockState.getBlock().onPlayerDestroy(getWorld(), blockPos, blockState); BlockUtility.startCaptureDrops(); - blockState.getBlock().harvestBlock(getWorld(), entityPlayer, blockPos, blockState, tileEntity, ItemStack.EMPTY); + blockState.getBlock().harvestBlock(getWorld(), entityPlayer, blockPos, blockState, tileEntity, + ItemStack.EMPTY); return BlockUtility.stopCaptureDrops(); } return Collections.emptyList(); } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { EnumFacing currentOutputSide = getOutputFacing(); if (currentOutputSide == facing || getFrontFacing() == facing) return false; @@ -187,8 +195,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacing; } @@ -209,7 +217,7 @@ public void setOutputFacing(EnumFacing outputFacing) { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -265,8 +273,10 @@ public boolean getIsWeatherOrTerrainResistant() { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.block_breaker.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_op", getEnergyPerBlockBreak())); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100))); tooltip.add(I18n.format("gregtech.universal.tooltip.requires_redstone")); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java index fc1e634a7b7..ffc8841a9fe 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.TieredMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -21,9 +22,10 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityCharger extends TieredMetaTileEntity { @@ -49,6 +51,7 @@ protected void reinitializeEnergyContainer() { @Override protected IItemHandlerModifiable createImportItemHandler() { return new ItemStackHandler(inventorySize) { + @Override protected void onContentsChanged(int slot) { MetaTileEntityCharger.this.markDirty(); @@ -59,7 +62,8 @@ protected void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || - (ConfigHolder.compat.energy.nativeEUToFE && stack.hasCapability(CapabilityEnergy.ENERGY, null))) { + (ConfigHolder.compat.energy.nativeEUToFE && + stack.hasCapability(CapabilityEnergy.ENERGY, null))) { return super.insertItem(slot, stack, simulate); } return stack; @@ -98,7 +102,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", inventorySize)); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java index a3dd8f29b6c..ce97300700e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -16,6 +12,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,14 +24,21 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.AMP_INDEX; -public class MetaTileEntityDiode extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityDiode extends MetaTileEntityMultiblockPart + implements IPassthroughHatch, IMultiblockAbilityPart { protected IEnergyContainer energyContainer; @@ -111,9 +115,10 @@ protected void reinitializeEnergyContainer() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_IN_MULTI.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); - Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing).forEach(f -> - Textures.ENERGY_OUT.renderSided(f, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]))); + Textures.ENERGY_IN_MULTI.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing).forEach(f -> Textures.ENERGY_OUT.renderSided(f, + renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]))); } @Override @@ -122,7 +127,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -143,10 +149,12 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.diode.tooltip_general")); tooltip.add(I18n.format("gregtech.machine.diode.tooltip_starts_at")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_out_till", getMaxAmperage())); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index e284b5c7f6f..3ea24fabe41 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -14,6 +11,7 @@ import gregtech.api.unification.OreDictUnifier; import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.client.resources.I18n; @@ -30,9 +28,14 @@ import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityFisher extends TieredMetaTileEntity { @@ -60,7 +63,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int rowSize = (int) Math.sqrt(inventorySize); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()) .widget(new SlotWidget(importItems, 0, 18, 18, true, true) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.STRING_SLOT_OVERLAY)); @@ -81,7 +84,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void update() { super.update(); ItemStack baitStack = importItems.getStackInSlot(0); - if (!getWorld().isRemote && energyContainer.getEnergyStored() >= energyAmountPerFish && getOffsetTimer() % fishingTicks == 0L && !baitStack.isEmpty()) { + if (!getWorld().isRemote && energyContainer.getEnergyStored() >= energyAmountPerFish && + getOffsetTimer() % fishingTicks == 0L && !baitStack.isEmpty()) { WorldServer world = (WorldServer) this.getWorld(); int waterCount = 0; int edgeSize = (int) Math.sqrt(WATER_CHECK_SIZE); @@ -142,9 +146,12 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.fisher.tooltip")); tooltip.add(I18n.format("gregtech.machine.fisher.speed", fishingTicks)); - tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE), (int) Math.sqrt(WATER_CHECK_SIZE))); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE), + (int) Math.sqrt(WATER_CHECK_SIZE))); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); super.addInformation(stack, player, tooltip, advanced); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java index 2ae05c894b9..e545c53df54 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java @@ -11,16 +11,20 @@ import gregtech.api.recipes.recipeproperties.GasCollectorDimensionProperty; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.IntLists; + import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntLists; + import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; + public class MetaTileEntityGasCollector extends SimpleMachineMetaTileEntity { - public MetaTileEntityGasCollector(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing, + public MetaTileEntityGasCollector(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + int tier, boolean hasFrontFacing, Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, tankScalingFunction); } @@ -47,7 +51,8 @@ protected boolean checkRecipe(@Nonnull Recipe recipe) { private static class GasCollectorRecipeLogic extends RecipeLogicEnergy { - public GasCollectorRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public GasCollectorRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(metaTileEntity, recipeMap, energyContainer); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index 09cea6042cc..ed7065e1a15 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.electric; -import appeng.api.util.AECableType; -import appeng.api.util.AEPartLocation; -import appeng.me.helpers.AENetworkProxy; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -18,6 +12,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,11 +22,20 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; +import appeng.api.util.AECableType; +import appeng.api.util.AEPartLocation; +import appeng.me.helpers.AENetworkProxy; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityHull extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityHull extends MetaTileEntityMultiblockPart + implements IPassthroughHatch, IMultiblockAbilityPart { protected IEnergyContainer energyContainer; private AENetworkProxy gridProxy; @@ -55,7 +59,8 @@ protected void reinitializeEnergyContainer() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + Textures.ENERGY_OUT.renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } @Override @@ -77,7 +82,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { String tierName = GTValues.VNF[getTier()]; tooltip.add(I18n.format("gregtech.machine.hull.tooltip")); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in_out", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_out", 1)); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java index fe4f641aa5c..25a87803c16 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -19,6 +16,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.covers.filter.ItemFilterContainer; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -35,17 +33,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; -import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityItemCollector extends TieredMetaTileEntity { - private static final int[] INVENTORY_SIZES = {4, 9, 16, 25, 25}; + private static final int[] INVENTORY_SIZES = { 4, 9, 16, 25, 25 }; private static final double MOTION_MULTIPLIER = 0.04; private static final int BASE_EU_CONSUMPTION = 6; @@ -116,7 +118,8 @@ public void update() { return; } - boolean isWorkingNow = energyContainer.getEnergyStored() >= getEnergyConsumedPerTick() && isBlockRedstonePowered(); + boolean isWorkingNow = energyContainer.getEnergyStored() >= getEnergyConsumedPerTick() && + isBlockRedstonePowered(); if (isWorkingNow) { energyContainer.removeEnergy(getEnergyConsumedPerTick()); @@ -174,8 +177,10 @@ protected void moveItemsInEffectRange() { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.item_collector.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", getEnergyConsumedPerTick())); - tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", maxItemSuckingRange, maxItemSuckingRange)); } @@ -188,7 +193,8 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t @Override protected IItemHandlerModifiable createExportItemHandler() { - return new GTItemStackHandler(this, INVENTORY_SIZES[MathHelper.clamp(getTier(), 0, INVENTORY_SIZES.length - 1)]); + return new GTItemStackHandler(this, + INVENTORY_SIZES[MathHelper.clamp(getTier(), 0, INVENTORY_SIZES.length - 1)]); } @Override @@ -236,7 +242,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.widget(new ClickButtonWidget(10, 20, 20, 20, "-1", data -> adjustSuckingRange(-1))); builder.widget(new ClickButtonWidget(146, 20, 20, 20, "+1", data -> adjustSuckingRange(+1))); builder.widget(new ImageWidget(30, 20, 116, 20, GuiTextures.DISPLAY)); - builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, () -> Integer.toString(itemSuckingRange))); + builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, + () -> Integer.toString(itemSuckingRange))); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java index 7475852317c..08784ed26b2 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,8 +8,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; + import net.minecraft.block.BlockDragonEgg; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -37,14 +32,22 @@ import net.minecraft.world.biome.BiomeEndDecorator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityMagicEnergyAbsorber extends TieredMetaTileEntity { @@ -76,7 +79,8 @@ public Pair getParticleTexture() { @Override @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getRenderer().render(renderState, translation, colouredPipeline); } @@ -86,7 +90,7 @@ public void update() { if (getWorld().isRemote) return; if (!(getWorld().provider instanceof WorldProviderEnd)) { - return; //don't try to do anything outside end dimension + return; // don't try to do anything outside end dimension } if (getOffsetTimer() % 20 == 0 || isFirstTick()) { updateDragonEggStatus(); @@ -97,9 +101,9 @@ public void update() { int totalEnergyGeneration = 0; // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < connectedCrystalsIds.size(); i++) { - //since we don't check quite often, check twice before outputting energy + // since we don't check quite often, check twice before outputting energy if (getWorld().getEntityByID(connectedCrystalsIds.get(i)) instanceof EntityEnderCrystal) { totalEnergyGeneration += hasDragonEggAmplifier ? 128 : 32; } @@ -161,31 +165,34 @@ private void updateConnectedCrystals() { this.connectedCrystalsIds.clear(); final double maxDistance = 64 * 64; List enderCrystals = Arrays.stream(BiomeEndDecorator.getSpikesForWorld(getWorld())) - .flatMap(endSpike -> getWorld().getEntitiesWithinAABB(EntityEnderCrystal.class, endSpike.getTopBoundingBox()).stream()) + .flatMap(endSpike -> getWorld() + .getEntitiesWithinAABB(EntityEnderCrystal.class, endSpike.getTopBoundingBox()).stream()) .filter(crystal -> crystal.getDistanceSq(getPos()) < maxDistance) .collect(Collectors.toList()); for (EntityEnderCrystal entityEnderCrystal : enderCrystals) { BlockPos beamTarget = entityEnderCrystal.getBeamTarget(); if (beamTarget == null) { - //if beam target is null, set ourselves as beam target + // if beam target is null, set ourselves as beam target entityEnderCrystal.setBeamTarget(getPos()); this.connectedCrystalsIds.add(entityEnderCrystal.getEntityId()); } else if (beamTarget.equals(getPos())) { - //if beam target is ourselves, just add it to list + // if beam target is ourselves, just add it to list this.connectedCrystalsIds.add(entityEnderCrystal.getEntityId()); } } for (EntityDragon entityDragon : getWorld().getEntities(EntityDragon.class, EntitySelectors.IS_ALIVE)) { - if (entityDragon.healingEnderCrystal != null && connectedCrystalsIds.contains(entityDragon.healingEnderCrystal.getEntityId())) { - //if dragon is healing from crystal we draw energy from, reset it's healing crystal + if (entityDragon.healingEnderCrystal != null && + connectedCrystalsIds.contains(entityDragon.healingEnderCrystal.getEntityId())) { + // if dragon is healing from crystal we draw energy from, reset it's healing crystal entityDragon.healingEnderCrystal = null; - //if dragon is holding pattern, than deal damage and set it's phase to attack ourselves + // if dragon is holding pattern, than deal damage and set it's phase to attack ourselves if (entityDragon.getPhaseManager().getCurrentPhase().getType() == PhaseList.HOLDING_PATTERN) { entityDragon.attackEntityFrom(DamageSource.causeExplosionDamage((EntityLivingBase) null), 10.0f); entityDragon.getPhaseManager().setPhase(PhaseList.CHARGING_PLAYER); - ((PhaseChargingPlayer) entityDragon.getPhaseManager().getCurrentPhase()).setTarget(new Vec3d(getPos())); + ((PhaseChargingPlayer) entityDragon.getPhaseManager().getCurrentPhase()) + .setTarget(new Vec3d(getPos())); } } } @@ -193,11 +200,12 @@ private void updateConnectedCrystals() { private void resetConnectedEnderCrystals() { // enhanced for loops cause boxing and unboxing with FastUtil collections - //noinspection ForLoopReplaceableByForEach + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < connectedCrystalsIds.size(); i++) { - EntityEnderCrystal entityEnderCrystal = (EntityEnderCrystal) getWorld().getEntityByID(connectedCrystalsIds.get(i)); + EntityEnderCrystal entityEnderCrystal = (EntityEnderCrystal) getWorld() + .getEntityByID(connectedCrystalsIds.get(i)); if (entityEnderCrystal != null && getPos().equals(entityEnderCrystal.getBeamTarget())) { - //on removal, reset ender crystal beam location so somebody can use it + // on removal, reset ender crystal beam location so somebody can use it entityEnderCrystal.setBeamTarget(null); } } @@ -235,6 +243,7 @@ public void randomDisplayTick() { } } } + @Override public void addToolUsages(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 209dac726b2..6bea4afcdbf 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -22,6 +18,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,11 +36,17 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityMiner extends TieredMetaTileEntity implements IMiner, IControllable, IDataInfoProvider { private final ItemStackHandler chargerInventory; @@ -65,7 +68,8 @@ public MetaTileEntityMiner(ResourceLocation metaTileEntityId, int tier, int spee @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityMiner(metaTileEntityId, getTier(), this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); + return new MetaTileEntityMiner(metaTileEntityId, getTier(), this.minerLogic.getSpeed(), + this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); } @Override @@ -102,16 +106,18 @@ protected ModularUI createUI(@Nonnull EntityPlayer entityPlayer) { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new SlotWidget(exportItems, index, 151 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + builder.widget( + new SlotWidget(exportItems, index, 151 - rowSize * 9 + x * 18, 18 + y * 18, true, false) + .setBackgroundTexture(GuiTextures.SLOT)); } } } else { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + builder.widget( + new SlotWidget(exportItems, index, 142 - rowSize * 9 + x * 18, 18 + y * 18, true, false) + .setBackgroundTexture(GuiTextures.SLOT)); } } } @@ -135,15 +141,19 @@ private void addDisplayText(@Nonnull List textList) { textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); if (isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") + .setStyle(new Style().setColor(TextFormatting.RED))); if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.needspower") + .setStyle(new Style().setColor(TextFormatting.RED))); } private void addDisplayText2(@Nonnull List textList) { @@ -153,13 +163,16 @@ private void addDisplayText2(@Nonnull List textList) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { int currentArea = getWorkingArea(minerLogic.getCurrentRadius()); tooltip.add(I18n.format("gregtech.machine.miner.tooltip", currentArea, currentArea)); - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", energyPerTick) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick", energyPerTick) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); int maxArea = getWorkingArea(minerLogic.getMaximumRadius()); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_max", maxArea, maxArea)); } @@ -201,7 +214,8 @@ public void update() { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) return true; if (!this.isActive()) { @@ -216,7 +230,8 @@ else if (playerIn.isSneaking()) this.minerLogic.resetArea(); int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + playerIn.sendMessage( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } else { playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.errorradius")); } @@ -303,6 +318,7 @@ public boolean isActive() { @Override public List getDataInfo() { int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java index 61fa5ecda80..acd9ac62b93 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -17,6 +12,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; + import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -42,14 +38,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.PUMP_HEAD_LEVEL; public class MetaTileEntityPump extends TieredMetaTileEntity { @@ -81,7 +84,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); IVertexOperation[] coloredPipeline = ArrayUtils.add(pipeline, multiplier); for (EnumFacing renderSide : EnumFacing.HORIZONTALS) { if (renderSide == getFrontFacing()) { @@ -148,8 +152,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)); tankDisplay.addWidget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()); TankWidget tankWidget = new PhantomTankWidget(exportFluids.getTankAt(0), 67, 41, 18, 18, () -> this.lockedFluid, @@ -227,13 +231,13 @@ private void updateQueueState(int blocksToCheckAmount) { // Always recheck next time writeCustomData(PUMP_HEAD_LEVEL, b -> b.writeVarInt(pumpHeadY)); markDirty(); - //schedule queue rebuild because we changed our position and no fluid is available + // schedule queue rebuild because we changed our position and no fluid is available this.initializedQueue = false; } if (!initializedQueue || getOffsetTimer() % 6000 == 0 || isFirstTick()) { this.initializedQueue = true; - //just add ourselves to check list and see how this will go + // just add ourselves to check list and see how this will go this.blocksToCheck.add(selfPos); } } @@ -263,7 +267,7 @@ private void checkFluidBlockAt(BlockPos pumpHeadPos, BlockPos checkPos) { for (EnumFacing facing : EnumFacing.VALUES) { BlockPos offsetPos = checkPos.offset(facing); if (offsetPos.distanceSq(pumpHeadPos) > maxPumpRange * maxPumpRange) - continue; //do not add blocks outside bounds + continue; // do not add blocks outside bounds if (!fluidSourceBlocks.contains(offsetPos) && !blocksToCheck.contains(offsetPos)) { this.blocksToCheck.add(offsetPos); @@ -317,6 +321,7 @@ private void setLocked(boolean locked) { } this.lockedFluid = null; } + private Consumer> getFluidNameText(TankWidget tankWidget) { return (list) -> { TextComponentTranslation translation = tankWidget.getFluidTextComponent(); @@ -359,7 +364,7 @@ public void update() { pushFluidsIntoNearbyHandlers(getFrontFacing()); fillContainerFromInternalTank(); - //do not do anything without enough energy supplied + // do not do anything without enough energy supplied if (energyContainer.getEnergyStored() < GTValues.V[getTier()] * 2) { return; } @@ -397,11 +402,15 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.machine.pump.tooltip")); if (ConfigHolder.machines.doTerrainExplosion) tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist")); - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_op", GTValues.V[getTier()] * 2) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.pump.tooltip_buckets", getPumpingCycleLength())); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", exportFluids.getTankAt(0).getCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.uses_per_op", GTValues.V[getTier()] * 2) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.pump.tooltip_buckets", getPumpingCycleLength())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", + exportFluids.getTankAt(0).getCapacity())); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", getMaxPumpRange(), getMaxPumpRange())); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java index daef625dc76..7ff2b055358 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityRockBreaker.java @@ -9,6 +9,7 @@ import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; @@ -21,13 +22,15 @@ public class MetaTileEntityRockBreaker extends SimpleMachineMetaTileEntity { private boolean hasValidFluids; - public MetaTileEntityRockBreaker(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier) { + public MetaTileEntityRockBreaker(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, + int tier) { super(metaTileEntityId, recipeMap, renderer, tier, true); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityRockBreaker(metaTileEntityId, RecipeMaps.ROCK_BREAKER_RECIPES, Textures.ROCK_BREAKER_OVERLAY, getTier()); + return new MetaTileEntityRockBreaker(metaTileEntityId, RecipeMaps.ROCK_BREAKER_RECIPES, + Textures.ROCK_BREAKER_OVERLAY, getTier()); } @Override @@ -94,7 +97,8 @@ public void readFromNBT(NBTTagCompound data) { protected class RockBreakerRecipeLogic extends RecipeLogicEnergy { - public RockBreakerRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, Supplier energyContainer) { + public RockBreakerRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + Supplier energyContainer) { super(metaTileEntity, recipeMap, energyContainer); } @@ -105,7 +109,7 @@ protected boolean shouldSearchForRecipes() { } @Override - public boolean getIsWeatherOrTerrainResistant(){ + public boolean getIsWeatherOrTerrainResistant() { return true; } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java index 24808e63611..2c2c8fd360d 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java @@ -1,27 +1,32 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.function.Function; public class MetaTileEntitySingleCombustion extends SimpleGeneratorMetaTileEntity { - public MetaTileEntitySingleCombustion(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + public MetaTileEntitySingleCombustion(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, + Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntitySingleCombustion(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + return new MetaTileEntitySingleCombustion(metaTileEntityId, recipeMap, renderer, getTier(), + getTankScalingFunction()); } @Override @@ -33,7 +38,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (getFrontFacing() == EnumFacing.DOWN) { // Trick the render into rendering on the top, as this case didn't render otherwise - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), + workable.isWorkingEnabled()); } else if (getFrontFacing() != EnumFacing.UP) { // Don't render the top overlay if the facing is up, as the textures // would collide, otherwise render normally. diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java index 1fd8c2deb2b..c594e76e88e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleTurbine.java @@ -1,27 +1,32 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.function.Function; public class MetaTileEntitySingleTurbine extends SimpleGeneratorMetaTileEntity { - public MetaTileEntitySingleTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, Function tankScalingFunction) { + public MetaTileEntitySingleTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, + Function tankScalingFunction) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntitySingleTurbine(metaTileEntityId, recipeMap, renderer, getTier(), getTankScalingFunction()); + return new MetaTileEntitySingleTurbine(metaTileEntityId, recipeMap, renderer, getTier(), + getTankScalingFunction()); } @Override @@ -34,8 +39,10 @@ protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IV if (getFrontFacing().getAxis() == EnumFacing.Axis.Y) { // If facing is up or down, render the turbine on all 4 sides. // Turbine renderer renders front and back, so just render it on both axes. - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), workable.isWorkingEnabled()); - this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.WEST, workable.isActive(), workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.NORTH, workable.isActive(), + workable.isWorkingEnabled()); + this.renderer.renderOrientedState(renderState, translation, pipeline, EnumFacing.WEST, workable.isActive(), + workable.isWorkingEnabled()); } else { super.renderOverlays(renderState, translation, pipeline); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java index 7744434ee0f..d54d7c46f46 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityTransformer.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.EnergyContainerHandler; import gregtech.api.gui.ModularUI; @@ -14,6 +10,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -26,6 +23,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.Nullable; import java.util.Arrays; @@ -44,7 +46,7 @@ public class MetaTileEntityTransformer extends TieredMetaTileEntity { public MetaTileEntityTransformer(ResourceLocation metaTileEntityId, int tier, int... highAmperages) { super(metaTileEntityId, tier); if (highAmperages == null || highAmperages.length == 0) { - this.highAmperages = new int[]{1}; // fallback case, "normal" transformer + this.highAmperages = new int[] { 1 }; // fallback case, "normal" transformer } else { this.highAmperages = highAmperages; } @@ -151,13 +153,15 @@ protected void reinitializeEnergyContainer() { int lowAmperage = highAmperage * 4; if (isTransformUp) { - //storage = 1 amp high; input = tier / 4; amperage = 4; output = tier; amperage = 1 - this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage, lowAmperage, tierVoltage * 4, highAmperage); + // storage = 1 amp high; input = tier / 4; amperage = 4; output = tier; amperage = 1 + this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage, + lowAmperage, tierVoltage * 4, highAmperage); ((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s != getFrontFacing()); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - //storage = 1 amp high; input = tier; amperage = 1; output = tier / 4; amperage = 4 - this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage * 4, highAmperage, tierVoltage, lowAmperage); + // storage = 1 amp high; input = tier; amperage = 1; output = tier / 4; amperage = 4 + this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L * lowAmperage, tierVoltage * 4, + highAmperage, tierVoltage, lowAmperage); ((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s == getFrontFacing()); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s != getFrontFacing()); } @@ -189,9 +193,11 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } } - frontFaceTexture.renderSided(frontFacing, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() + 1])); + frontFaceTexture.renderSided(frontFacing, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier() + 1])); Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing) - .forEach((f -> otherFaceTexture.renderSided(f, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])))); + .forEach((f -> otherFaceTexture.renderSided(f, renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])))); } @Override @@ -200,7 +206,8 @@ public boolean isValidFrontFacing(EnumFacing facing) { } @Override - public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; @@ -208,17 +215,20 @@ public boolean onSoftMalletClick(EntityPlayer playerIn, EnumHand hand, EnumFacin if (isTransformUp) { setTransformUp(false); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer.message_transform_down", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); } else { setTransformUp(true); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer.message_transform_up", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); } return true; } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (hasMultipleAmperages()) { if (getWorld().isRemote) { scheduleRenderUpdate(); @@ -227,7 +237,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci incrementAmpIndex(); playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.transformer_adjustable.message_adjust", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); return true; } @@ -262,8 +273,10 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (hasMultipleAmperages()) { tooltip.add(I18n.format("gregtech.machine.transformer_adjustable.tooltip_tool_usage", higherAmperage)); } - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down", lowerAmperage, higherVoltage, higherTierName, higherAmperage, lowerVoltage, lowerTierName)); - tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up", higherAmperage, lowerVoltage, lowerTierName, lowerAmperage, higherVoltage, higherTierName)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_down", lowerAmperage, higherVoltage, + higherTierName, higherAmperage, lowerVoltage, lowerTierName)); + tooltip.add(I18n.format("gregtech.machine.transformer.tooltip_transform_up", higherAmperage, lowerVoltage, + lowerTierName, lowerAmperage, higherVoltage, higherTierName)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java index 36738c40390..09c851400ce 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityWorldAccelerator.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -16,9 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2BooleanFunction; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -36,6 +30,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.Object2BooleanFunction; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -59,7 +61,7 @@ public class MetaTileEntityWorldAccelerator extends TieredMetaTileEntity impleme // Variables for Random Tick mode optimization // limit = ((tier - min) / (max - min)) * 2^tier - private static final int[] SUCCESS_LIMITS = {1, 8, 27, 64, 125, 216, 343, 512}; + private static final int[] SUCCESS_LIMITS = { 1, 8, 27, 64, 125, 216, 343, 512 }; private final int successLimit; private BlockPos bottomLeftCorner; @@ -86,13 +88,17 @@ protected void reinitializeEnergyContainer() { @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.world_accelerator.description")); - tooltip.add(I18n.format("gregtech.machine.world_accelerator.power_usage", getRandomTickModeAmperage(), getTEModeAmperage())); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.power_usage", getRandomTickModeAmperage(), + getTEModeAmperage())); tooltip.add(I18n.format("gregtech.machine.world_accelerator.acceleration", speed)); - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), + GTValues.VNF[getTier()])); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area")); tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_tile")); - tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2 + 1, getTier() * 2 + 1)); + tooltip.add(I18n.format("gregtech.machine.world_accelerator.working_area_random", getTier() * 2 + 1, + getTier() * 2 + 1)); } @Override @@ -211,9 +217,11 @@ private BlockPos getCornerPos() { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (isTEMode()) { - Textures.WORLD_ACCELERATOR_TE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, isWorkingEnabled()); + Textures.WORLD_ACCELERATOR_TE_OVERLAY.renderOrientedState(renderState, translation, pipeline, + getFrontFacing(), isActive, isWorkingEnabled()); } else { - Textures.WORLD_ACCELERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, isWorkingEnabled()); + Textures.WORLD_ACCELERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + isActive, isWorkingEnabled()); } } @@ -228,14 +236,17 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!getWorld().isRemote) { if (isTEMode()) { setTEMode(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_entity"), false); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.world_accelerator.mode_entity"), false); } else { setTEMode(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_tile"), false); + playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.world_accelerator.mode_tile"), + false); } } return true; diff --git a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java index a6c3e345f7d..be43ffb1ab0 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java +++ b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandlerModifiable; @@ -20,8 +21,10 @@ public class SimpleMachineMetaTileEntityResizable extends SimpleMachineMetaTileE private final int outputAmount; /** - * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. - * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. */ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, RecipeMap recipeMap, @@ -36,8 +39,10 @@ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, } /** - * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the RecipeMap. - * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the RecipeMap. + * @param inputAmount Number of Item Input Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. + * @param outputAmount Number of Item Output Slots for this machine. Pass -1 to use the default value from the + * RecipeMap. */ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, RecipeMap recipeMap, @@ -71,7 +76,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, outputAmount, renderer, getTier()); + return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, + outputAmount, renderer, getTier()); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java b/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java index 456c9ac7d52..033b03a971b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java +++ b/src/main/java/gregtech/common/metatileentities/multi/BoilerType.java @@ -2,6 +2,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.state.IBlockState; import static gregtech.common.blocks.BlockBoilerCasing.BoilerCasingType.*; @@ -70,7 +71,6 @@ public enum BoilerType { ICubeRenderer fireboxIdleRenderer, ICubeRenderer fireboxActiveRenderer, ICubeRenderer frontOverlay) { - this.steamPerTick = steamPerTick; this.ticksToBoiling = ticksToBoiling; @@ -93,11 +93,15 @@ public int getTicksToBoiling() { } public int runtimeBoost(int ticks) { - switch(this) { - case BRONZE: return ticks * 2; - case STEEL: return ticks * 150 / 100; - case TITANIUM: return ticks * 120 / 100; - case TUNGSTENSTEEL: return ticks; + switch (this) { + case BRONZE: + return ticks * 2; + case STEEL: + return ticks * 150 / 100; + case TITANIUM: + return ticks * 120 / 100; + case TUNGSTENSTEEL: + return ticks; } return 0; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index f4e5f7f39c2..f0b9743edeb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -22,6 +18,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -33,6 +30,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import javax.annotation.Nonnull; public class MetaTileEntityCokeOven extends RecipeMapPrimitiveMultiblockController { @@ -52,7 +54,9 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "XXX", "XXX") .aisle("XXX", "X#X", "XXX") .aisle("XXX", "XYX", "XXX") - .where('X', states(getCasingState()).or(metaTileEntities(MetaTileEntities.COKE_OVEN_HATCH).setMaxGlobalLimited(5))) + .where('X', + states(getCasingState()) + .or(metaTileEntities(MetaTileEntities.COKE_OVEN_HATCH).setMaxGlobalLimited(5))) .where('#', air()) .where('Y', selfPredicate()) .build(); @@ -71,7 +75,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -93,7 +98,9 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { .widget(new LabelWidget(5, 5, getMetaFullName())) .widget(new SlotWidget(importItems, 0, 52, 30, true, true) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) - .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 76, 32, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, RecipeMaps.COKE_OVEN_RECIPES)) + .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 76, 32, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, + RecipeMaps.COKE_OVEN_RECIPES)) .widget(new SlotWidget(exportItems, 0, 103, 30, true, false) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) .widget(new TankWidget(exportFluids.getTankAt(0), 134, 13, 20, 58) @@ -124,7 +131,8 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); @@ -132,7 +140,8 @@ public void randomDisplayTick() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { // try to fill a bucket (or similar) with creosote on right click (if not sneaking) if (playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { if (!playerIn.isSneaking()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java index 6713e5caf40..2983dde660f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.ItemHandlerProxy; @@ -16,6 +12,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,9 +27,15 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCokeOvenHatch extends MetaTileEntityMultiblockPart { public MetaTileEntityCokeOvenHatch(ResourceLocation metaTileEntityId) { @@ -55,11 +58,13 @@ public void update() { super.update(); if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock()) { TileEntity tileEntity = getNeighbor(getFrontFacing()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); } - IItemHandler itemHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IItemHandler itemHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (itemHandler != null) { GTTransferUtils.moveInventoryItems(this.itemInventory, itemHandler); } @@ -120,9 +125,11 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { // try to fill a bucket (or similar) with creosote on right click (if not sneaking) - if (!playerIn.isSneaking() && playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { + if (!playerIn.isSneaking() && + playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { return getWorld().isRemote || FluidUtil.interactWithFluidHandler(playerIn, hand, getFluidInventory()); } return super.onRightClick(playerIn, hand, facing, hitResult); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index 06ffe1ce621..f15008bab2e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.BoilerRecipeLogic; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FluidTankList; @@ -25,6 +22,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.utils.TooltipHelper; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -39,13 +37,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IProgressBarMultiblock { public final BoilerType boilerType; @@ -152,8 +155,10 @@ protected void addWarningText(List textList) { if (isStructureFormed()) { int[] waterAmount = getWaterAmount(); if (waterAmount[0] == 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_boiler.explosion_tooltip")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.large_boiler.no_water")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.large_boiler.explosion_tooltip")); } } } @@ -202,14 +207,16 @@ protected BlockPattern createStructurePattern() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_boiler.description")}; + return new String[] { I18n.format("gregtech.multiblock.large_boiler.description") }; } @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.multiblock.large_boiler.rate_tooltip", (int) (boilerType.steamPerTick() * 20 * boilerType.runtimeBoost(20) / 20.0))); - tooltip.add(I18n.format("gregtech.multiblock.large_boiler.heat_time_tooltip", boilerType.getTicksToBoiling() / 20)); + tooltip.add(I18n.format("gregtech.multiblock.large_boiler.rate_tooltip", + (int) (boilerType.steamPerTick() * 20 * boilerType.runtimeBoost(20) / 20.0))); + tooltip.add( + I18n.format("gregtech.multiblock.large_boiler.heat_time_tooltip", boilerType.getTicksToBoiling() / 20)); tooltip.add(I18n.format("gregtech.universal.tooltip.base_production_fluid", boilerType.steamPerTick())); tooltip.add(TooltipHelper.BLINKING_RED + I18n.format("gregtech.multiblock.large_boiler.explosion_tooltip")); } @@ -217,7 +224,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), recipeLogic.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), + recipeLogic.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -324,11 +332,13 @@ public TextureArea getProgressBarTexture(int index) { @Override public void addBarHoverText(List hoverList, int index) { if (!isStructureFormed()) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.invalid_structure")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.invalid_structure")); } else { int[] waterAmount = getWaterAmount(); if (waterAmount[0] == 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.large_boiler.no_water")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.large_boiler.no_water")); } else { ITextComponent waterInfo = TextComponentUtil.translationWithColor( TextFormatting.BLUE, @@ -347,7 +357,7 @@ public void addBarHoverText(List hoverList, int index) { * If there is no water in the boiler (or the structure isn't formed, both of these values will be zero. */ private int[] getWaterAmount() { - if (!isStructureFormed()) return new int[]{0, 0}; + if (!isStructureFormed()) return new int[] { 0, 0 }; List tanks = getAbilities(MultiblockAbility.IMPORT_FLUIDS); int filled = 0, capacity = 0; for (IFluidTank tank : tanks) { @@ -357,6 +367,6 @@ private int[] getWaterAmount() { capacity += tank.getCapacity(); } } - return new int[]{filled, capacity}; + return new int[] { filled, capacity }; } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 09062dfad75..17ffe999651 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.PropertyFluidFilter; @@ -23,6 +19,7 @@ import gregtech.common.blocks.BlockSteamCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -34,9 +31,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityMultiblockTank extends MultiblockWithDisplayBase { @@ -116,7 +119,8 @@ public boolean hasMaintenanceMechanics() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!isStructureFormed()) return false; return super.onRightClick(playerIn, hand, facing, hitResult); @@ -146,7 +150,8 @@ protected ICubeRenderer getFrontOverlay() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.tank.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", capacity)); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java index ed2a8309824..f8ea376d87f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -30,6 +25,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -39,13 +35,20 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import javax.annotation.Nonnull; public class MetaTileEntityPrimitiveBlastFurnace extends RecipeMapPrimitiveMultiblockController { - private static final TraceabilityPredicate SNOW_PREDICATE = new TraceabilityPredicate(bws -> GTUtility.isBlockSnow(bws.getBlockState())); + private static final TraceabilityPredicate SNOW_PREDICATE = new TraceabilityPredicate( + bws -> GTUtility.isBlockSnow(bws.getBlockState())); public MetaTileEntityPrimitiveBlastFurnace(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES); @@ -64,7 +67,8 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "XYX", "XXX", "XXX") .where('X', states(MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS))) .where('#', air()) - .where('&', air().or(SNOW_PREDICATE)) // this won't stay in the structure, and will be broken while running + .where('&', air().or(SNOW_PREDICATE)) // this won't stay in the structure, and will be broken while + // running .where('Y', selfPredicate()) .build(); } @@ -86,7 +90,9 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY)) .widget(new SlotWidget(importItems, 2, 52, 56, true, true) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)) - .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 77, 39, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES)) + .widget(new RecipeProgressWidget(recipeMapWorkable::getProgressPercent, 77, 39, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, + RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES)) .widget(new SlotWidget(exportItems, 0, 104, 38, true, false) .setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY)) .widget(new SlotWidget(exportItems, 1, 122, 38, true, false) @@ -99,7 +105,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); if (recipeMapWorkable.isActive() && isStructureFormed()) { EnumFacing back = getFrontFacing().getOpposite(); Matrix4 offset = translation.copy().translate(back.getXOffset(), -0.3, back.getZOffset()); @@ -107,7 +114,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.RENDER_STATE.set(new CubeRendererState(op.layer, CubeRendererState.PASS_MASK, op.world)); Textures.renderFace(renderState, offset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), - EnumFacing.UP, Cuboid6.full, TextureUtils.getBlockTexture("lava_still"), BloomEffectUtil.getEffectiveBloomLayer()); + EnumFacing.UP, Cuboid6.full, TextureUtils.getBlockTexture("lava_still"), + BloomEffectUtil.getEffectiveBloomLayer()); Textures.RENDER_STATE.set(op); } } @@ -151,7 +159,8 @@ private void pollutionParticles() { private void damageEntitiesAndBreakSnow() { BlockPos middlePos = this.getPos(); middlePos = middlePos.offset(getFrontFacing().getOpposite()); - this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(middlePos)).forEach(entity -> entity.attackEntityFrom(DamageSource.LAVA, 3.0f)); + this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(middlePos)) + .forEach(entity -> entity.attackEntityFrom(DamageSource.LAVA, 3.0f)); if (getOffsetTimer() % 10 == 0) { IBlockState state = getWorld().getBlockState(middlePos); @@ -180,7 +189,8 @@ public void randomDisplayTick() { x += horizontalOffset; } if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, + false); } getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java index 5db50d20918..d1c13cadedb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -20,6 +17,7 @@ import gregtech.common.blocks.BlockSteamCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; @@ -32,12 +30,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; + public class MetaTileEntityPrimitiveWaterPump extends MultiblockControllerBase implements IPrimitivePump { private IFluidTank waterTank; @@ -84,13 +87,14 @@ private int getAmount() { return 350; } else if (biomeTypes.contains(BiomeDictionary.Type.SNOWY)) { return 300; - } else if (biomeTypes.contains(BiomeDictionary.Type.PLAINS) || biomeTypes.contains(BiomeDictionary.Type.FOREST)) { - return 250; - } else if (biomeTypes.contains(BiomeDictionary.Type.COLD)) { - return 175; - } else if (biomeTypes.contains(BiomeDictionary.Type.BEACH)) { - return 170; - } + } else + if (biomeTypes.contains(BiomeDictionary.Type.PLAINS) || biomeTypes.contains(BiomeDictionary.Type.FOREST)) { + return 250; + } else if (biomeTypes.contains(BiomeDictionary.Type.COLD)) { + return 175; + } else if (biomeTypes.contains(BiomeDictionary.Type.BEACH)) { + return 170; + } return 100; } @@ -105,9 +109,7 @@ protected boolean openGUIOnRightClick() { } @Override - protected void updateFormedValid() { - - } + protected void updateFormedValid() {} @Override protected void formStructure(PatternMatchContext context) { @@ -145,7 +147,9 @@ protected BlockPattern createStructurePattern() { .where('S', selfPredicate()) .where('X', states(MetaBlocks.STEAM_CASING.getState(BlockSteamCasing.SteamCasingType.PUMP_DECK))) .where('F', frames(Materials.TreatedWood)) - .where('H', abilities(MultiblockAbility.PUMP_FLUID_HATCH).or(metaTileEntities(MetaTileEntities.FLUID_EXPORT_HATCH[0], MetaTileEntities.FLUID_EXPORT_HATCH[1]))) + .where('H', + abilities(MultiblockAbility.PUMP_FLUID_HATCH).or(metaTileEntities( + MetaTileEntities.FLUID_EXPORT_HATCH[0], MetaTileEntities.FLUID_EXPORT_HATCH[1]))) .where('*', any()) .build(); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java index 2071ccbe1c7..e257f788f2d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -20,6 +17,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -31,10 +29,16 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityPumpHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +import javax.annotation.Nullable; + +public class MetaTileEntityPumpHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private static final int FLUID_TANK_SIZE = 1000; @@ -52,7 +56,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } } @@ -79,7 +84,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java index 9197bbab4b5..f4a242788cd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.ModularUI; @@ -15,6 +12,7 @@ import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -25,11 +23,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityTankValve extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +public class MetaTileEntityTankValve extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private final boolean isMetal; @@ -67,9 +71,11 @@ public int getDefaultPaintingColor() { @Override public void update() { super.update(); - if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock() && getFrontFacing() == EnumFacing.DOWN) { + if (!getWorld().isRemote && getOffsetTimer() % 5 == 0L && isAttachedToMultiBlock() && + getFrontFacing() == EnumFacing.DOWN) { TileEntity tileEntity = getNeighbor(getFrontFacing()); - IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); + IFluidHandler fluidHandler = tileEntity == null ? null : tileEntity + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getFrontFacing().getOpposite()); if (fluidHandler != null) { GTTransferUtils.transferFluids(fluidInventory, fluidHandler); } @@ -83,7 +89,8 @@ protected void initializeInventory() { } /** - * When this block is not connected to any multiblock it uses dummy inventory to prevent problems with capability checks + * When this block is not connected to any multiblock it uses dummy inventory to prevent problems with capability + * checks */ private void initializeDummyInventory() { this.fluidInventory = new FluidHandlerProxy(new FluidTankList(false), new FluidTankList(false)); @@ -92,7 +99,8 @@ private void initializeDummyInventory() { @Override public void addToMultiBlock(MultiblockControllerBase controllerBase) { super.addToMultiBlock(controllerBase); - this.fluidInventory = controllerBase.getFluidInventory(); //directly use controllers fluid inventory as there is no reason to proxy it + this.fluidInventory = controllerBase.getFluidInventory(); // directly use controllers fluid inventory as there + // is no reason to proxy it } @Override @@ -132,7 +140,8 @@ protected boolean shouldSerializeInventories() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.tank_valve.tooltip")); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java index c7dee6a3957..059ec0264a7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityActiveTransformer.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; @@ -24,6 +21,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.BlockFusionCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -36,6 +34,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -144,13 +146,15 @@ protected IBlockState getCasingState() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) - .setWorkingStatus(true, isActive()) // set to true because we only want a two-state system (running or not running) + .setWorkingStatus(true, isActive()) // set to true because we only want a two-state system (running or + // not running) .setWorkingStatusKeys( "gregtech.multiblock.idling", "gregtech.multiblock.idling", @@ -244,10 +248,11 @@ public T getCapability(Capability capability, EnumFacing side) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip1")); tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip2")); - tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip3") - + TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.active_transformer.tooltip3.5")); + tooltip.add(I18n.format("gregtech.machine.active_transformer.tooltip3") + TooltipHelper.RAINBOW_SLOW + + I18n.format("gregtech.machine.active_transformer.tooltip3.5")); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java index 79c74db35ca..eb6bfff35b7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Vector3; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IDataAccessHatch; @@ -33,6 +29,7 @@ import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -47,17 +44,24 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import codechicken.lib.vec.Vector3; + import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityAssemblyLine extends RecipeMapMultiblockController { private static final ResourceLocation LASER_LOCATION = GTUtility.gregtechId("textures/fx/laser/laser.png"); - private static final ResourceLocation LASER_HEAD_LOCATION = GTUtility.gregtechId("textures/fx/laser/laser_start.png"); + private static final ResourceLocation LASER_HEAD_LOCATION = GTUtility + .gregtechId("textures/fx/laser/laser_start.png"); @SideOnly(Side.CLIENT) private GTLaserBeamParticle[][] beamParticles; @@ -91,9 +95,13 @@ protected BlockPattern createStructurePattern() { .setMaxGlobalLimited(3))) .where('I', metaTileEntities(MetaTileEntities.ITEM_IMPORT_BUS[GTValues.ULV])) .where('G', states(getGrateState())) - .where('A', states(MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_CONTROL))) + .where('A', + states(MetaBlocks.MULTIBLOCK_CASING + .getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_CONTROL))) .where('R', states(MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.LAMINATED_GLASS))) - .where('T', states(MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_LINE_CASING))) + .where('T', + states(MetaBlocks.MULTIBLOCK_CASING + .getState(BlockMultiblockCasing.MultiblockCasingType.ASSEMBLY_LINE_CASING))) .where('D', dataHatchPredicate()) .where(' ', any()); return pattern.build(); @@ -116,7 +124,7 @@ protected static TraceabilityPredicate fluidInputPredicate() { return metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.IMPORT_FLUIDS).stream() .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch)) .toArray(MetaTileEntity[]::new)) - .setMaxGlobalLimited(4); + .setMaxGlobalLimited(4); } return abilities(MultiblockAbility.IMPORT_FLUIDS); } @@ -161,7 +169,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled()); } @Override @@ -241,8 +250,10 @@ private void readParticles(@Nonnull PacketBuffer buf) { } BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(getPos()); - EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing relativeLeft = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing relativeLeft = RelativeDirection.LEFT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); boolean negativeUp = relativeUp.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE; for (int i = 0; i < beamParticles.length; i++) { @@ -347,7 +358,8 @@ public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { isRecipeAvailable(getAbilities(MultiblockAbility.OPTICAL_DATA_RECEPTION), recipe); } - private static boolean isRecipeAvailable(@Nonnull Iterable hatches, @Nonnull Recipe recipe) { + private static boolean isRecipeAvailable(@Nonnull Iterable hatches, + @Nonnull Recipe recipe) { for (IDataAccessHatch hatch : hatches) { // creative hatches do not need to check, they always have the recipe if (hatch.isCreative()) return true; @@ -359,7 +371,8 @@ private static boolean isRecipeAvailable(@Nonnull Iterable tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { if (ConfigHolder.machines.orderedAssembly && ConfigHolder.machines.orderedFluidAssembly) { tooltip.add(I18n.format("gregtech.machine.assembly_line.tooltip_ordered_both")); } else if (ConfigHolder.machines.orderedAssembly) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java index 252b4225bfb..4ce376d8597 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.CleanroomLogic; @@ -31,6 +26,7 @@ import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveWaterPump; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; @@ -48,7 +44,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -56,13 +51,21 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import appeng.core.AEConfig; +import appeng.core.features.AEFeature; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; -public class MetaTileEntityCleanroom extends MultiblockWithDisplayBase implements ICleanroomProvider, IWorkable, IDataInfoProvider { +public class MetaTileEntityCleanroom extends MultiblockWithDisplayBase + implements ICleanroomProvider, IWorkable, IDataInfoProvider { public static final int CLEAN_AMOUNT_THRESHOLD = 90; public static final int MIN_CLEAN_AMOUNT = 0; @@ -119,7 +122,8 @@ protected void formStructure(PatternMatchContext context) { // max progress is based on the dimensions of the structure: (x^3)-(x^2) // taller cleanrooms take longer than wider ones // minimum of 100 is a 5x5x5 cleanroom: 125-25=100 ticks - this.cleanroomLogic.setMaxProgress(Math.max(100, ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1)))); + this.cleanroomLogic.setMaxProgress(Math.max(100, + ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1)))); } @Override @@ -228,8 +232,10 @@ public boolean updateStructureDimensions() { * @param direction the direction to move * @return if a block is a valid wall block at pos moved in direction */ - public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { - return world.getBlockState(pos.move(direction)) == MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); + public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { + return world.getBlockState(pos.move(direction)) == + MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); } /** @@ -238,8 +244,10 @@ public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockP * @param direction the direction to move * @return if a block is a valid floor block at pos moved in direction */ - public boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { - return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); + public boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { + return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == + MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); } @Nonnull @@ -265,7 +273,7 @@ protected BlockPattern createStructurePattern() { // build each row of the structure StringBuilder borderBuilder = new StringBuilder(); // BBBBB StringBuilder wallBuilder = new StringBuilder(); // BXXXB - StringBuilder insideBuilder = new StringBuilder(); // X X + StringBuilder insideBuilder = new StringBuilder(); // X X StringBuilder roofBuilder = new StringBuilder(); // BFFFB StringBuilder controllerBuilder = new StringBuilder(); // BFSFB StringBuilder centerBuilder = new StringBuilder(); // BXKXB @@ -320,12 +328,12 @@ protected BlockPattern createStructurePattern() { wall[0] = borderBuilder.toString(); wall[wall.length - 1] = borderBuilder.toString(); - String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" + String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" Arrays.fill(slice, insideBuilder.toString()); slice[0] = wallBuilder.toString(); slice[slice.length - 1] = roofBuilder.toString(); - String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" + String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" if (this.frontFacing == EnumFacing.NORTH || this.frontFacing == EnumFacing.SOUTH) { center[0] = centerBuilder.reverse().toString(); center[center.length - 1] = controllerBuilder.reverse().toString(); @@ -350,7 +358,8 @@ protected BlockPattern createStructurePattern() { .where('X', wallPredicate.or(basePredicate) .or(doorPredicate().setMaxGlobalLimited(8)) .or(abilities(MultiblockAbility.PASSTHROUGH_HATCH).setMaxGlobalLimited(30))) - .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure dimension checks + .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure + // dimension checks .where('F', filterPredicate()) .where(' ', innerPredicate()) .build(); @@ -362,7 +371,8 @@ protected TraceabilityPredicate filterPredicate() { IBlockState blockState = blockWorldState.getBlockState(); Block block = blockState.getBlock(); if (block instanceof BlockCleanroomCasing) { - BlockCleanroomCasing.CasingType casingType = ((BlockCleanroomCasing) blockState.getBlock()).getState(blockState); + BlockCleanroomCasing.CasingType casingType = ((BlockCleanroomCasing) blockState.getBlock()) + .getState(blockState); if (casingType.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) return false; Object currentFilter = blockWorldState.getMatchContext().getOrPut("FilterType", casingType); @@ -379,7 +389,7 @@ protected TraceabilityPredicate filterPredicate() { .filter(type -> !type.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) .map(type -> new BlockInfo(MetaBlocks.CLEANROOM_CASING.getState(type), null)) .toArray(BlockInfo[]::new))) - .addTooltips("gregtech.multiblock.pattern.error.filters"); + .addTooltips("gregtech.multiblock.pattern.error.filters"); } @SideOnly(Side.CLIENT) @@ -401,7 +411,8 @@ protected IBlockState getGlassState() { @Nonnull protected static TraceabilityPredicate doorPredicate() { - return new TraceabilityPredicate(blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor); + return new TraceabilityPredicate( + blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor); } @Nonnull @@ -512,7 +523,9 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.8")); tooltip.add(I18n.format("gregtech.machine.cleanroom.tooltip.9")); if (Loader.isModLoaded(GTValues.MODID_APPENG)) { - tooltip.add(I18n.format(AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) ? "gregtech.machine.cleanroom.tooltip.ae2.channels" : "gregtech.machine.cleanroom.tooltip.ae2.no_channels")); + tooltip.add(I18n.format(AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) ? + "gregtech.machine.cleanroom.tooltip.ae2.channels" : + "gregtech.machine.cleanroom.tooltip.ae2.no_channels")); } tooltip.add(""); } else { @@ -523,7 +536,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive(), + isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -557,7 +571,8 @@ public boolean isClean() { @Nonnull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentTranslation(isClean() ? "gregtech.multiblock.cleanroom.clean_state" : "gregtech.multiblock.cleanroom.dirty_state")); + return Collections.singletonList(new TextComponentTranslation( + isClean() ? "gregtech.multiblock.cleanroom.clean_state" : "gregtech.multiblock.cleanroom.dirty_state")); } @Override @@ -603,7 +618,8 @@ public long getEnergyInputPerSecond() { } public boolean drainEnergy(boolean simulate) { - long energyToDrain = isClean() ? (long) Math.min(4, Math.pow(4, getEnergyTier())) : GTValues.VA[getEnergyTier()]; + long energyToDrain = isClean() ? (long) Math.min(4, Math.pow(4, getEnergyTier())) : + GTValues.VA[getEnergyTier()]; long resultEnergy = energyContainer.getEnergyStored() - energyToDrain; if (resultEnergy >= 0L && resultEnergy <= energyContainer.getEnergyCapacity()) { if (!simulate) @@ -712,13 +728,20 @@ public List getMatchingShapes() { .where('L', MetaTileEntities.PASSTHROUGH_HATCH_FLUID, EnumFacing.NORTH) .where('H', MetaTileEntities.HULL[GTValues.HV], EnumFacing.NORTH) .where('D', MetaTileEntities.DIODES[GTValues.HV], EnumFacing.NORTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE), EnumFacing.SOUTH) - .where('O', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)) - .where('R', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER)); + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE), + EnumFacing.SOUTH) + .where('O', + Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH) + .withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER)) + .where('R', Blocks.IRON_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.NORTH) + .withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER)); Arrays.stream(BlockCleanroomCasing.CasingType.values()) .filter(casingType -> !casingType.equals(BlockCleanroomCasing.CasingType.PLASCRETE)) - .forEach(casingType -> shapeInfo.add(builder.where('F', MetaBlocks.CLEANROOM_CASING.getState(casingType)).build())); + .forEach(casingType -> shapeInfo + .add(builder.where('F', MetaBlocks.CLEANROOM_CASING.getState(casingType)).build())); return shapeInfo; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java index 5386c82fa0c..c4a3c65ca5e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java @@ -19,6 +19,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -30,9 +31,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityCrackingUnit extends RecipeMapMultiblockController { @@ -85,7 +87,8 @@ protected void addDisplayText(List textList) { .addCustom(tl -> { // Coil energy discount line if (isStructureFormed()) { - ITextComponent energyDiscount = TextComponentUtil.stringWithColor(TextFormatting.AQUA, (100 - 10 * coilTier) + "%"); + ITextComponent energyDiscount = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + (100 - 10 * coilTier) + "%"); ITextComponent base = TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -153,7 +156,8 @@ protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipeProper if (coilTier <= 0) return; - resultOverclock[0] *= 1.0f - coilTier * 0.1; // each coil above cupronickel (coilTier = 0) uses 10% less energy + resultOverclock[0] *= 1.0f - coilTier * 0.1; // each coil above cupronickel (coilTier = 0) uses 10% less + // energy resultOverclock[0] = Math.max(1, resultOverclock[0]); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java index 55a8b966fa7..ed12643fe4a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -22,6 +19,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -31,19 +29,21 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityDataBank extends MultiblockWithDisplayBase implements IControllable { private static final int EUT_PER_HATCH = GTValues.VA[GTValues.EV]; @@ -215,7 +215,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @SideOnly(Side.CLIENT) @@ -237,13 +238,16 @@ public SoundEvent getSound() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.3")); - tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); - tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.5", TextFormattingUtil.formatNumbers(EUT_PER_HATCH_CHAINED))); + tooltip.add( + I18n.format("gregtech.machine.data_bank.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); + tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.5", + TextFormattingUtil.formatNumbers(EUT_PER_HATCH_CHAINED))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java index 3dddb3d390b..4918d203a08 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java @@ -9,8 +9,8 @@ import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; import gregtech.api.util.GTUtility; -import gregtech.api.util.TextComponentUtil; import gregtech.api.util.RelativeDirection; +import gregtech.api.util.TextComponentUtil; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; @@ -18,6 +18,7 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEOutputHatch; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -28,10 +29,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Function; +import javax.annotation.Nonnull; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityDistillationTower extends RecipeMapMultiblockController { @@ -60,7 +62,8 @@ protected void addDisplayText(List textList) { if (isStructureFormed()) { FluidStack stackInTank = importFluids.drain(Integer.MAX_VALUE, false); if (stackInTank != null && stackInTank.amount > 0) { - ITextComponent fluidName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(stackInTank), TextFormatting.AQUA); + ITextComponent fluidName = TextComponentUtil.setColor(GTUtility.getFluidTranslation(stackInTank), + TextFormatting.AQUA); textList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.distillation_tower.distilling_fluid", @@ -83,9 +86,10 @@ protected BlockPattern createStructurePattern() { .or(abilities(MultiblockAbility.IMPORT_FLUIDS).setExactLimit(1))) .where('X', states(getCasingState()) .or(metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.EXPORT_FLUIDS).stream() - .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch) && !(mte instanceof MetaTileEntityMEOutputHatch)) + .filter(mte -> !(mte instanceof MetaTileEntityMultiFluidHatch) && + !(mte instanceof MetaTileEntityMEOutputHatch)) .toArray(MetaTileEntity[]::new)) - .setMinLayerLimited(1).setMaxLayerLimited(1)) + .setMinLayerLimited(1).setMaxLayerLimited(1)) .or(autoAbilities(true, false))) .where('#', air()) .build(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java index 2136e3a2d91..51ba3cdb73a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java @@ -29,6 +29,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -44,12 +45,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityElectricBlastFurnace extends RecipeMapMultiblockController implements IHeatingCoil { private int blastFurnaceTemperature; @@ -97,8 +99,9 @@ protected void formStructure(PatternMatchContext context) { } else { this.blastFurnaceTemperature = CoilType.CUPRONICKEL.getCoilTemperature(); } - //the subtracted tier gives the starting level (exclusive) of the +100K heat bonus - this.blastFurnaceTemperature += 100 * Math.max(0, GTUtility.getFloorTierByVoltage(getEnergyContainer().getInputVoltage()) - GTValues.MV); + // the subtracted tier gives the starting level (exclusive) of the +100K heat bonus + this.blastFurnaceTemperature += 100 * + Math.max(0, GTUtility.getFloorTierByVoltage(getEnergyContainer().getInputVoltage()) - GTValues.MV); } @Override @@ -138,7 +141,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.2")); @@ -188,7 +192,8 @@ public List getMatchingShapes() { .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.WEST) .where('D', MetaTileEntities.FLUID_EXPORT_HATCH[GTValues.LV], EnumFacing.EAST) .where('H', MetaTileEntities.MUFFLER_HATCH[GTValues.LV], EnumFacing.UP) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.METAL_CASING.getState(MetalCasingType.INVAR_HEATPROOF), EnumFacing.NORTH); + .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(MetalCasingType.INVAR_HEATPROOF), EnumFacing.NORTH); GregTechAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) .forEach(entry -> shapeInfo.add(builder.where('C', entry.getKey()).build())); @@ -200,7 +205,8 @@ public List getMatchingShapes() { public List getDataInfo() { List list = super.getDataInfo(); list.add(new TextComponentTranslation("gregtech.multiblock.blast_furnace.max_temperature", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K").setStyle(new Style().setColor(TextFormatting.RED)))); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K") + .setStyle(new Style().setColor(TextFormatting.RED)))); return list; } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java index 0f435fece95..d7955df7bdb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IEnergyContainer; @@ -32,6 +28,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -48,12 +45,19 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.List; -public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase + implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { private final FluidDrillLogic minerLogic; private final int tier; @@ -169,7 +173,8 @@ protected void addDisplayText(List textList) { if (minerLogic.getDrilledFluid() != null) { // Fluid name Fluid drilledFluid = minerLogic.getDrilledFluid(); - ITextComponent fluidInfo = TextComponentUtil.setColor(GTUtility.getFluidTranslation(drilledFluid), TextFormatting.GREEN); + ITextComponent fluidInfo = TextComponentUtil + .setColor(GTUtility.getFluidTranslation(drilledFluid), TextFormatting.GREEN); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.drilled_fluid", @@ -178,13 +183,16 @@ protected void addDisplayText(List textList) { // Fluid amount ITextComponent amountInfo = TextComponentUtil.stringWithColor( TextFormatting.BLUE, - TextFormattingUtil.formatNumbers(minerLogic.getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + " L/t"); + TextFormattingUtil.formatNumbers( + minerLogic.getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + + " L/t"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.fluid_amount", amountInfo)); } else { - ITextComponent noFluid = TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.fluid_rig.no_fluid_in_area"); + ITextComponent noFluid = TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.fluid_rig.no_fluid_in_area"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fluid_rig.drilled_fluid", @@ -212,9 +220,12 @@ protected void addWarningText(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.description")); - tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.depletion", TextFormattingUtil.formatNumbers(100.0 / getDepletionChance()))); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], GTValues.VNF[this.tier + 1])); - tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.production", getRigMultiplier(), TextFormattingUtil.formatNumbers(getRigMultiplier() * 1.5))); + tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.depletion", + TextFormattingUtil.formatNumbers(100.0 / getDepletionChance()))); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], + GTValues.VNF[this.tier + 1])); + tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.production", getRigMultiplier(), + TextFormattingUtil.formatNumbers(getRigMultiplier() * 1.5))); if (tier > GTValues.MV) { tooltip.add(I18n.format("gregtech.machine.fluid_drilling_rig.shows_depletion")); } @@ -262,7 +273,8 @@ protected ICubeRenderer getFrontOverlay() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.minerLogic.isActive(), this.minerLogic.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + this.minerLogic.isActive(), this.minerLogic.isWorkingEnabled()); } @Override @@ -276,12 +288,14 @@ public void setWorkingEnabled(boolean isActivationAllowed) { } public boolean fillTanks(FluidStack stack, boolean simulate) { - return GTTransferUtils.addFluidsToFluidHandler(outputFluidInventory, simulate, Collections.singletonList(stack)); + return GTTransferUtils.addFluidsToFluidHandler(outputFluidInventory, simulate, + Collections.singletonList(stack)); } public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1 , Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, + Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } public long getEnergyInputPerSecond() { @@ -365,7 +379,8 @@ public boolean showProgressBar() { @Override public double getFillPercentage(int index) { - int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), + minerLogic.getChunkZ()); int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; return 1.0 * numOperationsLeft / maxOperations; } @@ -377,13 +392,16 @@ public TextureArea getProgressBarTexture(int index) { @Override public void addBarHoverText(List hoverList, int index) { - int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), minerLogic.getChunkZ()); + int numOperationsLeft = BedrockFluidVeinHandler.getOperationsRemaining(getWorld(), minerLogic.getChunkX(), + minerLogic.getChunkZ()); int maxOperations = BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS; int percentage = (int) Math.round(1.0 * numOperationsLeft / maxOperations * 100); - TextFormatting color = percentage > 40 ? TextFormatting.GREEN : percentage > 10 ? TextFormatting.YELLOW : TextFormatting.RED; + TextFormatting color = percentage > 40 ? TextFormatting.GREEN : + percentage > 10 ? TextFormatting.YELLOW : TextFormatting.RED; if (numOperationsLeft == 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.fluid_rig.vein_depleted")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.fluid_rig.vein_depleted")); } else { ITextComponent veinInfo = TextComponentUtil.stringWithColor(color, percentage + "%"); hoverList.add(TextComponentUtil.translationWithColor( diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index 957fbbe570f..8de28fd4ae8 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -1,7 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.AtomicDouble; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IEnergyContainer; @@ -39,6 +37,7 @@ import gregtech.common.blocks.BlockGlassCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -59,17 +58,22 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.AtomicDouble; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.DoubleSupplier; -public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity, IBloomEffect { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController + implements IFastRenderMetaTileEntity, IBloomEffect { private final int tier; private EnergyContainerList inputEnergyContainers; @@ -86,6 +90,7 @@ public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) this.recipeMapWorkable = new FusionRecipeLogic(this); this.tier = tier; this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -121,15 +126,18 @@ protected BlockPattern createStructurePattern() { .aisle("###############", "######OSO######", "###############") .where('S', selfPredicate()) .where('G', states(getCasingState(), getGlassState())) - .where('E', states(getCasingState(), getGlassState()).or(metaTileEntities(Arrays.stream(MetaTileEntities.ENERGY_INPUT_HATCH) - .filter(mte -> mte != null && tier <= mte.getTier() && mte.getTier() <= GTValues.UV) - .toArray(MetaTileEntity[]::new)) - .setMinGlobalLimited(1).setPreviewCount(16))) + .where('E', + states(getCasingState(), getGlassState()).or(metaTileEntities(Arrays + .stream(MetaTileEntities.ENERGY_INPUT_HATCH) + .filter(mte -> mte != null && tier <= mte.getTier() && mte.getTier() <= GTValues.UV) + .toArray(MetaTileEntity[]::new)) + .setMinGlobalLimited(1).setPreviewCount(16))) .where('C', states(getCasingState())) .where('K', states(getCoilState())) .where('O', states(getCasingState(), getGlassState()).or(abilities(MultiblockAbility.EXPORT_FLUIDS))) .where('A', air()) - .where('I', states(getCasingState()).or(abilities(MultiblockAbility.IMPORT_FLUIDS).setMinGlobalLimited(2))) + .where('I', + states(getCasingState()).or(abilities(MultiblockAbility.IMPORT_FLUIDS).setMinGlobalLimited(2))) .where('#', any()) .build(); } @@ -173,8 +181,7 @@ public List getMatchingShapes() { shapeInfos.add(baseBuilder.shallowCopy() .where('G', getCasingState()) - .build() - ); + .build()); shapeInfos.add(baseBuilder.build()); return shapeInfos; } @@ -221,6 +228,7 @@ protected void formStructure(PatternMatchContext context) { public void invalidateStructure() { super.invalidateStructure(); this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -241,6 +249,7 @@ protected void initializeAbilities() { this.inputEnergyContainers = new EnergyContainerList(energyInputs); long euCapacity = calculateEnergyStorageFactor(energyInputs.size()); this.energyContainer = new EnergyContainerHandler(this, euCapacity, GTValues.V[tier], 0, 0, 0) { + @Nonnull @Override public String getName() { @@ -261,8 +270,10 @@ protected void updateFormedValid() { } super.updateFormedValid(); if (recipeMapWorkable.isWorking() && color == null) { - if (recipeMapWorkable.getPreviousRecipe() != null && !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { - int newColor = 0xFF000000 | recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); + if (recipeMapWorkable.getPreviousRecipe() != null && + !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { + int newColor = 0xFF000000 | + recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); if (!Objects.equals(color, newColor)) { color = newColor; writeCustomData(GregtechDataCodes.UPDATE_COLOR, this::writeColor); @@ -306,9 +317,11 @@ private void writeColor(PacketBuffer buf) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); - tooltip.add(I18n.format("gregtech.machine.fusion_reactor.capacity", calculateEnergyStorageFactor(16) / 1000000L)); + tooltip.add( + I18n.format("gregtech.machine.fusion_reactor.capacity", calculateEnergyStorageFactor(16) / 1000000L)); tooltip.add(I18n.format("gregtech.machine.fusion_reactor.overclocking")); } @@ -338,17 +351,18 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Energy Bar builder.widget(new ProgressWidget( - () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity() : 0, + () -> energyContainer.getEnergyCapacity() > 0 ? + 1.0 * energyContainer.getEnergyStored() / energyContainer.getEnergyCapacity() : 0, 4, 144, 94, 7, GuiTextures.PROGRESS_BAR_FUSION_ENERGY, ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(this::addEnergyBarHoverText)); + .setHoverTextConsumer(this::addEnergyBarHoverText)); // Heat Bar builder.widget(new ProgressWidget( () -> energyContainer.getEnergyCapacity() > 0 ? 1.0 * heat / energyContainer.getEnergyCapacity() : 0, 100, 144, 94, 7, GuiTextures.PROGRESS_BAR_FUSION_HEAT, ProgressWidget.MoveType.HORIZONTAL) - .setHoverTextConsumer(this::addHeatBarHoverText)); + .setHoverTextConsumer(this::addHeatBarHoverText)); // Indicator Widget builder.widget(new IndicatorImageWidget(174, 122, 17, 17, getLogo()) @@ -385,7 +399,7 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { // Voiding Mode Button builder.widget(new ImageCycleButtonWidget(173, 189, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, 4, this::getVoidingMode, this::setVoidingMode) - .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); + .setTooltipHoverString(MultiblockWithDisplayBase::getVoidingModeTooltip)); // Distinct Buses Unavailable Image builder.widget(new ImageWidget(173, 171, 18, 18, GuiTextures.BUTTON_NO_DISTINCT_BUSES) @@ -402,8 +416,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { private void addEnergyBarHoverText(List hoverList) { ITextComponent energyInfo = TextComponentUtil.stringWithColor( TextFormatting.AQUA, - TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored()) + " / " - + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity()) + " EU"); + TextFormattingUtil.formatNumbers(energyContainer.getEnergyStored()) + " / " + + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity()) + " EU"); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.energy_stored", @@ -413,7 +427,8 @@ private void addEnergyBarHoverText(List hoverList) { private void addHeatBarHoverText(List hoverList) { ITextComponent heatInfo = TextComponentUtil.stringWithColor( TextFormatting.RED, - TextFormattingUtil.formatNumbers(heat) + " / " + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())); + TextFormattingUtil.formatNumbers(heat) + " / " + + TextFormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.fusion_reactor.heat", @@ -431,6 +446,7 @@ private static class FusionProgressSupplier { public FusionProgressSupplier() { // Bottom Left, fill on [0, 0.25) bottomLeft = new ProgressWidget.TimedProgressSupplier(200, 164, false) { + @Override public double getAsDouble() { double val = super.getAsDouble(); @@ -496,6 +512,7 @@ public DoubleSupplier getSupplier(Type type) { } private enum Type { + BOTTOM_LEFT( 61, 66, 35, 41, GuiTextures.PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL, ProgressWidget.MoveType.VERTICAL), @@ -527,12 +544,15 @@ private enum Type { public ProgressWidget getWidget(MetaTileEntityFusionReactor instance) { return new ProgressWidget( - () -> instance.recipeMapWorkable.isActive() ? instance.progressBarSupplier.getSupplier(this).getAsDouble() : 0, + () -> instance.recipeMapWorkable.isActive() ? + instance.progressBarSupplier.getSupplier(this).getAsDouble() : 0, x, y, width, height, texture, moveType) - .setIgnoreColor(true) - .setHoverTextConsumer(tl -> MultiblockDisplayText.builder(tl, instance.isStructureFormed()) - .setWorkingStatus(instance.recipeMapWorkable.isWorkingEnabled(), instance.recipeMapWorkable.isActive()) - .addWorkingStatusLine()); + .setIgnoreColor(true) + .setHoverTextConsumer( + tl -> MultiblockDisplayText.builder(tl, instance.isStructureFormed()) + .setWorkingStatus(instance.recipeMapWorkable.isWorkingEnabled(), + instance.recipeMapWorkable.isActive()) + .addWorkingStatusLine()); } } } @@ -561,8 +581,10 @@ public long getMaxVoltage() { @Override public void updateWorkable() { super.updateWorkable(); - // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and has fully wiped recipe progress - // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes it doubly hard to complete the recipe + // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and + // has fully wiped recipe progress + // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes + // it doubly hard to complete the recipe // (Will have to recover heat and recipe progress) if (heat > 0) { if (!isActive || !workingEnabled || (hasNotEnoughEnergy && progressTime == 0)) { @@ -623,7 +645,8 @@ protected void setActive(boolean active) { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { if (this.color != null && this.bloomRenderTicket == null) { - this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), this); + this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), + this); } } @@ -638,8 +661,10 @@ public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRend float r = (float) (color >> 16 & 255) / 255.0F; float g = (float) (color >> 8 & 255) / 255.0F; float b = (float) (color & 255) / 255.0F; - EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()).getAxis(); + EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing.Axis axis = RelativeDirection.UP.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()) + .getAxis(); RenderBufferHelper.renderRing(buffer, getPos().getX() - context.cameraX() + relativeBack.getXOffset() * 7 + 0.5, @@ -657,8 +682,10 @@ public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { @Override public AxisAlignedBB getRenderBoundingBox() { - EnumFacing relativeRight = RelativeDirection.RIGHT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); - EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), isFlipped()); + EnumFacing relativeRight = RelativeDirection.RIGHT.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); + EnumFacing relativeBack = RelativeDirection.BACK.getRelativeFacing(getFrontFacing(), getUpwardsFacing(), + isFlipped()); return new AxisAlignedBB( this.getPos().offset(relativeBack).offset(relativeRight, 6), diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java index 71dc6444a95..46098a29b79 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -32,8 +29,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -53,6 +49,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -62,7 +64,8 @@ import java.util.Set; import java.util.function.Supplier; -public class MetaTileEntityHPCA extends MultiblockWithDisplayBase implements IOpticalComputationProvider, IControllable, IProgressBarMultiblock { +public class MetaTileEntityHPCA extends MultiblockWithDisplayBase + implements IOpticalComputationProvider, IControllable, IProgressBarMultiblock { private static final double IDLE_TEMPERATURE = 200; private static final double DAMAGE_TEMPERATURE = 1000; @@ -131,7 +134,8 @@ public void update() { // we need to know what components we have on the client if (getWorld().isRemote) { if (isStructureFormed()) { - hpcaHandler.tryGatherClientComponents(getWorld(), getPos(), getFrontFacing(), getUpwardsFacing(), isFlipped()); + hpcaHandler.tryGatherClientComponents(getWorld(), getPos(), getFrontFacing(), getUpwardsFacing(), + isFlipped()); } else { hpcaHandler.clearClientComponents(); } @@ -144,7 +148,8 @@ protected void updateFormedValid() { if (isActive()) { // forcibly use active coolers at full rate if temperature is half-way to damaging temperature double midpoint = (DAMAGE_TEMPERATURE - IDLE_TEMPERATURE) / 2; - double temperatureChange = hpcaHandler.calculateTemperatureChange(coolantHandler, temperature >= midpoint) / 2.0; + double temperatureChange = hpcaHandler.calculateTemperatureChange(coolantHandler, temperature >= midpoint) / + 2.0; if (temperature + temperatureChange <= IDLE_TEMPERATURE) { temperature = IDLE_TEMPERATURE; } else { @@ -237,7 +242,8 @@ public List getMatchingShapes() { .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LuV], EnumFacing.NORTH) .where('H', MetaTileEntities.FLUID_IMPORT_HATCH[GTValues.LV], EnumFacing.NORTH) .where('O', MetaTileEntities.COMPUTATION_HATCH_TRANSMITTER, EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.NORTH); + .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getCasingState(), EnumFacing.NORTH); // a few example structures shapeInfo.add(builder.shallowCopy() @@ -309,7 +315,8 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override @@ -351,15 +358,16 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { builder.widget(new ProgressWidget( () -> hpcaHandler.getAllocatedCWUt() > 0 ? progressSupplier.getAsDouble() : 0, 74, 57, 47, 47, GuiTextures.HPCA_COMPONENT_OUTLINE, ProgressWidget.MoveType.HORIZONTAL) - .setIgnoreColor(true) - .setHoverTextConsumer(hpcaHandler::addInfo)); + .setIgnoreColor(true) + .setHoverTextConsumer(hpcaHandler::addInfo)); int startX = 76; int startY = 59; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { final int index = i * 3 + j; Supplier textureSupplier = () -> hpcaHandler.getComponentTexture(index); - builder.widget(new SuppliedImageWidget(startX + (15 * j), startY + (15 * i), 13, 13, textureSupplier).setIgnoreColor(true)); + builder.widget(new SuppliedImageWidget(startX + (15 * j), startY + (15 * i), 13, 13, textureSupplier) + .setIgnoreColor(true)); } } return builder; @@ -368,7 +376,8 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { @Override protected void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isStructureFormed()) - .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for display + .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for + // display .setWorkingStatusKeys( "gregtech.multiblock.idling", "gregtech.multiblock.idling", @@ -376,7 +385,8 @@ protected void addDisplayText(List textList) { .addCustom(tl -> { if (isStructureFormed()) { // Energy Usage - ITextComponent voltageName = new TextComponentString(GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())]); + ITextComponent voltageName = new TextComponentString( + GTValues.VNF[GTUtility.getTierByVoltage(hpcaHandler.getMaxEUt())]); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.hpca.energy", @@ -436,14 +446,16 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (temperature > 1000) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_temperature")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.error_temperature")); } hpcaHandler.addErrors(textList); } } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.high_performance_computing_array.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.high_performance_computing_array.tooltip.2")); @@ -521,16 +533,13 @@ public int getNumProgressBars() { @Override public double getFillPercentage(int index) { - return index == 0 - ? 1.0 * hpcaHandler.cachedCWUt / hpcaHandler.getMaxCWUt() - : Math.min(1.0, temperature / DAMAGE_TEMPERATURE); + return index == 0 ? 1.0 * hpcaHandler.cachedCWUt / hpcaHandler.getMaxCWUt() : + Math.min(1.0, temperature / DAMAGE_TEMPERATURE); } @Override public TextureArea getProgressBarTexture(int index) { - return index == 0 - ? GuiTextures.PROGRESS_BAR_HPCA_COMPUTATION - : GuiTextures.PROGRESS_BAR_FUSION_HEAT; + return index == 0 ? GuiTextures.PROGRESS_BAR_HPCA_COMPUTATION : GuiTextures.PROGRESS_BAR_FUSION_HEAT; } @Override @@ -825,57 +834,71 @@ public int getMaxCoolantDemand() { public void addInfo(List textList) { // Max Computation - ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, Integer.toString(getMaxCWUt())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_computation", data)); + ITextComponent data = TextComponentUtil.stringWithColor(TextFormatting.AQUA, + Integer.toString(getMaxCWUt())); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_computation", data)); // Cooling - TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : TextFormatting.GREEN; + TextFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? TextFormatting.RED : + TextFormatting.GREEN; data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingDemand())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_demand", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_cooling_demand", data)); data = TextComponentUtil.stringWithColor(coolingColor, Integer.toString(getMaxCoolingAmount())); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_cooling_available", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_cooling_available", data)); // Coolant Required if (getMaxCoolantDemand() > 0) { data = TextComponentUtil.stringWithColor( TextFormatting.YELLOW, getMaxCoolantDemand() + "L "); - ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.info_coolant_name"); + ITextComponent coolantName = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.hpca.info_coolant_name"); data.appendSibling(coolantName); } else { data = TextComponentUtil.stringWithColor(TextFormatting.GREEN, "0"); } - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.info_max_coolant_required", data)); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.info_max_coolant_required", data)); // Bridging if (numBridges > 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, "gregtech.multiblock.hpca.info_bridging_enabled")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GREEN, + "gregtech.multiblock.hpca.info_bridging_enabled")); } else { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.info_bridging_disabled")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.info_bridging_disabled")); } } public void addWarnings(List textList) { List warnings = new ArrayList<>(); if (numBridges > 1) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_multiple_bridges")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_multiple_bridges")); } if (computationProviders.isEmpty()) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_no_computation")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_no_computation")); } if (getMaxCoolingDemand() > getMaxCoolingAmount()) { - warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.hpca.warning_low_cooling")); + warnings.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.hpca.warning_low_cooling")); } if (!warnings.isEmpty()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.hpca.warning_structure_header")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.hpca.warning_structure_header")); textList.addAll(warnings); } } public void addErrors(List textList) { if (components.stream().anyMatch(IHPCAComponentHatch::isDamaged)) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.hpca.error_damaged")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.hpca.error_damaged")); } } @@ -886,7 +909,8 @@ public TextureArea getComponentTexture(int index) { return components.get(index).getComponentIcon(); } - public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing frontFacing, EnumFacing upwardsFacing, boolean flip) { + public void tryGatherClientComponents(World world, BlockPos pos, EnumFacing frontFacing, + EnumFacing upwardsFacing, boolean flip) { EnumFacing relativeUp = RelativeDirection.UP.getRelativeFacing(frontFacing, upwardsFacing, flip); if (components.isEmpty()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java index 4a3e201012f..a3fc6af4dbf 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java index bd00d438aa2..2f755707636 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java @@ -20,6 +20,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -30,11 +31,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityLargeChemicalReactor extends RecipeMapMultiblockController { public MetaTileEntityLargeChemicalReactor(ResourceLocation metaTileEntityId) { @@ -70,48 +72,47 @@ public List getMatchingShapes() { MultiblockShapeInfo.Builder baseBuilder = MultiblockShapeInfo.builder() .where('S', MetaTileEntities.LARGE_CHEMICAL_REACTOR, EnumFacing.SOUTH) .where('X', MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING)) - .where('P', MetaBlocks.BOILER_CASING.getState(BlockBoilerCasing.BoilerCasingType.POLYTETRAFLUOROETHYLENE_PIPE)) + .where('P', + MetaBlocks.BOILER_CASING + .getState(BlockBoilerCasing.BoilerCasingType.POLYTETRAFLUOROETHYLENE_PIPE)) .where('C', MetaBlocks.WIRE_COIL.getState(BlockWireCoil.CoilType.CUPRONICKEL)) .where('I', MetaTileEntities.ITEM_IMPORT_BUS[3], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[3], EnumFacing.NORTH) .where('O', MetaTileEntities.ITEM_EXPORT_BUS[3], EnumFacing.SOUTH) .where('F', MetaTileEntities.FLUID_IMPORT_HATCH[3], EnumFacing.SOUTH) .where('H', MetaTileEntities.FLUID_EXPORT_HATCH[3], EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), EnumFacing.SOUTH); + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), + EnumFacing.SOUTH); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XCX", "XXX") .aisle("XXX", "XPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "XPX", "XCX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XCX", "XPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "CPX", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("XEX", "XXX", "XXX") .aisle("XXX", "XPC", "XXX") .aisle("IMO", "FSH", "XXX") - .build() - ); + .build()); return shapeInfo; } - @SideOnly(Side.CLIENT) @Override public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { @@ -143,5 +144,4 @@ public void addInformation(ItemStack stack, @Nullable World player, List protected ICubeRenderer getFrontOverlay() { return Textures.LARGE_CHEMICAL_REACTOR_OVERLAY; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index dd52ae74fda..166073d5cec 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.Lists; import gregtech.api.GTValues; import gregtech.api.capability.*; import gregtech.api.capability.impl.EnergyContainerList; @@ -38,6 +33,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -56,16 +52,24 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.unification.material.Materials.DrillingFluid; -public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase implements IMiner, IControllable, IDataInfoProvider { +public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase + implements IMiner, IControllable, IDataInfoProvider { private static final int CHUNK_LENGTH = 16; @@ -85,17 +89,21 @@ public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase implemen private final MultiblockMinerLogic minerLogic; - public MetaTileEntityLargeMiner(ResourceLocation metaTileEntityId, int tier, int speed, int maximumChunkDiameter, int fortune, Material material, int drillingFluidConsumePerTick) { + public MetaTileEntityLargeMiner(ResourceLocation metaTileEntityId, int tier, int speed, int maximumChunkDiameter, + int fortune, Material material, int drillingFluidConsumePerTick) { super(metaTileEntityId); this.material = material; this.tier = tier; this.drillingFluidConsumePerTick = drillingFluidConsumePerTick; - this.minerLogic = new MultiblockMinerLogic(this, fortune, speed, maximumChunkDiameter * CHUNK_LENGTH / 2, RecipeMaps.MACERATOR_RECIPES); + this.minerLogic = new MultiblockMinerLogic(this, fortune, speed, maximumChunkDiameter * CHUNK_LENGTH / 2, + RecipeMaps.MACERATOR_RECIPES); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityLargeMiner(metaTileEntityId, this.tier, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius() * 2 / CHUNK_LENGTH, this.minerLogic.getFortune(), getMaterial(), getDrillingFluidConsumePerTick()); + return new MetaTileEntityLargeMiner(metaTileEntityId, this.tier, this.minerLogic.getSpeed(), + this.minerLogic.getMaximumRadius() * 2 / CHUNK_LENGTH, this.minerLogic.getFortune(), getMaterial(), + getDrillingFluidConsumePerTick()); } @Override @@ -117,7 +125,8 @@ private void initializeAbilities() { this.outputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.EXPORT_ITEMS)); this.energyContainer = new EnergyContainerList(getAbilities(MultiblockAbility.INPUT_ENERGY)); this.minerLogic.setVoltageTier(GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage())); - this.minerLogic.setOverclockAmount(Math.max(1, GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); + this.minerLogic.setOverclockAmount( + Math.max(1, GTUtility.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); this.minerLogic.initPos(getPos(), this.minerLogic.getCurrentRadius()); } @@ -129,7 +138,8 @@ private void resetTileAbilities() { public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1, Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, + Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } @Override @@ -146,9 +156,11 @@ public boolean drainEnergy(boolean simulate) { @Override public boolean drainFluid(boolean simulate) { - FluidStack drillingFluid = DrillingFluid.getFluid(this.drillingFluidConsumePerTick * this.minerLogic.getOverclockAmount()); + FluidStack drillingFluid = DrillingFluid + .getFluid(this.drillingFluidConsumePerTick * this.minerLogic.getOverclockAmount()); FluidStack fluidStack = inputFluidInventory.getTankAt(0).getFluid(); - if (fluidStack != null && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && fluidStack.amount >= drillingFluid.amount) { + if (fluidStack != null && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && + fluidStack.amount >= drillingFluid.amount) { if (!simulate) inputFluidInventory.drain(drillingFluid, true); return true; @@ -160,7 +172,8 @@ public boolean drainFluid(boolean simulate) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.minerLogic.isWorking(), this.isWorkingEnabled()); + this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + this.minerLogic.isWorking(), this.isWorkingEnabled()); minerLogic.renderPipe(renderState, translation, pipeline); } @@ -183,7 +196,8 @@ protected BlockPattern createStructurePattern() { .where('X', states(getCasingState()) .or(abilities(MultiblockAbility.EXPORT_ITEMS).setMaxGlobalLimited(1).setPreviewCount(1)) .or(abilities(MultiblockAbility.IMPORT_FLUIDS).setExactLimit(1).setPreviewCount(1)) - .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3) + .setPreviewCount(1))) .where('C', states(getCasingState())) .where('F', getFramePredicate()) .where('#', any()) @@ -192,17 +206,21 @@ protected BlockPattern createStructurePattern() { @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.machine.miner.multi.description")}; + return new String[] { I18n.format("gregtech.machine.miner.multi.description") }; } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; tooltip.add(I18n.format("gregtech.machine.miner.multi.modes")); tooltip.add(I18n.format("gregtech.machine.miner.multi.production")); - tooltip.add(I18n.format("gregtech.machine.miner.fluid_usage", getDrillingFluidConsumePerTick(), DrillingFluid.getLocalizedName())); - tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_chunks_max", workingAreaChunks, workingAreaChunks)); - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], GTValues.VNF[this.tier + 1])); + tooltip.add(I18n.format("gregtech.machine.miner.fluid_usage", getDrillingFluidConsumePerTick(), + DrillingFluid.getLocalizedName())); + tooltip.add(I18n.format("gregtech.universal.tooltip.working_area_chunks_max", workingAreaChunks, + workingAreaChunks)); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_tier_range", GTValues.VNF[this.tier], + GTValues.VNF[this.tier + 1])); } @Override @@ -224,23 +242,31 @@ protected void addDisplayText(List textList) { int energyContainer = getEnergyTier(); long maxVoltage = GTValues.V[energyContainer]; String voltageName = GTValues.VNF[energyContainer]; - textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, voltageName)); + textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", maxVoltage, + voltageName)); } int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", this.minerLogic.getX().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getX().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", this.minerLogic.getY().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getY().get())); - textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getZ().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", + this.minerLogic.getX().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getX().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", + this.minerLogic.getY().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getY().get())); + textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", + this.minerLogic.getZ().get() == Integer.MAX_VALUE ? 0 : this.minerLogic.getZ().get())); if (this.minerLogic.isChunkMode()) { - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", workingAreaChunks, workingAreaChunks)); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", + workingAreaChunks, workingAreaChunks)); } else { - textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + textList.add( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); } @@ -249,11 +275,14 @@ else if (!this.isWorkingEnabled()) private void addDisplayText2(List textList) { if (this.isStructureFormed()) { ITextComponent mCoords = new TextComponentString(" ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())) + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", + this.minerLogic.getMineX().get())) .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())) + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", + this.minerLogic.getMineY().get())) .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", + this.minerLogic.getMineZ().get())); textList.add(mCoords); } } @@ -275,7 +304,8 @@ protected void addWarningText(List textList) { protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed() && !drainFluid(true)) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.machine.miner.multi.needsfluid")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.machine.miner.multi.needsfluid")); } } @@ -322,7 +352,6 @@ public void readFromNBT(NBTTagCompound data) { this.minerLogic.readFromNBT(data); } - @Override public void writeInitialSyncData(PacketBuffer buf) { super.writeInitialSyncData(buf); @@ -406,17 +435,19 @@ private void setCurrentMode(int mode) { @Override protected @NotNull Widget getFlexButton(int x, int y, int width, int height) { - return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode, this::setCurrentMode) - .setTooltipHoverString(mode -> switch (mode) { - case 0 -> "gregtech.multiblock.miner.neither_mode"; - case 1 -> "gregtech.multiblock.miner.chunk_mode"; - case 2 -> "gregtech.multiblock.miner.silk_touch_mode"; - default -> "gregtech.multiblock.miner.both_modes"; - }); + return new ImageCycleButtonWidget(x, y, width, height, GuiTextures.BUTTON_MINER_MODES, 4, this::getCurrentMode, + this::setCurrentMode) + .setTooltipHoverString(mode -> switch (mode) { + case 0 -> "gregtech.multiblock.miner.neither_mode"; + case 1 -> "gregtech.multiblock.miner.chunk_mode"; + case 2 -> "gregtech.multiblock.miner.silk_touch_mode"; + default -> "gregtech.multiblock.miner.both_modes"; + }); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getWorld().isRemote || !this.isStructureFormed()) return true; @@ -429,7 +460,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci this.minerLogic.setCurrentRadius(currentRadius - CHUNK_LENGTH); } int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; - playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", workingAreaChunks, workingAreaChunks)); + playerIn.sendMessage(new TextComponentTranslation("gregtech.machine.miner.working_area_chunks", + workingAreaChunks, workingAreaChunks)); } else { if (currentRadius - CHUNK_LENGTH / 2 <= 0) { this.minerLogic.setCurrentRadius(this.minerLogic.getMaximumRadius()); @@ -437,7 +469,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci this.minerLogic.setCurrentRadius(currentRadius - CHUNK_LENGTH / 2); } int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); - playerIn.sendMessage(new TextComponentTranslation("gregtech.universal.tooltip.working_area", workingArea, workingArea)); + playerIn.sendMessage(new TextComponentTranslation("gregtech.universal.tooltip.working_area", + workingArea, workingArea)); } this.minerLogic.resetArea(); } else { @@ -514,7 +547,8 @@ public boolean isActive() { @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java index f6c6f6241de..831012eac9f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java @@ -20,17 +20,18 @@ import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.*; -import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; + public class MetaTileEntityMultiSmelter extends RecipeMapMultiblockController { protected int heatingCoilLevel; @@ -121,7 +122,9 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "C#C", "XMX") .aisle("XSX", "CCC", "XXX") .where('S', selfPredicate()) - .where('X', states(getCasingState()).setMinGlobalLimited(9).or(autoAbilities(true, true, true, true, true, true, false))) + .where('X', + states(getCasingState()).setMinGlobalLimited(9) + .or(autoAbilities(true, true, true, true, true, true, false))) .where('M', abilities(MultiblockAbility.MUFFLER_HATCH)) .where('C', heatingCoils()) .where('#', air()) @@ -173,7 +176,7 @@ public static int getMaxParallel(int heatingCoilLevel) { } /** - * @param parallel the amount of parallel recipes + * @param parallel the amount of parallel recipes * @param parallelLimit the maximum limit on parallel recipes * @return the un-overclocked duration for an amount of parallel recipes */ diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java index 80d51586aef..fc49827d51b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityNetworkSwitch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IOpticalComputationHatch; import gregtech.api.capability.IOpticalComputationProvider; @@ -21,7 +18,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -31,6 +28,8 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -136,11 +135,13 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.3")); - tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.4", TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); + tooltip.add(I18n.format("gregtech.machine.network_switch.tooltip.4", + TextFormattingUtil.formatNumbers(EUT_PER_HATCH))); } @Override @@ -167,7 +168,8 @@ protected void addWarningText(List textList) { } /** Handles computation load across multiple receivers and to multiple transmitters. */ - private static class MultipleComputationHandler implements IOpticalComputationProvider, IOpticalComputationReceiver { + private static class MultipleComputationHandler implements IOpticalComputationProvider, + IOpticalComputationReceiver { // providers in the NS provide distributable computation to the NS private final Set providers = new ObjectOpenHashSet<>(); @@ -176,7 +178,8 @@ private static class MultipleComputationHandler implements IOpticalComputationPr private int EUt; - private void onStructureForm(Collection providers, Collection transmitters) { + private void onStructureForm(Collection providers, + Collection transmitters) { reset(); this.providers.addAll(providers); this.transmitters.addAll(transmitters); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java index e80fb1044b0..c6ee87449d2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPowerSubstation.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechDataCodes; @@ -26,6 +23,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -40,6 +38,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.VisibleForTesting; @@ -51,7 +53,8 @@ import static gregtech.api.util.RelativeDirection.*; -public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase implements IControllable, IProgressBarMultiblock { +public class MetaTileEntityPowerSubstation extends MultiblockWithDisplayBase + implements IControllable, IProgressBarMultiblock { // Structure Constants public static final int MAX_BATTERY_LAYERS = 18; @@ -107,7 +110,8 @@ protected void formStructure(PatternMatchContext context) { List parts = new ArrayList<>(); for (Map.Entry battery : context.entrySet()) { - if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && battery.getValue() instanceof BatteryMatchWrapper wrapper) { + if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && + battery.getValue() instanceof BatteryMatchWrapper wrapper) { for (int i = 0; i < wrapper.amount; i++) { parts.add(wrapper.partType); } @@ -160,7 +164,8 @@ protected void updateFormedValid() { netIOLastSec -= energyPassiveDrained; // Debank to Dynamo Hatches - long energyDebanked = energyBank.drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); + long energyDebanked = energyBank + .drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); outputHatches.changeEnergy(energyDebanked); netIOLastSec -= energyDebanked; } @@ -222,10 +227,12 @@ protected BlockPattern createStructurePattern() { .aisle("GGGGG", "GGGGG", "GGGGG", "GGGGG", "GGGGG") .where('S', selfPredicate()) .where('C', states(getCasingState())) - .where('X' ,states(getCasingState()).setMinGlobalLimited(MIN_CASINGS) + .where('X', states(getCasingState()).setMinGlobalLimited(MIN_CASINGS) .or(maintenancePredicate()) - .or(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.SUBSTATION_INPUT_ENERGY, MultiblockAbility.INPUT_LASER).setMinGlobalLimited(1)) - .or(abilities(MultiblockAbility.OUTPUT_ENERGY, MultiblockAbility.SUBSTATION_OUTPUT_ENERGY, MultiblockAbility.OUTPUT_LASER).setMinGlobalLimited(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.SUBSTATION_INPUT_ENERGY, + MultiblockAbility.INPUT_LASER).setMinGlobalLimited(1)) + .or(abilities(MultiblockAbility.OUTPUT_ENERGY, MultiblockAbility.SUBSTATION_OUTPUT_ENERGY, + MultiblockAbility.OUTPUT_LASER).setMinGlobalLimited(1))) .where('G', states(getGlassState())) .where('B', BATTERY_PREDICATE.get()) .build(); @@ -247,9 +254,9 @@ public List getMatchingShapes() { .where('N', MetaTileEntities.SUBSTATION_ENERGY_INPUT_HATCH[0], EnumFacing.SOUTH) .where('O', MetaTileEntities.ENERGY_OUTPUT_HATCH[GTValues.HV], EnumFacing.SOUTH) .where('T', MetaTileEntities.SUBSTATION_ENERGY_OUTPUT_HATCH[0], EnumFacing.SOUTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance - ? MetaTileEntities.MAINTENANCE_HATCH - : MetaBlocks.METAL_CASING.getState(MetalCasingType.PALLADIUM_SUBSTATION), + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + MetaBlocks.METAL_CASING.getState(MetalCasingType.PALLADIUM_SUBSTATION), EnumFacing.SOUTH); GregTechAPI.PSS_BATTERIES.entrySet().stream() @@ -270,26 +277,27 @@ protected IBlockState getGlassState() { return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.LAMINATED_GLASS); } - protected static final Supplier BATTERY_PREDICATE = () -> new TraceabilityPredicate(blockWorldState -> { - IBlockState state = blockWorldState.getBlockState(); - if (GregTechAPI.PSS_BATTERIES.containsKey(state)) { - IBatteryData battery = GregTechAPI.PSS_BATTERIES.get(state); - // Allow unfilled batteries in the structure, but do not add them to match context. - // This lets you use empty batteries as "filler slots" for convenience if desired. - if (battery.getTier() != -1 && battery.getCapacity() > 0) { - String key = PMC_BATTERY_HEADER + battery.getBatteryName(); - BatteryMatchWrapper wrapper = blockWorldState.getMatchContext().get(key); - if (wrapper == null) wrapper = new BatteryMatchWrapper(battery); - blockWorldState.getMatchContext().set(key, wrapper.increment()); - } - return true; - } - return false; - }, () -> GregTechAPI.PSS_BATTERIES.entrySet().stream() - .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) - .map(entry -> new BlockInfo(entry.getKey(), null)) - .toArray(BlockInfo[]::new)) - .addTooltips("gregtech.multiblock.pattern.error.batteries"); + protected static final Supplier BATTERY_PREDICATE = () -> new TraceabilityPredicate( + blockWorldState -> { + IBlockState state = blockWorldState.getBlockState(); + if (GregTechAPI.PSS_BATTERIES.containsKey(state)) { + IBatteryData battery = GregTechAPI.PSS_BATTERIES.get(state); + // Allow unfilled batteries in the structure, but do not add them to match context. + // This lets you use empty batteries as "filler slots" for convenience if desired. + if (battery.getTier() != -1 && battery.getCapacity() > 0) { + String key = PMC_BATTERY_HEADER + battery.getBatteryName(); + BatteryMatchWrapper wrapper = blockWorldState.getMatchContext().get(key); + if (wrapper == null) wrapper = new BatteryMatchWrapper(battery); + blockWorldState.getMatchContext().set(key, wrapper.increment()); + } + return true; + } + return false; + }, () -> GregTechAPI.PSS_BATTERIES.entrySet().stream() + .sorted(Comparator.comparingInt(entry -> entry.getValue().getTier())) + .map(entry -> new BlockInfo(entry.getKey(), null)) + .toArray(BlockInfo[]::new)) + .addTooltips("gregtech.multiblock.pattern.error.batteries"); @SideOnly(Side.CLIENT) @Override @@ -307,7 +315,8 @@ protected ICubeRenderer getFrontOverlay() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), this.isWorkingEnabled()); + getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), + this.isWorkingEnabled()); } @Override @@ -378,14 +387,16 @@ protected void addDisplayText(List textList) { // Time to fill/drain line if (averageIOLastSec > 0) { - ITextComponent timeToFill = getTimeToFillDrainText(energyCapacity.subtract(energyStored).divide(BigInteger.valueOf(averageIOLastSec * 20))); + ITextComponent timeToFill = getTimeToFillDrainText(energyCapacity.subtract(energyStored) + .divide(BigInteger.valueOf(averageIOLastSec * 20))); TextComponentUtil.setColor(timeToFill, TextFormatting.GREEN); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.power_substation.time_to_fill", timeToFill)); } else if (averageIOLastSec < 0) { - ITextComponent timeToDrain = getTimeToFillDrainText(energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20))); + ITextComponent timeToDrain = getTimeToFillDrainText( + energyStored.divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20))); TextComponentUtil.setColor(timeToDrain, TextFormatting.RED); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, @@ -402,7 +413,8 @@ protected void addWarningText(List textList) { super.addWarningText(textList); if (isStructureFormed()) { if (averageIOLastSec < 0) { // decreasing - BigInteger timeToDrainSeconds = energyBank.getStored().divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); + BigInteger timeToDrainSeconds = energyBank.getStored() + .divide(BigInteger.valueOf(Math.abs(averageIOLastSec) * 20)); if (timeToDrainSeconds.compareTo(BigInteger.valueOf(60 * 60)) < 0) { // less than 1 hour left textList.add(TextComponentUtil.translationWithColor( TextFormatting.YELLOW, @@ -499,14 +511,15 @@ public T getCapability(Capability capability, EnumFacing side) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip1")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip2")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip3", MAX_BATTERY_LAYERS)); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip4")); tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip5", PASSIVE_DRAIN_MAX_PER_STORAGE)); - tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip6") - + TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.power_substation.tooltip6.5")); + tooltip.add(I18n.format("gregtech.machine.power_substation.tooltip6") + TooltipHelper.RAINBOW_SLOW + + I18n.format("gregtech.machine.power_substation.tooltip6.5")); } public String getStored() { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java index a680fd7e0bd..41cce088abd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java @@ -26,6 +26,7 @@ import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -38,11 +39,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + import org.apache.commons.lang3.ArrayUtils; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.api.GTValues.ULV; @@ -92,17 +95,14 @@ protected BlockPattern createStructurePattern() { } public IBlockState getCasingState() { - return tier == 0 - ? MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.TUNGSTENSTEEL_ROBUST) - : MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.HSSE_STURDY); + return tier == 0 ? MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.TUNGSTENSTEEL_ROBUST) : + MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.HSSE_STURDY); } @SideOnly(Side.CLIENT) @Override public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { - return tier == 0 - ? Textures.ROBUST_TUNGSTENSTEEL_CASING - : Textures.STURDY_HSSE_CASING; + return tier == 0 ? Textures.ROBUST_TUNGSTENSTEEL_CASING : Textures.STURDY_HSSE_CASING; } @Override @@ -118,27 +118,35 @@ protected void addDisplayText(List textList) { // Machine mode text // Shared text components for both states - ITextComponent maxMachinesText = TextComponentUtil.stringWithColor(TextFormatting.DARK_PURPLE, Integer.toString(getMachineLimit())); - maxMachinesText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_max", maxMachinesText); + ITextComponent maxMachinesText = TextComponentUtil.stringWithColor(TextFormatting.DARK_PURPLE, + Integer.toString(getMachineLimit())); + maxMachinesText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines_max", maxMachinesText); if (logic.activeRecipeMap == null) { // No machines in hatch - ITextComponent noneText = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.machine.machine_hatch.machines_none"); - ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", noneText); - ITextComponent hoverText1 = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_none_hover"); + ITextComponent noneText = TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.machine.machine_hatch.machines_none"); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines", noneText); + ITextComponent hoverText1 = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines_none_hover"); tl.add(TextComponentUtil.setHover(bodyText, hoverText1, maxMachinesText)); } else { // Some amount of machines in hatch String key = logic.getMachineStack().getTranslationKey(); - ITextComponent mapText = TextComponentUtil.translationWithColor(TextFormatting.DARK_PURPLE, key + ".name"); + ITextComponent mapText = TextComponentUtil.translationWithColor(TextFormatting.DARK_PURPLE, + key + ".name"); mapText = TextComponentUtil.translationWithColor( TextFormatting.DARK_PURPLE, "%sx %s", logic.getParallelLimit(), mapText); - ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines", mapText); + ITextComponent bodyText = TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.machine.machine_hatch.machines", mapText); ITextComponent voltageName = new TextComponentString(GTValues.VNF[logic.machineTier]); int amps = logic.getMachineStack().getCount(); - String energyFormatted = TextFormattingUtil.formatNumbers(GTValues.V[logic.machineTier] * amps); + String energyFormatted = TextFormattingUtil + .formatNumbers(GTValues.V[logic.machineTier] * amps); ITextComponent hoverText = TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.machine.machine_hatch.machines_max_eut", @@ -148,7 +156,8 @@ protected void addDisplayText(List textList) { // Hatch locked status if (isActive()) { - tl.add(TextComponentUtil.translationWithColor(TextFormatting.DARK_RED, "gregtech.machine.machine_hatch.locked")); + tl.add(TextComponentUtil.translationWithColor(TextFormatting.DARK_RED, + "gregtech.machine.machine_hatch.locked")); } } }) @@ -160,9 +169,7 @@ protected void addDisplayText(List textList) { @Nonnull @Override protected OrientedOverlayRenderer getFrontOverlay() { - return tier == 0 - ? Textures.PROCESSING_ARRAY_OVERLAY - : Textures.ADVANCED_PROCESSING_ARRAY_OVERLAY; + return tier == 0 ? Textures.PROCESSING_ARRAY_OVERLAY : Textures.ADVANCED_PROCESSING_ARRAY_OVERLAY; } @Override @@ -191,9 +198,12 @@ public SoundEvent getSound() { } @Override - public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, boolean checkMuffler) { + public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, + boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, + boolean checkMuffler) { TraceabilityPredicate predicate = super.autoAbilities(checkMaintenance, checkMuffler) - .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(4).setPreviewCount(1) : new TraceabilityPredicate()); + .or(checkEnergyIn ? abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(4).setPreviewCount(1) : new TraceabilityPredicate()); predicate = predicate.or(abilities(MultiblockAbility.IMPORT_ITEMS).setPreviewCount(1)); @@ -217,7 +227,6 @@ public int getItemOutputLimit() { ItemStack machineStack = ((ProcessingArrayWorkable) this.recipeMapWorkable).getMachineStack(); MetaTileEntity mte = GTUtility.getMetaTileEntity(machineStack); return mte == null ? 0 : mte.getItemOutputLimit(); - } @SuppressWarnings("InnerClassMayBeStatic") @@ -227,11 +236,11 @@ protected class ProcessingArrayWorkable extends MultiblockRecipeLogic { ItemStack currentMachineStack = ItemStack.EMPTY; MetaTileEntity mte = null; - //The Voltage Tier of the machines the PA is operating upon, from GTValues.V + // The Voltage Tier of the machines the PA is operating upon, from GTValues.V private int machineTier; - //The maximum Voltage of the machines the PA is operating upon + // The maximum Voltage of the machines the PA is operating upon private long machineVoltage; - //The Recipe Map of the machines the PA is operating upon + // The Recipe Map of the machines the PA is operating upon private RecipeMap activeRecipeMap; public ProcessingArrayWorkable(RecipeMapMultiblockController tileEntity) { @@ -243,7 +252,7 @@ public void invalidate() { super.invalidate(); // invalidate mte's cleanroom reference - if (mte != null && mte instanceof ICleanroomReceiver){ + if (mte != null && mte instanceof ICleanroomReceiver) { ((ICleanroomReceiver) mte).setCleanroom(null); } @@ -265,11 +274,13 @@ public void invalidate() { */ @Override public boolean isRecipeMapValid(@Nonnull RecipeMap recipeMap) { - if (ArrayUtils.contains(((IMachineHatchMultiblock) metaTileEntity).getBlacklist(), recipeMap.getUnlocalizedName())) { + if (ArrayUtils.contains(((IMachineHatchMultiblock) metaTileEntity).getBlacklist(), + recipeMap.getUnlocalizedName())) { return false; } - return GTUtility.isMachineValidForMachineHatch(currentMachineStack, ((IMachineHatchMultiblock) metaTileEntity).getBlacklist()); + return GTUtility.isMachineValidForMachineHatch(currentMachineStack, + ((IMachineHatchMultiblock) metaTileEntity).getBlacklist()); } @Override @@ -300,10 +311,9 @@ public RecipeMap getRecipeMap() { public void findMachineStack() { RecipeMapMultiblockController controller = (RecipeMapMultiblockController) this.metaTileEntity; - //The Processing Array is limited to 1 Machine Interface per multiblock, and only has 1 slot + // The Processing Array is limited to 1 Machine Interface per multiblock, and only has 1 slot ItemStack machine = controller.getAbilities(MultiblockAbility.MACHINE_HATCH).get(0).getStackInSlot(0); - mte = GTUtility.getMetaTileEntity(machine); if (mte == null) { @@ -326,7 +336,7 @@ public void findMachineStack() { } } - //Find the voltage tier of the machine. + // Find the voltage tier of the machine. this.machineTier = mte instanceof ITieredMetaTileEntity ? ((ITieredMetaTileEntity) mte).getTier() : 0; this.machineVoltage = GTValues.V[this.machineTier]; @@ -351,7 +361,8 @@ protected int getOverclockForTier(long voltage) { @Override public int getParallelLimit() { - return (currentMachineStack == null || currentMachineStack.isEmpty()) ? getMachineLimit() : Math.min(currentMachineStack.getCount(), getMachineLimit()); + return (currentMachineStack == null || currentMachineStack.isEmpty()) ? getMachineLimit() : + Math.min(currentMachineStack.getCount(), getMachineLimit()); } @Override @@ -370,10 +381,12 @@ public long getMaxVoltage() { protected int getNumberOfOCs(int recipeEUt) { if (!isAllowOverclocking()) return 0; - int recipeTier = Math.max(0, GTUtility.getTierByVoltage(recipeEUt / Math.max(1, this.parallelRecipesPerformed))); + int recipeTier = Math.max(0, + GTUtility.getTierByVoltage(recipeEUt / Math.max(1, this.parallelRecipesPerformed))); int maximumTier = Math.min(this.machineTier, GTUtility.getTierByVoltage(getMaxVoltage())); - // The maximum number of overclocks is determined by the difference between the tier the recipe is running at, + // The maximum number of overclocks is determined by the difference between the tier the recipe is running + // at, // and the maximum tier that the machine can overclock to. int numberOfOCs = maximumTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java index 6aa26293409..5528e207359 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java @@ -19,21 +19,22 @@ import gregtech.common.blocks.BlockMachineCasing.MachineCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityPyrolyseOven extends RecipeMapMultiblockController { @@ -180,8 +181,7 @@ protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipeProper if (coilTier == 0) { resultOverclock[1] *= 5.0 / 4; // 25% slower with cupronickel (coilTier = 0) - } - else resultOverclock[1] *= 2.0f / (coilTier + 1); // each coil above kanthal (coilTier = 1) is 50% faster + } else resultOverclock[1] *= 2.0f / (coilTier + 1); // each coil above kanthal (coilTier = 1) is 50% faster resultOverclock[1] = Math.max(1, resultOverclock[1]); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java index e7c20439a0c..17fafd955ae 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityResearchStation.java @@ -26,6 +26,7 @@ import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; @@ -37,13 +38,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -public class MetaTileEntityResearchStation extends RecipeMapMultiblockController implements IOpticalComputationReceiver { +public class MetaTileEntityResearchStation extends RecipeMapMultiblockController + implements IOpticalComputationReceiver { private IOpticalComputationProvider computationProvider; private IObjectHolder objectHolder; @@ -156,7 +159,10 @@ public List getMatchingShapes() { .where('P', getCasingState()) .where('O', MetaTileEntities.COMPUTATION_HATCH_RECEIVER, EnumFacing.NORTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LuV], EnumFacing.NORTH) - .where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : getCasingState(), EnumFacing.NORTH) + .where('M', + () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : + getCasingState(), + EnumFacing.NORTH) .where('H', MetaTileEntities.OBJECT_HOLDER, EnumFacing.NORTH) .build()); } @@ -205,7 +211,8 @@ public boolean canVoidRecipeItemOutputs() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.research_station.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.research_station.tooltip.2")); @@ -255,9 +262,10 @@ public boolean isAllowOverclocking() { } @Override - protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, @NotNull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, + @NotNull IItemHandlerModifiable importInventory) { // this machine cannot overclock, so don't bother calling it - this.overclockResults = new int[]{recipe.getEUt(), recipe.getDuration()}; + this.overclockResults = new int[] { recipe.getEUt(), recipe.getDuration() }; if (!hasEnoughPower(overclockResults)) { return false; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java index aa374cb8c68..d2d7af8a7b9 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.BlockMetalCasing.MetalCasingType; import gregtech.common.blocks.MetaBlocks; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; @@ -21,6 +22,7 @@ import javax.annotation.Nonnull; public class MetaTileEntityVacuumFreezer extends RecipeMapMultiblockController { + public MetaTileEntityVacuumFreezer(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.VACUUM_RECIPES); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java index 94334c5e427..5146f61dcc3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.electric.centralmonitor; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IEnergyContainer; @@ -37,6 +34,7 @@ import gregtech.common.pipelike.cable.net.EnergyNet; import gregtech.common.pipelike.cable.net.WorldENet; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -58,15 +56,21 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.*; +import javax.annotation.Nullable; + import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityCentralMonitor extends MultiblockWithDisplayBase implements IFastRenderMetaTileEntity { + private final static long ENERGY_COST = -ConfigHolder.machines.centralMonitorEuCost; public final static int MAX_HEIGHT = 9; public final static int MAX_WIDTH = 14; @@ -95,10 +99,12 @@ private EnergyNet getEnergyNet() { if (te instanceof TileEntityCable) { TileEntityPipeBase tileEntityCable = (TileEntityCable) te; EnergyNet currentEnergyNet = this.currentEnergyNet.get(); - if (currentEnergyNet != null && currentEnergyNet.isValid() && currentEnergyNet.containsNode(tileEntityCable.getPipePos())) { - return currentEnergyNet; //return current net if it is still valid + if (currentEnergyNet != null && currentEnergyNet.isValid() && + currentEnergyNet.containsNode(tileEntityCable.getPipePos())) { + return currentEnergyNet; // return current net if it is still valid } - WorldENet worldENet = (WorldENet) tileEntityCable.getPipeBlock().getWorldPipeNet(tileEntityCable.getPipeWorld()); + WorldENet worldENet = (WorldENet) tileEntityCable.getPipeBlock() + .getWorldPipeNet(tileEntityCable.getPipeWorld()); currentEnergyNet = worldENet.getNetFromPos(tileEntityCable.getPipePos()); if (currentEnergyNet != null) { this.currentEnergyNet = new WeakReference<>(currentEnergyNet); @@ -184,25 +190,24 @@ private boolean checkCovers() { } private void writeCovers(PacketBuffer buf) { - if(netCovers == null) { + if (netCovers == null) { buf.writeInt(0); } else { buf.writeInt(netCovers.size()); - for (FacingPos cover : netCovers){ + for (FacingPos cover : netCovers) { buf.writeBlockPos(cover.getPos()); buf.writeByte(cover.getFacing().getIndex()); } } - if(remoteCovers == null) { + if (remoteCovers == null) { buf.writeInt(0); } else { buf.writeInt(remoteCovers.size()); - for (FacingPos cover : remoteCovers){ + for (FacingPos cover : remoteCovers) { buf.writeBlockPos(cover.getPos()); buf.writeByte(cover.getFacing().getIndex()); } } - } private void readCovers(PacketBuffer buf) { @@ -219,8 +224,9 @@ private void readCovers(PacketBuffer buf) { } private void writeParts(PacketBuffer buf) { - buf.writeInt((int) this.getMultiblockParts().stream().filter(MetaTileEntityMonitorScreen.class::isInstance).count()); - this.getMultiblockParts().forEach(part->{ + buf.writeInt( + (int) this.getMultiblockParts().stream().filter(MetaTileEntityMonitorScreen.class::isInstance).count()); + this.getMultiblockParts().forEach(part -> { if (part instanceof MetaTileEntityMonitorScreen) { buf.writeBlockPos(((MetaTileEntityMonitorScreen) part).getPos()); } @@ -237,15 +243,15 @@ private void readParts(PacketBuffer buf) { } public void setHeight(int height) { - if(this.height == height || height < 2 || height > MAX_HEIGHT) return; + if (this.height == height || height < 2 || height > MAX_HEIGHT) return; this.height = height; reinitializeStructurePattern(); checkStructurePattern(); - writeCustomData(GregtechDataCodes.UPDATE_HEIGHT, buf-> buf.writeInt(height)); + writeCustomData(GregtechDataCodes.UPDATE_HEIGHT, buf -> buf.writeInt(height)); } private void setActive(boolean isActive) { - if(isActive == this.isActive) return; + if (isActive == this.isActive) return; this.isActive = isActive; writeCustomData(GregtechDataCodes.UPDATE_ACTIVE, buf -> buf.writeBoolean(this.isActive)); } @@ -258,7 +264,7 @@ private void clearScreens() { if (screens != null) { for (MetaTileEntityMonitorScreen[] screen : screens) { for (MetaTileEntityMonitorScreen s : screen) { - if(s != null) s.removeFromMultiBlock(this); + if (s != null) s.removeFromMultiBlock(this); } } } @@ -277,7 +283,8 @@ protected void addDisplayText(List textList) { super.addDisplayText(textList); textList.add(new TextComponentTranslation("gregtech.multiblock.central_monitor.height", this.height)); if (!isStructureFormed()) { - ITextComponent buttonText = new TextComponentTranslation("gregtech.multiblock.central_monitor.height_modify", height); + ITextComponent buttonText = new TextComponentTranslation( + "gregtech.multiblock.central_monitor.height_modify", height); buttonText.appendText(" "); buttonText.appendSibling(AdvancedTextWidget.withButton(new TextComponentString("[-]"), "sub")); buttonText.appendText(" "); @@ -363,8 +370,9 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHol @Override protected void updateFormedValid() { - if (this.getOffsetTimer() % 20 ==0) { - setActive(inputEnergy.changeEnergy(ENERGY_COST * this.getMultiblockParts().size()) == ENERGY_COST * this.getMultiblockParts().size()); + if (this.getOffsetTimer() % 20 == 0) { + setActive(inputEnergy.changeEnergy(ENERGY_COST * this.getMultiblockParts().size()) == + ENERGY_COST * this.getMultiblockParts().size()); if (checkCovers()) { this.getMultiblockParts().forEach(part -> { Set covers = getAllCovers(); @@ -404,14 +412,15 @@ protected BlockPattern createStructurePattern() { .aisle(end.toString()) .where('S', selfPredicate()) .where('A', states(MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID)) - .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3).setPreviewCount(1))) + .or(abilities(MultiblockAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3) + .setPreviewCount(1))) .where('B', metaTileEntities(MetaTileEntities.MONITOR_SCREEN)) .build(); } @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.central_monitor.tooltip.1")}; + return new String[] { I18n.format("gregtech.multiblock.central_monitor.tooltip.1") }; } @Override @@ -448,7 +457,7 @@ protected void formStructure(PatternMatchContext context) { @Override public T getCapability(Capability capability, EnumFacing side) { - if(side == this.frontFacing.getOpposite() && capability == GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER) { + if (side == this.frontFacing.getOpposite() && capability == GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER) { return GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER.cast(IEnergyContainer.DEFAULT); } return null; @@ -478,13 +487,13 @@ public boolean isGlobalRenderer() { @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { if (!this.isStructureFormed()) return; - RenderUtil.useStencil(()->{ + RenderUtil.useStencil(() -> { GlStateManager.pushMatrix(); RenderUtil.moveToFace(x, y, z, this.frontFacing); RenderUtil.rotateToFace(this.frontFacing, this.upwardsFacing); RenderUtil.renderRect(0.5f, -0.5f - (height - 2), width, height, 0.001f, 0xFF000000); GlStateManager.popMatrix(); - }, ()->{ + }, () -> { if (isActive) { GlStateManager.pushMatrix(); /* hack the lightmap */ @@ -494,7 +503,8 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick float lastBrightnessY = OpenGlHelper.lastBrightnessY; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); EntityPlayer player = Minecraft.getMinecraft().player; - RayTraceResult rayTraceResult = player == null ? null : player.rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); + RayTraceResult rayTraceResult = player == null ? null : player + .rayTrace(Minecraft.getMinecraft().playerController.getBlockReachDistance(), partialTicks); int size = 0; for (int w = 0; w < width; w++) { for (int h = 0; h < height; h++) { @@ -505,7 +515,8 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick BlockPos pos = screen.getPos(); BlockPos pos2 = this.getPos(); GlStateManager.pushMatrix(); - RenderUtil.moveToFace(x + pos.getX() - pos2.getX(), y + pos.getY() - pos2.getY(), z + pos.getZ() - pos2.getZ(), this.frontFacing); + RenderUtil.moveToFace(x + pos.getX() - pos2.getX(), y + pos.getY() - pos2.getY(), + z + pos.getZ() - pos2.getZ(), this.frontFacing); RenderUtil.rotateToFace(this.frontFacing, this.upwardsFacing); screen.renderScreen(partialTicks, rayTraceResult); GlStateManager.popMatrix(); @@ -518,8 +529,10 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick clearScreens(); for (BlockPos pos : parts) { TileEntity tileEntity = getWorld().getTileEntity(pos); - if(tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen screen = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen screen = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); screen.addToMultiBlock(this); int sx = screen.getX(), sy = screen.getY(); if (sx < 0 || sx >= width || sy < 0 || sy >= height) { @@ -532,7 +545,7 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick } } - /* restore the lightmap */ + /* restore the lightmap */ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); @@ -551,7 +564,7 @@ public AxisAlignedBB getRenderBoundingBox() { } else { if (spin == EnumFacing.NORTH) { sp = this.getPos().offset(EnumFacing.DOWN, 2); - ep = sp.offset(EnumFacing.UP, height + 1).offset(this.frontFacing.rotateY(), - width - 2); + ep = sp.offset(EnumFacing.UP, height + 1).offset(this.frontFacing.rotateY(), -width - 2); } else if (spin == EnumFacing.SOUTH) { sp = this.getPos().offset(EnumFacing.UP, 2); ep = sp.offset(EnumFacing.DOWN, height + 1).offset(this.frontFacing.rotateY(), width + 2); @@ -586,7 +599,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } } if (!this.getWorld().isRemote) { - this.getMultiblockParts().forEach(part->{ + this.getMultiblockParts().forEach(part -> { if (part instanceof MetaTileEntityMonitorScreen) { int x = ((MetaTileEntityMonitorScreen) part).getX(); int y = ((MetaTileEntityMonitorScreen) part).getY(); @@ -594,10 +607,12 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } }); } else { - parts.forEach(partPos->{ + parts.forEach(partPos -> { TileEntity tileEntity = this.getWorld().getTileEntity(partPos); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen part = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen part = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); int x = part.getX(); int y = part.getY(); screenGrids[x][y].setScreen(part); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java index 9bba55693a3..bd18ff1df86 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java @@ -1,6 +1,5 @@ package gregtech.common.metatileentities.multi.electric.centralmonitor; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.cover.Cover; import gregtech.api.cover.CoverHolder; @@ -27,6 +26,7 @@ import gregtech.common.gui.widget.monitor.WidgetPluginConfig; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; @@ -53,14 +53,17 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityMonitorScreen extends MetaTileEntityMultiblockPart { // run-time data @@ -84,7 +87,8 @@ public void setMode(FacingPos cover, CoverDigitalInterface.MODE mode) { CoverDigitalInterface last_cover = this.getCoverFromPosSide(coverPos); CoverDigitalInterface now_cover = this.getCoverFromPosSide(cover); if (this.mode == mode) { - if (Objects.equals(cover, coverPos) && last_cover == null && cover == null || last_cover != null && last_cover == now_cover) { + if (Objects.equals(cover, coverPos) && last_cover == null && cover == null || + last_cover != null && last_cover == now_cover) { return; } } @@ -110,7 +114,8 @@ public void setMode(CoverDigitalInterface.MODE mode) { } public void setConfig(int slot, float scale, int color) { - if ((this.scale == scale || scale < 1 || scale > 8) && (this.slot == slot || slot < 0) && this.frameColor == color) + if ((this.scale == scale || scale < 1 || scale > 8) && (this.slot == slot || slot < 0) && + this.frameColor == color) return; this.slot = slot; this.scale = scale; @@ -125,7 +130,7 @@ public CoverDigitalInterface getCoverFromPosSide(FacingPos posFacing) { IGregTechTileEntity holder = getHolderFromPos(posFacing.getPos()); if (holder == null) { TileEntity te = this.getWorld() == null ? null : this.getWorld().getTileEntity(posFacing.getPos()); - if (te instanceof IPipeTile pipeTile) { + if (te instanceof IPipeTilepipeTile) { coverHolder = pipeTile.getCoverableImplementation(); } } else { @@ -211,12 +216,12 @@ public int getX() { public int getY() { if (this.getController() != null) { - return ((MetaTileEntityCentralMonitor) this.getController()).height - (this.getPos().getY() + 1 - this.getController().getPos().getY()) - 1; + return ((MetaTileEntityCentralMonitor) this.getController()).height - + (this.getPos().getY() + 1 - this.getController().getPos().getY()) - 1; } return -1; } - public boolean isActive() { if (this.coverPos != null && this.mode != CoverDigitalInterface.MODE.PROXY) { CoverDigitalInterface cover = coverTMP != null ? coverTMP : this.getCoverFromPosSide(this.coverPos); @@ -238,7 +243,7 @@ public void pluginDirty() { } private void loadPlugin(MonitorPluginBaseBehavior plugin) { - if (plugin !=null && this.plugin != plugin) { + if (plugin != null && this.plugin != plugin) { this.plugin = plugin.createPlugin(); this.plugin.readFromNBT(this.itemInventory.getStackInSlot(0).getOrCreateSubCompound("monitor_plugin")); this.plugin.onMonitorValid(this, true); @@ -274,7 +279,8 @@ public void renderScreen(float partialTicks, RayTraceResult rayTraceResult) { if (coverTMP != null) { boolean flag = true; - if (checkLookingAt(rayTraceResult) != null && plugin == null && this.mode != CoverDigitalInterface.MODE.PROXY) { + if (checkLookingAt(rayTraceResult) != null && plugin == null && + this.mode != CoverDigitalInterface.MODE.PROXY) { if (coverTMP.renderSneakingLookAt(rayTraceResult.getBlockPos(), side, slot, partialTicks)) { flag = false; } @@ -290,7 +296,9 @@ public void renderScreen(float partialTicks, RayTraceResult rayTraceResult) { itemStack = ((IGregTechTileEntity) te).getMetaTileEntity().getStackForm(); } else { BlockPos pos = te.getPos(); - itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), coverTMP.getCoveredFacing(), pos), te.getWorld(), pos, Minecraft.getMinecraft().player); + itemStack = te.getBlockType().getPickBlock(te.getWorld().getBlockState(pos), + new RayTraceResult(new Vec3d(0.5, 0.5, 0.5), coverTMP.getCoveredFacing(), pos), + te.getWorld(), pos, Minecraft.getMinecraft().player); } String name = itemStack.getDisplayName(); // render machine @@ -347,7 +355,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == GregtechDataCodes.UPDATE_ALL) { readSync(buf); - } else if (dataId == GregtechDataCodes.UPDATE_PLUGIN_DATA) { //plugin + } else if (dataId == GregtechDataCodes.UPDATE_PLUGIN_DATA) { // plugin if (plugin != null) { plugin.readPluginData(buf.readVarInt(), buf); } @@ -408,6 +416,7 @@ public void readFromNBT(NBTTagCompound data) { protected void initializeInventory() { super.initializeInventory(); this.inventory = new GTItemStackHandler(this) { + @Override public int getSlotLimit(int slot) { return 1; @@ -455,7 +464,8 @@ public void onRemoval() { @Override public T getCapability(Capability capability, EnumFacing side) { - if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || + capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { Cover cover = getCoverFromPosSide(this.coverPos); if (cover != null) { return cover.getCoverableView().getCapability(capability, cover.getAttachedSide()); @@ -476,37 +486,52 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int width = 330; int height = 260; ToggleButtonWidget[] buttons = new ToggleButtonWidget[5]; - buttons[0] = new ToggleButtonWidget(width - 135, 25, 20, 20, GuiTextures.BUTTON_FLUID, () -> this.mode == CoverDigitalInterface.MODE.FLUID, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.FLUID); - }).setTooltipText("metaitem.cover.digital.mode.fluid"); - buttons[1] = new ToggleButtonWidget(width - 115, 25, 20, 20, GuiTextures.BUTTON_ITEM, () -> this.mode == CoverDigitalInterface.MODE.ITEM, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.ITEM); - }).setTooltipText("metaitem.cover.digital.mode.item"); - buttons[2] = new ToggleButtonWidget(width - 95, 25, 20, 20, GuiTextures.BUTTON_ENERGY, () -> this.mode == CoverDigitalInterface.MODE.ENERGY, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.ENERGY); - }).setTooltipText("metaitem.cover.digital.mode.energy"); - buttons[3] = new ToggleButtonWidget(width - 75, 25, 20, 20, GuiTextures.BUTTON_MACHINE, () -> this.mode == CoverDigitalInterface.MODE.MACHINE, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.MACHINE); - }).setTooltipText("metaitem.cover.digital.mode.machine"); - buttons[4] = new ToggleButtonWidget(width - 35, 25, 20, 20, GuiTextures.BUTTON_INTERFACE, () -> this.mode == CoverDigitalInterface.MODE.PROXY, (isPressed) -> { - if (isPressed) setMode(CoverDigitalInterface.MODE.PROXY); - }).setTooltipText("metaitem.cover.digital.mode.proxy"); + buttons[0] = new ToggleButtonWidget(width - 135, 25, 20, 20, GuiTextures.BUTTON_FLUID, + () -> this.mode == CoverDigitalInterface.MODE.FLUID, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.FLUID); + }).setTooltipText("metaitem.cover.digital.mode.fluid"); + buttons[1] = new ToggleButtonWidget(width - 115, 25, 20, 20, GuiTextures.BUTTON_ITEM, + () -> this.mode == CoverDigitalInterface.MODE.ITEM, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.ITEM); + }).setTooltipText("metaitem.cover.digital.mode.item"); + buttons[2] = new ToggleButtonWidget(width - 95, 25, 20, 20, GuiTextures.BUTTON_ENERGY, + () -> this.mode == CoverDigitalInterface.MODE.ENERGY, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.ENERGY); + }).setTooltipText("metaitem.cover.digital.mode.energy"); + buttons[3] = new ToggleButtonWidget(width - 75, 25, 20, 20, GuiTextures.BUTTON_MACHINE, + () -> this.mode == CoverDigitalInterface.MODE.MACHINE, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.MACHINE); + }).setTooltipText("metaitem.cover.digital.mode.machine"); + buttons[4] = new ToggleButtonWidget(width - 35, 25, 20, 20, GuiTextures.BUTTON_INTERFACE, + () -> this.mode == CoverDigitalInterface.MODE.PROXY, (isPressed) -> { + if (isPressed) setMode(CoverDigitalInterface.MODE.PROXY); + }).setTooltipText("metaitem.cover.digital.mode.proxy"); List covers = new ArrayList<>(); - ((MetaTileEntityCentralMonitor) controller).getAllCovers().forEach(coverPos -> covers.add(getCoverFromPosSide(coverPos))); + ((MetaTileEntityCentralMonitor) controller).getAllCovers() + .forEach(coverPos -> covers.add(getCoverFromPosSide(coverPos))); WidgetPluginConfig pluginWidget = new WidgetPluginConfig(); WidgetPluginConfig mainGroup = new WidgetPluginConfig().setSize(width, height); mainGroup.widget(new LabelWidget(15, 55, "monitor.gui.title.scale", 0xFFFFFFFF)) - .widget(new ClickButtonWidget(50, 50, 20, 20, "-1", (data) -> setConfig(this.slot, ((float) Math.round((scale - (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), this.frameColor))) - .widget(new ClickButtonWidget(130, 50, 20, 20, "+1", (data) -> setConfig(this.slot, ((float) Math.round((scale + (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), this.frameColor))) + .widget(new ClickButtonWidget(50, 50, 20, 20, "-1", + (data) -> setConfig(this.slot, + ((float) Math.round((scale - (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), + this.frameColor))) + .widget(new ClickButtonWidget(130, 50, 20, 20, "+1", + (data) -> setConfig(this.slot, + ((float) Math.round((scale + (data.isShiftClick ? 1.0f : 0.1f)) * 10) / 10), + this.frameColor))) .widget(new ImageWidget(70, 50, 60, 20, GuiTextures.DISPLAY)) .widget(new SimpleTextWidget(100, 60, "", 16777215, () -> Float.toString(scale))) .widget(new LabelWidget(15, 85, "monitor.gui.title.argb", 0xFFFFFFFF)) - .widget(new WidgetARGB(50, 80, 20, this.frameColor, (color) -> setConfig(this.slot, this.scale, color))) + .widget(new WidgetARGB(50, 80, 20, this.frameColor, + (color) -> setConfig(this.slot, this.scale, color))) .widget(new LabelWidget(15, 110, "monitor.gui.title.slot", 0xFFFFFFFF)) - .widget(new ClickButtonWidget(50, 105, 20, 20, "-1", (data) -> setConfig(this.slot - 1, this.scale, this.frameColor))) - .widget(new ClickButtonWidget(130, 105, 20, 20, "+1", (data) -> setConfig(this.slot + 1, this.scale, this.frameColor))) + .widget(new ClickButtonWidget(50, 105, 20, 20, "-1", + (data) -> setConfig(this.slot - 1, this.scale, this.frameColor))) + .widget(new ClickButtonWidget(130, 105, 20, 20, "+1", + (data) -> setConfig(this.slot + 1, this.scale, this.frameColor))) .widget(new ImageWidget(70, 105, 60, 20, GuiTextures.DISPLAY)) .widget(new SimpleTextWidget(100, 115, "", 16777215, () -> Integer.toString(slot))) @@ -515,13 +540,15 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT) .setChangeListener(() -> { if (this.getWorld() != null && !this.getWorld().isRemote) { - MonitorPluginBaseBehavior behavior = MonitorPluginBaseBehavior.getBehavior(inventory.getStackInSlot(0)); + MonitorPluginBaseBehavior behavior = MonitorPluginBaseBehavior + .getBehavior(inventory.getStackInSlot(0)); if (behavior == null) { unloadPlugin(); } else { loadPlugin(behavior); } - writeCustomData(GregtechDataCodes.UPDATE_PLUGIN_ITEM, packetBuffer -> packetBuffer.writeItemStack(inventory.getStackInSlot(0))); + writeCustomData(GregtechDataCodes.UPDATE_PLUGIN_ITEM, + packetBuffer -> packetBuffer.writeItemStack(inventory.getStackInSlot(0))); } })) .widget(new ClickButtonWidget(80, 130, 40, 20, "monitor.gui.title.config", (data) -> { @@ -530,6 +557,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { mainGroup.setVisible(false); } }) { + @Override protected void triggerButton() { super.triggerButton(); @@ -540,13 +568,14 @@ protected void triggerButton() { } }) - .widget(new WidgetCoverList(width - 140, 50, 120, 11, covers, getCoverFromPosSide(this.coverPos), (coverPos) -> { - if (coverPos == null) { - this.setMode(null, this.mode); - } else { - this.setMode(new FacingPos(coverPos.getPos(), coverPos.getAttachedSide())); - } - })) + .widget(new WidgetCoverList(width - 140, 50, 120, 11, covers, getCoverFromPosSide(this.coverPos), + (coverPos) -> { + if (coverPos == null) { + this.setMode(null, this.mode); + } else { + this.setMode(new FacingPos(coverPos.getPos(), coverPos.getAttachedSide())); + } + })) .widget(buttons[0]) .widget(buttons[1]) @@ -562,7 +591,8 @@ protected void triggerButton() { .widget(new LabelWidget(15, 13, "gregtech.machine.monitor_screen.name", 0XFFFFFFFF)) .widget(new ClickButtonWidget(15, 25, 40, 20, "monitor.gui.title.back", data -> { if (mainGroup.isVisible() && controller.isActive() && controller.isValid()) { - MetaTileEntityUIFactory.INSTANCE.openUI(controller.getHolder(), (EntityPlayerMP) entityPlayer); + MetaTileEntityUIFactory.INSTANCE.openUI(controller.getHolder(), + (EntityPlayerMP) entityPlayer); } else if (!mainGroup.isVisible()) { pluginWidget.removePluginWidget(); mainGroup.setVisible(true); @@ -571,6 +601,7 @@ protected void triggerButton() { } } }) { + @Override protected void triggerButton() { super.triggerButton(); @@ -593,8 +624,10 @@ protected void triggerButton() { return null; } - // adaptive click, supports scaling. x and y is the pos of the origin screen (scale = 1). this func must be called when screen is active. - public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, double y) { + // adaptive click, supports scaling. x and y is the pos of the origin screen (scale = 1). this func must be called + // when screen is active. + public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, double x, + double y) { if (this.plugin != null) { boolean flag = this.plugin.onClickLogic(playerIn, hand, facing, isRight, x, y); if (flag) return true; @@ -618,7 +651,8 @@ public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing fac if (te != null) { BlockPos pos = te.getPos(); IBlockState state = te.getWorld().getBlockState(pos); - state.getBlock().onBlockActivated(cover.getWorld(), pos, state, playerIn, hand, cover.getCoveredFacing(), 0.5f, 0.5f, 0.5f); + state.getBlock().onBlockActivated(cover.getWorld(), pos, state, playerIn, hand, + cover.getCoveredFacing(), 0.5f, 0.5f, 0.5f); } return true; } else { @@ -636,15 +670,15 @@ public boolean onClickLogic(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } private static double[] handleRayTraceResult(RayTraceResult rayTraceResult) { - double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); - double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y - ? rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() - : rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); + double dX = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.X ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.x - rayTraceResult.getBlockPos().getX(); + double dY = rayTraceResult.sideHit.getAxis() == EnumFacing.Axis.Y ? + rayTraceResult.hitVec.z - rayTraceResult.getBlockPos().getZ() : + rayTraceResult.hitVec.y - rayTraceResult.getBlockPos().getY(); dX = 1 - dX; dY = 1 - dY; - if(rayTraceResult.sideHit.getYOffset() < 0) { + if (rayTraceResult.sideHit.getYOffset() < 0) { dY = 1 - dY; } if (rayTraceResult.sideHit == EnumFacing.WEST || rayTraceResult.sideHit == EnumFacing.SOUTH) { @@ -653,12 +687,14 @@ private static double[] handleRayTraceResult(RayTraceResult rayTraceResult) { dX = 1 - dX; dY = 1 - dY; } - return new double[]{dX, dY}; + return new double[] { dX, dY }; } - private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, CuboidRayTraceResult rayTraceResult) { + private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, boolean isRight, + CuboidRayTraceResult rayTraceResult) { boolean flag = false; - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && this.getController() != null) { + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && + this.getController() != null) { double[] pos = handleRayTraceResult(rayTraceResult); MetaTileEntityMonitorScreen[][] screens = ((MetaTileEntityCentralMonitor) this.getController()).screens; int mX = this.getX(), mY = this.getY(); @@ -684,20 +720,25 @@ private boolean handleHitResultWithScale(EntityPlayer playerIn, EnumHand hand, E public double[] checkLookingAt(RayTraceResult rayTraceResult) { if (this.getWorld() != null) { MultiblockControllerBase controller = this.getController(); - if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && controller != null && rayTraceResult.sideHit == controller.getFrontFacing()) { + if (rayTraceResult != null && rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK && controller != null && + rayTraceResult.sideHit == controller.getFrontFacing()) { int i, j; TileEntity tileEntity = this.getWorld().getTileEntity(rayTraceResult.getBlockPos()); - if (tileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MetaTileEntityMonitorScreen screenHit = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (tileEntity instanceof IGregTechTileEntity && + ((IGregTechTileEntity) tileEntity).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MetaTileEntityMonitorScreen screenHit = (MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity) + .getMetaTileEntity(); if (controller == screenHit.getController()) { - i = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()).getX() - this.getX(); - j = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()).getY() - this.getY(); + i = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()) + .getX() - this.getX(); + j = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()) + .getY() - this.getY(); double[] pos = handleRayTraceResult(rayTraceResult); if ((i >= 0 && j >= 0)) { pos[0] = (pos[0] + i) / this.scale; pos[1] = (pos[1] + j) / this.scale; if (pos[0] >= 0 && pos[0] <= 1 && pos[1] >= 0 && pos[1] <= 1) - return new double[]{pos[0], pos[1]}; + return new double[] { pos[0], pos[1] }; } } } @@ -707,9 +748,10 @@ public double[] checkLookingAt(RayTraceResult rayTraceResult) { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { - if (!(!playerIn.isSneaking() && ToolHelper.isTool(playerIn.getHeldItem(hand), ToolClasses.SCREWDRIVER)) - && !MetaTileEntities.MONITOR_SCREEN.getStackForm().isItemEqual(playerIn.getHeldItem(hand))) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { + if (!(!playerIn.isSneaking() && ToolHelper.isTool(playerIn.getHeldItem(hand), ToolClasses.SCREWDRIVER)) && + !MetaTileEntities.MONITOR_SCREEN.getStackForm().isItemEqual(playerIn.getHeldItem(hand))) { if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { return true; @@ -727,7 +769,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking() && this.getWorld() != null && !this.getWorld().isRemote) { MetaTileEntityUIFactory.INSTANCE.openUI(this.getHolder(), (EntityPlayerMP) playerIn); return true; @@ -738,7 +781,8 @@ public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFaci @Override public void onLeftClick(EntityPlayer playerIn, EnumFacing facing, CuboidRayTraceResult hitResult) { - if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && playerIn.getPersistentID().equals(lastClickUUID)) { + if (playerIn.world.getTotalWorldTime() - lastClickTime < 2 && + playerIn.getPersistentID().equals(lastClickUUID)) { return; } lastClickTime = playerIn.world.getTotalWorldTime(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java index b095670187e..98344cce952 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java @@ -8,9 +8,9 @@ import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; + import net.minecraft.util.math.MathHelper; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -32,7 +32,7 @@ protected void updateRecipeProgress() { if (canRecipeProgress) { // turbines can void energy drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -44,7 +44,9 @@ public FluidStack getInputFluidStack() { if (previousRecipe == null) { Recipe recipe = findRecipe(Integer.MAX_VALUE, getInputInventory(), getInputTank()); - return recipe == null ? null : getInputTank().drain(new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), false); + return recipe == null ? null : getInputTank().drain( + new FluidStack(recipe.getFluidInputs().get(0).getInputFluidStack().getFluid(), Integer.MAX_VALUE), + false); } FluidStack fuelStack = previousRecipe.getFluidInputs().get(0).getInputFluidStack(); return getInputTank().drain(new FluidStack(fuelStack.getFluid(), Integer.MAX_VALUE), false); @@ -85,9 +87,9 @@ protected boolean prepareRecipe(Recipe recipe) { excessVoltage -= turbineMaxVoltage; } else { double holderEfficiency = rotorHolder.getTotalEfficiency() / 100.0; - //get the amount of parallel required to match the desired output voltage + // get the amount of parallel required to match the desired output voltage parallel = MathHelper.ceil((turbineMaxVoltage - excessVoltage) / - (Math.abs(recipe.getEUt()) * holderEfficiency)); + (Math.abs(recipe.getEUt()) * holderEfficiency)); // Null check fluid here, since it can return null on first join into world or first form FluidStack inputFluid = getInputFluidStack(); @@ -95,11 +97,11 @@ protected boolean prepareRecipe(Recipe recipe) { return false; } - //this is necessary to prevent over-consumption of fuel + // this is necessary to prevent over-consumption of fuel excessVoltage += (int) (parallel * Math.abs(recipe.getEUt()) * holderEfficiency - turbineMaxVoltage); } - //rebuild the recipe and adjust voltage to match the turbine + // rebuild the recipe and adjust voltage to match the turbine RecipeBuilder recipeBuilder = getRecipeMap().recipeBuilder(); recipeBuilder.append(recipe, parallel, false) .EUt(-turbineMaxVoltage); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 7499bbf37f4..a5a2a51ae86 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -24,6 +24,7 @@ import gregtech.common.blocks.BlockMultiblockCasing.MultiblockCasingType; import gregtech.common.blocks.BlockTurbineCasing.TurbineCasingType; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -37,9 +38,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntityLargeCombustionEngine extends FuelMultiblockController implements IProgressBarMultiblock { @@ -76,9 +78,8 @@ protected void addDisplayText(List textList) { builder.addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration()) .addCustom(tl -> { if (isStructureFormed() && recipeLogic.isOxygenBoosted) { - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted" - : "gregtech.multiblock.large_combustion_engine.oxygen_boosted"; + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted" : + "gregtech.multiblock.large_combustion_engine.oxygen_boosted"; tl.add(TextComponentUtil.translationWithColor(TextFormatting.AQUA, key)); } }) @@ -90,13 +91,17 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (checkIntakesObstructed()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.large_combustion_engine.obstructed.desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.large_combustion_engine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.large_combustion_engine.obstructed.desc")); } - FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), false); + FluidStack lubricantStack = getInputFluidInventory().drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + false); if (lubricantStack == null || lubricantStack.amount == 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.large_combustion_engine.no_lubricant")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.large_combustion_engine.no_lubricant")); } } } @@ -107,9 +112,11 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.universal.tooltip.base_production_eut", GTValues.V[tier])); tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_hour_lubricant", 1000)); if (isExtreme) { - tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_extreme", GTValues.V[tier] * 4)); + tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_extreme", + GTValues.V[tier] * 4)); } else { - tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_regular", GTValues.V[tier] * 3)); + tooltip.add(I18n.format("gregtech.machine.large_combustion_engine.tooltip.boost_regular", + GTValues.V[tier] * 3)); } } @@ -122,14 +129,18 @@ protected BlockPattern createStructurePattern() { .aisle("AAA", "AYA", "AAA") .where('X', states(getCasingState())) .where('G', states(getGearboxState())) - .where('C', states(getCasingState()).setMinGlobalLimited(3).or(autoAbilities(false, true, true, true, true, true, true))) + .where('C', + states(getCasingState()).setMinGlobalLimited(3) + .or(autoAbilities(false, true, true, true, true, true, true))) .where('D', metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.OUTPUT_ENERGY).stream() .filter(mte -> { - IEnergyContainer container = mte.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); - return container != null && container.getOutputVoltage() * container.getOutputAmperage() >= GTValues.V[tier]; + IEnergyContainer container = mte + .getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null); + return container != null && + container.getOutputVoltage() * container.getOutputAmperage() >= GTValues.V[tier]; }) .toArray(MetaTileEntity[]::new)) - .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier])) + .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier])) .where('A', states(getIntakeState()).addTooltips("gregtech.multiblock.pattern.clear_amount_1")) .where('Y', selfPredicate()) .build(); @@ -186,7 +197,7 @@ private boolean checkIntakesObstructed() { BlockPos centerPos = this.getPos().offset(facing); for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { - //Skip the controller block itself + // Skip the controller block itself if (x == 0 && y == 0) continue; BlockPos blockPos = centerPos.add(permuteXZ ? x : 0, y, permuteXZ ? 0 : x); @@ -228,16 +239,17 @@ public double getFillPercentage(int index) { } else if (index == 1) { int[] lubricantAmount = new int[2]; if (getInputFluidInventory() != null) { - lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + getInputFluidInventory()); } return lubricantAmount[1] != 0 ? 1.0 * lubricantAmount[0] / lubricantAmount[1] : 0; } else { int[] oxygenAmount = new int[2]; if (getInputFluidInventory() != null) { if (isBoostAllowed()) { - FluidStack oxygenStack = isExtreme - ? Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) - : Materials.Oxygen.getFluid(Integer.MAX_VALUE); + FluidStack oxygenStack = isExtreme ? + Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) : + Materials.Oxygen.getFluid(Integer.MAX_VALUE); oxygenAmount = getTotalFluidAmount(oxygenStack, getInputFluidInventory()); } } @@ -266,14 +278,16 @@ public void addBarHoverText(List hoverList, int index) { int lubricantCapacity = 0; if (isStructureFormed() && getInputFluidInventory() != null) { // Hunt for tanks with lubricant in them - int[] lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), getInputFluidInventory()); + int[] lubricantAmount = getTotalFluidAmount(Materials.Lubricant.getFluid(Integer.MAX_VALUE), + getInputFluidInventory()); lubricantStored = lubricantAmount[0]; lubricantCapacity = lubricantAmount[1]; } ITextComponent lubricantInfo = TextComponentUtil.stringWithColor( TextFormatting.GOLD, - TextFormattingUtil.formatNumbers(lubricantStored) + " / " + TextFormattingUtil.formatNumbers(lubricantCapacity) + " L"); + TextFormattingUtil.formatNumbers(lubricantStored) + " / " + + TextFormattingUtil.formatNumbers(lubricantCapacity) + " L"); hoverList.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.large_combustion_engine.lubricant_amount", @@ -285,9 +299,9 @@ public void addBarHoverText(List hoverList, int index) { int oxygenCapacity = 0; if (isStructureFormed() && getInputFluidInventory() != null) { // Hunt for tanks with Oxygen or LOX (depending on tier) in them - FluidStack oxygenStack = isExtreme - ? Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) - : Materials.Oxygen.getFluid(Integer.MAX_VALUE); + FluidStack oxygenStack = isExtreme ? + Materials.Oxygen.getFluid(FluidStorageKeys.LIQUID, Integer.MAX_VALUE) : + Materials.Oxygen.getFluid(Integer.MAX_VALUE); int[] oxygenAmount = getTotalFluidAmount(oxygenStack, getInputFluidInventory()); oxygenStored = oxygenAmount[0]; oxygenCapacity = oxygenAmount[1]; @@ -295,15 +309,14 @@ public void addBarHoverText(List hoverList, int index) { ITextComponent oxygenInfo = TextComponentUtil.stringWithColor( TextFormatting.AQUA, - TextFormattingUtil.formatNumbers(oxygenStored) + " / " + TextFormattingUtil.formatNumbers(oxygenCapacity) + " L"); - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount" - : "gregtech.multiblock.large_combustion_engine.oxygen_amount"; + TextFormattingUtil.formatNumbers(oxygenStored) + " / " + + TextFormattingUtil.formatNumbers(oxygenCapacity) + " L"); + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount" : + "gregtech.multiblock.large_combustion_engine.oxygen_amount"; hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, key, oxygenInfo)); } else { - String key = isExtreme - ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed" - : "gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed"; + String key = isExtreme ? "gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed" : + "gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed"; hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, key)); } } @@ -332,7 +345,7 @@ public LargeCombustionEngineWorkableHandler(RecipeMapMultiblockController tileEn protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { - //drain lubricant and invalidate if it fails + // drain lubricant and invalidate if it fails if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { @@ -343,8 +356,9 @@ protected void updateRecipeProgress() { } } - //drain oxygen if present to boost production, and if the dynamo hatch supports it - if (combustionEngine.isBoostAllowed() && (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { + // drain oxygen if present to boost production, and if the dynamo hatch supports it + if (combustionEngine.isBoostAllowed() && + (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; if (boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false))) { @@ -357,7 +371,7 @@ protected void updateRecipeProgress() { drawEnergy(recipeEUt, false); - //as recipe starts with progress on 1 this has to be > only not => to compensate for it + // as recipe starts with progress on 1 this has to be > only not => to compensate for it if (++progressTime > maxProgressTime) { completeRecipe(); } @@ -366,12 +380,14 @@ protected void updateRecipeProgress() { @Override protected boolean shouldSearchForRecipes() { - return super.shouldSearchForRecipes() && LUBRICANT_STACK.isFluidStackIdentical(((RecipeMapMultiblockController) metaTileEntity).getInputFluidInventory().drain(LUBRICANT_STACK, false)); + return super.shouldSearchForRecipes() && + LUBRICANT_STACK.isFluidStackIdentical(((RecipeMapMultiblockController) metaTileEntity) + .getInputFluidInventory().drain(LUBRICANT_STACK, false)); } @Override public long getMaxVoltage() { - //this multiplies consumption through parallel + // this multiplies consumption through parallel if (isOxygenBoosted) return GTValues.V[tier] * 2; else @@ -380,13 +396,13 @@ public long getMaxVoltage() { @Override protected long boostProduction(long production) { - //this multiplies production without increasing consumption + // this multiplies production without increasing consumption if (isOxygenBoosted) if (!isExtreme) - //recipe gives 2A EV and we want 3A EV, for 150% efficiency + // recipe gives 2A EV and we want 3A EV, for 150% efficiency return production * 3 / 2; else - //recipe gives 2A IV and we want 4A IV, for 200% efficiency + // recipe gives 2A IV and we want 4A IV, for 200% efficiency return production * 2; return production; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index 8a3e139e26b..105a5c3db29 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -17,6 +17,7 @@ import gregtech.api.util.TextComponentUtil; import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.ICubeRenderer; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -29,11 +30,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityLargeTurbine extends FuelMultiblockController implements ITieredMetaTileEntity, IProgressBarMultiblock { +public class MetaTileEntityLargeTurbine extends FuelMultiblockController + implements ITieredMetaTileEntity, IProgressBarMultiblock { public final int tier; @@ -47,7 +50,9 @@ public class MetaTileEntityLargeTurbine extends FuelMultiblockController impleme public IFluidHandler exportFluidHandler; - public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier, IBlockState casingState, IBlockState gearboxState, ICubeRenderer casingRenderer, boolean hasMufflerHatch, ICubeRenderer frontOverlay) { + public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier, + IBlockState casingState, IBlockState gearboxState, ICubeRenderer casingRenderer, + boolean hasMufflerHatch, ICubeRenderer frontOverlay) { super(metaTileEntityId, recipeMap, tier); this.casingState = casingState; this.gearboxState = gearboxState; @@ -61,7 +66,8 @@ public MetaTileEntityLargeTurbine(ResourceLocation metaTileEntityId, RecipeMap textList) { IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder.getRotorEfficiency() > 0) { ITextComponent efficiencyInfo = TextComponentUtil.stringWithColor( - TextFormatting.AQUA, TextFormattingUtil.formatNumbers(rotorHolder.getTotalEfficiency()) + "%"); + TextFormatting.AQUA, + TextFormattingUtil.formatNumbers(rotorHolder.getTotalEfficiency()) + "%"); tl.add(TextComponentUtil.translationWithColor( TextFormatting.GRAY, "gregtech.multiblock.turbine.efficiency", @@ -155,13 +162,16 @@ protected void addErrorText(List textList) { super.addErrorText(textList); if (isStructureFormed()) { if (!isRotorFaceFree()) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.obstructed")); - textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, "gregtech.multiblock.turbine.obstructed.desc")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.turbine.obstructed")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.GRAY, + "gregtech.multiblock.turbine.obstructed.desc")); } IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder.getRotorEfficiency() <= 0) { - textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, "gregtech.multiblock.turbine.no_rotor")); + textList.add(TextComponentUtil.translationWithColor(TextFormatting.RED, + "gregtech.multiblock.turbine.no_rotor")); } } } @@ -183,19 +193,20 @@ protected BlockPattern createStructurePattern() { .where('G', states(getGearBoxState())) .where('C', states(getCasingState())) .where('R', metaTileEntities(MultiblockAbility.REGISTRY.get(MultiblockAbility.ROTOR_HOLDER).stream() - .filter(mte -> (mte instanceof ITieredMetaTileEntity) && (((ITieredMetaTileEntity) mte).getTier() >= tier)) + .filter(mte -> (mte instanceof ITieredMetaTileEntity) && + (((ITieredMetaTileEntity) mte).getTier() >= tier)) .toArray(MetaTileEntity[]::new)) - .addTooltips("gregtech.multiblock.pattern.clear_amount_3") - .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier]) - .setExactLimit(1) - .or(abilities(MultiblockAbility.OUTPUT_ENERGY)).setExactLimit(1)) + .addTooltips("gregtech.multiblock.pattern.clear_amount_3") + .addTooltip("gregtech.multiblock.pattern.error.limited.1", GTValues.VN[tier]) + .setExactLimit(1) + .or(abilities(MultiblockAbility.OUTPUT_ENERGY)).setExactLimit(1)) .where('H', states(getCasingState()).or(autoAbilities(false, true, false, false, true, true, true))) .build(); } @Override public String[] getDescription() { - return new String[]{I18n.format("gregtech.multiblock.large_turbine.description")}; + return new String[] { I18n.format("gregtech.multiblock.large_turbine.description") }; } public IBlockState getCasingState() { @@ -296,7 +307,8 @@ public void addBarHoverText(List hoverList, int index) { // Rotor speed IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.turbine.no_rotor")); } else { int rotorSpeed = rotorHolder.getRotorSpeed(); int rotorMaxSpeed = rotorHolder.getMaxRotorHolderSpeed(); @@ -319,7 +331,8 @@ public void addBarHoverText(List hoverList, int index) { IRotorHolder rotorHolder = getRotorHolder(); if (rotorHolder == null || rotorHolder.getRotorEfficiency() <= 0) { // No rotor found - hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, "gregtech.multiblock.turbine.no_rotor")); + hoverList.add(TextComponentUtil.translationWithColor(TextFormatting.YELLOW, + "gregtech.multiblock.turbine.no_rotor")); } else { int rotorDurability = rotorHolder.getRotorDurabilityPercent(); ITextComponent rotorInfo = TextComponentUtil.stringWithColor( diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java index e5807b2359e..4f6c8eeff2b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IMaintenanceHatch; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,6 +9,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -21,10 +19,16 @@ import net.minecraft.util.Tuple; import net.minecraft.world.World; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityAutoMaintenanceHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IMaintenanceHatch { +import javax.annotation.Nullable; + +public class MetaTileEntityAutoMaintenanceHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IMaintenanceHatch { public MetaTileEntityAutoMaintenanceHatch(ResourceLocation metaTileEntityId) { super(metaTileEntityId, 3); @@ -57,12 +61,10 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } @Override - public void setTaped(boolean ignored) { - } + public void setTaped(boolean ignored) {} @Override - public void storeMaintenanceData(byte ignored1, int ignored2) { - } + public void storeMaintenanceData(byte ignored1, int ignored2) {} @Override public boolean hasMaintenanceData() { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java index 1801b18b91a..716fef7515d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.collect.ImmutableSet; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -12,7 +7,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; @@ -20,13 +15,21 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityCleaningMaintenanceHatch extends MetaTileEntityAutoMaintenanceHatch { protected static final Set CLEANED_TYPES = new ObjectOpenHashSet<>(); @@ -50,7 +53,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void addToMultiBlock(MultiblockControllerBase controllerBase) { super.addToMultiBlock(controllerBase); - if (controllerBase instanceof ICleanroomReceiver && ((ICleanroomReceiver) controllerBase).getCleanroom() == null) { + if (controllerBase instanceof ICleanroomReceiver && + ((ICleanroomReceiver) controllerBase).getCleanroom() == null) { ((ICleanroomReceiver) controllerBase).setCleanroom(DUMMY_CLEANROOM); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java index 175c8775eef..5787bfaae36 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IOpticalComputationHatch; @@ -15,18 +12,25 @@ import gregtech.api.util.GTLog; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collection; import java.util.List; -public class MetaTileEntityComputationHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IOpticalComputationHatch { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityComputationHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IOpticalComputationHatch { private final boolean isTransmitter; @@ -115,7 +119,8 @@ private IOpticalComputationProvider getOpticalNetProvider() { if (tileEntity == null) return null; if (tileEntity instanceof TileEntityOpticalPipe) { - return tileEntity.getCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, getFrontFacing().getOpposite()); + return tileEntity.getCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, + getFrontFacing().getOpposite()); } return null; } @@ -146,9 +151,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public MultiblockAbility getAbility() { - return isTransmitter() - ? MultiblockAbility.COMPUTATION_DATA_TRANSMISSION - : MultiblockAbility.COMPUTATION_DATA_RECEPTION; + return isTransmitter() ? MultiblockAbility.COMPUTATION_DATA_TRANSMISSION : + MultiblockAbility.COMPUTATION_DATA_RECEPTION; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java index ce0efdb5a9b..ea812b787c3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IDataAccessHatch; import gregtech.api.capability.impl.NotifiableItemStackHandler; @@ -25,8 +22,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.electric.MetaTileEntityDataBank; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -39,11 +35,20 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + +import java.util.*; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; -public class MetaTileEntityDataAccessHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IDataAccessHatch, IDataInfoProvider { +public class MetaTileEntityDataAccessHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IDataAccessHatch, + IDataInfoProvider { private final Set recipes; private final boolean isCreative; @@ -64,6 +69,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { protected IItemHandlerModifiable createImportItemHandler() { if (isCreative) return super.createImportItemHandler(); return new NotifiableItemStackHandler(this, getInventorySize(), getController(), false) { + @Override public void onContentsChanged(int slot) { super.onContentsChanged(slot); @@ -75,7 +81,8 @@ public void onContentsChanged(int slot) { public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { var controller = MetaTileEntityDataAccessHatch.this.getController(); boolean isDataBank = controller instanceof MetaTileEntityDataBank; - if (AssemblyLineManager.isStackDataItem(stack, isDataBank) && AssemblyLineManager.hasResearchTag(stack)) { + if (AssemblyLineManager.isStackDataItem(stack, isDataBank) && + AssemblyLineManager.hasResearchTag(stack)) { return super.insertItem(slot, stack, simulate); } return stack; @@ -107,7 +114,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { int index = y * rowSize + x; builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, 88 - rowSize * 9 + x * 18, 18 + y * 18, true, !isExportHatch) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12) @@ -131,7 +138,8 @@ private void rebuildData(boolean isDataBank) { String researchId = AssemblyLineManager.readResearchId(stack); boolean isValid = AssemblyLineManager.isStackDataItem(stack, isDataBank); if (researchId != null && isValid) { - Collection collection = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection collection = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (collection != null) { recipes.addAll(collection); } @@ -158,13 +166,13 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_access_hatch.tooltip.1")); if (isCreative) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); } else { tooltip.add(I18n.format("gregtech.machine.data_access_hatch.tooltip.2", getInventorySize())); } @@ -183,7 +191,8 @@ public List getDataInfo() { ItemStack stack = recipe.getOutputs().get(0); if (!itemsAdded.contains(stack)) { itemsAdded.add(stack); - list.add(new TextComponentTranslation("behavior.data_item.assemblyline.data", LocalizationUtils.format(stack.getTranslationKey()))); + list.add(new TextComponentTranslation("behavior.data_item.assemblyline.data", + LocalizationUtils.format(stack.getTranslationKey()))); } } return list; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java index 92a53c79041..34c53e7a0cb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.impl.EnergyContainerHandler; @@ -15,6 +12,7 @@ import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.client.utils.PipelineUtil; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -23,11 +21,17 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityEnergyHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +public class MetaTileEntityEnergyHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { protected final boolean isExportHatch; protected final int amperage; @@ -38,10 +42,12 @@ public MetaTileEntityEnergyHatch(ResourceLocation metaTileEntityId, int tier, in this.isExportHatch = isExportHatch; this.amperage = amperage; if (isExportHatch) { - this.energyContainer = EnergyContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.energyContainer = EnergyContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - this.energyContainer = EnergyContainerHandler.receiverContainer(this, GTValues.V[tier] * 16L * amperage, GTValues.V[tier], amperage); + this.energyContainer = EnergyContainerHandler.receiverContainer(this, GTValues.V[tier] * 16L * amperage, + GTValues.V[tier], amperage); } } @@ -54,7 +60,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); if (shouldRenderOverlay()) { - getOverlay().renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()])); + getOverlay().renderSided(getFrontFacing(), renderState, translation, + PipelineUtil.color(pipeline, GTValues.VC[getTier()])); } } @@ -115,17 +122,22 @@ public void addInformation(ItemStack stack, @Nullable World world, List addDescriptorTooltip(stack, world, tooltip, advanced); if (isExportHatch) { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), tierName)); - tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); + tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), + tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.amperage_out_till", energyContainer.getOutputAmperage())); } else { - tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); + tooltip.add( + I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(), tierName)); tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", energyContainer.getInputAmperage())); } - tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add( + I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); tooltip.add(I18n.format("gregtech.universal.enabled")); } - protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, + boolean advanced) { if (isExportHatch) { if (amperage > 2) { tooltip.add(I18n.format("gregtech.machine.energy_hatch.output_hi_amp.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java index a2fe88ea34b..6d23c88bd56 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; @@ -20,6 +17,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -37,12 +35,18 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; -public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable { private static final int INITIAL_INVENTORY_SIZE = 8000; @@ -87,11 +91,13 @@ public void readFromNBT(NBTTagCompound data) { this.workingEnabled = data.getBoolean("workingEnabled"); } if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } if (isExportHatch) { this.locked = data.getBoolean("IsLocked"); - this.lockedFluid = this.locked ? FluidStack.loadFluidStackFromNBT(data.getCompoundTag("LockedFluid")) : null; + this.lockedFluid = this.locked ? FluidStack.loadFluidStackFromNBT(data.getCompoundTag("LockedFluid")) : + null; } } @@ -165,7 +171,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (shouldRenderOverlay()) { SimpleOverlayRenderer renderer = isExportHatch ? Textures.PIPE_OUT_OVERLAY : Textures.PIPE_IN_OVERLAY; renderer.renderSided(getFrontFacing(), renderState, translation, pipeline); - SimpleOverlayRenderer overlay = isExportHatch ? Textures.FLUID_HATCH_OUTPUT_OVERLAY : Textures.FLUID_HATCH_INPUT_OVERLAY; + SimpleOverlayRenderer overlay = isExportHatch ? Textures.FLUID_HATCH_OUTPUT_OVERLAY : + Textures.FLUID_HATCH_INPUT_OVERLAY; overlay.renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -186,7 +193,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -231,15 +239,15 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, Entity this.lockedFluid.amount = 1; } }) - .setAlwaysShowFull(true).setDrawHoveringText(false); + .setAlwaysShowFull(true).setDrawHoveringText(false); builder.image(7, 16, 81, 46, GuiTextures.DISPLAY) .widget(new SlotWidget(exportItems, 0, 90, 44, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()); + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()); } else { tankWidget = new TankWidget(fluidTank, 69, 52, 18, 18) .setAlwaysShowFull(true).setDrawHoveringText(false); @@ -295,7 +303,8 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); else diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index e6fedc3cde8..db97935abe0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.GhostCircuitItemStackHandler; import gregtech.api.capability.impl.ItemHandlerList; @@ -23,8 +19,7 @@ import gregtech.api.util.GTHashMaps; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; -import gregtech.integration.jei.recipe.IntCircuitCategory; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,13 +34,22 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class MetaTileEntityItemBus extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable, IGhostSlotConfigurable { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityItemBus extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable, + IGhostSlotConfigurable { @Nullable protected GhostCircuitItemStackHandler circuitInventory; @@ -120,9 +124,11 @@ public void update() { } // Only attempt to auto collapse the inventory contents once the bus has been notified if (isAutoCollapse()) { - // Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits from the slot + // Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits + // from the slot IItemHandlerModifiable inventory = (isExportHatch ? this.getExportItems() : super.getImportItems()); - if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : this.getNotifiedItemInputList().contains(inventory)) { + if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : + this.getNotifiedItemInputList().contains(inventory)) { collapseInventorySlotContents(inventory); } } @@ -157,7 +163,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, if (shouldRenderOverlay()) { SimpleOverlayRenderer renderer = isExportHatch ? Textures.PIPE_OUT_OVERLAY : Textures.PIPE_IN_OVERLAY; renderer.renderSided(getFrontFacing(), renderState, translation, pipeline); - SimpleOverlayRenderer overlay = isExportHatch ? Textures.ITEM_HATCH_OUTPUT_OVERLAY : Textures.ITEM_HATCH_INPUT_OVERLAY; + SimpleOverlayRenderer overlay = isExportHatch ? Textures.ITEM_HATCH_OUTPUT_OVERLAY : + Textures.ITEM_HATCH_INPUT_OVERLAY; overlay.renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -169,12 +176,14 @@ private int getInventorySize() { @Override protected IItemHandlerModifiable createExportItemHandler() { - return isExportHatch ? new NotifiableItemStackHandler(this, getInventorySize(), getController(), true) : new GTItemStackHandler(this, 0); + return isExportHatch ? new NotifiableItemStackHandler(this, getInventorySize(), getController(), true) : + new GTItemStackHandler(this, 0); } @Override protected IItemHandlerModifiable createImportItemHandler() { - return isExportHatch ? new GTItemStackHandler(this, 0) : new NotifiableItemStackHandler(this, getInventorySize(), getController(), false); + return isExportHatch ? new GTItemStackHandler(this, 0) : + new NotifiableItemStackHandler(this, getInventorySize(), getController(), false); } @Override @@ -265,7 +274,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, gridStartX + x * 18, 18 + y * 18, true, !isExportHatch) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } @@ -342,8 +351,8 @@ private static void collapseInventorySlotContents(IItemHandlerModifiable invento } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { - + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { boolean isAttached = false; if (this.isAttachedToMultiBlock()) { setAutoCollapse(!this.autoCollapse); @@ -378,7 +387,8 @@ public void setAutoCollapse(boolean inverted) { addNotifiedInput(super.getImportItems()); } } - writeCustomData(GregtechDataCodes.TOGGLE_COLLAPSE_ITEMS, packetBuffer -> packetBuffer.writeBoolean(autoCollapse)); + writeCustomData(GregtechDataCodes.TOGGLE_COLLAPSE_ITEMS, + packetBuffer -> packetBuffer.writeBoolean(autoCollapse)); notifyBlockUpdate(); markDirty(); } @@ -396,7 +406,8 @@ public void setGhostCircuitConfig(int config) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); else diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java index 18b373c0aca..2f622588c7b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityLaserHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.ILaserContainer; import gregtech.api.capability.impl.LaserContainerHandler; @@ -13,6 +10,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -22,6 +20,10 @@ import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,7 +33,8 @@ import static gregtech.api.GTValues.V; import static gregtech.api.GTValues.VN; -public class MetaTileEntityLaserHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IDataInfoProvider { +public class MetaTileEntityLaserHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IDataInfoProvider { private final boolean isOutput; private final int tier; @@ -44,10 +47,12 @@ public MetaTileEntityLaserHatch(ResourceLocation metaTileEntityId, boolean isOut this.tier = tier; this.amperage = amperage; if (isOutput) { - this.buffer = LaserContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = LaserContainerHandler.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((LaserContainerHandler) this.buffer).setSideOutputCondition(s -> s == getFrontFacing()); } else { - this.buffer = LaserContainerHandler.receiverContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = LaserContainerHandler.receiverContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); ((LaserContainerHandler) this.buffer).setSideInputCondition(s -> s == getFrontFacing()); } } @@ -95,8 +100,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { - tooltip.add(I18n.format(isOutput ? "gregtech.machine.laser_hatch.source.tooltip1" : "gregtech.machine.laser_hatch.target.tooltip1")); + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { + tooltip.add(I18n.format(isOutput ? "gregtech.machine.laser_hatch.source.tooltip1" : + "gregtech.machine.laser_hatch.target.tooltip1")); tooltip.add(I18n.format("gregtech.machine.laser_hatch.tooltip2")); if (isOutput) { @@ -113,7 +120,8 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List @NotNull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentString(String.format("%d/%d EU", this.buffer.getEnergyStored(), this.buffer.getEnergyCapacity()))); + return Collections.singletonList(new TextComponentString( + String.format("%d/%d EU", this.buffer.getEnergyStored(), this.buffer.getEnergyCapacity()))); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java index 4a19067eb7f..f6897f1144b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -17,6 +14,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.ItemStackHashStrategy; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -24,11 +22,17 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityMachineHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMachineHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart { private final IItemHandlerModifiable machineHandler; @@ -61,14 +65,15 @@ protected IItemHandlerModifiable createImportItemHandler() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 + 94) + 18 + 18 + 94) .label(10, 5, getMetaFullName()); builder.widget(new BlockableSlotWidget(machineHandler, 0, 81, 18, true, true) .setIsBlocked(this::isSlotBlocked) .setBackgroundTexture(GuiTextures.SLOT)); - return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 + 12).build(getHolder(), entityPlayer); + return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 + 12).build(getHolder(), + entityPlayer); } @Override @@ -119,27 +124,28 @@ public LimitedImportHandler(MetaTileEntity metaTileEntity) { @Override // Insert item returns the remainder stack that was not inserted public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { - // If the item was not valid, nothing from the stack can be inserted if (!isItemValid(slot, stack)) { return stack; } // Return Empty if passed Empty - if(stack.isEmpty()) { + if (stack.isEmpty()) { return ItemStack.EMPTY; } // If the stacks do not match, nothing can be inserted - if(!ItemStackHashStrategy.comparingAllButCount().equals(stack, this.getStackInSlot(slot)) && !this.getStackInSlot(slot).isEmpty()) { + if (!ItemStackHashStrategy.comparingAllButCount().equals(stack, this.getStackInSlot(slot)) && + !this.getStackInSlot(slot).isEmpty()) { return stack; } int amountInSlot = this.getStackInSlot(slot).getCount(); int slotLimit = getSlotLimit(slot); - // If the current stack size in the slot is greater than the limit of the Multiblock, nothing can be inserted - if(amountInSlot >= slotLimit) { + // If the current stack size in the slot is greater than the limit of the Multiblock, nothing can be + // inserted + if (amountInSlot >= slotLimit) { return stack; } @@ -155,13 +161,12 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate // Handle any remainder ItemStack remainder = ItemStack.EMPTY; - if(remainderAmount > 0) { + if (remainderAmount > 0) { remainder = stack.copy(); remainder.setCount(remainderAmount); } - - if(!simulate) { + if (!simulate) { // Perform the actual insertion ItemStack temp = stack.copy(); temp.setCount(amountInSlot + amountToInsert); @@ -173,14 +178,15 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { - - boolean slotMatches = this.getStackInSlot(slot).isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(this.getStackInSlot(slot), stack); + boolean slotMatches = this.getStackInSlot(slot).isEmpty() || + ItemStackHashStrategy.comparingAllButCount().equals(this.getStackInSlot(slot), stack); MultiblockControllerBase controller = getController(); if (controller instanceof IMachineHatchMultiblock) - return slotMatches && GTUtility.isMachineValidForMachineHatch(stack, ((IMachineHatchMultiblock) controller).getBlacklist()); + return slotMatches && GTUtility.isMachineValidForMachineHatch(stack, + ((IMachineHatchMultiblock) controller).getBlacklist()); - //If the controller is null, this part is not attached to any Multiblock + // If the controller is null, this part is not attached to any Multiblock return slotMatches; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java index 7cc57b4c50b..8a9445d70fd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IMaintenanceHatch; import gregtech.api.gui.GuiTextures; @@ -28,6 +24,7 @@ import gregtech.common.gui.widget.among_us.FixWiringTaskWidget; import gregtech.common.inventory.handlers.TapeItemStackHandler; import gregtech.common.items.MetaItems; + import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -44,8 +41,11 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; @@ -55,9 +55,13 @@ import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; -public class MetaTileEntityMaintenanceHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IMaintenanceHatch { +public class MetaTileEntityMaintenanceHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IMaintenanceHatch { private final boolean isConfigurable; private GTItemStackHandler itemStackHandler; @@ -95,8 +99,9 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, super.renderMetaTileEntity(renderState, translation, pipeline); if (shouldRenderOverlay()) { - (isConfigurable ? Textures.MAINTENANCE_OVERLAY_CONFIGURABLE : isTaped ? Textures.MAINTENANCE_OVERLAY_TAPED : Textures.MAINTENANCE_OVERLAY) - .renderSided(getFrontFacing(), renderState, translation, pipeline); + (isConfigurable ? Textures.MAINTENANCE_OVERLAY_CONFIGURABLE : + isTaped ? Textures.MAINTENANCE_OVERLAY_TAPED : Textures.MAINTENANCE_OVERLAY) + .renderSided(getFrontFacing(), renderState, translation, pipeline); } } @@ -115,6 +120,7 @@ public void clearMachineInventory(NonNullList itemBuffer) { /** * Sets this Maintenance Hatch as being duct taped + * * @param isTaped is the state of the hatch being taped or not */ @Override @@ -128,8 +134,9 @@ public void setTaped(boolean isTaped) { /** * Stores maintenance data to this MetaTileEntity + * * @param maintenanceProblems is the byte value representing the problems - * @param timeActive is the int value representing the total time the parent multiblock has been active + * @param timeActive is the int value representing the total time the parent multiblock has been active */ @Override public void storeMaintenanceData(byte maintenanceProblems, int timeActive) { @@ -154,6 +161,7 @@ public boolean hasMaintenanceData() { /** * reads this MetaTileEntity's maintenance data + * * @return Tuple of Byte, Integer corresponding to the maintenance problems, and total time active */ @Override @@ -186,6 +194,7 @@ public void update() { /** * Fixes the maintenance problems of this hatch's Multiblock Controller + * * @param entityPlayer the player performing the fixing */ private void fixMaintenanceProblems(@Nullable EntityPlayer entityPlayer) { @@ -219,7 +228,7 @@ private void fixMaintenanceProblems(@Nullable EntityPlayer entityPlayer) { * Handles duct taping for manual and auto-taping use * * @param handler is the handler to get duct tape from - * @param slot is the inventory slot to check for tape + * @param slot is the inventory slot to check for tape * @return true if tape was consumed, else false */ private boolean consumeDuctTape(@Nullable IItemHandler handler, int slot) { @@ -242,7 +251,7 @@ private boolean consumeDuctTape(@Nullable EntityPlayer player, ItemStack itemSta * Attempts to fix a provided maintenance problem with a tool in the player's * inventory, if the tool exists. * - * @param problems Problem Flags + * @param problems Problem Flags * @param entityPlayer Target Player which their inventory would be scanned for tools to fix */ private void fixProblemsWithTools(byte problems, EntityPlayer entityPlayer) { @@ -368,7 +377,8 @@ public void onRemoval() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (getController() instanceof IMaintenance && ((IMaintenance) getController()).hasMaintenanceProblems()) { if (consumeDuctTape(playerIn, playerIn.getHeldItem(hand))) { fixAllMaintenanceProblems(); @@ -391,15 +401,20 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setCanInteractPredicate(this::isAttachedToMultiBlock)); } else { builder.widget(new SlotWidget(itemStackHandler, 0, 89 - 10, 18 - 1) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DUCT_TAPE_OVERLAY).setTooltipText("gregtech.machine.maintenance_hatch_tape_slot.tooltip")) - .widget(new ClickButtonWidget(89 - 10 - 1, 18 * 2 + 3, 20, 20, "", data -> fixMaintenanceProblems(entityPlayer)) - .setButtonTexture(GuiTextures.MAINTENANCE_ICON).setTooltipText("gregtech.machine.maintenance_hatch_tool_slot.tooltip")); + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DUCT_TAPE_OVERLAY) + .setTooltipText("gregtech.machine.maintenance_hatch_tape_slot.tooltip")) + .widget(new ClickButtonWidget(89 - 10 - 1, 18 * 2 + 3, 20, 20, "", + data -> fixMaintenanceProblems(entityPlayer)) + .setButtonTexture(GuiTextures.MAINTENANCE_ICON) + .setTooltipText("gregtech.machine.maintenance_hatch_tool_slot.tooltip")); } if (isConfigurable) { - builder.widget(new AdvancedTextWidget(5, 25, getTextWidgetText("duration", this::getDurationMultiplier), 0x404040)) + builder.widget( + new AdvancedTextWidget(5, 25, getTextWidgetText("duration", this::getDurationMultiplier), 0x404040)) .widget(new AdvancedTextWidget(5, 39, getTextWidgetText("time", this::getTimeMultiplier), 0x404040)) .widget(new ClickButtonWidget(9, 18 * 3 + 16 - 18, 12, 12, "-", this::decInternalMultiplier)) - .widget(new ClickButtonWidget(9 + 18 * 2, 18 * 3 + 16 - 18, 12, 12, "+", this::incInternalMultiplier)); + .widget(new ClickButtonWidget(9 + 18 * 2, 18 * 3 + 16 - 18, 12, 12, "+", + this::incInternalMultiplier)); } return builder.build(getHolder(), entityPlayer); } @@ -408,9 +423,11 @@ private static Consumer> getTextWidgetText(String type, Sup return (list) -> { ITextComponent tooltip; if (multiplier.get() == 1.0) { - tooltip = new TextComponentTranslation("gregtech.maintenance.configurable_" + type + ".unchanged_description"); + tooltip = new TextComponentTranslation( + "gregtech.maintenance.configurable_" + type + ".unchanged_description"); } else { - tooltip = new TextComponentTranslation("gregtech.maintenance.configurable_" + type + ".changed_description", multiplier.get()); + tooltip = new TextComponentTranslation( + "gregtech.maintenance.configurable_" + type + ".changed_description", multiplier.get()); } list.add(new TextComponentTranslation("gregtech.maintenance.configurable_" + type, multiplier.get()) .setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); @@ -499,7 +516,8 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.universal.disabled")); if (isConfigurable) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java index 5c5e2b6600b..6f8088743c7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.IMufflerHatch; import gregtech.api.gui.GuiTextures; @@ -19,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -32,10 +30,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, ITieredMetaTileEntity, IMufflerHatch { +import javax.annotation.Nullable; + +public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, ITieredMetaTileEntity, IMufflerHatch { private final int recoveryChance; private final GTItemStackHandler inventory; @@ -63,7 +67,8 @@ public void update() { this.frontFaceFree = checkFrontFaceFree(); } - if (getWorld().isRemote && getController() instanceof MultiblockWithDisplayBase controller && controller.isActive()) { + if (getWorld().isRemote && getController() instanceof MultiblockWithDisplayBase controller && + controller.isActive()) { pollutionParticles(); } } @@ -85,7 +90,6 @@ private boolean calculateChance() { return recoveryChance >= 100 || recoveryChance > GTValues.RNG.nextInt(100); } - /** * @return true if front face is free and contains only air blocks in 1x1 area */ @@ -178,7 +182,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int xOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + xOffset * 2, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()); for (int y = 0; y < rowSize; y++) { @@ -186,7 +190,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int int index = y * rowSize + x; builder.widget(new SlotWidget(inventory, index, (88 - rowSize * 9 + x * 18) + xOffset, 18 + y * 18, true, false) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7 + xOffset, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java index b6dab63c91b..2c6c4fcf309 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -18,6 +15,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,10 +28,16 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { +import javax.annotation.Nullable; + +public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IControllable { private static final int BASE_TANK_SIZE = 8000; @@ -44,7 +48,8 @@ public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotif private final FluidTankList fluidTankList; private boolean workingEnabled; - public MetaTileEntityMultiFluidHatch(ResourceLocation metaTileEntityId, int tier, int numSlots, boolean isExportHatch) { + public MetaTileEntityMultiFluidHatch(ResourceLocation metaTileEntityId, int tier, int numSlots, + boolean isExportHatch) { super(metaTileEntityId, tier, isExportHatch); this.workingEnabled = true; this.numSlots = numSlots; @@ -144,7 +149,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format(isExportHatch ? "gregtech.machine.fluid_hatch.export.tooltip" : "gregtech.machine.fluid_hatch.import.tooltip")); + tooltip.add(I18n.format(isExportHatch ? "gregtech.machine.fluid_hatch.export.tooltip" : + "gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity_mult", numSlots, tankSize)); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -180,16 +186,17 @@ public void registerAbilities(List abilityList) { protected ModularUI createUI(EntityPlayer entityPlayer) { int rowSize = (int) Math.sqrt(numSlots); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, - 18 + 18 * rowSize + 94) + 18 + 18 * rowSize + 94) .label(10, 5, getMetaFullName()); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) - .setBackgroundTexture(GuiTextures.FLUID_SLOT) - .setContainerClicking(true, !isExportHatch) - .setAlwaysShowFull(true)); + builder.widget( + new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) + .setBackgroundTexture(GuiTextures.FLUID_SLOT) + .setContainerClicking(true, !isExportHatch) + .setAlwaysShowFull(true)); } } builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java index 888cf9f94f7..6af14227d09 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java @@ -5,6 +5,7 @@ import gregtech.api.capability.impl.FluidTankList; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.IFluidTank; @@ -12,6 +13,7 @@ import java.util.List; public abstract class MetaTileEntityMultiblockNotifiablePart extends MetaTileEntityMultiblockPart { + protected final boolean isExportHatch; public MetaTileEntityMultiblockNotifiablePart(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java index 56d2dd7adfe..04b67b858b2 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockPart.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; @@ -13,17 +9,24 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOrientedCubeRenderer; import gregtech.client.renderer.texture.custom.FireboxActiveRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import static gregtech.api.capability.GregtechDataCodes.SYNC_CONTROLLER; -public abstract class MetaTileEntityMultiblockPart extends MetaTileEntity implements IMultiblockPart, ITieredMetaTileEntity { +public abstract class MetaTileEntityMultiblockPart extends MetaTileEntity + implements IMultiblockPart, ITieredMetaTileEntity { private final int tier; private BlockPos controllerPos; @@ -44,7 +47,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { ICubeRenderer baseTexture = getBaseTexture(); - pipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + pipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); if (baseTexture instanceof FireboxActiveRenderer || baseTexture instanceof SimpleOrientedCubeRenderer) { baseTexture.renderOriented(renderState, translation, pipeline, getFrontFacing()); @@ -58,15 +62,17 @@ public int getTier() { } public MultiblockControllerBase getController() { - if (getWorld() != null && getWorld().isRemote) { //check this only clientside + if (getWorld() != null && getWorld().isRemote) { // check this only clientside if (controllerTile == null && controllerPos != null) { this.controllerTile = (MultiblockControllerBase) GTUtility.getMetaTileEntity(getWorld(), controllerPos); } } if (controllerTile != null && (controllerTile.getHolder() == null || - !controllerTile.isValid() || !(getWorld().isRemote || controllerTile.getMultiblockParts().contains(this)))) { - //tile can become invalid for many reasons, and can also forgot to remove us once we aren't in structure anymore - //so check it here to prevent bugs with dangling controller reference and wrong texture + !controllerTile.isValid() || + !(getWorld().isRemote || controllerTile.getMultiblockParts().contains(this)))) { + // tile can become invalid for many reasons, and can also forgot to remove us once we aren't in structure + // anymore + // so check it here to prevent bugs with dangling controller reference and wrong texture this.controllerTile = null; } return controllerTile; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java index f7a0b6613e9..5658841fcda 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IObjectHolder; @@ -20,6 +17,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -28,11 +26,16 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import java.util.List; -public class MetaTileEntityObjectHolder extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IObjectHolder { +public class MetaTileEntityObjectHolder extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart, IObjectHolder { // purposefully not exposed to automation or capabilities private final ObjectHolderHandler heldItems; @@ -138,7 +141,7 @@ public void setLocked(boolean locked) { @Override public @NotNull IItemHandler getAsHandler() { - //noinspection ReturnOfInnerClass + // noinspection ReturnOfInnerClass return this.heldItems; } @@ -234,7 +237,7 @@ public boolean isItemValid(int slot, @NotNull ItemStack stack) { } boolean isDataItem = false; - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(stack)) { if (behaviour instanceof IDataItem) { isDataItem = true; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java index de63e673534..497b36e22f7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IDataAccessHatch; @@ -16,17 +13,24 @@ import gregtech.api.recipes.Recipe; import gregtech.client.renderer.texture.Textures; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.Collection; import java.util.List; -public class MetaTileEntityOpticalDataHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IOpticalDataAccessHatch { +import javax.annotation.Nonnull; + +public class MetaTileEntityOpticalDataHatch extends MetaTileEntityMultiblockNotifiablePart implements + IMultiblockAbilityPart, IOpticalDataAccessHatch { private final boolean isTransmitter; @@ -71,13 +75,15 @@ public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection { +public class MetaTileEntityPassthroughHatchFluid extends MetaTileEntityMultiblockPart implements IPassthroughHatch, + IMultiblockAbilityPart { private static final int TANK_SIZE = 16_000; @@ -82,7 +86,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, // back side output Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.FLUID_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.FLUID_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } } @@ -110,10 +115,11 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize) { for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; - builder.widget(new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) - .setBackgroundTexture(GuiTextures.FLUID_SLOT) - .setContainerClicking(true, true) - .setAlwaysShowFull(true)); + builder.widget( + new TankWidget(fluidTankList.getTankAt(index), 89 - rowSize * 9 + x * 18, 18 + y * 18, 18, 18) + .setBackgroundTexture(GuiTextures.FLUID_SLOT) + .setContainerClicking(true, true) + .setAlwaysShowFull(true)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java index 41002c534f6..64baf3c2d36 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.ItemHandlerProxy; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; @@ -15,6 +12,7 @@ import gregtech.api.metatileentity.multiblock.IPassthroughHatch; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -29,11 +27,17 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityPassthroughHatchItem extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { +public class MetaTileEntityPassthroughHatchItem extends MetaTileEntityMultiblockPart implements IPassthroughHatch, + IMultiblockAbilityPart { private ItemStackHandler itemStackHandler; @@ -82,7 +86,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, // back side output Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } } @@ -112,7 +117,7 @@ private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize) { int index = y * rowSize + x; builder.widget(new SlotWidget(itemStackHandler, index, (88 - rowSize * 9 + x * 18), 18 + y * 18, true, true) - .setBackgroundTexture(GuiTextures.SLOT)); + .setBackgroundTexture(GuiTextures.SLOT)); } } return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java index 17dcb28d766..d8f4e9ae716 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FilteredItemHandler; import gregtech.api.capability.impl.FluidTankList; @@ -15,6 +12,7 @@ import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -32,12 +30,18 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; -public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart + implements IMultiblockAbilityPart { private final InfiniteWaterTank fluidTank; @@ -92,7 +96,8 @@ protected FluidTankList createImportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -159,7 +164,8 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -171,6 +177,7 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t } private static class InfiniteWaterTank extends NotifiableFluidTank { + private final FluidStack BIG_WATER = new FluidStack(FluidRegistry.WATER, Integer.MAX_VALUE); public InfiniteWaterTank(int capacity, MetaTileEntity entityToNotify) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java index 0da91d04d61..df13c768d74 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IRotorHolder; import gregtech.api.damagesources.DamageSources; @@ -19,6 +15,7 @@ import gregtech.common.items.behaviors.TurbineRotorBehavior; import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -33,11 +30,18 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; -public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IRotorHolder { +public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart, IRotorHolder { static final int SPEED_INCREMENT = 1; static final int SPEED_DECREMENT = 3; @@ -257,17 +261,20 @@ private int getTierDifference() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn) || super.onRightClick(playerIn, hand, facing, hitResult); } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn) || super.onWrenchClick(playerIn, hand, facing, hitResult); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { return onRotorHolderInteract(playerIn); } @@ -382,35 +389,34 @@ private boolean hasRotor() { private int getRotorColor() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getPartMaterial(getStackInSlot(0)).getMaterialRGB(); - } private int getRotorDurabilityPercent() { if (!hasRotor()) return 0; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorDurabilityPercent(getStackInSlot(0)); } private int getRotorEfficiency() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorEfficiency(getTurbineStack()); } private int getRotorPower() { if (!hasRotor()) return -1; - //noinspection ConstantConditions + // noinspection ConstantConditions return getTurbineBehavior().getRotorPower(getTurbineStack()); } private void damageRotor(int damageAmount) { if (!hasRotor()) return; - //noinspection ConstantConditions + // noinspection ConstantConditions getTurbineBehavior().applyRotorDamage(getStackInSlot(0), damageAmount); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java index 5db2a2fdea8..d2ed31587aa 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntitySubstationEnergyHatch.java @@ -4,10 +4,12 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockAbility; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -16,7 +18,8 @@ // much higher amperages, without hard-coding values in the super class. public class MetaTileEntitySubstationEnergyHatch extends MetaTileEntityEnergyHatch { - public MetaTileEntitySubstationEnergyHatch(ResourceLocation metaTileEntityId, int tier, int amperage, boolean isExportHatch) { + public MetaTileEntitySubstationEnergyHatch(ResourceLocation metaTileEntityId, int tier, int amperage, + boolean isExportHatch) { super(metaTileEntityId, tier, amperage, isExportHatch); } @@ -31,7 +34,8 @@ public MultiblockAbility getAbility() { } @Override - protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { + protected void addDescriptorTooltip(ItemStack stack, @Nullable World world, List tooltip, + boolean advanced) { if (isExportHatch) { tooltip.add(I18n.format("gregtech.machine.substation_hatch.output.tooltip")); } else { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java index 8bfbbf8fe53..e6a01b5e09f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java @@ -1,9 +1,10 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.storage.data.IAEStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.INBTSerializable; +import appeng.api.storage.data.IAEStack; + import javax.annotation.Nullable; /** @@ -11,7 +12,9 @@ * @Description A export only slot to hold {@link IAEStack} * @date 2023/4/22-13:42 */ -public abstract class ExportOnlyAESlot> implements IConfigurableSlot, INBTSerializable { +public abstract class ExportOnlyAESlot> + implements IConfigurableSlot, INBTSerializable { + protected final static String CONFIG_TAG = "config"; protected final static String STOCK_TAG = "stock"; protected T config; @@ -99,5 +102,4 @@ public void setConfig(T val) { public void setStock(T val) { this.stock = val; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java index 3e0ac7b2add..6cc3a48771d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/IConfigurableSlot.java @@ -16,5 +16,4 @@ public interface IConfigurableSlot { void setStock(T val); IConfigurableSlot copy(); - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java index 5680dbcbdb6..7d6866b2a6f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java @@ -1,5 +1,20 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; +import gregtech.api.GTValues; +import gregtech.api.capability.IControllable; +import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockNotifiablePart; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; + import appeng.api.AEApi; import appeng.api.networking.GridFlags; import appeng.api.networking.security.IActionHost; @@ -15,34 +30,25 @@ import appeng.me.helpers.BaseActionSource; import appeng.me.helpers.IGridProxyable; import appeng.me.helpers.MachineSource; -import gregtech.api.GTValues; -import gregtech.api.capability.IControllable; -import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; -import gregtech.client.renderer.ICubeRenderer; -import gregtech.client.renderer.texture.Textures; -import gregtech.common.ConfigHolder; -import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockNotifiablePart; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.EnumSet; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description It can connect to ME network. * @Date 2023/4/18-23:17 */ -public abstract class MetaTileEntityAEHostablePart extends MetaTileEntityMultiblockNotifiablePart implements IControllable { +public abstract class MetaTileEntityAEHostablePart extends MetaTileEntityMultiblockNotifiablePart + implements IControllable { - protected static final IStorageChannel ITEM_NET = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class); - protected static final IStorageChannel FLUID_NET = AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class); + protected static final IStorageChannel ITEM_NET = AEApi.instance().storage() + .getStorageChannel(IItemStorageChannel.class); + protected static final IStorageChannel FLUID_NET = AEApi.instance().storage() + .getStorageChannel(IFluidStorageChannel.class); private final static int ME_UPDATE_INTERVAL = ConfigHolder.compat.ae2.updateIntervals; private AENetworkProxy aeProxy; @@ -166,6 +172,7 @@ public void gridChanged() { /** * Update me network connection status. + * * @return the updated status. */ public boolean updateMEStatus() { @@ -192,7 +199,8 @@ protected IActionSource getActionSource() { @Nullable private AENetworkProxy createProxy() { if (this.getHolder() instanceof IGridProxyable) { - AENetworkProxy proxy = new AENetworkProxy((IGridProxyable) this.getHolder(), "mte_proxy", this.getStackForm(), true); + AENetworkProxy proxy = new AENetworkProxy((IGridProxyable) this.getHolder(), "mte_proxy", + this.getStackForm(), true); proxy.setFlags(GridFlags.REQUIRE_CHANNEL); proxy.setIdlePowerUsage(ConfigHolder.compat.ae2.meHatchEnergyUsage); proxy.setValidSides(EnumSet.of(this.getFrontFacing())); @@ -200,5 +208,4 @@ private AENetworkProxy createProxy() { } return null; } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java index cf86a8e3c0f..67e0a12fdcd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEItemStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -20,6 +13,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEItemConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedItemStack; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -33,17 +27,27 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEItemStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Input Bus that can auto fetch item ME storage network. * @Date 2023/4/22-13:34 */ -public class MetaTileEntityMEInputBus extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEInputBus extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String ITEM_BUFFER_TAG = "ItemSlots"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -83,7 +87,8 @@ public void update() { IAEItemStack exceedItem = aeSlot.exceedStack(); if (exceedItem != null) { long total = exceedItem.getStackSize(); - IAEItemStack notInserted = aeNetwork.injectItems(exceedItem, Actionable.MODULATE, this.getActionSource()); + IAEItemStack notInserted = aeNetwork.injectItems(exceedItem, Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { aeSlot.extractItem(0, (int) (total - notInserted.getStackSize()), false); continue; @@ -94,14 +99,14 @@ public void update() { // Fill it IAEItemStack reqItem = aeSlot.requestStack(); if (reqItem != null) { - IAEItemStack extracted = aeNetwork.extractItems(reqItem, Actionable.MODULATE, this.getActionSource()); + IAEItemStack extracted = aeNetwork.extractItems(reqItem, Actionable.MODULATE, + this.getActionSource()); if (extracted != null) { aeSlot.addStack(extracted); } } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -119,8 +124,7 @@ public void onRemoval() { aeNetwork.injectItems(stock, Actionable.MODULATE, this.getActionSource()); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -136,8 +140,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); // Config slots @@ -186,7 +190,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean(WORKING_TAG, this.workingEnabled); NBTTagList slots = new NBTTagList(); - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { ExportOnlyAEItem slot = this.aeItemHandler.inventory[i]; NBTTagCompound slotTag = new NBTTagCompound(); slotTag.setInteger("slot", i); @@ -223,7 +227,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.item_import.tooltip")); @@ -244,11 +249,10 @@ private static class ExportOnlyAEItemList extends NotifiableItemStackHandler { ExportOnlyAEItem[] inventory; - public ExportOnlyAEItemList(MetaTileEntity holder, int slots, MetaTileEntity entityToNotify) { super(holder, slots, entityToNotify, false); this.inventory = new ExportOnlyAEItem[CONFIG_SIZE]; - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { this.inventory[i] = new ExportOnlyAEItem(null, null); } for (ExportOnlyAEItem slot : this.inventory) { @@ -258,7 +262,7 @@ public ExportOnlyAEItemList(MetaTileEntity holder, int slots, MetaTileEntity ent @Override public void deserializeNBT(NBTTagCompound nbt) { - for (int index = 0; index < CONFIG_SIZE; index ++) { + for (int index = 0; index < CONFIG_SIZE; index++) { if (nbt.hasKey("#" + index)) { NBTTagCompound slotTag = nbt.getCompoundTag("#" + index); this.inventory[index].deserializeNBT(slotTag); @@ -269,7 +273,7 @@ public void deserializeNBT(NBTTagCompound nbt) { @Override public NBTTagCompound serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); - for (int index = 0; index < CONFIG_SIZE; index ++) { + for (int index = 0; index < CONFIG_SIZE; index++) { NBTTagCompound slot = this.inventory[index].serializeNBT(); nbt.setTag("#" + index, slot); } @@ -319,10 +323,10 @@ public int getSlotLimit(int slot) { protected int getStackLimit(int slot, @Nonnull ItemStack stack) { return Integer.MAX_VALUE; } - } public static class ExportOnlyAEItem extends ExportOnlyAESlot implements IItemHandlerModifiable { + private Consumer trigger; public ExportOnlyAEItem(IAEItemStack config, IAEItemStack stock) { @@ -347,8 +351,7 @@ public void deserializeNBT(NBTTagCompound nbt) { public ExportOnlyAEItem copy() { return new ExportOnlyAEItem( this.config == null ? null : this.config.copy(), - this.stock == null ? null : this.stock.copy() - ); + this.stock == null ? null : this.stock.copy()); } @Override @@ -432,5 +435,4 @@ public int getSlotLimit(int slot) { return Integer.MAX_VALUE; } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java index 9e5096150c9..0ce47737b7d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEFluidStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -21,6 +14,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEFluidConfigWidget; import gregtech.common.metatileentities.multi.multiblockpart.appeng.stack.WrappedFluidStack; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -39,18 +33,28 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEFluidStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Input Hatch that can auto fetch fluid ME storage network. * @Date 2023/4/20-21:21 */ -public class MetaTileEntityMEInputHatch extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEInputHatch extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String FLUID_BUFFER_TAG = "FluidTanks"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -66,7 +70,7 @@ public MetaTileEntityMEInputHatch(ResourceLocation metaTileEntityId) { @Override protected void initializeInventory() { this.aeFluidTanks = new ExportOnlyAEFluid[CONFIG_SIZE]; - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { this.aeFluidTanks[i] = new ExportOnlyAEFluid(this, null, null, this.getController()); } super.initializeInventory(); @@ -89,7 +93,8 @@ public void update() { IAEFluidStack exceedFluid = aeTank.exceedStack(); if (exceedFluid != null) { long total = exceedFluid.getStackSize(); - IAEFluidStack notInserted = aeNetwork.injectItems(exceedFluid, Actionable.MODULATE, this.getActionSource()); + IAEFluidStack notInserted = aeNetwork.injectItems(exceedFluid, Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { aeTank.drain((int) (total - notInserted.getStackSize()), true); continue; @@ -100,14 +105,14 @@ public void update() { // Fill it IAEFluidStack reqFluid = aeTank.requestStack(); if (reqFluid != null) { - IAEFluidStack extracted = aeNetwork.extractItems(reqFluid, Actionable.MODULATE, this.getActionSource()); + IAEFluidStack extracted = aeNetwork.extractItems(reqFluid, Actionable.MODULATE, + this.getActionSource()); if (extracted != null) { aeTank.addStack(extracted); } } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -125,8 +130,7 @@ public void onRemoval() { aeNetwork.injectItems(stock, Actionable.MODULATE, this.getActionSource()); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -142,8 +146,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); // Config slots @@ -192,7 +196,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { super.writeToNBT(data); data.setBoolean(WORKING_TAG, this.workingEnabled); NBTTagList tanks = new NBTTagList(); - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { ExportOnlyAEFluid tank = this.aeFluidTanks[i]; NBTTagCompound tankTag = new NBTTagCompound(); tankTag.setInteger("slot", i); @@ -228,7 +232,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.fluid_import.tooltip")); @@ -245,7 +250,9 @@ public void registerAbilities(List list) { list.addAll(Arrays.asList(this.aeFluidTanks)); } - public static class ExportOnlyAEFluid extends ExportOnlyAESlot implements IFluidTank, INotifiableHandler, IFluidHandler { + public static class ExportOnlyAEFluid extends ExportOnlyAESlot + implements IFluidTank, INotifiableHandler, IFluidHandler { + private final List notifiableEntities = new ArrayList<>(); private MetaTileEntity holder; @@ -390,9 +397,7 @@ public ExportOnlyAEFluid copy() { this.holder, this.config == null ? null : this.config.copy(), this.stock == null ? null : this.stock.copy(), - null - ); + null); } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java index a75f6bc96ef..8f84d35c711 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java @@ -1,14 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.me.GridAccessException; -import appeng.util.item.AEItemStack; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -24,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEItemGridWidget; import gregtech.common.inventory.appeng.SerializableItemList; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -36,17 +28,29 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; +import appeng.me.GridAccessException; +import appeng.util.item.AEItemStack; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Output Bus that can directly send its contents to ME storage network. * @Date 2023/4/19-20:37 */ -public class MetaTileEntityMEOutputBus extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEOutputBus extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String ITEM_BUFFER_TAG = "ItemBuffer"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -73,15 +77,15 @@ public void update() { try { IMEMonitor aeNetwork = this.getProxy().getStorage().getInventory(ITEM_NET); for (IAEItemStack item : this.internalBuffer) { - IAEItemStack notInserted = aeNetwork.injectItems(item.copy(), Actionable.MODULATE, this.getActionSource()); + IAEItemStack notInserted = aeNetwork.injectItems(item.copy(), Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { item.setStackSize(notInserted.getStackSize()); } else { item.reset(); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -94,8 +98,7 @@ public void onRemoval() { for (IAEItemStack item : this.internalBuffer) { aeNetwork.injectItems(item.copy(), Actionable.MODULATE, this.getActionSource()); } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -111,8 +114,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); builder.label(10, 25, "gregtech.gui.waiting_list", 0xFFFFFFFF); builder.widget(new AEItemGridWidget(10, 35, 3, this.internalBuffer)); @@ -183,7 +186,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.item_export.tooltip")); @@ -210,11 +214,13 @@ public void addToMultiBlock(MultiblockControllerBase controllerBase) { } private static class InaccessibleInfiniteSlot implements IItemHandlerModifiable, INotifiableHandler { + private final IItemList internalBuffer; private final List notifiableEntities = new ArrayList<>(); private final MetaTileEntity holder; - public InaccessibleInfiniteSlot(MetaTileEntity holder, IItemList internalBuffer, MetaTileEntity mte) { + public InaccessibleInfiniteSlot(MetaTileEntity holder, IItemList internalBuffer, + MetaTileEntity mte) { this.holder = holder; this.internalBuffer = internalBuffer; this.notifiableEntities.add(mte); @@ -281,5 +287,4 @@ private void trigger() { } } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java index 1a7bb420560..8eb67f78225 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java @@ -1,14 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng; -import appeng.api.config.Actionable; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.data.IAEFluidStack; -import appeng.api.storage.data.IItemList; -import appeng.fluids.util.AEFluidStack; -import appeng.me.GridAccessException; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -24,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.common.gui.widget.appeng.AEFluidGridWidget; import gregtech.common.inventory.appeng.SerializableFluidList; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -38,17 +30,29 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import appeng.api.config.Actionable; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IItemList; +import appeng.fluids.util.AEFluidStack; +import appeng.me.GridAccessException; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @Author GlodBlock * @Description The Output Hatch that can directly send its contents to ME storage network. * @Date 2023/4/19-1:18 */ -public class MetaTileEntityMEOutputHatch extends MetaTileEntityAEHostablePart implements IMultiblockAbilityPart { +public class MetaTileEntityMEOutputHatch extends MetaTileEntityAEHostablePart + implements IMultiblockAbilityPart { public final static String FLUID_BUFFER_TAG = "FluidBuffer"; public final static String WORKING_TAG = "WorkingEnabled"; @@ -75,15 +79,15 @@ public void update() { try { IMEMonitor aeNetwork = this.getProxy().getStorage().getInventory(FLUID_NET); for (IAEFluidStack fluid : this.internalBuffer) { - IAEFluidStack notInserted = aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, this.getActionSource()); + IAEFluidStack notInserted = aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, + this.getActionSource()); if (notInserted != null && notInserted.getStackSize() > 0) { fluid.setStackSize(notInserted.getStackSize()); } else { fluid.reset(); } } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} } } } @@ -96,8 +100,7 @@ public void onRemoval() { for (IAEFluidStack fluid : this.internalBuffer) { aeNetwork.injectItems(fluid.copy(), Actionable.MODULATE, this.getActionSource()); } - } catch (GridAccessException ignore) { - } + } catch (GridAccessException ignore) {} super.onRemoval(); } @@ -113,8 +116,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .label(10, 5, getMetaFullName()); // ME Network status builder.dynamicLabel(10, 15, () -> this.isOnline ? - I18n.format("gregtech.gui.me_network.online") : - I18n.format("gregtech.gui.me_network.offline"), + I18n.format("gregtech.gui.me_network.online") : + I18n.format("gregtech.gui.me_network.offline"), 0xFFFFFFFF); builder.label(10, 25, "gregtech.gui.waiting_list", 0xFFFFFFFF); builder.widget(new AEFluidGridWidget(10, 35, 3, this.internalBuffer)); @@ -185,7 +188,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.fluid_export.tooltip")); @@ -212,11 +216,13 @@ public void addToMultiBlock(MultiblockControllerBase controllerBase) { } private static class InaccessibleInfiniteTank implements IFluidTank, INotifiableHandler { + private final IItemList internalBuffer; private final List notifiableEntities = new ArrayList<>(); private final MetaTileEntity holder; - public InaccessibleInfiniteTank(MetaTileEntity holder, IItemList internalBuffer, MetaTileEntity mte) { + public InaccessibleInfiniteTank(MetaTileEntity holder, IItemList internalBuffer, + MetaTileEntity mte) { this.holder = holder; this.internalBuffer = internalBuffer; this.notifiableEntities.add(mte); @@ -280,5 +286,4 @@ private void trigger() { } } } - } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java index ba379c9bd24..06aa7a5a41c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java @@ -1,5 +1,11 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng.stack; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.storage.IStorageChannel; @@ -7,15 +13,11 @@ import appeng.api.storage.data.IAEFluidStack; import appeng.fluids.util.AEFluidStack; import io.netty.buffer.ByteBuf; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; import java.nio.charset.StandardCharsets; +import javax.annotation.Nonnull; + /** * @Author GlodBlock * @Date 2023/4/22-19:25 @@ -141,7 +143,7 @@ public boolean fuzzyComparison(IAEFluidStack stack, FuzzyMode fuzzyMode) { @Override public void writeToPacket(ByteBuf buffer) { byte[] name = this.delegate.getFluid().getName().getBytes(StandardCharsets.UTF_8); - buffer.writeByte((byte)name.length); + buffer.writeByte((byte) name.length); buffer.writeBytes(name); buffer.writeInt(this.delegate.amount); } @@ -189,7 +191,8 @@ public boolean equals(Object other) { return ((WrappedFluidStack) other).delegate.isFluidEqual(this.delegate); } else if (other instanceof FluidStack) { return ((FluidStack) other).isFluidEqual(this.delegate); - } return false; + } + return false; } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java index 23529516cf3..14efe091f7d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java @@ -1,5 +1,10 @@ package gregtech.common.metatileentities.multi.multiblockpart.appeng.stack; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.network.ByteBufUtils; + import appeng.api.config.FuzzyMode; import appeng.api.storage.IStorageChannel; import appeng.api.storage.channels.IItemStorageChannel; @@ -7,10 +12,6 @@ import appeng.core.Api; import appeng.util.item.AEItemStack; import io.netty.buffer.ByteBuf; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.common.network.ByteBufUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -213,7 +214,8 @@ public boolean equals(ItemStack itemStack) { public boolean equals(Object other) { if (other instanceof IAEItemStack) { return this.delegate.isItemEqual(((IAEItemStack) other).createItemStack()); - } if (other instanceof ItemStack) { + } + if (other instanceof ItemStack) { return this.delegate.isItemEqual((ItemStack) other); } return false; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java index 41112608963..9af74c4227b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCABridge.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCABridge extends MetaTileEntityHPCAComponent { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java index 0b9fd6b3139..4a8da7d2234 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComponent.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.multi.multiblockpart.hpca; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IHPCAComponentHatch; @@ -21,6 +18,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,12 +28,17 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; -public abstract class MetaTileEntityHPCAComponent extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IHPCAComponentHatch { +public abstract class MetaTileEntityHPCAComponent extends MetaTileEntityMultiblockPart implements + IMultiblockAbilityPart, IHPCAComponentHatch { private boolean damaged; @@ -117,7 +120,8 @@ public boolean canPartShare() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, + boolean advanced) { if (isBridge()) { tooltip.add(I18n.format("gregtech.machine.hpca.component_type.bridge")); } @@ -137,14 +141,16 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_active_coolant", provider.getMaxCoolantPerTick(), I18n.format(Materials.PCBCoolant.getUnlocalizedName()))); } else { - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_passive")); + tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_passive")); } - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.cooler_cooling", provider.getCoolingAmount())); + tooltip.add( + I18n.format("gregtech.machine.hpca.component_type.cooler_cooling", provider.getCoolingAmount())); } if (this instanceof IHPCAComputationProvider provider) { tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cwut", provider.getCWUPerTick())); - tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cooling", provider.getCoolingPerTick())); + tooltip.add(I18n.format("gregtech.machine.hpca.component_type.computation_cooling", + provider.getCoolingPerTick())); } if (canBeDamaged()) { @@ -233,9 +239,11 @@ public boolean shouldDropWhenDestroyed() { public void getDrops(NonNullList dropsList, @Nullable EntityPlayer harvester) { if (canBeDamaged() && isDamaged()) { if (isAdvanced()) { - dropsList.add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.ADVANCED_COMPUTER_CASING)); + dropsList.add(MetaBlocks.COMPUTER_CASING + .getItemVariant(BlockComputerCasing.CasingType.ADVANCED_COMPUTER_CASING)); } else { - dropsList.add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING)); + dropsList + .add(MetaBlocks.COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING)); } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java index c0ad45c0dfb..a27376901c9 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAComputation.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCAComputation extends MetaTileEntityHPCAComponent implements IHPCAComputationProvider { @@ -38,14 +39,17 @@ public SimpleOverlayRenderer getFrontOverlay() { @Override public TextureArea getComponentIcon() { if (isDamaged()) { - return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; + return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : + GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; } - return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; + return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : + GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; } @Override public SimpleOverlayRenderer getFrontActiveOverlay() { - if (isDamaged()) return advanced ? Textures.HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY : Textures.HPCA_DAMAGED_ACTIVE_OVERLAY; + if (isDamaged()) + return advanced ? Textures.HPCA_ADVANCED_DAMAGED_ACTIVE_OVERLAY : Textures.HPCA_DAMAGED_ACTIVE_OVERLAY; return advanced ? Textures.HPCA_ADVANCED_COMPUTATION_ACTIVE_OVERLAY : Textures.HPCA_COMPUTATION_ACTIVE_OVERLAY; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java index d96354f50f7..90d00239f88 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCACooler.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCACooler extends MetaTileEntityHPCAComponent implements IHPCACoolantProvider { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java index c666ccba379..9c25261401e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/hpca/MetaTileEntityHPCAEmpty.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; + import net.minecraft.util.ResourceLocation; public class MetaTileEntityHPCAEmpty extends MetaTileEntityHPCAComponent { diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java index 41510d00689..97fae542c2d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java @@ -14,6 +14,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -22,9 +23,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; import static gregtech.client.renderer.texture.Textures.BRONZE_PLATED_BRICKS; import static gregtech.client.renderer.texture.Textures.SOLID_STEEL_CASING; diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java index 78300bb88b3..5fb3ee75612 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java @@ -15,6 +15,7 @@ import gregtech.common.blocks.BlockFireboxCasing; import gregtech.common.blocks.BlockMetalCasing; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -23,9 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntitySteamOven extends RecipeMapSteamMultiblockController { @@ -50,7 +52,8 @@ protected BlockPattern createStructurePattern() { .aisle("XXX", "CSC", "#C#") .where('S', selfPredicate()) .where('X', states(getFireboxState()) - .or(autoAbilities(true, false, false, false, false).setMinGlobalLimited(1).setMaxGlobalLimited(3))) + .or(autoAbilities(true, false, false, false, false).setMinGlobalLimited(1) + .setMaxGlobalLimited(3))) .where('C', states(getCasingState()).setMinGlobalLimited(6) .or(autoAbilities(false, false, true, true, false))) .where('#', any()) diff --git a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java index 788093220fa..051db7649d3 100644 --- a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java +++ b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.primitive; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.block.IBlock; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -25,8 +19,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.behaviors.LighterBehaviour; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -48,16 +41,26 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.block.IBlock; +import crafttweaker.api.minecraft.CraftTweakerMC; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.machines.CharcoalPileIgniter") @ZenRegister public class MetaTileEntityCharcoalPileIgniter extends MultiblockControllerBase implements IWorkable { @@ -97,7 +100,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - Textures.CHARCOAL_PILE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive, true); + Textures.CHARCOAL_PILE_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), + isActive, true); } @Override @@ -128,8 +132,8 @@ protected BlockPattern createStructurePattern() { if (rDist < 1) rDist = MIN_RADIUS; if (hDist < 2) hDist = MIN_DEPTH; - //swap the left and right distances if the front facing is east or west - //i guess allows BlockPattern checkPatternAt to get the correct relative position, somehow. + // swap the left and right distances if the front facing is east or west + // i guess allows BlockPattern checkPatternAt to get the correct relative position, somehow. if (this.frontFacing == EnumFacing.EAST || this.frontFacing == EnumFacing.WEST) { int tmp = lDist; lDist = rDist; @@ -138,7 +142,7 @@ protected BlockPattern createStructurePattern() { StringBuilder wallBuilder = new StringBuilder(); // " XXX " StringBuilder floorBuilder = new StringBuilder(); // " BBB " - StringBuilder cornerBuilder = new StringBuilder(); // " " + StringBuilder cornerBuilder = new StringBuilder(); // " " StringBuilder ctrlBuilder = new StringBuilder(); // " XSX " StringBuilder woodBuilder = new StringBuilder(); // "XCCCX" @@ -181,7 +185,7 @@ protected BlockPattern createStructurePattern() { ctrlBuilder.append(" "); woodBuilder.append("X"); - String[] wall = new String[hDist + 1]; // " ", " XXX ", " " + String[] wall = new String[hDist + 1]; // " ", " XXX ", " " Arrays.fill(wall, wallBuilder.toString()); wall[0] = cornerBuilder.toString(); wall[wall.length - 1] = cornerBuilder.toString(); @@ -191,7 +195,7 @@ protected BlockPattern createStructurePattern() { slice[0] = floorBuilder.toString(); String[] center = Arrays.copyOf(slice, slice.length); // " BBB ", "XCCCX", " XSX " - //inverse the center slice if facing east or west. + // inverse the center slice if facing east or west. if (this.frontFacing == EnumFacing.EAST || this.frontFacing == EnumFacing.WEST) { center[center.length - 1] = ctrlBuilder.reverse().toString(); } else { @@ -218,7 +222,8 @@ protected BlockPattern createStructurePattern() { @Nonnull private TraceabilityPredicate logPredicate() { return new TraceabilityPredicate(blockWorldState -> { - if (blockWorldState.getBlockState().getBlock().isWood(blockWorldState.getWorld(), blockWorldState.getPos())) { + if (blockWorldState.getBlockState().getBlock().isWood(blockWorldState.getWorld(), + blockWorldState.getPos())) { // store the position of every log, so we can easily turn them into charcoal logPositions.add(blockWorldState.getPos()); return true; @@ -269,7 +274,8 @@ private boolean updateStructureDimensions() { return true; } - private static boolean isBlockWall(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, @Nonnull EnumFacing direction) { + private static boolean isBlockWall(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, + @Nonnull EnumFacing direction) { return WALL_BLOCKS.contains(world.getBlockState(pos.move(direction)).getBlock()); } @@ -342,7 +348,8 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.charcoal_pile.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.charcoal_pile.tooltip.2")); @@ -455,9 +462,7 @@ public boolean isWorkingEnabled() { } @Override - public void setWorkingEnabled(boolean isActivationAllowed) { - - } + public void setWorkingEnabled(boolean isActivationAllowed) {} @Override public int getProgress() { @@ -502,7 +507,8 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) stack.damageItem(1, event.getEntityPlayer()); // flint and steel sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; } else if (stack.getItem() instanceof ItemFireball) { @@ -510,7 +516,8 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) stack.shrink(1); // fire charge sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FIRECHARGE_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; } else if (stack.getItem() instanceof MetaItem) { @@ -518,9 +525,11 @@ public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) MetaItem.MetaValueItem valueItem = ((MetaItem) stack.getItem()).getItem(stack); if (valueItem != null) { for (IItemBehaviour behaviour : valueItem.getBehaviours()) { - if (behaviour instanceof LighterBehaviour && ((LighterBehaviour) behaviour).consumeFuel(event.getEntityPlayer(), stack)) { + if (behaviour instanceof LighterBehaviour && + ((LighterBehaviour) behaviour).consumeFuel(event.getEntityPlayer(), stack)) { // lighter sound does not get played when handled like this - event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F, 1.0F); + event.getWorld().playSound(null, event.getPos(), SoundEvents.ITEM_FLINTANDSTEEL_USE, + SoundCategory.PLAYERS, 1.0F, 1.0F); shouldActivate = true; break; diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java index 2cb0ef88750..c75459c8df7 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -46,10 +47,13 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) - .slot(this.importItems, 1, 35, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 1, 35, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 20, 16, - GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java b/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java index 2cfd574cf03..6e5ab571600 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamCompressor.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -39,9 +40,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.COMPRESSOR_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.COMPRESSOR_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 78, 25, 20, 18, - GuiTextures.PROGRESS_BAR_COMPRESS_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_COMPRESS_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java index 326cfd50f34..e71cc0d1201 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -40,9 +41,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.EXTRACTOR_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.EXTRACTOR_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 25, 20, 18, - GuiTextures.PROGRESS_BAR_EXTRACT_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_EXTRACT_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java index 3ab4d606469..ec1bfb1b2e9 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -45,9 +46,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.FURNACE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 20, 16, - GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_ARROW_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java index d07fec97104..f31bc66214f 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -39,9 +40,11 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.HAMMER_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.HAMMER_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 25, 20, 18, - GuiTextures.PROGRESS_BAR_HAMMER_STEAM.get(isHighPressure), MoveType.VERTICAL_DOWNWARDS, workableHandler.getRecipeMap()) + GuiTextures.PROGRESS_BAR_HAMMER_STEAM.get(isHighPressure), MoveType.VERTICAL_DOWNWARDS, + workableHandler.getRecipeMap()) .image(79, 41, 20, 18, GuiTextures.PROGRESS_BAR_HAMMER_BASE_STEAM.get(isHighPressure)) .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure)) .build(getHolder(), player); diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java index 9f242d44811..51a3716025d 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -42,10 +43,13 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(this.importItems, 0, 53, 25, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 26, 21, 18, - GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) - .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) + .slot(this.exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) .build(getHolder(), player); } @@ -60,8 +64,10 @@ public void randomDisplayTick() { if (isActive()) { final BlockPos pos = getPos(); final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + horizontalOffset, pos.getY() + 0.52F, pos.getZ() + horizontalOffset, - GTValues.RNG.nextFloat() * 0.125F, GTValues.RNG.nextFloat() * 0.375F, GTValues.RNG.nextFloat() * 0.125F); + getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + horizontalOffset, pos.getY() + 0.52F, + pos.getZ() + horizontalOffset, + GTValues.RNG.nextFloat() * 0.125F, GTValues.RNG.nextFloat() * 0.375F, + GTValues.RNG.nextFloat() * 0.125F); } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index f42401d1b17..50f298cb4e8 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.steam; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.*; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -23,6 +19,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -46,14 +43,20 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class SteamMiner extends MetaTileEntity implements IMiner, IControllable, IVentable, IDataInfoProvider { private boolean needsVenting = false; @@ -75,7 +78,8 @@ public SteamMiner(ResourceLocation metaTileEntityId, int speed, int maximumRadiu @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new SteamMiner(metaTileEntityId, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), this.minerLogic.getFortune()); + return new SteamMiner(metaTileEntityId, this.minerLogic.getSpeed(), this.minerLogic.getMaximumRadius(), + this.minerLogic.getFortune()); } @Override @@ -95,7 +99,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override @SideOnly(Side.CLIENT) public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); IVertexOperation[] coloredPipeline = ArrayUtils.add(pipeline, multiplier); Textures.STEAM_CASING_BRONZE.render(renderState, translation, coloredPipeline); for (EnumFacing renderSide : EnumFacing.HORIZONTALS) { @@ -132,7 +137,6 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.widget(new AdvancedTextWidget(70, 19, this::addDisplayText2, 0xFFFFFF) .setMaxWidthLimit(84)); - return builder.build(getHolder(), entityPlayer); } @@ -143,17 +147,22 @@ void addDisplayText(List textList) { textList.add(new TextComponentTranslation("gregtech.machine.miner.startz", this.minerLogic.getZ().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); if (this.minerLogic.isDone()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.done").setStyle(new Style().setColor(TextFormatting.GREEN))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.done") + .setStyle(new Style().setColor(TextFormatting.GREEN))); else if (this.minerLogic.isWorking()) - textList.add(new TextComponentTranslation("gregtech.machine.miner.working").setStyle(new Style().setColor(TextFormatting.GOLD))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.working") + .setStyle(new Style().setColor(TextFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused")); if (this.isInventoryFull) - textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.miner.invfull") + .setStyle(new Style().setColor(TextFormatting.RED))); if (ventingStuck) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.vent").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.vent") + .setStyle(new Style().setColor(TextFormatting.RED))); else if (!drainEnergy(true)) - textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.steam").setStyle(new Style().setColor(TextFormatting.RED))); + textList.add(new TextComponentTranslation("gregtech.machine.steam_miner.steam") + .setStyle(new Style().setColor(TextFormatting.RED))); } void addDisplayText2(List textList) { @@ -164,8 +173,8 @@ void addDisplayText2(List textList) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick_steam", energyPerTick) - + TextFormatting.GRAY + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); + tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_tick_steam", energyPerTick) + TextFormatting.GRAY + + ", " + I18n.format("gregtech.machine.miner.per_block", this.minerLogic.getSpeed() / 20)); int maxArea = getWorkingArea(minerLogic.getMaximumRadius()); tooltip.add(I18n.format("gregtech.universal.tooltip.working_area", maxArea, maxArea)); } @@ -248,7 +257,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { @SideOnly(Side.CLIENT) public Pair getParticleTexture() { - return Pair.of(Textures.STEAM_CASING_BRONZE.getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.TOP), getPaintingColorForRendering()); + return Pair.of(Textures.STEAM_CASING_BRONZE.getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.TOP), + getPaintingColorForRendering()); } public void setVentingStuck(boolean ventingStuck) { @@ -311,14 +321,20 @@ public void tryDoVenting() { BlockPos ventingBlockPos = machinePos.offset(ventingSide); IBlockState blockOnPos = this.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(this.getWorld(), ventingBlockPos) == Block.NULL_AABB) { - this.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET).forEach((entity) -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0F)); + this.getWorld() + .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), + EntitySelectors.CAN_AI_TARGET) + .forEach((entity) -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0F)); WorldServer world = (WorldServer) this.getWorld(); double posX = (double) machinePos.getX() + 0.5D + (double) ventingSide.getXOffset() * 0.6D; double posY = (double) machinePos.getY() + 0.5D + (double) ventingSide.getYOffset() * 0.6D; double posZ = (double) machinePos.getZ() + 0.5D + (double) ventingSide.getZOffset() * 0.6D; - world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), (double) ventingSide.getXOffset() / 2.0D, (double) ventingSide.getYOffset() / 2.0D, (double) ventingSide.getZOffset() / 2.0D, 0.1D); + world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), + (double) ventingSide.getXOffset() / 2.0D, (double) ventingSide.getYOffset() / 2.0D, + (double) ventingSide.getZOffset() / 2.0D, 0.1D); if (ConfigHolder.machines.machineSounds && !this.isMuffled()) { - world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, + 1.0F); } this.setNeedsVenting(false); } else if (!this.ventingStuck) { @@ -335,6 +351,7 @@ public boolean isVentingStuck() { @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); + return Collections.singletonList( + new TextComponentTranslation("gregtech.machine.miner.working_area", workingArea, workingArea)); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java index 84cc188c3b2..5dbf91b5d8e 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java @@ -11,6 +11,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.RecipeMaps; import gregtech.client.renderer.texture.Textures; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -82,13 +83,19 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public ModularUI createUI(EntityPlayer player) { return createUITemplate(player) - .slot(importItems, 0, 53, 34, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) + .slot(importItems, 0, 53, 34, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)) .progressBar(workableHandler::getProgressPercent, 79, 35, 21, 18, - GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, workableHandler.getRecipeMap()) - .slot(exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 1, 125, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 2, 107, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) - .slot(exportItems, 3, 125, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.PROGRESS_BAR_MACERATE_STEAM.get(isHighPressure), MoveType.HORIZONTAL, + workableHandler.getRecipeMap()) + .slot(exportItems, 0, 107, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 1, 125, 25, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 2, 107, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) + .slot(exportItems, 3, 125, 43, true, false, GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.CRUSHED_ORE_OVERLAY_STEAM.get(isHighPressure)) .build(getHolder(), player); } @@ -115,7 +122,8 @@ protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes fl protected class SteamRockBreakerRecipeLogic extends RecipeLogicSteam { - public SteamRockBreakerRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, IFluidTank steamFluidTank, double conversionRate) { + public SteamRockBreakerRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, boolean isHighPressure, + IFluidTank steamFluidTank, double conversionRate) { super(tileEntity, recipeMap, isHighPressure, steamFluidTank, conversionRate); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index 44e97729e31..9c564c1fa78 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.steam.boiler; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; @@ -27,6 +23,7 @@ import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; import gregtech.common.ConfigHolder; import gregtech.core.sound.GTSoundEvents; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -44,16 +41,22 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public abstract class SteamBoiler extends MetaTileEntity implements IDataInfoProvider { @@ -113,7 +116,8 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); getBaseRenderer().render(renderState, translation, colouredPipeline); renderer.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isBurning(), true); } @@ -214,7 +218,7 @@ private void updateCurrentTemperature() { if (fuelBurnTimeLeft == 0) { this.fuelMaxBurnTime = 0; this.timeBeforeCoolingDown = getCooldownInterval(); - //boiler has no fuel now, so queue burning state update + // boiler has no fuel now, so queue burning state update this.wasBurningAndNeedsUpdate = true; } } @@ -223,7 +227,7 @@ private void updateCurrentTemperature() { currentTemperature -= getCoolDownRate(); timeBeforeCoolingDown = getCooldownInterval(); } - } else --timeBeforeCoolingDown; + } else--timeBeforeCoolingDown; } protected abstract int getBaseSteamOutput(); @@ -264,7 +268,8 @@ private void generateSteam() { getFrontFacing().getZOffset() / 2.0, 0.1); if (ConfigHolder.machines.machineSounds && !this.isMuffled()) { - getWorld().playSound(null, x, y, z, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + getWorld().playSound(null, x, y, z, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, + 1.0f); } steamFluidTank.drain(4000, true); @@ -336,9 +341,11 @@ public ModularUI.Builder createUITemplate(EntityPlayer player) { .setBackgroundTexture(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure))) .widget(new FluidContainerSlotWidget(containerInventory, 0, 43, 26, true) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.IN_SLOT_OVERLAY_STEAM.get(isHighPressure))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.IN_SLOT_OVERLAY_STEAM.get(isHighPressure))) .slot(containerInventory, 1, 43, 62, true, false, - GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(isHighPressure)) + GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(isHighPressure)) .image(43, 44, 18, 18, GuiTextures.CANISTER_OVERLAY_STEAM.get(isHighPressure)) .bindPlayerInventory(player.inventory, GuiTextures.SLOT_STEAM.get(isHighPressure), 0); @@ -372,7 +379,8 @@ public void clearMachineInventory(NonNullList itemBuffer) { @Nonnull @Override public List getDataInfo() { - return Collections.singletonList(new TextComponentTranslation("gregtech.machine.steam_boiler.heat_amount", TextFormattingUtil.formatNumbers((int) (this.getTemperaturePercent() * 100)))); + return Collections.singletonList(new TextComponentTranslation("gregtech.machine.steam_boiler.heat_amount", + TextFormattingUtil.formatNumbers((int) (this.getTemperaturePercent() * 100)))); } @SideOnly(Side.CLIENT) @@ -384,7 +392,8 @@ public void randomDisplayTick() { float z = pos.getZ() + 0.5F; if (GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, pos.getY(), z + 0.5F, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + getWorld().playSound(x, pos.getY(), z + 0.5F, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, + SoundCategory.BLOCKS, 1.0F, 1.0F, false); } final EnumFacing facing = getFrontFacing(); @@ -406,7 +415,8 @@ public void randomDisplayTick() { @SideOnly(Side.CLIENT) protected void randomDisplayTick(float x, float y, float z) { - getWorld().spawnParticle(isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0, 0, 0); + getWorld().spawnParticle(isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL, x, y, + z, 0, 0, 0); getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java index 2bc3fa58a03..9159b29cbaa 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.ModHandler; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; @@ -38,14 +39,14 @@ protected void tryConsumeNewFuel() { ItemStack fuelInSlot = importItems.extractItem(0, 1, true); if (fuelInSlot.isEmpty()) return; // Prevent consuming buckets with burn time - if(FluidUtil.getFluidHandler(fuelInSlot) != null) { + if (FluidUtil.getFluidHandler(fuelInSlot) != null) { return; } int burnTime = TileEntityFurnace.getItemBurnTime(fuelInSlot); if (burnTime <= 0) return; importItems.extractItem(0, 1, false); ItemStack remainderAsh = ModHandler.getBurningFuelRemainder(fuelInSlot); - if (!remainderAsh.isEmpty()) { //we don't care if we can't insert ash - it's chanced anyway + if (!remainderAsh.isEmpty()) { // we don't care if we can't insert ash - it's chanced anyway exportItems.insertItem(0, remainderAsh, false); } setFuelMaxBurnTime(burnTime); @@ -69,6 +70,7 @@ public IItemHandlerModifiable createExportItemHandler() { @Override public IItemHandlerModifiable createImportItemHandler() { return new GTItemStackHandler(this, 1) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java index ecbd0782fc5..9d9511d1fd7 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java @@ -12,9 +12,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.client.renderer.texture.Textures; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntMaps; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -24,15 +22,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.Objects; +import javax.annotation.Nonnull; + public class SteamLavaBoiler extends SteamBoiler { private static final Object2IntMap BOILER_FUEL_TO_CONSUMPTION = new Object2IntOpenHashMap<>(); private static boolean initialized; private static final IFilter FUEL_FILTER = new IFilter<>() { + @Override public boolean test(@Nonnull FluidStack fluidStack) { for (Fluid fluid : getBoilerFuelToConsumption().keySet()) { @@ -126,7 +130,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { public void randomDisplayTick(float x, float y, float z) { super.randomDisplayTick(x, y, z); if (GTValues.RNG.nextFloat() < 0.3F) { - getWorld().spawnParticle(EnumParticleTypes.LAVA, x + GTValues.RNG.nextFloat(), y, z + GTValues.RNG.nextFloat(), 0.0F, 0.0F, 0.0F); + getWorld().spawnParticle(EnumParticleTypes.LAVA, x + GTValues.RNG.nextFloat(), y, + z + GTValues.RNG.nextFloat(), 0.0F, 0.0F, 0.0F); } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java index 1bdf8a8c8df..970afae65d3 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamSolarBoiler.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java index 63357b15870..d03a6ac6e75 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.steam.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.CommonFluidFilters; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FilteredItemHandler; @@ -25,6 +22,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -35,10 +33,16 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nullable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + import java.util.List; -public class MetaTileEntitySteamHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { +import javax.annotation.Nullable; + +public class MetaTileEntitySteamHatch extends MetaTileEntityMultiblockPart + implements IMultiblockAbilityPart { private static final int INVENTORY_SIZE = 64000; private static final boolean IS_STEEL = ConfigHolder.machines.steelSteamMultiblocks; @@ -56,7 +60,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("ContainerInventory")) { - MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), 0, 1); + MetaTileEntityQuantumTank.legacyTankItemHandlerNBTReading(this, data.getCompoundTag("ContainerInventory"), + 0, 1); } } @@ -100,7 +105,8 @@ protected FluidTankList createImportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -136,10 +142,12 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, Entity builder.dynamicLabel(11, 40, tankWidget::getFluidLocalizedName, 0xFFFFFF); return builder.label(6, 6, title) .widget(new FluidContainerSlotWidget(importItems, 0, 90, 17, false) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), GuiTextures.IN_SLOT_OVERLAY_STEAM.get(IS_STEEL))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), + GuiTextures.IN_SLOT_OVERLAY_STEAM.get(IS_STEEL))) .widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)) // todo tank icon .widget(new SlotWidget(exportItems, 0, 90, 54, true, false) - .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(IS_STEEL))) + .setBackgroundTexture(GuiTextures.SLOT_STEAM.get(IS_STEEL), + GuiTextures.OUT_SLOT_OVERLAY_STEAM.get(IS_STEEL))) .bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(IS_STEEL), 7, 83); } diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java index 2cc0a0f1755..19bca0ef1e5 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java @@ -1,8 +1,5 @@ package gregtech.common.metatileentities.steam.multiblockpart; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; @@ -15,6 +12,7 @@ import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -22,9 +20,14 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; + +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public class MetaTileEntitySteamItemBus extends MetaTileEntityItemBus { @@ -60,7 +63,8 @@ public ICubeRenderer getBaseTexture() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("gregtech.machine.steam_bus.tooltip")); } @@ -88,7 +92,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { for (int y = 0; y < 2; y++) { for (int x = 0; x < 2; x++) { int index = y * 2 + x; - builder.slot(isExportHatch ? exportItems : importItems, index, 70 + x * 18, 31 + y * 18, true, !isExportHatch, + builder.slot(isExportHatch ? exportItems : importItems, index, 70 + x * 18, 31 + y * 18, true, + !isExportHatch, GuiTextures.SLOT_STEAM.get(IS_STEEL)); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java b/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java index 07e9277213b..403eed12261 100755 --- a/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CachedRecipeData.java @@ -4,22 +4,26 @@ import gregtech.common.crafting.ShapedOreEnergyTransferRecipe; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.itemsource.ItemSources; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.world.World; + import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenCustomHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.world.World; public class CachedRecipeData { + private final ItemSources itemSources; private IRecipe recipe; - private final Object2IntMap requiredItems = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private final Object2IntMap requiredItems = new Object2IntOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); private final Int2ObjectMap> replaceAttemptMap = new Int2ObjectArrayMap<>(); private final InventoryCrafting inventory; @@ -34,7 +38,7 @@ public short attemptMatchRecipe() { this.requiredItems.clear(); for (int i = 0; i < inventory.getSizeInventory(); i++) { if (getIngredientEquivalent(i)) - itemsFound += 1 << i; //ingredient was found, and indicate in the short of this fact + itemsFound += 1 << i; // ingredient was found, and indicate in the short of this fact } if (itemsFound != CraftingRecipeLogic.ALL_INGREDIENTS_PRESENT) { requiredItems.clear(); @@ -44,7 +48,8 @@ public short attemptMatchRecipe() { protected boolean consumeRecipeItems() { boolean gathered = true; - Object2IntMap gatheredItems = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Object2IntMap gatheredItems = new Object2IntOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); if (requiredItems.isEmpty()) { return false; } @@ -62,7 +67,8 @@ protected boolean consumeRecipeItems() { } if (!gathered) { for (Object2IntMap.Entry entry : gatheredItems.object2IntEntrySet()) { - itemSources.insertItem(entry.getKey(), entry.getIntValue(), false, IItemList.InsertMode.HIGHEST_PRIORITY); + itemSources.insertItem(entry.getKey(), entry.getIntValue(), false, + IItemList.InsertMode.HIGHEST_PRIORITY); } } return gathered; @@ -71,7 +77,7 @@ protected boolean consumeRecipeItems() { public boolean getIngredientEquivalent(int slot) { ItemStack currentStack = inventory.getStackInSlot(slot); if (currentStack.isEmpty()) { - return true; //stack is empty, nothing to return + return true; // stack is empty, nothing to return } if (simulateExtractItem(currentStack)) { @@ -80,16 +86,17 @@ public boolean getIngredientEquivalent(int slot) { ItemStack previousStack = recipe.getCraftingResult(inventory); - Object2BooleanMap map = replaceAttemptMap.computeIfAbsent(slot, (m) -> new Object2BooleanOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount())); + Object2BooleanMap map = replaceAttemptMap.computeIfAbsent(slot, + (m) -> new Object2BooleanOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount())); - //iterate stored items to find equivalent + // iterate stored items to find equivalent for (ItemStack itemStack : itemSources.getStoredItems()) { boolean matchedPreviously = false; if (map.containsKey(itemStack)) { if (!map.get(itemStack)) { continue; } else { - //cant return here before checking if: + // cant return here before checking if: // The item is available for extraction // The recipe output is still the same, as depending on the ingredient, the output NBT may change matchedPreviously = true; @@ -98,9 +105,9 @@ public boolean getIngredientEquivalent(int slot) { if (!matchedPreviously) { boolean matched = false; - //Matching shapeless recipes actually is very bad for performance, as it checks the entire - //recipe ingredients recursively, so we fail early here if none of the recipes ingredients can - //take the stack + // Matching shapeless recipes actually is very bad for performance, as it checks the entire + // recipe ingredients recursively, so we fail early here if none of the recipes ingredients can + // take the stack for (Ingredient in : recipe.getIngredients()) { if (in.apply(itemStack)) { matched = true; @@ -113,12 +120,13 @@ public boolean getIngredientEquivalent(int slot) { } } - //update item in slot, and check that recipe matches and output item is equal to the expected one + // update item in slot, and check that recipe matches and output item is equal to the expected one inventory.setInventorySlotContents(slot, itemStack); if (recipe.matches(inventory, itemSources.getWorld()) && - (ItemStack.areItemStacksEqual(recipe.getCraftingResult(inventory), previousStack) || recipe instanceof ShapedOreEnergyTransferRecipe)) { + (ItemStack.areItemStacksEqual(recipe.getCraftingResult(inventory), previousStack) || + recipe instanceof ShapedOreEnergyTransferRecipe)) { map.put(itemStack, true); - //ingredient matched, attempt to extract it and return if successful + // ingredient matched, attempt to extract it and return if successful if (simulateExtractItem(itemStack)) { return true; } @@ -126,7 +134,7 @@ public boolean getIngredientEquivalent(int slot) { map.put(itemStack, false); inventory.setInventorySlotContents(slot, currentStack); } - //nothing matched, so return null + // nothing matched, so return null return false; } diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java index 3958de6c670..f5efc438a37 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java @@ -1,11 +1,11 @@ package gregtech.common.metatileentities.storage; -import com.google.common.collect.Lists; import gregtech.api.storage.ICraftingStorage; import gregtech.api.util.DummyContainer; import gregtech.common.inventory.IItemList; import gregtech.common.inventory.itemsource.ItemSources; import gregtech.common.inventory.itemsource.sources.TileItemSource; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; @@ -21,6 +21,8 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.items.ItemStackHandler; +import com.google.common.collect.Lists; + import java.util.Collections; import java.util.Map; @@ -93,10 +95,10 @@ private boolean hasCraftingGridUpdated() { craftingGridChanged = true; } else if (!ItemStack.areItemsEqual(oldStack, newStack) || !ItemStack.areItemStackTagsEqual(oldStack, newStack)) { - oldCraftingGrid[i] = newStack; - inventoryCrafting.setInventorySlotContents(i, newStack.copy()); - craftingGridChanged = true; - } + oldCraftingGrid[i] = newStack; + inventoryCrafting.setInventorySlotContents(i, newStack.copy()); + craftingGridChanged = true; + } } return craftingGridChanged; } @@ -109,7 +111,9 @@ public boolean performRecipe(EntityPlayer player) { return false; } ForgeHooks.setCraftingPlayer(player); - NonNullList remainingItems = cachedRecipe.getRemainingItems(inventoryCrafting); // todo right here is where tools get damaged (in UI) + NonNullList remainingItems = cachedRecipe.getRemainingItems(inventoryCrafting); // todo right here is + // where tools get + // damaged (in UI) ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < remainingItems.size(); i++) { ItemStack itemStack = remainingItems.get(i); @@ -119,11 +123,12 @@ public boolean performRecipe(EntityPlayer player) { ItemStack current = inventoryCrafting.getStackInSlot(i); inventoryCrafting.setInventorySlotContents(i, itemStack); - if (!cachedRecipe.matches(inventoryCrafting, itemSources.getWorld())){ + if (!cachedRecipe.matches(inventoryCrafting, itemSources.getWorld())) { inventoryCrafting.setInventorySlotContents(i, current); } - int remainingAmount = itemStack.getCount() - itemSources.insertItem(itemStack, itemStack.getCount(), false, IItemList.InsertMode.HIGHEST_PRIORITY); + int remainingAmount = itemStack.getCount() - itemSources.insertItem(itemStack, itemStack.getCount(), false, + IItemList.InsertMode.HIGHEST_PRIORITY); if (remainingAmount > 0) { itemStack.setCount(remainingAmount); player.addItemStackToInventory(itemStack); @@ -138,7 +143,7 @@ public boolean performRecipe(EntityPlayer player) { public void handleItemCraft(ItemStack itemStack, EntityPlayer player) { itemStack.onCrafting(world, player, 1); itemStack.getItem().onCreated(itemStack, world, player); - //if we're not simulated, fire the event, unlock recipe and add crafted items, and play sounds + // if we're not simulated, fire the event, unlock recipe and add crafted items, and play sounds FMLCommonHandler.instance().firePlayerCraftingEvent(player, itemStack, inventoryCrafting); if (cachedRecipe != null && !cachedRecipe.isDynamic()) { @@ -160,11 +165,13 @@ public void refreshOutputSlot() { } public boolean isRecipeValid() { - return cachedRecipeData.getRecipe() != null && cachedRecipeData.matches(inventoryCrafting, this.world) && cachedRecipeData.attemptMatchRecipe() == ALL_INGREDIENTS_PRESENT; + return cachedRecipeData.getRecipe() != null && cachedRecipeData.matches(inventoryCrafting, this.world) && + cachedRecipeData.attemptMatchRecipe() == ALL_INGREDIENTS_PRESENT; } private void updateCurrentRecipe() { - if (!cachedRecipeData.matches(inventoryCrafting, world) || !ItemStack.areItemStacksEqual(oldResult, cachedRecipe.getCraftingResult(inventoryCrafting))) { + if (!cachedRecipeData.matches(inventoryCrafting, world) || + !ItemStack.areItemStacksEqual(oldResult, cachedRecipe.getCraftingResult(inventoryCrafting))) { IRecipe newRecipe = CraftingManager.findMatchingRecipe(inventoryCrafting, world); this.cachedRecipe = newRecipe; ItemStack resultStack = ItemStack.EMPTY; @@ -178,12 +185,11 @@ private void updateCurrentRecipe() { } public void update() { - //update item sources every tick for fast tinting updates + // update item sources every tick for fast tinting updates itemSources.update(); if (getCachedRecipeData().getRecipe() != null) { tintLocation = getCachedRecipeData().attemptMatchRecipe(); - } - else { + } else { tintLocation = ALL_INGREDIENTS_PRESENT; } if (hasCraftingGridUpdated()) { diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java index 8d1800f9df7..17a26c15475 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java @@ -47,7 +47,8 @@ private MemorizedRecipe offsetRecipe(int startIndex) { private MemorizedRecipe findOrCreateRecipe(ItemStack resultItemStack) { // search preexisting recipe with identical recipe result for (MemorizedRecipe memorizedRecipe : memorizedRecipes) { - if (memorizedRecipe != null && ItemStack.areItemStacksEqual(memorizedRecipe.recipeResult, resultItemStack)) { + if (memorizedRecipe != null && + ItemStack.areItemStacksEqual(memorizedRecipe.recipeResult, resultItemStack)) { return memorizedRecipe; } } @@ -112,6 +113,7 @@ private static void copyInventoryItems(IItemHandler src, IItemHandlerModifiable } public static class MemorizedRecipe { + private final ItemStackHandler craftingMatrix = new ItemStackHandler(9); private ItemStack recipeResult; private boolean recipeLocked = false; @@ -147,7 +149,7 @@ private void initialize(ItemStack recipeResult) { } private void updateCraftingMatrix(IItemHandler craftingGrid) { - //do not modify crafting grid for locked recipes + // do not modify crafting grid for locked recipes if (!recipeLocked) { copyInventoryItems(craftingGrid, craftingMatrix); } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java index 4b74235b915..2b1264ae613 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -15,6 +11,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -25,12 +22,18 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityBuffer extends MetaTileEntity implements ITieredMetaTileEntity { private static final int TANK_SIZE = 64000; @@ -53,7 +56,7 @@ protected void initializeInventory() { fluidHandlers[i] = new FilteredFluidHandler(TANK_SIZE); } fluidInventory = fluidTankList = new FluidTankList(false, fluidHandlers); - itemInventory = itemStackHandler = new GTItemStackHandler(this, ((int)Math.pow(tier + 2, 2))); + itemInventory = itemStackHandler = new GTItemStackHandler(this, ((int) Math.pow(tier + 2, 2))); } @Override @@ -70,7 +73,7 @@ public Pair getParticleTexture() { protected ModularUI createUI(EntityPlayer entityPlayer) { int invTier = tier + 2; ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, - 176, Math.max(166, 18 + 18 * invTier + 94));//176, 166 + 176, Math.max(166, 18 + 18 * invTier + 94));// 176, 166 for (int i = 0; i < this.fluidTankList.getTanks(); i++) { builder.widget(new TankWidget(this.fluidTankList.getTankAt(i), 176 - 8 - 18, 18 + 18 * i, 18, 18) .setAlwaysShowFull(true) @@ -140,7 +143,7 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); // TODO Add this when the Buffer gets an auto-output side, and change the above to // "gregtech.tool_action.screwdriver.auto_output_covers" - //tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); + // tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); super.addToolUsages(stack, world, tooltip, advanced); } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index a8c68fbc476..ba35f958fd3 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.ModularUI.Builder; @@ -17,6 +12,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,11 +27,18 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.IS_TAPED; import static gregtech.api.capability.GregtechDataCodes.TAG_KEY_PAINTING_COLOR; @@ -83,7 +86,7 @@ protected void initializeInventory() { @Override public void clearMachineInventory(NonNullList itemBuffer) { - if(!isTaped) { + if (!isTaped) { clearInventory(itemBuffer, inventory); } } @@ -105,9 +108,11 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (material.toString().contains("wood")) { - Textures.WOODEN_CRATE.render(renderState, translation, GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()), pipeline); + Textures.WOODEN_CRATE.render(renderState, translation, + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()), pipeline); } else { - int baseColor = ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + int baseColor = ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); Textures.METAL_CRATE.render(renderState, translation, baseColor, pipeline); } boolean taped = isTaped; @@ -130,19 +135,25 @@ public int getDefaultPaintingColor() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { int factor = inventorySize / 9 > 8 ? 18 : 9; - Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + (factor == 18 ? 176 : 0), 8 + inventorySize / factor * 18 + 104).label(5, 5, getMetaFullName()); + Builder builder = ModularUI + .builder(GuiTextures.BACKGROUND, 176 + (factor == 18 ? 176 : 0), 8 + inventorySize / factor * 18 + 104) + .label(5, 5, getMetaFullName()); for (int i = 0; i < inventorySize; i++) { - builder.slot(inventory, i, 7 * (factor == 18 ? 2 : 1) + i % factor * 18, 18 + i / factor * 18, GuiTextures.SLOT); + builder.slot(inventory, i, 7 * (factor == 18 ? 2 : 1) + i % factor * 18, 18 + i / factor * 18, + GuiTextures.SLOT); } - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7 + (factor == 18 ? 88 : 0), 18 + inventorySize / factor * 18 + 11); + builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7 + (factor == 18 ? 88 : 0), + 18 + inventorySize / factor * 18 + 11); return builder.build(getHolder(), entityPlayer); } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { ItemStack stack = playerIn.getHeldItem(hand); - if(playerIn.isSneaking() && !isTaped) { - if (stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm()) || stack.isItemEqual(MetaItems.BASIC_TAPE.getStackForm())) { + if (playerIn.isSneaking() && !isTaped) { + if (stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm()) || + stack.isItemEqual(MetaItems.BASIC_TAPE.getStackForm())) { if (!playerIn.isCreative()) { stack.shrink(1); } @@ -178,7 +189,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); - if(data.hasKey(TAPED_NBT)) { + if (data.hasKey(TAPED_NBT)) { this.isTaped = data.getBoolean(TAPED_NBT); } } @@ -190,7 +201,7 @@ public void initFromItemStackData(NBTTagCompound data) { this.setPaintingColor(data.getInteger(TAG_KEY_PAINTING_COLOR)); } this.isTaped = data.getBoolean(TAPED_NBT); - if(isTaped) { + if (isTaped) { this.inventory.deserializeNBT(data.getCompoundTag("Inventory")); } @@ -209,7 +220,7 @@ public void writeItemStackData(NBTTagCompound data) { data.setInteger(TAG_KEY_PAINTING_COLOR, this.getPaintingColor()); } // Don't write tape NBT if not taped, to stack with ones from JEI - if(isTaped) { + if (isTaped) { data.setBoolean(TAPED_NBT, isTaped); data.setTag("Inventory", inventory.serializeNBT()); } @@ -219,7 +230,7 @@ public void writeItemStackData(NBTTagCompound data) { public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); - if(dataId == IS_TAPED) { + if (dataId == IS_TAPED) { this.isTaped = buf.readBoolean(); scheduleRenderUpdate(); markDirty(); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java index a792a2ee44c..d30b53f5242 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -19,6 +15,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -30,17 +27,24 @@ import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCreativeChest extends MetaTileEntityQuantumChest { private int itemsPerCycle = 1; private int ticksPerCycle = 1; - private final GTItemStackHandler handler = new GTItemStackHandler(this,1) { + private final GTItemStackHandler handler = new GTItemStackHandler(this, 1) { + @Override protected int getStackLimit(int slot, ItemStack stack) { return 1; @@ -64,7 +68,8 @@ public MetaTileEntityCreativeChest(ResourceLocation metaTileEntityId) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.getTier()); Textures.CREATIVE_CONTAINER_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); Textures.PIPE_OUT_OVERLAY.renderSided(this.getOutputFacing(), renderState, translation, pipeline); @@ -76,7 +81,6 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick QuantumStorageRenderer.renderChestStack(x, y, z, this, this.virtualItemStack, 420, partialTicks); } - @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityCreativeChest(this.metaTileEntityId); @@ -107,8 +111,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { }).setMaxLength(11).setNumbersOnly(1, Integer.MAX_VALUE)); builder.label(7, 65, "gregtech.creative.chest.tpc"); - - builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); return builder.build(getHolder(), entityPlayer); } @@ -123,7 +127,8 @@ public void update() { TileEntity tile = getNeighbor(getOutputFacing()); if (tile != null) { - IItemHandler container = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, this.getOutputFacing().getOpposite()); + IItemHandler container = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + this.getOutputFacing().getOpposite()); if (container == null || container.getSlots() == 0) return; stack.setCount(itemsPerCycle); @@ -179,9 +184,8 @@ public void writeItemStackData(NBTTagCompound tag) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); // do not append the normal tooltips } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java index d8c856f03b5..eb62f8c1fe2 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.GregtechTileCapabilities; @@ -21,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -31,13 +27,20 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Function; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.MAX; import static gregtech.api.GTValues.V; import static gregtech.api.capability.GregtechDataCodes.UPDATE_IO_SPEED; @@ -63,7 +66,8 @@ public MetaTileEntityCreativeEnergy() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[14].render(renderState, translation, renderPipeline, Cuboid6.full); for (EnumFacing face : EnumFacing.VALUES) { Textures.INFINITE_EMITTER_FACE.renderSided(face, renderState, translation, pipeline); @@ -123,7 +127,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.dynamicLabel(7, 110, () -> "Energy I/O per sec: " + this.lastEnergyIOPerSec, 0x232323); - builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); builder.widget(new CycleButtonWidget(85, 139, 77, 20, () -> source, value -> { source = value; if (source) { @@ -148,9 +153,8 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t @Override public void addInformation(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); } @Override @@ -178,7 +182,8 @@ public void update() { EnumFacing opposite = facing.getOpposite(); TileEntity tile = getNeighbor(facing); if (tile != null) { - IEnergyContainer container = tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, opposite); + IEnergyContainer container = tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + opposite); // Try to get laser capability if (container == null) container = tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, opposite); @@ -317,5 +322,4 @@ public static Function getTextFieldValidator() { return val; }; } - } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java index 8e20dcfabbd..8a006937579 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java @@ -1,9 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -17,6 +13,7 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -29,11 +26,17 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + public class MetaTileEntityCreativeTank extends MetaTileEntityQuantumTank { private int mBPerCycle = 1; @@ -48,7 +51,8 @@ public MetaTileEntityCreativeTank(ResourceLocation metaTileEntityId) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.getTier()); Textures.CREATIVE_CONTAINER_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (this.getOutputFacing() != null) { @@ -57,7 +61,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.FLUID_OUTPUT_OVERLAY.renderSided(this.getOutputFacing(), renderState, translation, pipeline); } } - QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, this.fluidTank, getWorld(), getPos(), getFrontFacing()); + QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, this.fluidTank, getWorld(), getPos(), + getFrontFacing()); } @Override @@ -77,8 +82,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .bindPlayerInventory(entityPlayer.inventory, 126); builder.widget(new PhantomFluidWidget(36, 6, 18, 18, () -> this.fluidTank.getFluid(), data -> { - this.fluidTank.setFluid(data); - }).showTip(false)); + this.fluidTank.setFluid(data); + }).showTip(false)); builder.label(7, 9, "gregtech.creative.tank.fluid"); builder.widget(new ImageWidget(7, 45, 154, 14, GuiTextures.DISPLAY)); builder.widget(new TextFieldWidget2(9, 47, 152, 10, () -> String.valueOf(mBPerCycle), value -> { @@ -96,8 +101,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { }).setMaxLength(11).setNumbersOnly(1, Integer.MAX_VALUE)); builder.label(7, 65, "gregtech.creative.tank.tpc"); - - builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); + builder.widget(new CycleButtonWidget(7, 101, 162, 20, () -> active, value -> active = value, + "gregtech.creative.activity.off", "gregtech.creative.activity.on")); return builder.build(getHolder(), entityPlayer); } @@ -105,12 +110,14 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @Override public void update() { super.update(); - if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || fluidTank.getFluid() == null - || getWorld().isRemote || !active) return; + if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || fluidTank.getFluid() == null || + getWorld().isRemote || !active) + return; TileEntity tile = getNeighbor(getOutputFacing()); if (tile != null) { - IFluidHandler fluidHandler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, getOutputFacing().getOpposite()); + IFluidHandler fluidHandler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + getOutputFacing().getOpposite()); if (fluidHandler == null || fluidHandler.getTankProperties().length == 0) return; @@ -155,9 +162,8 @@ public void writeItemStackData(NBTTagCompound itemStack) { @Override public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { - tooltip.add(I18n.format("gregtech.creative_tooltip.1") - + TooltipHelper.RAINBOW + I18n.format("gregtech.creative_tooltip.2") - + I18n.format("gregtech.creative_tooltip.3")); + tooltip.add(I18n.format("gregtech.creative_tooltip.1") + TooltipHelper.RAINBOW + + I18n.format("gregtech.creative_tooltip.2") + I18n.format("gregtech.creative_tooltip.3")); // do not append the normal tooltips } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java index 58b1ea098aa..0ab8ba0093d 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java @@ -1,11 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.IPropertyFluidFilter; import gregtech.api.capability.impl.FilteredFluidHandler; import gregtech.api.capability.impl.GTFluidHandlerItemStack; @@ -20,6 +14,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -40,13 +35,21 @@ import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_AUTO_OUTPUT; public class MetaTileEntityDrum extends MetaTileEntity { @@ -94,7 +97,8 @@ protected void initializeInventory() { super.initializeInventory(); IPropertyFluidFilter filter = this.material.getProperty(PropertyKey.FLUID_PIPE); if (filter == null) { - throw new IllegalArgumentException(String.format("Material %s requires FluidPipePropety for Drums", material)); + throw new IllegalArgumentException( + String.format("Material %s requires FluidPipePropety for Drums", material)); } this.fluidInventory = this.fluidTank = new FilteredFluidHandler(tankSize).setFilter(filter); } @@ -103,7 +107,8 @@ protected void initializeInventory() { public void initFromItemStackData(NBTTagCompound itemStack) { super.initFromItemStackData(itemStack); if (itemStack.hasKey(FluidHandlerItemStack.FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { - FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(itemStack.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); + FluidStack fluidStack = FluidStack + .loadFluidStackFromNBT(itemStack.getCompoundTag(FluidHandlerItemStack.FLUID_NBT_KEY)); fluidTank.setFluid(fluidStack); } } @@ -145,8 +150,7 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { NBTTagCompound tagCompound = buf.readCompoundTag(); fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound); - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } fluidTank.setFluid(fluidStack); isAutoOutput = buf.readBoolean(); @@ -172,21 +176,25 @@ public void update() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (playerIn.getHeldItem(hand).hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { - return getWorld().isRemote || (!playerIn.isSneaking() && FluidUtil.interactWithFluidHandler(playerIn, hand, fluidTank)); + return getWorld().isRemote || + (!playerIn.isSneaking() && FluidUtil.interactWithFluidHandler(playerIn, hand, fluidTank)); } return super.onRightClick(playerIn, hand, facing, hitResult); } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getWorld().isRemote) { scheduleRenderUpdate(); return true; } - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.drum." + (isAutoOutput ? "disable" : "enable") + "_output"), true); + playerIn.sendStatusMessage(new TextComponentTranslation( + "gregtech.machine.drum." + (isAutoOutput ? "disable" : "enable") + "_output"), true); toggleOutput(); return true; } @@ -219,10 +227,14 @@ public Pair getParticleTexture() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { if (ModHandler.isMaterialWood(material)) { - ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); - Textures.WOODEN_DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), getFrontFacing()); + ColourMultiplier multiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())); + Textures.WOODEN_DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), + getFrontFacing()); } else { - ColourMultiplier multiplier = new ColourMultiplier(ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + ColourMultiplier multiplier = new ColourMultiplier( + ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.getMaterialRGB()), + GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.DRUM.render(renderState, translation, ArrayUtils.add(pipeline, multiplier), getFrontFacing()); Textures.DRUM_OVERLAY.render(renderState, translation, pipeline); } @@ -254,7 +266,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (tagCompound != null && tagCompound.hasKey("Fluid", Constants.NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tagCompound.getCompoundTag("Fluid")); if (fluidStack == null) return; - tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, I18n.format(fluidStack.getUnlocalizedName()))); + tooltip.add(I18n.format("gregtech.machine.fluid_tank.fluid", fluidStack.amount, + I18n.format(fluidStack.getUnlocalizedName()))); } } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java index 805a10f145d..8c9bb85a6f9 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java @@ -1,12 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -27,6 +20,7 @@ import gregtech.common.worldgen.LootTableHelper; import gregtech.loaders.recipe.CraftingComponent; import gregtech.loaders.recipe.CraftingComponent.Component; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -43,14 +37,23 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.oredict.OreDictionary; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.raytracer.IndexedCuboid6; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.List; import java.util.Random; import java.util.function.DoubleSupplier; +import javax.annotation.Nonnull; + import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONTENTS_SEED; import static gregtech.api.capability.GregtechDataCodes.UPDATE_LOCKED_STATE; @@ -58,7 +61,8 @@ public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRen private static final int MAX_UNLOCK_PROGRESS = 100; private static Component[] ALLOWED_COMPONENTS; - private static final IndexedCuboid6 COLLISION_BOX = new IndexedCuboid6(null, new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0)); + private static final IndexedCuboid6 COLLISION_BOX = new IndexedCuboid6(null, + new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0)); private int unlockProgress = -1; private int unlockComponentTier = 1; @@ -67,6 +71,7 @@ public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRen private long unlockComponentsSeed = 0L; private final ItemStackHandler unlockComponents = new GTItemStackHandler(this, 2); private final ItemStackHandler unlockInventory = new GTItemStackHandler(this, 2) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { @@ -115,7 +120,8 @@ public void update() { } @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { generateUnlockComponents(); return super.onRightClick(playerIn, hand, facing, hitResult); } @@ -150,7 +156,8 @@ private void updateDisplayUnlockComponents() { GTRecipeInput[] unlockComponents = getUnlockComponents(); for (int i = 0; i < Math.min(this.unlockComponents.getSlots(), unlockComponents.length); i++) { if (unlockComponents[i].isOreDict()) { - this.unlockComponents.setStackInSlot(i, OreDictionary.getOres(OreDictionary.getOreName(unlockComponents[i].getOreDict())).get(0)); + this.unlockComponents.setStackInSlot(i, + OreDictionary.getOres(OreDictionary.getOreName(unlockComponents[i].getOreDict())).get(0)); } else { this.unlockComponents.setStackInSlot(i, (unlockComponents[i].getInputStacks()[0])); } @@ -159,12 +166,14 @@ private void updateDisplayUnlockComponents() { private GTRecipeInput[] getUnlockComponents() { if (ALLOWED_COMPONENTS == null) - ALLOWED_COMPONENTS = new Component[]{CraftingComponent.PUMP, CraftingComponent.CONVEYOR, CraftingComponent.EMITTER, CraftingComponent.SENSOR}; + ALLOWED_COMPONENTS = new Component[] { CraftingComponent.PUMP, CraftingComponent.CONVEYOR, + CraftingComponent.EMITTER, CraftingComponent.SENSOR }; Random random = new Random(unlockComponentsSeed); - return new GTRecipeInput[]{ + return new GTRecipeInput[] { new GTRecipeOreInput(CraftingComponent.CIRCUIT.getIngredient(unlockComponentTier).toString()), - new GTRecipeItemInput((ItemStack) ALLOWED_COMPONENTS[random.nextInt(ALLOWED_COMPONENTS.length)].getIngredient(unlockComponentTier)), + new GTRecipeItemInput((ItemStack) ALLOWED_COMPONENTS[random.nextInt(ALLOWED_COMPONENTS.length)] + .getIngredient(unlockComponentTier)), }; } @@ -341,16 +350,17 @@ public void readFromNBT(NBTTagCompound data) { } @Override - public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - } + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {} @Override public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - ColourMultiplier colourMultiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier])); + ColourMultiplier colourMultiplier = new ColourMultiplier( + GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier])); float angle = prevDoorAngle + (doorAngle - prevDoorAngle) * partialTicks; angle = 1.0f - (1.0f - angle) * (1.0f - angle) * (1.0f - angle); float resultDoorAngle = angle * 120.0f; - Textures.SAFE.render(renderState, translation, new IVertexOperation[]{colourMultiplier}, getFrontFacing(), resultDoorAngle); + Textures.SAFE.render(renderState, translation, new IVertexOperation[] { colourMultiplier }, getFrontFacing(), + resultDoorAngle); } @Override @@ -386,8 +396,10 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { lockedGroup.addWidget(new LabelWidget(5, 20, "gregtech.machine.locked_safe.malfunctioning")); lockedGroup.addWidget(new LabelWidget(5, 30, "gregtech.machine.locked_safe.requirements")); - lockedGroup.addWidget(new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); - lockedGroup.addWidget(new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); + lockedGroup.addWidget( + new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); + lockedGroup.addWidget( + new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); lockedGroup.addWidget(new SlotWidget(unlockComponents, 0, 70, 58, false, false)); lockedGroup.addWidget(new SlotWidget(unlockComponents, 1, 70 + 18, 58, false, false)); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java index 7233e398669..81ed97cf149 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java @@ -1,12 +1,12 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; import gregtech.api.metatileentity.IDataInfoProvider; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistanceNetwork; import gregtech.api.pipenet.longdist.LongDistancePipeType; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -18,15 +18,19 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; + +import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; -public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity implements ILDEndpoint, IDataInfoProvider { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity + implements ILDEndpoint, IDataInfoProvider { private final LongDistancePipeType pipeType; private IOType ioType = IOType.NONE; @@ -61,7 +65,8 @@ public void updateNetwork() { } } - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing wrenchSide, + CuboidRayTraceResult hitResult) { return super.onWrenchClick(playerIn, hand, wrenchSide.getOpposite(), hitResult); } @@ -208,7 +213,8 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + boolean advanced) { tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.3")); @@ -261,10 +267,8 @@ public BlockPos pos() { } @Override - public void onNeighborChanged(@NotNull EnumFacing facing) { - } + public void onNeighborChanged(@NotNull EnumFacing facing) {} @Override - public void markAsDirty() { - } + public void markAsDirty() {} } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java index 6bc0842e3b5..ae6cfd69a76 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.impl.ItemHandlerList; @@ -27,6 +22,7 @@ import gregtech.api.util.TextFormattingUtil; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -47,19 +43,26 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static gregtech.api.capability.GregtechDataCodes.*; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; -public class MetaTileEntityQuantumChest extends MetaTileEntity implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { +import static gregtech.api.capability.GregtechDataCodes.*; +public class MetaTileEntityQuantumChest extends MetaTileEntity + implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { private final int tier; protected final long maxStoredItems; @@ -95,11 +98,11 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityQuantumChest(metaTileEntityId, tier, maxStoredItems); } - @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.tier); Textures.QUANTUM_CHEST_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (outputFacing != null) { @@ -128,7 +131,8 @@ public void update() { if (itemsStoredInside < maxStoredItems) { ItemStack inputStack = importItems.getStackInSlot(0); ItemStack outputStack = exportItems.getStackInSlot(0); - if (!inputStack.isEmpty() && (virtualItemStack.isEmpty() || areItemStackIdentical(outputStack, inputStack))) { + if (!inputStack.isEmpty() && + (virtualItemStack.isEmpty() || areItemStackIdentical(outputStack, inputStack))) { GTTransferUtils.moveInventoryItems(importItems, combinedInventory); markDirty(); @@ -137,7 +141,8 @@ public void update() { if (itemsStoredInside > 0 && !virtualItemStack.isEmpty()) { ItemStack outputStack = exportItems.getStackInSlot(0); int maxStackSize = virtualItemStack.getMaxStackSize(); - if (outputStack.isEmpty() || (areItemStackIdentical(virtualItemStack, outputStack) && outputStack.getCount() < maxStackSize)) { + if (outputStack.isEmpty() || (areItemStackIdentical(virtualItemStack, outputStack) && + outputStack.getCount() < maxStackSize)) { GTTransferUtils.moveInventoryItems(itemInventory, exportItems); markDirty(); @@ -173,7 +178,8 @@ protected void addDisplayInformation(List textList) { textList.add(new TextComponentString(String.format("%,d", itemsStoredInside))); ItemStack export = exportItems.getStackInSlot(0); if (!export.isEmpty()) { - textList.add(new TextComponentString(TextFormattingUtil.formatStringWithNewlines(export.getDisplayName(), 14))); + textList.add( + new TextComponentString(TextFormattingUtil.formatStringWithNewlines(export.getDisplayName(), 14))); } } @@ -219,7 +225,6 @@ protected void initializeInventory() { temp.add(this.itemInventory); this.combinedInventory = new ItemHandlerList(temp); this.outputItemInventory = new ItemHandlerProxy(new GTItemStackHandler(this, 0), combinedInventory); - } @Override @@ -242,7 +247,9 @@ public boolean isItemValid(int slot, @Nonnull ItemStack stack) { outStackMatch = areItemStackIdentical(stack, outStack); } if (compound == null) return true; - return outStackMatch && !(compound.hasKey(NBT_ITEMSTACK, NBT.TAG_COMPOUND) || compound.hasKey("Fluid", NBT.TAG_COMPOUND)); //prevents inserting items with NBT to the Quantum Chest + return outStackMatch && !(compound.hasKey(NBT_ITEMSTACK, NBT.TAG_COMPOUND) || + compound.hasKey("Fluid", NBT.TAG_COMPOUND)); // prevents inserting items with NBT to the Quantum + // Chest } }; } @@ -278,7 +285,7 @@ public void readFromNBT(NBTTagCompound data) { this.itemsStoredInside = data.getLong(NBT_ITEMCOUNT); } } - if (data.hasKey(IS_VOIDING)){ + if (data.hasKey(IS_VOIDING)) { this.voiding = data.getBoolean(IS_VOIDING); } } @@ -313,7 +320,6 @@ public void writeItemStackData(NBTTagCompound itemStack) { itemStack.setTag(NBT_PARTIALSTACK, partialStack.writeToNBT(new NBTTagCompound())); } - if (this.voiding) { itemStack.setBoolean(IS_VOIDING, true); } @@ -334,12 +340,13 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .widget(new SlotWidget(exportItems, 0, 90, 44, true, false) .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, - GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems).shouldUseBaseBackground() - .setTooltipText("gregtech.gui.item_auto_output.tooltip")) + GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems) + .shouldUseBaseBackground() + .setTooltipText("gregtech.gui.item_auto_output.tooltip")) .widget(new ToggleButtonWidget(25, 64, 18, 18, GuiTextures.BUTTON_ITEM_VOID, this::isVoiding, this::setVoiding) - .setTooltipText("gregtech.gui.item_voiding.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.item_voiding.tooltip") + .shouldUseBaseBackground()) .bindPlayerInventory(entityPlayer.inventory); return builder.build(getHolder(), entityPlayer); @@ -359,7 +366,8 @@ public void setOutputFacing(EnumFacing outputFacing) { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getOutputFacing() == facing || getFrontFacing() == facing) { return false; @@ -390,7 +398,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { this.virtualItemStack = buf.readItemStack(); } catch (IOException ignored) { - GTLog.logger.warn("Failed to load item from NBT in a quantum chest at " + this.getPos() + " on initial server/client sync"); + GTLog.logger.warn("Failed to load item from NBT in a quantum chest at " + this.getPos() + + " on initial server/client sync"); } this.itemsStoredInside = buf.readLong(); this.voiding = buf.readBoolean(); @@ -398,8 +407,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { @Override public boolean isValidFrontFacing(EnumFacing facing) { - //use direct outputFacing field instead of getter method because otherwise - //it will just return SOUTH for null output facing + // use direct outputFacing field instead of getter method because otherwise + // it will just return SOUTH for null output facing return super.isValidFrontFacing(facing) && facing != outputFacing; } @@ -458,7 +467,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (side == null) return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(combinedInventory); // try fix being able to insert through output hole when input on output is disabled - IItemHandler itemHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideItems()) ? outputItemInventory : combinedInventory; + IItemHandler itemHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideItems()) ? + outputItemInventory : combinedInventory; if (itemHandler.getSlots() > 0) { return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler); } @@ -479,7 +489,7 @@ public IItemHandler getOutputItemInventory() { public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -509,16 +519,20 @@ public void clearMachineInventory(NonNullList itemBuffer) { } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { EnumFacing hitFacing = CoverRayTracer.determineGridSideHit(hitResult); if (facing == getOutputFacing() || (hitFacing == getOutputFacing() && playerIn.isSneaking())) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideItems()) { setAllowInputFromOutputSide(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), + true); } else { setAllowInputFromOutputSide(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index e1a0627775c..27f523a1b23 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.IFilter; @@ -26,6 +21,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -49,19 +45,27 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.IOException; import java.util.List; import java.util.function.Consumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.*; import static net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack.FLUID_NBT_KEY; -public class MetaTileEntityQuantumTank extends MetaTileEntity implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { +public class MetaTileEntityQuantumTank extends MetaTileEntity + implements ITieredMetaTileEntity, IActiveOutputSide, IFastRenderMetaTileEntity { private final int tier; private final int maxFluidCapacity; @@ -122,14 +126,16 @@ public void update() { if (currentFluid == null) { // tank had fluid, but now is empty updatePreviousFluid(null); - } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && previousFluid.amount != currentFluid.amount) { - // tank has fluid with changed amount - previousFluid.amount = currentFluid.amount; - writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); - } else if (!previousFluid.equals(currentFluid)) { - // tank has a different fluid from before - updatePreviousFluid(currentFluid); - } + } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && + previousFluid.amount != currentFluid.amount) { + // tank has fluid with changed amount + previousFluid.amount = currentFluid.amount; + writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); + } else + if (!previousFluid.equals(currentFluid)) { + // tank has a different fluid from before + updatePreviousFluid(currentFluid); + } } } } @@ -137,7 +143,8 @@ public void update() { // should only be called on the server protected void updatePreviousFluid(FluidStack currentFluid) { previousFluid = currentFluid == null ? null : currentFluid.copy(); - writeCustomData(UPDATE_FLUID, buf -> buf.writeCompoundTag(currentFluid == null ? null : currentFluid.writeToNBT(new NBTTagCompound()))); + writeCustomData(UPDATE_FLUID, buf -> buf + .writeCompoundTag(currentFluid == null ? null : currentFluid.writeToNBT(new NBTTagCompound()))); } @Override @@ -170,12 +177,14 @@ public void readFromNBT(NBTTagCompound data) { this.allowInputFromOutputSide = data.getBoolean("AllowInputFromOutputSideF"); } - public static void legacyTankItemHandlerNBTReading(MetaTileEntity mte, NBTTagCompound nbt, int inputSlot, int outputSlot) { + public static void legacyTankItemHandlerNBTReading(MetaTileEntity mte, NBTTagCompound nbt, int inputSlot, + int outputSlot) { if (mte == null || nbt == null) { return; } NBTTagList items = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); - if (mte.getExportItems().getSlots() < 1 || mte.getImportItems().getSlots() < 1 || inputSlot < 0 || outputSlot < 0 || inputSlot == outputSlot) { + if (mte.getExportItems().getSlots() < 1 || mte.getImportItems().getSlots() < 1 || inputSlot < 0 || + outputSlot < 0 || inputSlot == outputSlot) { return; } for (int i = 0; i < items.tagCount(); ++i) { @@ -237,7 +246,8 @@ protected FluidTankList createExportFluidHandler() { @Override protected IItemHandlerModifiable createImportItemHandler() { - return new FilteredItemHandler(this, 1).setFillPredicate(FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); + return new FilteredItemHandler(this, 1).setFillPredicate( + FilteredItemHandler.getCapabilityFilter(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)); } @Override @@ -248,7 +258,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { Textures.QUANTUM_STORAGE_RENDERER.renderMachine(renderState, translation, - ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), + ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))), this.getFrontFacing(), this.tier); Textures.QUANTUM_TANK_OVERLAY.renderSided(EnumFacing.UP, renderState, translation, pipeline); if (outputFacing != null) { @@ -257,7 +268,8 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, Textures.FLUID_OUTPUT_OVERLAY.renderSided(outputFacing, renderState, translation, pipeline); } } - QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, fluidTank, getWorld(), getPos(), getFrontFacing()); + QuantumStorageRenderer.renderTankFluid(renderState, translation, pipeline, fluidTank, getWorld(), getPos(), + getFrontFacing()); } @Override @@ -282,7 +294,8 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (tag.hasKey(FLUID_NBT_KEY, Constants.NBT.TAG_COMPOUND)) { FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag(FLUID_NBT_KEY)); if (fluidStack != null) { - tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_stored", fluidStack.getLocalizedName(), fluidStack.amount)); + tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_stored", fluidStack.getLocalizedName(), + fluidStack.amount)); } } if (tag.getBoolean("IsVoiding") || tag.getBoolean("IsPartialVoiding")) { // legacy save support @@ -315,7 +328,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { this.lockedFluid.amount = 1; } }) - .setAlwaysShowFull(true).setDrawHoveringText(false); + .setAlwaysShowFull(true).setDrawHoveringText(false); return ModularUI.defaultBuilder() .widget(new ImageWidget(7, 16, 81, 46, GuiTextures.DISPLAY)) @@ -330,16 +343,16 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)) .widget(new ToggleButtonWidget(7, 64, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids) - .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_auto_output.tooltip") + .shouldUseBaseBackground()) .widget(new ToggleButtonWidget(25, 64, 18, 18, GuiTextures.BUTTON_LOCK, this::isLocked, this::setLocked) - .setTooltipText("gregtech.gui.fluid_lock.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_lock.tooltip") + .shouldUseBaseBackground()) .widget(new ToggleButtonWidget(43, 64, 18, 18, GuiTextures.BUTTON_FLUID_VOID, this::isVoiding, this::setVoiding) - .setTooltipText("gregtech.gui.fluid_voiding.tooltip") - .shouldUseBaseBackground()) + .setTooltipText("gregtech.gui.fluid_voiding.tooltip") + .shouldUseBaseBackground()) .bindPlayerInventory(entityPlayer.inventory) .build(getHolder(), entityPlayer); } @@ -393,7 +406,7 @@ public void setFrontFacing(EnumFacing frontFacing) { super.setFrontFacing(frontFacing); } if (this.outputFacing == null) { - //set initial output facing as opposite to front + // set initial output facing as opposite to front setOutputFacing(frontFacing.getOpposite()); } } @@ -431,7 +444,8 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { try { this.fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(buf.readCompoundTag())); } catch (IOException ignored) { - GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + " on a routine fluid update"); + GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + + " on a routine fluid update"); } scheduleRenderUpdate(); } else if (dataId == UPDATE_FLUID_AMOUNT) { @@ -456,7 +470,8 @@ public void writeInitialSyncData(PacketBuffer buf) { buf.writeByte(getOutputFacing().getIndex()); buf.writeBoolean(autoOutputFluids); buf.writeBoolean(locked); - buf.writeCompoundTag(fluidTank.getFluid() == null ? null : fluidTank.getFluid().writeToNBT(new NBTTagCompound())); + buf.writeCompoundTag( + fluidTank.getFluid() == null ? null : fluidTank.getFluid().writeToNBT(new NBTTagCompound())); buf.writeBoolean(voiding); } @@ -477,7 +492,8 @@ public void receiveInitialSyncData(PacketBuffer buf) { try { this.fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(buf.readCompoundTag())); } catch (IOException e) { - GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + " on initial server/client sync"); + GTLog.logger.warn("Failed to load fluid from NBT in a quantum tank at " + this.getPos() + + " on initial server/client sync"); } this.voiding = buf.readBoolean(); } @@ -499,7 +515,8 @@ public T getCapability(Capability capability, EnumFacing side) { } return null; } else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { - IFluidHandler fluidHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideFluids()) ? outputFluidInventory : fluidInventory; + IFluidHandler fluidHandler = (side == getOutputFacing() && !isAllowInputFromOutputSideFluids()) ? + outputFluidInventory : fluidInventory; if (fluidHandler.getTankProperties().length > 0) { return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); } @@ -515,7 +532,8 @@ public ICapabilityProvider initItemStackCapabilities(ItemStack itemStack) { } @Override - public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { if (!playerIn.isSneaking()) { if (getOutputFacing() == facing || getFrontFacing() == facing) { return false; @@ -529,16 +547,20 @@ public boolean onWrenchClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fa } @Override - public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { + public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, + CuboidRayTraceResult hitResult) { EnumFacing hitFacing = CoverRayTracer.determineGridSideHit(hitResult); if (facing == getOutputFacing() || (hitFacing == getOutputFacing() && playerIn.isSneaking())) { if (!getWorld().isRemote) { if (isAllowInputFromOutputSideFluids()) { setAllowInputFromOutputSide(false); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.disallow"), + true); } else { setAllowInputFromOutputSide(true); - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); + playerIn.sendStatusMessage( + new TextComponentTranslation("gregtech.machine.basic.input_from_output_side.allow"), true); } } return true; @@ -595,13 +617,13 @@ protected void setVoiding(boolean isPartialVoid) { @Override public ItemStack getPickItem(EntityPlayer player) { - if(!player.isCreative()) return super.getPickItem(player); + if (!player.isCreative()) return super.getPickItem(player); ItemStack baseItemStack = getStackForm(); NBTTagCompound tag = new NBTTagCompound(); this.writeItemStackData(tag); - if(!tag.isEmpty()) { + if (!tag.isEmpty()) { baseItemStack.setTagCompound(tag); } return baseItemStack; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java index e1c46526e09..e46c10cef79 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java @@ -1,10 +1,5 @@ package gregtech.common.metatileentities.storage; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; -import com.google.common.base.Preconditions; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.ModularUI.Builder; @@ -28,6 +23,7 @@ import gregtech.common.inventory.handlers.ToolItemStackHandler; import gregtech.common.inventory.itemsource.ItemSources; import gregtech.common.inventory.itemsource.sources.InventoryItemSource; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -39,18 +35,26 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import com.google.common.base.Preconditions; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MetaTileEntityWorkbench extends MetaTileEntity implements ICraftingStorage { + private final ItemStackHandler internalInventory = new GTItemStackHandler(this, 18); private final ItemStackHandler craftingGrid = new SingleItemStackHandler(9); private final ItemStackHandler toolInventory = new ToolItemStackHandler(9); @@ -65,35 +69,43 @@ public MetaTileEntityWorkbench(ResourceLocation metaTileEntityId) { super(metaTileEntityId); } - public static AbstractWidgetGroup createWorkbenchTab(CraftingRecipeLogic craftingRecipeLogic, ItemStackHandler craftingGrid, CraftingRecipeMemory recipeMemory, - ItemStackHandler toolInventory, ItemStackHandler internalInventory) { + public static AbstractWidgetGroup createWorkbenchTab(CraftingRecipeLogic craftingRecipeLogic, + ItemStackHandler craftingGrid, + CraftingRecipeMemory recipeMemory, + ItemStackHandler toolInventory, + ItemStackHandler internalInventory) { WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.addWidget(new ImageWidget(88 - 13, 44 - 14, 26, 26, GuiTextures.SLOT)); widgetGroup.addWidget(new CraftingSlotWidget(craftingRecipeLogic, 0, 88 - 9, 44 - 9)); - //crafting grid + // crafting grid widgetGroup.addWidget(new CraftingStationInputWidgetGroup(4, 7, craftingGrid, craftingRecipeLogic)); Supplier textSupplier = () -> Integer.toString(craftingRecipeLogic.getItemsCraftedAmount()); widgetGroup.addWidget(new SimpleTextWidget(88, 44 + 19, "", textSupplier)); Consumer clearAction = (clickData) -> craftingRecipeLogic.clearCraftingGrid(); - widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 3, 16, 8, 8, "", clearAction).setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID)); + widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 3, 16, 8, 8, "", clearAction) + .setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID)); - widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 19 * 3 / 2, 18 * 3, 18 * 3, TextureArea.fullImage("textures/gui/base/darkened_slot.png"))); + widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 19 * 3 / 2, 18 * 3, 18 * 3, + TextureArea.fullImage("textures/gui/base/darkened_slot.png"))); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 28 + i * 18)); + widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, + 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 28 + i * 18)); } } - //tool inventory + // tool inventory for (int i = 0; i < 9; i++) { - widgetGroup.addWidget(new SlotWidget(toolInventory, i, 7 + i * 18, 75).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY)); + widgetGroup.addWidget(new SlotWidget(toolInventory, i, 7 + i * 18, 75) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY)); } - //internal inventory + // internal inventory for (int i = 0; i < 2; ++i) { for (int j = 0; j < 9; ++j) { - widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 7 + j * 18, 98 + i * 18).setBackgroundTexture(GuiTextures.SLOT)); + widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 7 + j * 18, 98 + i * 18) + .setBackgroundTexture(GuiTextures.SLOT)); } } return widgetGroup; @@ -190,7 +202,6 @@ private AbstractWidgetGroup createItemListTab() { @Override protected ModularUI createUI(EntityPlayer entityPlayer) { - createCraftingRecipeLogic(entityPlayer); Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 221) @@ -199,7 +210,8 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { TabGroup tabGroup = new TabGroup<>(TabLocation.HORIZONTAL_TOP_LEFT, Position.ORIGIN); tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.workbench", - new ItemStack(Blocks.CRAFTING_TABLE)), createWorkbenchTab(recipeLogic, craftingGrid, recipeMemory, toolInventory, internalInventory)); + new ItemStack(Blocks.CRAFTING_TABLE)), + createWorkbenchTab(recipeLogic, craftingGrid, recipeMemory, toolInventory, internalInventory)); tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.item_list", new ItemStack(Blocks.CHEST)), createItemListTab()); builder.widget(tabGroup); diff --git a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java index 24788e11b2a..70e789cec47 100644 --- a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.cable; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.damagesources.DamageSources; @@ -19,6 +18,7 @@ import gregtech.common.pipelike.cable.tile.TileEntityCable; import gregtech.common.pipelike.cable.tile.TileEntityCableTickable; import gregtech.core.advancement.AdvancementTriggers; + import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -37,15 +37,19 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.TreeMap; -public class BlockCable extends BlockMaterialPipe implements ITileEntityProvider { +import javax.annotation.Nonnull; + +public class BlockCable extends BlockMaterialPipe + implements ITileEntityProvider { private final Map enabledMaterials = new TreeMap<>(); @@ -58,7 +62,8 @@ public BlockCable(Insulation cableType, MaterialRegistry registry) { public void addCableMaterial(Material material, WireProperties wireProperties) { Preconditions.checkNotNull(material, "material was null"); Preconditions.checkNotNull(wireProperties, "material %s wireProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); if (!pipeType.orePrefix.isIgnored(material)) { this.enabledMaterials.put(material, wireProperties); } @@ -135,13 +140,16 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityCable && sideTile instanceof TileEntityCable; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()) != null; } @Override @@ -154,7 +162,8 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entityIn) { + public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Entity entityIn) { if (worldIn.isRemote) return; Insulation insulation = getPipeTileEntity(worldIn, pos).getPipeType(); if (insulation.insulationLevel == -1 && entityIn instanceof EntityLivingBase) { diff --git a/src/main/java/gregtech/common/pipelike/cable/Insulation.java b/src/main/java/gregtech/common/pipelike/cable/Insulation.java index f06508417d1..6587144ce8a 100644 --- a/src/main/java/gregtech/common/pipelike/cable/Insulation.java +++ b/src/main/java/gregtech/common/pipelike/cable/Insulation.java @@ -60,13 +60,13 @@ public boolean isCable() { @Override public WireProperties modifyProperties(WireProperties baseProperties) { - int lossPerBlock; if (!baseProperties.isSuperconductor() && baseProperties.getLossPerBlock() == 0) lossPerBlock = (int) (0.75 * lossMultiplier); else lossPerBlock = baseProperties.getLossPerBlock() * lossMultiplier; - return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, baseProperties.isSuperconductor()); + return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, + baseProperties.isSuperconductor()); } @Override diff --git a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java index 5f6cc32fc60..f054c37746f 100644 --- a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java @@ -7,12 +7,14 @@ import gregtech.api.util.GTUtility; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,11 +28,13 @@ public ItemBlockCable(BlockCable block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); WireProperties wireProperties = blockPipe.createItemProperties(stack); int tier = GTUtility.getTierByVoltage(wireProperties.getVoltage()); - if (wireProperties.isSuperconductor()) tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier])); + if (wireProperties.isSuperconductor()) + tooltip.add(I18n.format("gregtech.cable.superconductor", GTValues.VN[tier])); tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.getVoltage(), GTValues.VNF[tier])); tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.getAmperage())); tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.getLossPerBlock())); @@ -45,7 +49,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N if (ConfigHolder.misc.debug) { BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java index 26cd507f124..8d6f7110cb1 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java @@ -4,11 +4,13 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.WireProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.*; public class EnergyNet extends PipeNet { @@ -66,7 +68,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((EnergyNet) parentNet).NET_DATA.clear(); diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java index dbb47628a7b..181f78b2a96 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetHandler.java @@ -4,6 +4,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; @@ -79,7 +80,9 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage boolean cableBroken = false; for (TileEntityCable cable : path.getPath()) { if (cable.getMaxVoltage() < voltage) { - int heat = (int) (Math.log(GTUtility.getTierByVoltage(voltage) - GTUtility.getTierByVoltage(cable.getMaxVoltage())) * 45 + 36.5); + int heat = (int) (Math.log( + GTUtility.getTierByVoltage(voltage) - GTUtility.getTierByVoltage(cable.getMaxVoltage())) * + 45 + 36.5); cable.applyHeat(heat); cableBroken = cable.isInvalid(); diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java index 3603d3fc85d..96aee6229b8 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java @@ -4,16 +4,19 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.pipenet.PipeNetWalker; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + public class EnergyNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe) { @@ -35,7 +38,8 @@ protected EnergyNetWalker(World world, BlockPos sourcePipe, int walkedBlocks, Li } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, + int walkedBlocks) { EnergyNetWalker walker = new EnergyNetWalker(world, nextPos, walkedBlocks, routes); walker.loss = loss; walker.pipes = pipes; @@ -49,11 +53,14 @@ protected void checkPipe(TileEntityCable pipeTile, BlockPos pos) { } @Override - protected void checkNeighbour(TileEntityCable pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { + protected void checkNeighbour(TileEntityCable pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { // assert that the last added pipe is the current pipe - if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException("The current pipe is not the last added pipe. Something went seriously wrong!"); + if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException( + "The current pipe is not the last added pipe. Something went seriously wrong!"); if (neighbourTile != null) { - IEnergyContainer container = neighbourTile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, faceToNeighbour.getOpposite()); + IEnergyContainer container = neighbourTile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + faceToNeighbour.getOpposite()); if (container != null) { routes.add(new EnergyRoutePath(faceToNeighbour, pipes, getWalkedBlocks(), loss)); } diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java index a3b42b46174..83e2c9856d0 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyRoutePath.java @@ -4,7 +4,9 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.pipenet.IRoutePath; import gregtech.common.pipelike.cable.tile.TileEntityCable; + import net.minecraft.util.EnumFacing; + import org.jetbrains.annotations.NotNull; public class EnergyRoutePath implements IRoutePath { diff --git a/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java b/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java index 4ecb922beb2..32f06681d65 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/WorldENet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.WireProperties; + import net.minecraft.world.World; public class WorldENet extends WorldPipeNet { @@ -27,5 +28,4 @@ public WorldENet(String name) { protected EnergyNet createNetInstance() { return new EnergyNet(this); } - } diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java b/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java index c62785d3be7..e2fe2e9102e 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/PerTickLongCounter.java @@ -24,11 +24,11 @@ private void checkValueState(World world) { long currentWorldTime = world.getTotalWorldTime(); if (currentWorldTime != lastUpdatedWorldTime) { if (currentWorldTime == lastUpdatedWorldTime + 1) { - //last updated time is 1 tick ago, so we can move current value to last - //before resetting it to default value + // last updated time is 1 tick ago, so we can move current value to last + // before resetting it to default value this.lastValue = currentValue; } else { - //otherwise, set last value as default value + // otherwise, set last value as default value this.lastValue = defaultValue; } this.lastUpdatedWorldTime = currentWorldTime; diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java index 913c7f429ef..5550648cd14 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.cable.tile; -import codechicken.lib.vec.Cuboid6; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; @@ -18,6 +17,7 @@ import gregtech.common.pipelike.cable.net.EnergyNet; import gregtech.common.pipelike.cable.net.EnergyNetHandler; import gregtech.common.pipelike.cable.net.WorldENet; + import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -30,17 +30,21 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import codechicken.lib.vec.Cuboid6; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.capability.GregtechDataCodes.CABLE_TEMPERATURE; import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONNECTIONS; -public class TileEntityCable extends TileEntityMaterialPipeBase implements IDataInfoProvider { +public class TileEntityCable extends TileEntityMaterialPipeBase + implements IDataInfoProvider { private static final int meltTemp = 3000; @@ -263,7 +267,6 @@ public T getCapabilityInternal(Capability capability, @Nullable EnumFacin return super.getCapabilityInternal(capability, facing); } - public void checkNetwork() { if (defaultHandler != null) { EnergyNet current = getEnergyNet(); @@ -282,7 +285,7 @@ private EnergyNet getEnergyNet() { EnergyNet currentEnergyNet = this.currentEnergyNet.get(); if (currentEnergyNet != null && currentEnergyNet.isValid() && currentEnergyNet.containsNode(getPos())) - return currentEnergyNet; //return current net if it is still valid + return currentEnergyNet; // return current net if it is still valid WorldENet worldENet = WorldENet.getWorldENet(getWorld()); currentEnergyNet = worldENet.getNetFromPos(getPos()); if (currentEnergyNet != null) { @@ -345,11 +348,11 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { public List getDataInfo() { List list = new ArrayList<>(); list.add(new TextComponentTranslation("behavior.tricorder.eut_per_sec", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageVoltage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageVoltage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); list.add(new TextComponentTranslation("behavior.tricorder.amp_per_sec", - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageAmperage())).setStyle(new Style().setColor(TextFormatting.RED)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getAverageAmperage())) + .setStyle(new Style().setColor(TextFormatting.RED)))); return list; } } diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java index 214fd373856..29b9592cdb3 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCableTickable.java @@ -4,8 +4,7 @@ public class TileEntityCableTickable extends TileEntityCable implements ITickable { - public TileEntityCableTickable() { - } + public TileEntityCableTickable() {} @Override public void update() { diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java index 49c777d6e10..71c10eed334 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.fluidpipe; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.pipenet.block.material.BlockMaterialPipe; @@ -15,6 +14,7 @@ import gregtech.common.pipelike.fluidpipe.net.WorldFluidPipeNet; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -32,14 +32,17 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.SortedMap; import java.util.TreeMap; +import javax.annotation.Nonnull; + public class BlockFluidPipe extends BlockMaterialPipe { private final SortedMap enabledMaterials = new TreeMap<>(); @@ -53,7 +56,8 @@ public BlockFluidPipe(FluidPipeType pipeType, MaterialRegistry registry) { public void addPipeMaterial(Material material, FluidPipeProperties fluidPipeProperties) { Preconditions.checkNotNull(material, "material"); Preconditions.checkNotNull(fluidPipeProperties, "material %s fluidPipeProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); this.enabledMaterials.put(material, fluidPipeProperties); } @@ -98,17 +102,20 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityFluidPipe && sideTile instanceof TileEntityFluidPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()) != null; } @Override @@ -121,10 +128,12 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entityIn) { + public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull Entity entityIn) { if (worldIn.isRemote) return; TileEntityFluidPipe pipe = (TileEntityFluidPipe) getPipeTileEntity(worldIn, pos); - if (pipe instanceof TileEntityFluidPipeTickable && pipe.getFrameMaterial() == null && ((TileEntityFluidPipeTickable) pipe).getOffsetTimer() % 10 == 0) { + if (pipe instanceof TileEntityFluidPipeTickable && pipe.getFrameMaterial() == null && + ((TileEntityFluidPipeTickable) pipe).getOffsetTimer() % 10 == 0) { if (entityIn instanceof EntityLivingBase) { if (((TileEntityFluidPipeTickable) pipe).getFluidTanks().length > 1) { // apply temperature damage for the hottest and coldest pipe (multi fluid pipes) @@ -132,8 +141,10 @@ public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @No int minTemperature = Integer.MAX_VALUE; for (FluidTank tank : ((TileEntityFluidPipeTickable) pipe).getFluidTanks()) { if (tank.getFluid() != null && tank.getFluid().amount > 0) { - maxTemperature = Math.max(maxTemperature, tank.getFluid().getFluid().getTemperature(tank.getFluid())); - minTemperature = Math.min(minTemperature, tank.getFluid().getFluid().getTemperature(tank.getFluid())); + maxTemperature = Math.max(maxTemperature, + tank.getFluid().getFluid().getTemperature(tank.getFluid())); + minTemperature = Math.min(minTemperature, + tank.getFluid().getFluid().getTemperature(tank.getFluid())); } } if (maxTemperature != Integer.MIN_VALUE) { @@ -146,7 +157,8 @@ public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @No FluidTank tank = ((TileEntityFluidPipeTickable) pipe).getFluidTanks()[0]; if (tank.getFluid() != null && tank.getFluid().amount > 0) { // Apply temperature damage for the pipe (single fluid pipes) - EntityDamageUtil.applyTemperatureDamage((EntityLivingBase) entityIn, tank.getFluid().getFluid().getTemperature(), 1.0F, 5); + EntityDamageUtil.applyTemperatureDamage((EntityLivingBase) entityIn, + tank.getFluid().getFluid().getTemperature(), 1.0F, 5); } } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java index c82164d7540..bbb3339a507 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java @@ -30,7 +30,8 @@ public enum FluidPipeType implements IMaterialPipeType { this(name, thickness, capacityMultiplier, orePrefix, opaque, 1); } - FluidPipeType(String name, float thickness, int capacityMultiplier, OrePrefix orePrefix, boolean opaque, int channels) { + FluidPipeType(String name, float thickness, int capacityMultiplier, OrePrefix orePrefix, boolean opaque, + int channels) { this.name = name; this.thickness = thickness; this.capacityMultiplier = capacityMultiplier; diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java index 7770ef5ae95..150879cd4b2 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/ItemBlockFluidPipe.java @@ -5,12 +5,14 @@ import gregtech.api.unification.material.properties.FluidPipeProperties; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,13 +26,15 @@ public ItemBlockFluidPipe(BlockFluidPipe block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); FluidPipeProperties pipeProperties = blockPipe.createItemProperties(stack); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_transfer_rate", pipeProperties.getThroughput())); tooltip.add(I18n.format("gregtech.fluid_pipe.capacity", pipeProperties.getThroughput() * 20)); tooltip.add(I18n.format("gregtech.fluid_pipe.max_temperature", pipeProperties.getMaxFluidTemperature())); - if (pipeProperties.getTanks() > 1) tooltip.add(I18n.format("gregtech.fluid_pipe.channels", pipeProperties.getTanks())); + if (pipeProperties.getTanks() > 1) + tooltip.add(I18n.format("gregtech.fluid_pipe.channels", pipeProperties.getTanks())); pipeProperties.appendTooltips(tooltip, false, false); @@ -43,7 +47,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; if (ConfigHolder.misc.debug) { - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java index aa6817e0493..ecca27a4c52 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java @@ -1,9 +1,5 @@ package gregtech.common.pipelike.fluidpipe.longdistance; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.FluidHandlerDelegate; import gregtech.api.gui.ModularUI; @@ -13,6 +9,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.storage.MetaTileEntityLongDistanceEndpoint; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -23,6 +20,11 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; @@ -31,6 +33,7 @@ public class MetaTileEntityLDFluidEndpoint extends MetaTileEntityLongDistanceEndpoint { private static final FluidTank DEFAULT_TANK = new FluidTank(10000) { + @Override public int fill(FluidStack resource, boolean doFill) { return 0; @@ -70,7 +73,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { - return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(new FluidHandlerWrapper((IFluidHandler) t)); + return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY + .cast(new FluidHandlerWrapper((IFluidHandler) t)); } } } @@ -81,7 +85,8 @@ public T getCapability(Capability capability, EnumFacing side) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[GTValues.LV].render(renderState, translation, colouredPipeline); Textures.LD_FLUID_PIPE.renderOrientedState(renderState, translation, pipeline, frontFacing, false, false); Textures.PIPE_IN_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java index 4fca0cce91d..e073fc74cce 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java @@ -3,6 +3,7 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.FluidPipeProperties; + import net.minecraft.nbt.NBTTagCompound; public class FluidPipeNet extends PipeNet { @@ -31,6 +32,7 @@ protected FluidPipeProperties readNodeData(NBTTagCompound tagCompound) { boolean cryoProof = tagCompound.getBoolean("cryo_proof"); boolean plasmaProof = tagCompound.getBoolean("plasma_proof"); int channels = tagCompound.getInteger("channels"); - return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, channels); + return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, + channels); } } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java index b70b438a3ac..5309c429bd0 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java @@ -2,6 +2,7 @@ import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe; import gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable; + import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -9,11 +10,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Iterator; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class PipeTankList implements IFluidHandler, Iterable { private final TileEntityFluidPipeTickable pipe; @@ -55,7 +57,8 @@ else if (f.isFluidEqual(stack)) @Override public int fill(FluidStack resource, boolean doFill) { int channel; - if (pipe.isFaceBlocked(facing) || resource == null || resource.amount <= 0 || (channel = findChannel(resource)) < 0) + if (pipe.isFaceBlocked(facing) || resource == null || resource.amount <= 0 || + (channel = findChannel(resource)) < 0) return 0; return fill(resource, doFill, channel); diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java index 016a04d9bb2..9e58ed1ec14 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/WorldFluidPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.FluidPipeProperties; + import net.minecraft.world.World; public class WorldFluidPipeNet extends WorldPipeNet { @@ -27,5 +28,4 @@ public WorldFluidPipeNet(String name) { protected FluidPipeNet createNetInstance() { return new FluidPipeNet(this); } - } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java index 0b76b7c3cd5..0a566171bda 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipe.java @@ -6,6 +6,7 @@ import gregtech.common.pipelike.fluidpipe.FluidPipeType; import gregtech.common.pipelike.fluidpipe.net.FluidPipeNet; import gregtech.common.pipelike.fluidpipe.net.WorldFluidPipeNet; + import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -41,7 +42,7 @@ public FluidPipeNet getFluidPipeNet() { FluidPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldFluidPipeNet worldFluidPipeNet = (WorldFluidPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldFluidPipeNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -62,7 +63,8 @@ public static void setNeighboursToFire(World world, BlockPos selfPos) { } } - public static void spawnParticles(World worldIn, BlockPos pos, EnumFacing direction, EnumParticleTypes particleType, int particleCount) { + public static void spawnParticles(World worldIn, BlockPos pos, EnumFacing direction, EnumParticleTypes particleType, + int particleCount) { if (worldIn instanceof WorldServer) { ((WorldServer) worldIn).spawnParticle(particleType, pos.getX() + 0.5, diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java index 9b9102c7661..038fef391f8 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/tile/TileEntityFluidPipeTickable.java @@ -15,6 +15,7 @@ import gregtech.common.covers.CoverPump; import gregtech.common.covers.ManualImportExportMode; import gregtech.common.pipelike.fluidpipe.net.PipeTankList; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; @@ -36,6 +37,7 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -124,7 +126,8 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { TileEntity neighbor = getNeighbor(facing); if (neighbor == null) continue; - IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite()); + IFluidHandler fluidHandler = neighbor.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + facing.getOpposite()); if (fluidHandler == null) continue; IFluidHandler pipeTank = tank; @@ -136,7 +139,8 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Shutter covers return null capability when active, so check here to prevent NPE if (pipeTank == null || checkForPumpCover(cover)) continue; } else { - CoverableView coverable = neighbor.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); + CoverableView coverable = neighbor.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing.getOpposite()); if (coverable != null) { cover = coverable.getCoverAtSide(facing.getOpposite()); if (checkForPumpCover(cover)) continue; @@ -166,10 +170,17 @@ private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Now distribute for (FluidTransaction transaction : tanks) { if (availableCapacity > maxAmount) { - transaction.amount = (int) Math.floor(transaction.amount * maxAmount / availableCapacity); // Distribute fluids based on percentage available space at destination + transaction.amount = (int) Math.floor(transaction.amount * maxAmount / availableCapacity); // Distribute + // fluids + // based on + // percentage + // available + // space at + // destination } if (transaction.amount == 0) { - if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent dupes + if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent + // dupes transaction.amount = 1; // If the percent is not enough to give at least 1L, try to give 1L } else if (transaction.amount < 0) { continue; @@ -231,23 +242,27 @@ public void checkAndDestroy(@NotNull FluidStack stack) { } } - public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, boolean isCorroding, boolean isShattering, boolean isMelting) { + public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, boolean isCorroding, + boolean isShattering, boolean isMelting) { // prevent the sound from spamming when filled from anything not a pipe if (getOffsetTimer() % 10 == 0) { world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, 1.0F); } if (isLeaking) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.SMOKE_NORMAL, 7 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.SMOKE_NORMAL, + 7 + GTValues.RNG.nextInt(2)); // voids 10% stack.amount = Math.max(0, stack.amount * 9 / 10); // apply heat damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -258,14 +273,16 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isCorroding) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CRIT_MAGIC, 3 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CRIT_MAGIC, + 3 + GTValues.RNG.nextInt(2)); // voids 25% stack.amount = Math.max(0, stack.amount * 3 / 4); // apply chemical damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(1)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(1)); for (EntityLivingBase entityLivingBase : entities) { EntityDamageUtil.applyChemicalDamage(entityLivingBase, 2); } @@ -279,7 +296,8 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isBurning || isMelting) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.FLAME, (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.FLAME, + (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); // voids 75% stack.amount = Math.max(0, stack.amount / 4); @@ -291,9 +309,11 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply heat damage in area surrounding the pipe if (isMelting && getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -305,16 +325,19 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, } if (isShattering) { - TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CLOUD, 3 + GTValues.RNG.nextInt(2)); + TileEntityFluidPipe.spawnParticles(world, pos, EnumFacing.UP, EnumParticleTypes.CLOUD, + 3 + GTValues.RNG.nextInt(2)); // voids 75% stack.amount = Math.max(0, stack.amount / 4); // apply frost damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { - List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPipePos()).grow(2)); + List entities = getPipeWorld().getEntitiesWithinAABB(EntityLivingBase.class, + new AxisAlignedBB(getPipePos()).grow(2)); for (EntityLivingBase entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getTemperature(stack), + 2.0F, 10); } } @@ -431,10 +454,12 @@ public List getDataInfo() { allTanksEmpty = false; list.add(new TextComponentTranslation("behavior.tricorder.tank", i, - new TextComponentTranslation(TextFormattingUtil.formatNumbers(fluids[i].amount)).setStyle(new Style().setColor(TextFormatting.GREEN)), - new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getCapacityPerTank())).setStyle(new Style().setColor(TextFormatting.YELLOW)), - new TextComponentTranslation(fluids[i].getFluid().getLocalizedName(fluids[i])).setStyle(new Style().setColor(TextFormatting.GOLD)) - )); + new TextComponentTranslation(TextFormattingUtil.formatNumbers(fluids[i].amount)) + .setStyle(new Style().setColor(TextFormatting.GREEN)), + new TextComponentTranslation(TextFormattingUtil.formatNumbers(this.getCapacityPerTank())) + .setStyle(new Style().setColor(TextFormatting.YELLOW)), + new TextComponentTranslation(fluids[i].getFluid().getLocalizedName(fluids[i])) + .setStyle(new Style().setColor(TextFormatting.GOLD)))); } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java index d6a8bddf5d2..975aeac1701 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java @@ -1,6 +1,5 @@ package gregtech.common.pipelike.itempipe; -import com.google.common.base.Preconditions; import gregtech.api.GregTechAPI; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.pipenet.block.material.BlockMaterialPipe; @@ -14,6 +13,7 @@ import gregtech.common.pipelike.itempipe.net.WorldItemPipeNet; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipeTickable; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -28,14 +28,17 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; + +import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; + public class BlockItemPipe extends BlockMaterialPipe { private final Map enabledMaterials = new HashMap<>(); @@ -49,7 +52,8 @@ public BlockItemPipe(ItemPipeType itemPipeType, MaterialRegistry registry) { public void addPipeMaterial(Material material, ItemPipeProperties properties) { Preconditions.checkNotNull(material, "material"); Preconditions.checkNotNull(properties, "material %s itemPipeProperties was null", material); - Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, "material %s is not registered", material); + Preconditions.checkArgument(material.getRegistry().getNameForObject(material) != null, + "material %s is not registered", material); this.enabledMaterials.put(material, properties); } @@ -102,13 +106,16 @@ public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityItemPipe && sideTile instanceof TileEntityItemPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, TileEntity tile) { - return tile != null && tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + TileEntity tile) { + return tile != null && + tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()) != null; } @Override @@ -127,6 +134,4 @@ public boolean isHoldingPipe(EntityPlayer player) { public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { return ItemPipeRenderer.INSTANCE.getBlockRenderType(); } - - } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java index 5a984d30415..ae90e8dcab1 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/ItemBlockItemPipe.java @@ -5,12 +5,14 @@ import gregtech.api.unification.material.properties.ItemPipeProperties; import gregtech.client.utils.TooltipHelper; import gregtech.common.ConfigHolder; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,13 +26,16 @@ public ItemBlockItemPipe(BlockItemPipe block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); ItemPipeProperties pipeProperties = blockPipe.createItemProperties(stack); if (pipeProperties.getTransferRate() % 1 != 0) { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate", (int) ((pipeProperties.getTransferRate() * 64) + 0.5))); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate", + (int) ((pipeProperties.getTransferRate() * 64) + 0.5))); } else { - tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate_stacks", (int) pipeProperties.getTransferRate())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_transfer_rate_stacks", + (int) pipeProperties.getTransferRate())); } tooltip.add(I18n.format("gregtech.item_pipe.priority", pipeProperties.getPriority())); @@ -44,7 +49,8 @@ public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @N if (ConfigHolder.misc.debug) { BlockMaterialPipe blockMaterialPipe = (BlockMaterialPipe) blockPipe; - tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); + tooltip.add("MetaItem Id: " + blockMaterialPipe.getPrefix().name + + blockMaterialPipe.getItemMaterial(stack).toCamelCaseString()); } } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java index a433e9621f8..d13e338c4e8 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java @@ -7,7 +7,8 @@ import javax.annotation.Nonnull; public enum ItemPipeType implements IMaterialPipeType { - //TINY_OPAQUE("tiny", 0.25f, OrePrefix.pipeTinyItem, 0.25f, 2f), + + // TINY_OPAQUE("tiny", 0.25f, OrePrefix.pipeTinyItem, 0.25f, 2f), SMALL("small", 0.375f, OrePrefix.pipeSmallItem, 0.5f, 1.5f), NORMAL("normal", 0.5f, OrePrefix.pipeNormalItem, 1f, 1f), LARGE("large", 0.75f, OrePrefix.pipeLargeItem, 2f, 0.75f), @@ -52,7 +53,8 @@ public float getThickness() { @Override public ItemPipeProperties modifyProperties(ItemPipeProperties baseProperties) { - return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), baseProperties.getTransferRate() * rateMultiplier); + return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), + baseProperties.getTransferRate() * rateMultiplier); } public float getRateMultiplier() { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java index 94e15ccd456..706c5ef4f07 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java @@ -1,9 +1,5 @@ package gregtech.common.pipelike.itempipe.longdistance; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.ItemHandlerDelegate; import gregtech.api.gui.ModularUI; @@ -13,6 +9,7 @@ import gregtech.api.util.GTUtility; import gregtech.client.renderer.texture.Textures; import gregtech.common.metatileentities.storage.MetaTileEntityLongDistanceEndpoint; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,6 +20,11 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; @@ -31,6 +33,7 @@ public class MetaTileEntityLDItemEndpoint extends MetaTileEntityLongDistanceEndpoint { private static final ItemStackHandler DEFAULT_INVENTORY = new ItemStackHandler(1) { + @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { @@ -71,7 +74,8 @@ public T getCapability(Capability capability, EnumFacing side) { if (te != null) { T t = te.getCapability(capability, outputFacing.getOpposite()); if (t != null) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(new ItemHandlerWrapper((IItemHandler) t)); + return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY + .cast(new ItemHandlerWrapper((IItemHandler) t)); } } } @@ -82,13 +86,15 @@ public T getCapability(Capability capability, EnumFacing side) { @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { - IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); + IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, + new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))); Textures.VOLTAGE_CASINGS[GTValues.LV].render(renderState, translation, colouredPipeline); Textures.LD_ITEM_PIPE.renderOrientedState(renderState, translation, pipeline, frontFacing, false, false); Textures.PIPE_IN_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); Textures.ITEM_HATCH_INPUT_OVERLAY.renderSided(getFrontFacing(), renderState, translation, pipeline); Textures.PIPE_OUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); - Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, pipeline); + Textures.ITEM_HATCH_OUTPUT_OVERLAY.renderSided(getFrontFacing().getOpposite(), renderState, translation, + pipeline); } @Override diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java index 448a5402158..8590e1b2254 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java @@ -8,24 +8,26 @@ import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.covers.*; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class ItemNetHandler implements IItemHandler { private ItemPipeNet net; @@ -87,7 +89,8 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate return insertFirst(stack, simulate); CoverConveyor conveyor = (CoverConveyor) (pipeConveyor ? pipeCover : tileCover); - if (conveyor.getConveyorMode() == (pipeConveyor ? CoverConveyor.ConveyorMode.IMPORT : CoverConveyor.ConveyorMode.EXPORT)) { + if (conveyor.getConveyorMode() == + (pipeConveyor ? CoverConveyor.ConveyorMode.IMPORT : CoverConveyor.ConveyorMode.EXPORT)) { boolean roundRobinGlobal = conveyor.getDistributionMode() == DistributionMode.ROUND_ROBIN_GLOBAL; if (roundRobinGlobal || conveyor.getDistributionMode() == DistributionMode.ROUND_ROBIN_PRIO) return insertRoundRobin(stack, simulate, roundRobinGlobal); @@ -223,7 +226,8 @@ private ItemStack insertToHandlersEnhanced(List copy, ItemStack s // equally distribute items over all inventories // it takes into account how much was inserted in total - // f.e. if inv1 has 2 inserted and inv2 has 6 inserted, it will first try to insert 4 into inv1 so that both have 6 and then it will distribute the rest equally + // f.e. if inv1 has 2 inserted and inv2 has 6 inserted, it will first try to insert 4 into inv1 so that both + // have 6 and then it will distribute the rest equally outer: while (amount > 0 && !transferredCopy.isEmpty()) { Iterator iterator = transferredCopy.iterator(); @@ -236,7 +240,7 @@ private ItemStack insertToHandlersEnhanced(List copy, ItemStack s int toInsert; if (nextStep <= 0) { if (amount <= m) { - //break outer; + // break outer; toInsert = 1; } else { toInsert = Math.min(c, amount); @@ -295,34 +299,43 @@ public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simula } public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simulate, boolean ignoreLimit) { - int allowed = ignoreLimit ? stack.getCount() : checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); + int allowed = ignoreLimit ? stack.getCount() : + checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); if (allowed == 0 || !routePath.matchesFilters(stack)) { return stack; } - Cover pipeCover = routePath.getTargetPipe().getCoverableImplementation().getCoverAtSide(routePath.getTargetFacing()); + Cover pipeCover = routePath.getTargetPipe().getCoverableImplementation() + .getCoverAtSide(routePath.getTargetFacing()); Cover tileCover = getCoverOnNeighbour(routePath.getTargetPipe(), routePath.getTargetFacing()); if (pipeCover != null) { testHandler.setStackInSlot(0, stack.copy()); - IItemHandler itemHandler = pipeCover.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, testHandler); - if (itemHandler == null || (itemHandler != testHandler && (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { + IItemHandler itemHandler = pipeCover.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + testHandler); + if (itemHandler == null || (itemHandler != testHandler && + (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { testHandler.setStackInSlot(0, ItemStack.EMPTY); return stack; } testHandler.setStackInSlot(0, ItemStack.EMPTY); } IItemHandler neighbourHandler = routePath.getHandler(); - if (pipeCover instanceof CoverRoboticArm && ((CoverRoboticArm) pipeCover).getConveyorMode() == CoverConveyor.ConveyorMode.EXPORT) { - return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) pipeCover, stack, simulate, allowed, ignoreLimit); + if (pipeCover instanceof CoverRoboticArm && + ((CoverRoboticArm) pipeCover).getConveyorMode() == CoverConveyor.ConveyorMode.EXPORT) { + return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) pipeCover, stack, simulate, allowed, + ignoreLimit); } - if (tileCover instanceof CoverRoboticArm && ((CoverRoboticArm) tileCover).getConveyorMode() == CoverConveyor.ConveyorMode.IMPORT) { - return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) tileCover, stack, simulate, allowed, ignoreLimit); + if (tileCover instanceof CoverRoboticArm && + ((CoverRoboticArm) tileCover).getConveyorMode() == CoverConveyor.ConveyorMode.IMPORT) { + return insertOverRobotArm(neighbourHandler, (CoverRoboticArm) tileCover, stack, simulate, allowed, + ignoreLimit); } return insert(neighbourHandler, stack, simulate, allowed, ignoreLimit); } - private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate, int allowed, boolean ignoreLimit) { + private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate, int allowed, + boolean ignoreLimit) { if (stack.getCount() == allowed) { ItemStack re = GTTransferUtils.insertItem(handler, stack, simulate); if (!ignoreLimit) @@ -342,14 +355,16 @@ private ItemStack insert(IItemHandler handler, ItemStack stack, boolean simulate public Cover getCoverOnNeighbour(TileEntityItemPipe itemPipe, EnumFacing facing) { TileEntity tile = itemPipe.getNeighbor(facing); if (tile != null) { - CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, facing.getOpposite()); + CoverHolder coverHolder = tile.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing.getOpposite()); if (coverHolder == null) return null; return coverHolder.getCoverAtSide(facing.getOpposite()); } return null; } - public ItemStack insertOverRobotArm(IItemHandler handler, CoverRoboticArm arm, ItemStack stack, boolean simulate, int allowed, boolean ignoreLimit) { + public ItemStack insertOverRobotArm(IItemHandler handler, CoverRoboticArm arm, ItemStack stack, boolean simulate, + int allowed, boolean ignoreLimit) { int rate; boolean isStackSpecific = false; Object index = arm.getItemFilterContainer().matchItemStack(stack); @@ -440,11 +455,11 @@ private void transferTo(ItemRoutePath routePath, boolean simulate, int amount) { simulatedTransfersGlobalRoundRobin.merge(routePath.toFacingPos(), amount, Integer::sum); else pipe.getTransferred().merge(routePath.toFacingPos(), amount, Integer::sum); - } private boolean contains(ItemRoutePath routePath, boolean simulate) { - return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(routePath.toFacingPos()) : pipe.getTransferred().containsKey(routePath.toFacingPos()); + return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(routePath.toFacingPos()) : + pipe.getTransferred().containsKey(routePath.toFacingPos()); } private int didTransferTo(ItemRoutePath routePath, boolean simulate) { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java index 00ea1d8faff..56b5af5ba7d 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java @@ -8,6 +8,7 @@ import gregtech.common.covers.CoverShutter; import gregtech.common.covers.ItemFilterMode; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -16,12 +17,13 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nullable; + public class ItemNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { @@ -42,14 +44,16 @@ public static List createNetData(World world, BlockPos sourcePipe private BlockPos sourcePipe; private EnumFacing facingToHandler; - protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, ItemPipeProperties properties) { + protected ItemNetWalker(World world, BlockPos sourcePipe, int distance, List inventories, + ItemPipeProperties properties) { super(world, sourcePipe, distance); this.inventories = inventories; this.minProperties = properties; } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { ItemNetWalker walker = new ItemNetWalker(world, nextPos, walkedBlocks, inventories, minProperties); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -73,16 +77,20 @@ protected void checkPipe(TileEntityItemPipe pipeTile, BlockPos pos) { if (minProperties == null) { minProperties = pipeProperties; } else { - minProperties = new ItemPipeProperties(minProperties.getPriority() + pipeProperties.getPriority(), Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); + minProperties = new ItemPipeProperties(minProperties.getPriority() + pipeProperties.getPriority(), + Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); } } @Override - protected void checkNeighbour(TileEntityItemPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityItemPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } - IItemHandler handler = neighbourTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, faceToNeighbour.getOpposite()); + IItemHandler handler = neighbourTile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, + faceToNeighbour.getOpposite()); if (handler != null) { List> filters = new ArrayList<>(this.filters); List> moreFilters = nextFilters.get(faceToNeighbour); @@ -99,20 +107,23 @@ protected Class getBasePipeClass() { } @Override - protected boolean isValidPipe(TileEntityItemPipe currentPipe, TileEntityItemPipe neighbourPipe, BlockPos pipePos, EnumFacing faceToNeighbour) { + protected boolean isValidPipe(TileEntityItemPipe currentPipe, TileEntityItemPipe neighbourPipe, BlockPos pipePos, + EnumFacing faceToNeighbour) { Cover thisCover = currentPipe.getCoverableImplementation().getCoverAtSide(faceToNeighbour); Cover neighbourCover = neighbourPipe.getCoverableImplementation().getCoverAtSide(faceToNeighbour.getOpposite()); List> filters = new ArrayList<>(); if (thisCover instanceof CoverShutter) { - filters.add(stack -> !((CoverShutter) thisCover).isWorkingEnabled()); - } else if (thisCover instanceof CoverItemFilter && ((CoverItemFilter) thisCover).getFilterMode() != ItemFilterMode.FILTER_INSERT) { - filters.add(((CoverItemFilter) thisCover)::testItemStack); - } + filters.add(stack -> !((CoverShutter) thisCover).isWorkingEnabled()); + } else if (thisCover instanceof CoverItemFilter && + ((CoverItemFilter) thisCover).getFilterMode() != ItemFilterMode.FILTER_INSERT) { + filters.add(((CoverItemFilter) thisCover)::testItemStack); + } if (neighbourCover instanceof CoverShutter) { filters.add(stack -> !((CoverShutter) neighbourCover).isWorkingEnabled()); - } else if (neighbourCover instanceof CoverItemFilter && ((CoverItemFilter) neighbourCover).getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { - filters.add(((CoverItemFilter) neighbourCover)::testItemStack); - } + } else if (neighbourCover instanceof CoverItemFilter && + ((CoverItemFilter) neighbourCover).getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { + filters.add(((CoverItemFilter) neighbourCover)::testItemStack); + } if (!filters.isEmpty()) { nextFilters.put(faceToNeighbour, filters); } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java index 2aa9a845661..25e6534b0f4 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemPipeNet.java @@ -4,6 +4,7 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.ItemPipeProperties; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -43,7 +44,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((ItemPipeNet) parentNet).NET_DATA.clear(); diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java index 057cd665609..ccafca7be9a 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java @@ -4,15 +4,17 @@ import gregtech.api.unification.material.properties.ItemPipeProperties; import gregtech.api.util.FacingPos; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; import java.util.List; import java.util.function.Predicate; +import javax.annotation.Nonnull; + public class ItemRoutePath implements IRoutePath { private final TileEntityItemPipe targetPipe; @@ -21,7 +23,8 @@ public class ItemRoutePath implements IRoutePath { private final ItemPipeProperties properties; private final Predicate filters; - public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int distance, ItemPipeProperties properties, List> filters) { + public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int distance, ItemPipeProperties properties, + List> filters) { this.targetPipe = targetPipe; this.faceToHandler = facing; this.distance = distance; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java b/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java index 02da7ef905a..62cac8b52af 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/WorldItemPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.unification.material.properties.ItemPipeProperties; + import net.minecraft.world.World; public class WorldItemPipeNet extends WorldPipeNet { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java index 227470a6f3c..d6c5362f2ed 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java @@ -8,18 +8,21 @@ import gregtech.common.pipelike.itempipe.net.ItemNetHandler; import gregtech.common.pipelike.itempipe.net.ItemPipeNet; import gregtech.common.pipelike.itempipe.net.WorldItemPipeNet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.lang.ref.WeakReference; import java.util.EnumMap; +import javax.annotation.Nullable; + public class TileEntityItemPipe extends TileEntityMaterialPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); @@ -91,7 +94,7 @@ public ItemPipeNet getItemPipeNet() { ItemPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldItemPipeNet worldFluidPipeNet = (WorldItemPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldFluidPipeNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -130,7 +133,7 @@ public void transferDataFrom(IPipeTile tileEnt // if 20 ticks passed since the last access it will reset it // this method is equal to // if (++time % 20 == 0) { - // this.transferredItems = 0; + // this.transferredItems = 0; // } // if it was in a ticking TileEntity private void updateTransferredState() { diff --git a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java index 4caca6cedca..5c6b3075e41 100644 --- a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java @@ -11,6 +11,7 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.common.pipelike.laser.net.WorldLaserPipeNet; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -25,6 +26,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -96,7 +98,8 @@ public LaserPipeType getItemPipeType(ItemStack itemStack) { } @Override - public void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack) { + public void setTileEntityData(TileEntityPipeBase pipeTile, + ItemStack itemStack) { pipeTile.setPipeData(this, pipeType); } @@ -111,13 +114,16 @@ protected boolean isPipeTool(@Nonnull ItemStack stack) { } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityLaserPipe && sideTile instanceof TileEntityLaserPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile) { - return tile != null && tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, side.getOpposite()) != null; + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile) { + return tile != null && + tile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, side.getOpposite()) != null; } @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java index 74e8028be48..18e9b0157d9 100644 --- a/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/ItemBlockLaserPipe.java @@ -3,10 +3,12 @@ import gregtech.api.pipenet.block.BlockPipe; import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -19,7 +21,8 @@ public ItemBlockLaserPipe(BlockPipe block } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.laser_pipe_normal.tooltip1")); diff --git a/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java b/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java index 5b1fca8d23e..b524b392bb1 100644 --- a/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java +++ b/src/main/java/gregtech/common/pipelike/laser/LaserPipeType.java @@ -3,6 +3,7 @@ import gregtech.api.pipenet.block.IPipeType; public enum LaserPipeType implements IPipeType { + NORMAL; @Override diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java index 513598063b1..71d1829287d 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java @@ -2,6 +2,7 @@ import gregtech.api.capability.ILaserContainer; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java index e085988ab57..1637f17a3e6 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetWalker.java @@ -5,10 +5,12 @@ import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import org.jetbrains.annotations.Nullable; public class LaserNetWalker extends PipeNetWalker { @@ -25,9 +27,9 @@ public static LaserRoutePath createNetData(World world, BlockPos sourcePipe, Enu return walker.isFailed() ? FAILED_MARKER : walker.routePath; } - private static final EnumFacing[] X_AXIS_FACINGS = {EnumFacing.WEST, EnumFacing.EAST}; - private static final EnumFacing[] Y_AXIS_FACINGS = {EnumFacing.UP, EnumFacing.DOWN}; - private static final EnumFacing[] Z_AXIS_FACINGS = {EnumFacing.NORTH, EnumFacing.SOUTH}; + private static final EnumFacing[] X_AXIS_FACINGS = { EnumFacing.WEST, EnumFacing.EAST }; + private static final EnumFacing[] Y_AXIS_FACINGS = { EnumFacing.UP, EnumFacing.DOWN }; + private static final EnumFacing[] Z_AXIS_FACINGS = { EnumFacing.NORTH, EnumFacing.SOUTH }; private LaserRoutePath routePath; private BlockPos sourcePipe; @@ -39,7 +41,8 @@ protected LaserNetWalker(World world, BlockPos sourcePipe, int distance) { } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { LaserNetWalker walker = new LaserNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -57,17 +60,19 @@ protected EnumFacing[] getSurroundingPipeSides() { } @Override - protected void checkPipe(TileEntityLaserPipe pipeTile, BlockPos pos) { - } + protected void checkPipe(TileEntityLaserPipe pipeTile, BlockPos pos) {} @Override - protected void checkNeighbour(TileEntityLaserPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityLaserPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } if (((LaserNetWalker) root).routePath == null) { - ILaserContainer handler = neighbourTile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, faceToNeighbour.getOpposite()); + ILaserContainer handler = neighbourTile.getCapability(GregtechTileCapabilities.CAPABILITY_LASER, + faceToNeighbour.getOpposite()); if (handler != null) { ((LaserNetWalker) root).routePath = new LaserRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); stop(); diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java index 7bd9478c42c..cff94155e38 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java @@ -4,14 +4,17 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.laser.LaserPipeProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nullable; + public class LaserPipeNet extends PipeNet { private final Map netData = new Object2ObjectOpenHashMap<>(); @@ -45,15 +48,15 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); netData.clear(); ((LaserPipeNet) parentNet).netData.clear(); } @Override - protected void writeNodeData(LaserPipeProperties nodeData, NBTTagCompound tagCompound) { - } + protected void writeNodeData(LaserPipeProperties nodeData, NBTTagCompound tagCompound) {} @Override protected LaserPipeProperties readNodeData(NBTTagCompound tagCompound) { diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java index 48d23dbe268..8e72484bf40 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java @@ -3,8 +3,8 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.ILaserContainer; import gregtech.api.pipenet.IRoutePath; -import gregtech.common.pipelike.laser.LaserPipeProperties; import gregtech.common.pipelike.laser.tile.TileEntityLaserPipe; + import net.minecraft.util.EnumFacing; import javax.annotation.Nonnull; @@ -33,7 +33,6 @@ public EnumFacing getFaceToHandler() { return faceToHandler; } - @Nonnull @Override public TileEntityLaserPipe getTargetPipe() { diff --git a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java index e0a614864c7..23c165a1df7 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java @@ -2,12 +2,15 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.laser.LaserPipeProperties; + import net.minecraft.world.World; import javax.annotation.Nonnull; public class WorldLaserPipeNet extends WorldPipeNet { + private static final String DATA_ID = "gregtech.laser_pipe_net"; + public WorldLaserPipeNet(String name) { super(name); } diff --git a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java index c9801ac42f2..ff7e7a8727b 100644 --- a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java @@ -11,12 +11,14 @@ import gregtech.common.pipelike.laser.net.LaserNetHandler; import gregtech.common.pipelike.laser.net.LaserPipeNet; import gregtech.common.pipelike.laser.net.WorldLaserPipeNet; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -134,7 +136,8 @@ public void setConnection(EnumFacing side, boolean connected, boolean fromNeighb // check the same for the targeted pipe TileEntity tile = getWorld().getTileEntity(getPos().offset(side)); - if (tile instanceof IPipeTile pipeTile && pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { + if (tile instanceof IPipeTilepipeTile && + pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { connections = pipeTile.getConnections(); connections &= ~(1 << side.getIndex()); connections &= ~(1 << side.getOpposite().getIndex()); diff --git a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java index a562aba2875..6b82c9e28bb 100644 --- a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java @@ -10,6 +10,7 @@ import gregtech.client.renderer.pipe.OpticalPipeRenderer; import gregtech.common.pipelike.optical.net.WorldOpticalPipeNet; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -23,6 +24,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -94,7 +96,8 @@ public OpticalPipeType getItemPipeType(@Nonnull ItemStack itemStack) { } @Override - public void setTileEntityData(@Nonnull TileEntityPipeBase pipeTile, ItemStack itemStack) { + public void setTileEntityData(@Nonnull TileEntityPipeBase pipeTile, + ItemStack itemStack) { pipeTile.setPipeData(this, pipeType); } @@ -109,12 +112,14 @@ protected boolean isPipeTool(@Nonnull ItemStack stack) { } @Override - public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, IPipeTile sideTile) { + public boolean canPipesConnect(IPipeTile selfTile, EnumFacing side, + IPipeTile sideTile) { return selfTile instanceof TileEntityOpticalPipe && sideTile instanceof TileEntityOpticalPipe; } @Override - public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, @Nullable TileEntity tile) { + public boolean canPipeConnectToBlock(IPipeTile selfTile, EnumFacing side, + @Nullable TileEntity tile) { if (tile == null) return false; if (tile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, side.getOpposite())) return true; return tile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, side.getOpposite()); diff --git a/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java index dd5fda2a5bc..9269423dedd 100644 --- a/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/ItemBlockOpticalPipe.java @@ -2,10 +2,12 @@ import gregtech.api.pipenet.block.ItemBlockPipe; import gregtech.client.utils.TooltipHelper; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,7 +20,8 @@ public ItemBlockOpticalPipe(BlockOpticalPipe block) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.optical_pipe_normal.tooltip1")); diff --git a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java index 9ae57678db2..beeb47d7bc6 100644 --- a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java +++ b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; public enum OpticalPipeType implements IPipeType { + NORMAL; @Override diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java index 3e5ede5700c..539af26786e 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java @@ -5,13 +5,15 @@ import gregtech.api.capability.IOpticalDataAccessHatch; import gregtech.api.recipes.Recipe; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.Collection; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Collection; public class OpticalNetHandler implements IDataAccessHatch, IOpticalComputationProvider { diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java index cd32b810f89..6f696565b37 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java @@ -4,6 +4,7 @@ import gregtech.api.pipenet.PipeNetWalker; import gregtech.api.util.GTUtility; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; + import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -33,7 +34,8 @@ protected OpticalNetWalker(World world, BlockPos sourcePipe, int distance) { } @Override - protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(World world, EnumFacing facingToNextPos, + BlockPos nextPos, int walkedBlocks) { OpticalNetWalker walker = new OpticalNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -41,19 +43,23 @@ protected PipeNetWalker createSubWalker(World world, Enum } @Override - protected void checkPipe(TileEntityOpticalPipe pipeTile, BlockPos pos) { - } + protected void checkPipe(TileEntityOpticalPipe pipeTile, BlockPos pos) {} @Override - protected void checkNeighbour(TileEntityOpticalPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, @Nullable TileEntity neighbourTile) { - if (neighbourTile == null || (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { + protected void checkNeighbour(TileEntityOpticalPipe pipeTile, BlockPos pipePos, EnumFacing faceToNeighbour, + @Nullable TileEntity neighbourTile) { + if (neighbourTile == null || + (GTUtility.arePosEqual(pipePos, sourcePipe) && faceToNeighbour == facingToHandler)) { return; } if (((OpticalNetWalker) root).routePath == null) { - if (neighbourTile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, faceToNeighbour.getOpposite()) || - neighbourTile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, faceToNeighbour.getOpposite())) { - ((OpticalNetWalker) root).routePath = new OpticalRoutePath(pipeTile, faceToNeighbour, getWalkedBlocks()); + if (neighbourTile.hasCapability(GregtechTileCapabilities.CAPABILITY_DATA_ACCESS, + faceToNeighbour.getOpposite()) || + neighbourTile.hasCapability(GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER, + faceToNeighbour.getOpposite())) { + ((OpticalNetWalker) root).routePath = new OpticalRoutePath(pipeTile, faceToNeighbour, + getWalkedBlocks()); stop(); } } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java index 4708a4dbd90..09cfc97eb2c 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java @@ -4,14 +4,17 @@ import gregtech.api.pipenet.PipeNet; import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.optical.OpticalPipeProperties; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; +import javax.annotation.Nullable; + public class OpticalPipeNet extends PipeNet { private final Map NET_DATA = new Object2ObjectOpenHashMap<>(); @@ -46,20 +49,18 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((OpticalPipeNet) parentNet).NET_DATA.clear(); } @Override - protected void writeNodeData(OpticalPipeProperties nodeData, NBTTagCompound tagCompound) { - - } + protected void writeNodeData(OpticalPipeProperties nodeData, NBTTagCompound tagCompound) {} @Override protected OpticalPipeProperties readNodeData(NBTTagCompound tagCompound) { return OpticalPipeProperties.INSTANCE; } - } diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java index 9489a4d5ca9..cc5b85ab500 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java @@ -5,13 +5,9 @@ import gregtech.api.capability.IOpticalComputationProvider; import gregtech.api.capability.IOpticalDataAccessHatch; import gregtech.api.pipenet.IRoutePath; -import gregtech.api.util.FacingPos; -import gregtech.common.pipelike.optical.OpticalPipeProperties; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; -import net.minecraft.tileentity.TileEntity; + import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java index 00bc97e9032..c4761328cbc 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java @@ -2,6 +2,7 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.common.pipelike.optical.OpticalPipeProperties; + import net.minecraft.world.World; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java index b926ac514f6..82c80a09dcf 100644 --- a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java @@ -13,17 +13,19 @@ import gregtech.common.pipelike.optical.net.OpticalNetHandler; import gregtech.common.pipelike.optical.net.OpticalPipeNet; import gregtech.common.pipelike.optical.net.WorldOpticalPipeNet; + import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.EnumMap; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class TileEntityOpticalPipe extends TileEntityPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); @@ -82,7 +84,8 @@ public T getCapabilityInternal(Capability capability, @Nullable EnumFacin if (handlers.isEmpty()) initHandlers(); checkNetwork(); - return GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER.cast(handlers.getOrDefault(facing, defaultHandler)); + return GregtechTileCapabilities.CABABILITY_COMPUTATION_PROVIDER + .cast(handlers.getOrDefault(facing, defaultHandler)); } return super.getCapabilityInternal(capability, facing); } @@ -104,7 +107,7 @@ public OpticalPipeNet getOpticalPipeNet() { return null; OpticalPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) - return currentPipeNet; //if current net is valid and does contain position, return it + return currentPipeNet; // if current net is valid and does contain position, return it WorldOpticalPipeNet worldNet = (WorldOpticalPipeNet) getPipeBlock().getWorldPipeNet(getPipeWorld()); currentPipeNet = worldNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { @@ -139,7 +142,8 @@ public void setConnection(EnumFacing side, boolean connected, boolean fromNeighb // also check the other pipe TileEntity tile = getWorld().getTileEntity(getPos().offset(side)); - if (tile instanceof IPipeTile pipeTile && pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { + if (tile instanceof IPipeTilepipeTile && + pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { if (pipeTile.getNumConnections() >= 2) return; } } diff --git a/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java b/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java index 9468da006e6..b6a24a190b9 100644 --- a/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java +++ b/src/main/java/gregtech/common/terminal/app/VirtualTankApp.java @@ -14,6 +14,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.VirtualTankRegistry; import gregtech.common.terminal.component.SearchComponent; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fluids.FluidStack; @@ -21,6 +22,7 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -45,7 +47,7 @@ public AbstractApplication initApp() { this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2)); this.addWidget(new LabelWidget(10, 10, "terminal.vtank_viewer.title", -1)); this.addWidget(new RectButtonWidget(216, 7, 110, 18) - .setClickListener(cd->{ + .setClickListener(cd -> { if (cd.isClient) { reloadWidgets(cacheClient); } @@ -71,7 +73,8 @@ public AbstractApplication initApp() { private List> findVirtualTanks() { List> result = new LinkedList<>(); Map> tankMap = VirtualTankRegistry.getTankMap(); - for (UUID uuid : tankMap.keySet().stream().sorted(Comparator.nullsLast(UUID::compareTo)).collect(Collectors.toList())) { + for (UUID uuid : tankMap.keySet().stream().sorted(Comparator.nullsLast(UUID::compareTo)) + .collect(Collectors.toList())) { if (uuid == null || uuid.equals(gui.entityPlayer.getUniqueID())) { for (String key : tankMap.get(uuid).keySet().stream().sorted().collect(Collectors.toList())) { result.add(new ImmutablePair<>(uuid, key)); @@ -116,7 +119,7 @@ private void refresh() { } } if (!toUpdated.isEmpty()) { - writeUpdateInfo(-2, buffer->{ // update specific info + writeUpdateInfo(-2, buffer -> { // update specific info buffer.writeVarInt(toUpdated.size()); for (Pair update : toUpdated) { buffer.writeBoolean(update.getKey() != null); @@ -227,7 +230,8 @@ public List getMenuComponents() { @Override public String resultDisplay(Pair result) { FluidStack fluidStack = VirtualTankRegistry.getTankMap().get(result.getKey()).get(result.getValue()).getFluid(); - return String.format("Lock: %b, ID: %s, Fluid: %s", result.getKey() != null, result.getValue(), fluidStack == null ? "-" : fluidStack.getLocalizedName()); + return String.format("Lock: %b, ID: %s, Fluid: %s", result.getKey() != null, result.getValue(), + fluidStack == null ? "-" : fluidStack.getLocalizedName()); } @Override @@ -243,7 +247,8 @@ public void search(String word, Consumer> find) { return; for (Map.Entry, IFluidTank> access : cacheClient.entrySet()) { Pair accessingCover = access.getKey(); - if (accessingCover.getValue() != null && accessingCover.getValue().toLowerCase().contains(word.toLowerCase())) { + if (accessingCover.getValue() != null && + accessingCover.getValue().toLowerCase().contains(word.toLowerCase())) { find.accept(accessingCover); } else { FluidStack fluidStack = access.getValue().getFluid(); diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java index 8d6c31e5b51..f06ec173db3 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppCardWidget.java @@ -4,17 +4,18 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.*; import gregtech.api.gui.widgets.ImageWidget; -import gregtech.client.shader.Shaders; import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.gui.widgets.AnimaWidgetGroup; import gregtech.api.terminal.gui.widgets.CircleButtonWidget; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; -import gregtech.client.utils.RenderUtil; import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; +import gregtech.client.shader.Shaders; +import gregtech.client.utils.RenderUtil; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.network.PacketBuffer; @@ -25,6 +26,7 @@ import java.util.List; public class AppCardWidget extends AnimaWidgetGroup { + private final AbstractApplication application; private final AppStoreApp store; @SideOnly(Side.CLIENT) @@ -39,12 +41,12 @@ public class AppCardWidget extends AnimaWidgetGroup { private int alpha; public AppCardWidget(int x, int y, AbstractApplication application, AppStoreApp store) { - super(x, y , 100, 100); + super(x, y, 100, 100); this.application = application; this.store = store; TerminalOSWidget os = store.getOs(); if (os.isRemote()) { - this.addWidget(new CircleButtonWidget(15,17) + this.addWidget(new CircleButtonWidget(15, 17) .setColors(TerminalTheme.COLOR_B_2.getColor(), application.getThemeColor(), TerminalTheme.COLOR_B_2.getColor()) @@ -56,7 +58,9 @@ public AppCardWidget(int x, int y, AbstractApplication application, AppStoreApp offset = Math.abs(GTValues.RNG.nextInt()) % 200; banner = application.getBanner(); if (os.installedApps.contains(application)) { - if (TerminalBehaviour.isCreative(os.itemStack) || application.getMaxTier() == Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier())) { + if (TerminalBehaviour.isCreative(os.itemStack) || application.getMaxTier() == + Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier())) { updateState(0); } else { updateState(1); @@ -82,7 +86,8 @@ public void updateState(int state) { removeWidget(stateWidget); removeWidget(bgWidget); } - stateWidget = new ImageWidget(15, 85, 70, 15, new TextTexture(text, -1).setWidth(70).setDropShadow(true).setType(TextTexture.TextType.HIDE)); + stateWidget = new ImageWidget(15, 85, 70, 15, + new TextTexture(text, -1).setWidth(70).setDropShadow(true).setType(TextTexture.TextType.HIDE)); bgWidget = new ImageWidget(15, 85, 70, 13, new ColorRectTexture(bg)); this.addWidget(bgWidget); this.addWidget(stateWidget); @@ -119,14 +124,15 @@ public void hookDrawInForeground(int mouseX, int mouseY) { int y = getPosition().y; int width = getSize().width; int height = getSize().height; - if (isMouseOverElement(mouseX, mouseY) && store.getOs().desktop.widgets.stream().noneMatch(app->app instanceof TerminalDialogWidget)) { + if (isMouseOverElement(mouseX, mouseY) && + store.getOs().desktop.widgets.stream().noneMatch(app -> app instanceof TerminalDialogWidget)) { int dur = 7; int maxAlpha = 100; // 0-255!!!!! float partialTicks = Minecraft.getMinecraft().getRenderPartialTicks(); if (alpha != maxAlpha && interpolator == null) { interpolator = new Interpolator(0, maxAlpha, dur, Eases.LINEAR, - value-> alpha = value.intValue(), - value-> interpolator = null); + value -> alpha = value.intValue(), + value -> interpolator = null); interpolator.start(); } // smooth @@ -134,17 +140,19 @@ public void hookDrawInForeground(int mouseX, int mouseY) { if (alpha == maxAlpha) { color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | ((alpha) << 24); } else { - color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | ((alpha + (int) (maxAlpha * partialTicks / dur)) << 24); + color = TerminalTheme.COLOR_B_2.getColor() & 0x00ffffff | + ((alpha + (int) (maxAlpha * partialTicks / dur)) << 24); } int finalColor = color; - RenderUtil.useScissor(store.getPosition().x, store.getPosition().y, store.getSize().width, store.getSize().height, ()->{ - drawSolidRect(0, 0, gui.getScreenWidth(), y, finalColor); - drawSolidRect(0, y + height, gui.getScreenWidth(), gui.getScreenHeight(), finalColor); - drawSolidRect(0, y, x, height, finalColor); - drawSolidRect(x + width, y, gui.getScreenWidth(), height, finalColor); + RenderUtil.useScissor(store.getPosition().x, store.getPosition().y, store.getSize().width, + store.getSize().height, () -> { + drawSolidRect(0, 0, gui.getScreenWidth(), y, finalColor); + drawSolidRect(0, y + height, gui.getScreenWidth(), gui.getScreenHeight(), finalColor); + drawSolidRect(0, y, x, height, finalColor); + drawSolidRect(x + width, y, gui.getScreenWidth(), height, finalColor); - drawBorder(x, y, width, height, application.getThemeColor(), -1); - }); + drawBorder(x, y, width, height, application.getThemeColor(), -1); + }); } else { alpha = 0; } @@ -166,7 +174,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe float time = offset + (gui.entityPlayer.ticksExisted + partialTicks) / 20f; ShaderTexture.createShader("banner.frag").draw(x, y, width, 34, uniformCache -> { uniformCache.glUniform1F("u_time", time); - uniformCache.glUniform3F("b_color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f); + uniformCache.glUniform3F("b_color", color.getRed() / 255f, color.getGreen() / 255f, + color.getBlue() / 255f); }); } else { drawSolidRect(x, y, width, 34, color.getRGB()); diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java index 380f4fd325f..dc02aac2078 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppPageWidget.java @@ -16,6 +16,7 @@ import gregtech.api.util.interpolate.Interpolator; import gregtech.common.inventory.handlers.SingleItemStackHandler; import gregtech.common.items.behaviors.TerminalBehaviour; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -32,6 +33,7 @@ import java.util.stream.Collectors; public class AppPageWidget extends TerminalDialogWidget { + private final AbstractApplication application; private final AppCardWidget appCardWidget; private final AppStoreApp store; @@ -53,7 +55,7 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard int tier = i; // upgrade button buttons[i] = new CircleButtonWidget(dur + dur * i, 110, 6, 2, 0) - .setClickListener(cd->buttonClicked(tier)); + .setClickListener(cd -> buttonClicked(tier)); this.addWidget(buttons[i]); } this.addWidget(new CircleButtonWidget(310, 10, 6, 1, 8) @@ -62,7 +64,7 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard TerminalTheme.COLOR_3.getColor()) .setIcon(GuiTextures.ICON_REMOVE) .setHoverText("terminal.store.close") - .setClickListener(cd->close())); + .setClickListener(cd -> close())); if (store.getOs().isRemote()) { // profile int color = application.getThemeColor(); @@ -73,20 +75,21 @@ public AppPageWidget(AbstractApplication application, AppStoreApp store, AppCard for (int i = 0; i < stage; i++) { List demand = TerminalRegistry.getAppHardwareDemand(name, i) .stream() - .map(hw-> hw.getLocalizedName() + "(" + hw.addInformation() + ")") + .map(hw -> hw.getLocalizedName() + "(" + hw.addInformation() + ")") .collect(Collectors.toList()); demand.add(0, application.getTierInformation(i)); buttons[i].setColors(0, lightColor, color).setHoverText(demand.toArray(new String[0])); List conditions = TerminalRegistry.getAppHardwareUpgradeConditions(name, i); // line if (conditions.size() > 0) { - this.addWidget(new ImageWidget(dur + dur * i, 115, 1, -18 + (conditions.size() >= 4 ? 4 * 25 : conditions.size() * 25), + this.addWidget(new ImageWidget(dur + dur * i, 115, 1, + -18 + (conditions.size() >= 4 ? 4 * 25 : conditions.size() * 25), new ColorRectTexture(0xafffffff))); } // conditions for (int j = 0; j < conditions.size(); j++) { this.addWidget(new SlotWidget(new SingleItemStackHandler(conditions.get(j)), 0, - dur + dur * i + 25 * (j / 4)- 9, 120 + 25 * (j % 4), false, false)); + dur + dur * i + 25 * (j / 4) - 9, 120 + 25 * (j % 4), false, false)); } } } @@ -100,7 +103,8 @@ private void buttonClicked(int tier) { } else if (TerminalBehaviour.isCreative(os.itemStack)) { lastTier = application.getMaxTier(); } else { - lastTier = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier()); + lastTier = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier()); } String name = application.getRegistryName(); if (tier > lastTier) { @@ -146,34 +150,34 @@ private void buttonClicked(int tier) { } } - if (match) { if (os.isRemote()) { appCardWidget.updateState(tier == application.getMaxTier() ? 0 : 1); } if (!gui.entityPlayer.isCreative()) { // cost - TerminalDialogWidget.showConfirmDialog(store.getOs(), "terminal.dialog.notice", "terminal.store.match", res->{ - if (res) { - for (ItemStack requirement : requirements) { - int left = requirement.getCount(); - for (ItemStack hold : gui.entityPlayer.inventory.mainInventory) { - if (requirement.isItemEqual(hold)) { - if (hold.getCount() <= left) { - hold.setCount(0); - left -= hold.getCount(); - } else { - hold.setCount(hold.getCount() - left); - left = 0; - } - if (left == 0) { - break; + TerminalDialogWidget + .showConfirmDialog(store.getOs(), "terminal.dialog.notice", "terminal.store.match", res -> { + if (res) { + for (ItemStack requirement : requirements) { + int left = requirement.getCount(); + for (ItemStack hold : gui.entityPlayer.inventory.mainInventory) { + if (requirement.isItemEqual(hold)) { + if (hold.getCount() <= left) { + hold.setCount(0); + left -= hold.getCount(); + } else { + hold.setCount(hold.getCount() - left); + left = 0; + } + if (left == 0) { + break; + } + } } } + updateTerminalAppTier(tier, lastTier); } - } - updateTerminalAppTier(tier, lastTier); - } - }).open(); + }).open(); } else { updateTerminalAppTier(tier, lastTier); } @@ -191,9 +195,9 @@ private void buttonClicked(int tier) { private void updateTerminalAppTier(int tier, int lastTier) { TerminalOSWidget os = store.getOs(); os.openedApps.stream() - .filter(app->app.getRegistryName().equals(this.application.getRegistryName())) + .filter(app -> app.getRegistryName().equals(this.application.getRegistryName())) .findFirst() - .ifPresent(app->os.closeApplication(app, os.isRemote())); + .ifPresent(app -> os.closeApplication(app, os.isRemote())); if (lastTier == -1) { // update terminal NBTTagList installed = os.tabletNBT.getTagList("_installed", Constants.NBT.TAG_STRING); installed.appendTag(new NBTTagString(application.getRegistryName())); @@ -224,7 +228,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe } else if (TerminalBehaviour.isCreative(os.itemStack)) { stage = application.getMaxTier() + 1; } else { - stage = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), application.getMaxTier()) + 1; + stage = Math.min(os.tabletNBT.getCompoundTag(application.getRegistryName()).getInteger("_tier"), + application.getMaxTier()) + 1; } int maxStage = application.getMaxTier() + 1; int color = application.getThemeColor(); @@ -252,16 +257,16 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe if (lineWidth != end && (interpolator == null || back)) { back = false; interpolator = new Interpolator(lineWidth, end, (end - lineWidth) / 15, Eases.LINEAR, - value-> lineWidth = value.intValue(), - value-> interpolator = null); + value -> lineWidth = value.intValue(), + value -> interpolator = null); interpolator.start(); } } else { if (lineWidth != 0 && (interpolator == null || !back)) { back = true; interpolator = new Interpolator(lineWidth, 0, lineWidth / 15, Eases.LINEAR, - value-> lineWidth = value.intValue(), - value-> interpolator = null); + value -> lineWidth = value.intValue(), + value -> interpolator = null); interpolator.start(); } } @@ -286,7 +291,8 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe String localizedName = I18n.format(application.getUnlocalizedName()); drawStringSized(localizedName, x + 100, y + 14, fColor, store.darkMode, 2, false); if (isMouseOver(x + 100, y + 14, fr.getStringWidth(localizedName) * 2, fr.FONT_HEIGHT * 2, mouseX, mouseY)) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList("("+application.getRegistryName()+")"), 200, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList("(" + application.getRegistryName() + ")"), 200, + mouseX, mouseY); } for (int i = 0; i < description.size(); i++) { fr.drawString(description.get(i), x + 100, y + 35 + i * fr.FONT_HEIGHT, fColor, store.darkMode); @@ -296,5 +302,4 @@ public void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, IRe GlStateManager.enableDepth(); } - } diff --git a/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java b/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java index 498dad07655..6e1ffea4e6e 100644 --- a/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java +++ b/src/main/java/gregtech/common/terminal/app/appstore/AppStoreApp.java @@ -17,6 +17,7 @@ import gregtech.api.util.Size; import gregtech.common.items.MetaItems; import gregtech.common.terminal.component.ClickComponent; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,6 +26,7 @@ import java.util.List; public class AppStoreApp extends AbstractApplication { + @SideOnly(Side.CLIENT) protected boolean darkMode; @@ -44,14 +46,16 @@ public AbstractApplication initApp() { int index = 0; int yOffset = 50; group.addWidget(new ImageWidget(0, 0, 333, 30, GuiTextures.UI_FRAME_SIDE_UP)); - group.addWidget(new LabelWidget(333 / 2, 10, getUnlocalizedName(), -1).setShadow(true).setYCentered(true).setXCentered(true)); + group.addWidget(new LabelWidget(333 / 2, 10, getUnlocalizedName(), -1).setShadow(true).setYCentered(true) + .setXCentered(true)); for (AbstractApplication app : TerminalRegistry.getAllApps()) { group.addWidget(new AppCardWidget(5 + 110 * (index % 3), yOffset + 110 * (index / 3), app, this)); index++; } int y = yOffset + 110 * ((index + 2) / 3); group.addWidget(new ImageWidget(0, y, 333, 30, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - group.addWidget(new ImageWidget(0, y, 333, 30, new TextTexture("Copyright @2021-xxxx Gregicality Team XD", -1))); + group.addWidget( + new ImageWidget(0, y, 333, 30, new TextTexture("Copyright @2021-xxxx Gregicality Team XD", -1))); loadLocalConfig(nbt -> this.darkMode = nbt.getBoolean("dark")); return this; } @@ -79,11 +83,12 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, @Override public List getMenuComponents() { - ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE).setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { - if (cd.isClient) { - this.darkMode = !this.darkMode; - } - }); + ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE) + .setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { + if (cd.isClient) { + this.darkMode = !this.darkMode; + } + }); return Collections.singletonList(darkMode); } diff --git a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java index 684fdc41148..25fae6eee53 100644 --- a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java +++ b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryManagerApp.java @@ -9,11 +9,13 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.items.MetaItems; import gregtech.common.terminal.hardware.BatteryHardware; + import net.minecraft.client.resources.I18n; import java.util.concurrent.atomic.AtomicInteger; public class BatteryManagerApp extends AbstractApplication { + public BatteryManagerApp() { super("battery"); } @@ -42,15 +44,20 @@ public AbstractApplication initApp() { private void addBatteryApps() { AtomicInteger index = new AtomicInteger(); for (AbstractApplication installed : getOs().installedApps) { - TerminalRegistry.getAppHardwareDemand(installed.getRegistryName(), getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")).stream() - .filter(i->i instanceof BatteryHardware).findFirst() - .ifPresent(battery-> { - long charge = ((BatteryHardware)battery).getCharge(); - this.addWidget(new RectButtonWidget(180 + (index.get() % 5) * 30, 15 + (index.get() / 5) * 30, 20, 20, 2) - .setIcon(installed.getIcon()) - // warn unsafe call the I18n here. - .setHoverText(I18n.format("terminal.battery.hover", I18n.format(installed.getUnlocalizedName()), charge)) - .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); + TerminalRegistry + .getAppHardwareDemand(installed.getRegistryName(), + getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")) + .stream() + .filter(i -> i instanceof BatteryHardware).findFirst() + .ifPresent(battery -> { + long charge = ((BatteryHardware) battery).getCharge(); + this.addWidget(new RectButtonWidget(180 + (index.get() % 5) * 30, 15 + (index.get() / 5) * 30, + 20, 20, 2) + .setIcon(installed.getIcon()) + // warn unsafe call the I18n here. + .setHoverText(I18n.format("terminal.battery.hover", + I18n.format(installed.getUnlocalizedName()), charge)) + .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); index.getAndIncrement(); }); } diff --git a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java index c1a2c462ecb..50dc490e3dd 100644 --- a/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java +++ b/src/main/java/gregtech/common/terminal/app/batterymanager/BatteryWidget.java @@ -8,10 +8,12 @@ import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; import gregtech.client.shader.Shaders; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BatteryWidget extends Widget { + @SideOnly(Side.CLIENT) private ShaderTexture battery; private final TerminalOSWidget os; @@ -29,9 +31,10 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender int width = getSize().width; int height = getSize().height; float left = 0; - IElectricItem electricItem = os.hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + IElectricItem electricItem = os.hardwareProvider.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, + null); if (electricItem != null) { - left = electricItem.getCharge() / (float)electricItem.getMaxCharge(); + left = electricItem.getCharge() / (float) electricItem.getMaxCharge(); } if (Shaders.allowedShader()) { float progress = left; @@ -44,14 +47,16 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender uniformCache.glUniform1F("u_time", time); uniformCache.glUniform1F("progress", progress); uniformCache.glUniform3F("c_ring", .55f, .7f, .7f); - uniformCache.glUniform3F("c_sector", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F); + uniformCache.glUniform3F("c_sector", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, + (color & 255) / 255.0F); uniformCache.glUniform3F("c_water", (1 - progress), progress, 0f); }); } else { - int b_color = (int)(255 * (1 - left)) << 16 | (int)(255 * left) << 8 | 255 << 24; + int b_color = (int) (255 * (1 - left)) << 16 | (int) (255 * left) << 8 | 255 << 24; drawBorder(x, y, width, height, TerminalTheme.COLOR_1.getColor(), 2); - drawSolidRect(x, y + height - (int)(height * left), width, (int)(height * left), b_color); + drawSolidRect(x, y + height - (int) (height * left), width, (int) (height * left), b_color); } - drawStringSized(String.format("%.2f%%", left * 100), x + width / 2f + 3, y + height / 2f - 7, -1, true, 2, true); + drawStringSized(String.format("%.2f%%", left * 100), x + width / 2f + 3, y + height / 2f - 7, -1, true, 2, + true); } } diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java index 1f244022df5..2105e3ed11e 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/CapeSelectorApp.java @@ -10,6 +10,7 @@ import gregtech.common.terminal.app.capeselector.widget.CapeListWidget; public class CapeSelectorApp extends AbstractApplication { + protected CapeListWidget capeListWidget; public CapeSelectorApp() { @@ -29,14 +30,14 @@ public AbstractApplication initApp() { this.getCapeList().setYScrollBarWidth(3).setYBarStyle(null, TerminalTheme.COLOR_F_1); this.addWidget(new SimpleTextWidget(166, 33, "", 0xFFFFFF, () -> { - if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { + if (this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { return "terminal.cape_selector.empty"; } return "terminal.cape_selector.select"; })); this.addWidget(new SimpleTextWidget(166, 45, "", 0xFFFFFF, () -> { - if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { + if (this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) { return "terminal.cape_selector.tip"; } return ""; diff --git a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java index 56202a76ec7..98f7bd57e35 100644 --- a/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/capeselector/widget/CapeListWidget.java @@ -9,6 +9,7 @@ import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.CapesRegistry; import gregtech.client.utils.RenderUtil; + import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -17,6 +18,7 @@ import java.util.UUID; public class CapeListWidget extends DraggableScrollableWidgetGroup { + private final UUID uuid; private List capes; private int selectedX, selectedY = -1; @@ -67,11 +69,13 @@ private void updateCapeCandidates(List capes) { int finalRowNumber = rowNumber; int finalI = i; ClickButtonWidget capeButton = new ClickButtonWidget(rowPosition * 70 + 21, rowNumber * 56, 28, 44, "", - (data) -> this.setCape(finalRowPosition, finalRowNumber, capes.get(finalI))).setButtonTexture(capeImage) - .setShouldClientCallback(true); + (data) -> this.setCape(finalRowPosition, finalRowNumber, capes.get(finalI))) + .setButtonTexture(capeImage) + .setShouldClientCallback(true); row.addWidget(capeButton); - if(capes.get(i).equals(CapesRegistry.getPlayerCape(uuid))) { // If this is the cape that the player is wearing right now, select it. + if (capes.get(i).equals(CapesRegistry.getPlayerCape(uuid))) { // If this is the cape that the player is + // wearing right now, select it. selectedX = finalRowPosition; selectedY = finalRowNumber; } @@ -113,9 +117,10 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender // Get selected cape button Widget button = ((WidgetGroup) this.widgets.get(this.selectedY)).widgets.get(this.selectedX); - RenderUtil.useScissor(getPosition().x, getPosition().y, getSize().width - yBarWidth, getSize().height - xBarHeight, () -> { - drawSelectionOverlay(button.getPosition().x - 6, button.getPosition().y - 6, - button.getSize().width + 12, button.getSize().height + 12); // Add a bit of margin - }); + RenderUtil.useScissor(getPosition().x, getPosition().y, getSize().width - yBarWidth, + getSize().height - xBarHeight, () -> { + drawSelectionOverlay(button.getPosition().x - 6, button.getPosition().y - 6, + button.getSize().width + 12, button.getSize().height + 12); // Add a bit of margin + }); } } diff --git a/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java b/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java index bb21dde690a..6147c219ad4 100644 --- a/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java +++ b/src/main/java/gregtech/common/terminal/app/console/ConsoleApp.java @@ -8,6 +8,7 @@ import gregtech.api.terminal.gui.widgets.MachineSceneWidget; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.common.metatileentities.storage.MetaTileEntityWorkbench; + import net.minecraft.tileentity.TileEntity; public class ConsoleApp extends AbstractApplication { @@ -31,7 +32,7 @@ public AbstractApplication initApp() { IGregTechTileEntity mteResult = getMTE(); if (mteResult == null || - mteResult.getMetaTileEntity() instanceof MetaTileEntityWorkbench) // Remove Crafting Station compat + mteResult.getMetaTileEntity() instanceof MetaTileEntityWorkbench) // Remove Crafting Station compat { // 333 232 TerminalDialogWidget.showInfoDialog(os, "terminal.dialog.notice", @@ -42,7 +43,8 @@ public AbstractApplication initApp() { MachineConsoleWidget consoleWidget = new MachineConsoleWidget(200, 16, 133, 200); this.addWidget(consoleWidget); if (isClient) { - this.addWidget(0, new MachineSceneWidget(0, 16, 200, 200, os.clickPos).setOnSelected(consoleWidget::setFocus)); + this.addWidget(0, + new MachineSceneWidget(0, 16, 200, 200, os.clickPos).setOnSelected(consoleWidget::setFocus)); this.addWidget(new ImageWidget(0, 0, 333, 16, GuiTextures.UI_FRAME_SIDE_UP)); this.addWidget(new ImageWidget(0, 216, 333, 16, GuiTextures.UI_FRAME_SIDE_DOWN)); } else { diff --git a/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java b/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java index 0eb49bab023..a3272fa06c3 100644 --- a/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java +++ b/src/main/java/gregtech/common/terminal/app/console/MachineConsoleWidget.java @@ -24,6 +24,7 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumChest; import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Items; import net.minecraft.network.PacketBuffer; @@ -33,6 +34,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.ItemStackHandler; + import org.lwjgl.opengl.GL11; /** @@ -43,6 +45,7 @@ * @Description: */ public class MachineConsoleWidget extends WidgetGroup { + private BlockPos pos; private EnumFacing facing; private MetaTileEntity mte; @@ -76,7 +79,7 @@ private void checkMachine() { mte = ((IGregTechTileEntity) te).getMetaTileEntity(); initWidgets(); if (isRemote()) { - writeClientAction(5, buf->{ + writeClientAction(5, buf -> { buf.writeBlockPos(pos); buf.writeByte(facing.getIndex()); }); @@ -92,7 +95,8 @@ private void initWidgets() { uiWidgetGroup.setVisible(false); Size size = getSize(); addWidget(new ImageWidget(0, 0, size.width, size.height, GuiTextures.BACKGROUND)); - addWidget(new SimpleTextWidget(size.width / 2, 12, "", -1, ()->facing.toString().toUpperCase()).setShadow(true)); + addWidget(new SimpleTextWidget(size.width / 2, 12, "", -1, () -> facing.toString().toUpperCase()) + .setShadow(true)); int y = 20; if (mte.hasFrontFacing()) { addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) @@ -101,7 +105,8 @@ private void initWidgets() { mte.setFrontFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.front", -1))); y += 25; } @@ -110,7 +115,7 @@ private void initWidgets() { IControllable controllable = mte.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, facing); if (controllable != null) { addWidget(new RectButtonWidget(10, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0, 1, 0.5), (c, p) -> { if (!isRemote()) { controllable.setWorkingEnabled(p); } @@ -120,13 +125,16 @@ private void initWidgets() { .setHoverText("terminal.console.controllable") .setIcon(GuiTextures.BUTTON_WORKING_ENABLE.getSubArea(0, 0.5, 1, 0.5))); // AbstractRecipeLogic - AbstractRecipeLogic recipeLogic = mte.getCapability(GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC, facing); + AbstractRecipeLogic recipeLogic = mte.getCapability(GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC, + facing); if (recipeLogic != null) { addWidget(new CycleButtonWidget(35, y, 20, 20, - recipeLogic.getAvailableOverclockingTiers(), recipeLogic::getOverclockTier, recipeLogic::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); - addWidget(new ProgressWidget(recipeLogic::getProgressPercent, 60, y, 63, 20, GuiTextures.PROGRESS_BAR_ARC_FURNACE, ProgressWidget.MoveType.HORIZONTAL)); + recipeLogic.getAvailableOverclockingTiers(), recipeLogic::getOverclockTier, + recipeLogic::setOverclockTier) + .setTooltipHoverString("gregtech.gui.overclock.description") + .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); + addWidget(new ProgressWidget(recipeLogic::getProgressPercent, 60, y, 63, 20, + GuiTextures.PROGRESS_BAR_ARC_FURNACE, ProgressWidget.MoveType.HORIZONTAL)); if (recipeLogic instanceof RecipeLogicSteam) { y += 25; addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) @@ -135,7 +143,8 @@ private void initWidgets() { if (currentVentingSide == facing || mte.getFrontFacing() == facing) return; ((RecipeLogicSteam) recipeLogic).setVentingSide(facing); }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.venting", -1))); } } @@ -147,18 +156,20 @@ private void initWidgets() { SimpleMachineMetaTileEntity simpleMTE = (SimpleMachineMetaTileEntity) mte; // items output if (simpleMTE.getExportItems().getSlots() > 0) { - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.GLOWSTONE_DUST))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.GLOWSTONE_DUST))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && mte.getFrontFacing() != facing) { simpleMTE.setOutputFacingItems(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.items")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->simpleMTE.getOutputFacingItems().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, + () -> simpleMTE.getOutputFacingItems().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { simpleMTE.setAutoOutputItems(p); } @@ -169,11 +180,12 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ - if (!isRemote()) { - simpleMTE.setAllowInputFromOutputSideItems(p); - } - }) + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), + (c, p) -> { + if (!isRemote()) { + simpleMTE.setAllowInputFromOutputSideItems(p); + } + }) .setInitValue(simpleMTE.isAllowInputFromOutputSideItems()) .setValueSupplier(false, simpleMTE::isAllowInputFromOutputSideItems) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), 0) @@ -184,18 +196,20 @@ private void initWidgets() { // fluids output if (simpleMTE.getExportFluids().getTanks() > 0) { - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.WATER_BUCKET))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.WATER_BUCKET))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && simpleMTE.getFrontFacing() != facing) { simpleMTE.setOutputFacingFluids(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.fluids")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->simpleMTE.getOutputFacingFluids().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, + () -> simpleMTE.getOutputFacingFluids().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { simpleMTE.setAutoOutputFluids(p); } @@ -206,11 +220,12 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ - if (!isRemote()) { - simpleMTE.setAllowInputFromOutputSideFluids(p); - } - }) + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), + (c, p) -> { + if (!isRemote()) { + simpleMTE.setAllowInputFromOutputSideFluids(p); + } + }) .setInitValue(simpleMTE.isAllowInputFromOutputSideFluids()) .setValueSupplier(false, simpleMTE::isAllowInputFromOutputSideFluids) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), 0) @@ -224,18 +239,19 @@ private void initWidgets() { // MetaTileEntityQuantumTank if (mte instanceof MetaTileEntityQuantumChest) { MetaTileEntityQuantumChest chest = (MetaTileEntityQuantumChest) mte; - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.GLOWSTONE_DUST))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.GLOWSTONE_DUST))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && mte.getFrontFacing() != facing) { chest.setOutputFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.items")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->chest.getOutputFacing().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, () -> chest.getOutputFacing().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { chest.setAutoOutputItems(p); } @@ -246,7 +262,7 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_ITEM_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { chest.setAllowInputFromOutputSide(p); } @@ -259,18 +275,19 @@ private void initWidgets() { y += 25; } else if (mte instanceof MetaTileEntityQuantumTank) { MetaTileEntityQuantumTank tank = (MetaTileEntityQuantumTank) mte; - addWidget(new ImageWidget(10, y, 20 ,20, new ItemStackTexture(Items.WATER_BUCKET))); + addWidget(new ImageWidget(10, y, 20, 20, new ItemStackTexture(Items.WATER_BUCKET))); addWidget(new RectButtonWidget(33, y, 50, 20, 1) .setClickListener(clickData -> { if (!isRemote() && tank.getFrontFacing() != facing) { tank.setOutputFacing(facing); } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setHoverText("terminal.console.fluids")); - addWidget(new SimpleTextWidget(58, y + 10, "", -1, ()->tank.getOutputFacing().toString())); + addWidget(new SimpleTextWidget(58, y + 10, "", -1, () -> tank.getOutputFacing().toString())); addWidget(new RectButtonWidget(83, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { tank.setAutoOutputFluids(p); } @@ -281,7 +298,7 @@ private void initWidgets() { .setHoverText("terminal.console.auto_output") .setIcon(GuiTextures.BUTTON_FLUID_OUTPUT.getSubArea(0, 0, 1, 0.5))); addWidget(new RectButtonWidget(103, y, 20, 20, 1) - .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p)->{ + .setToggleButton(GuiTextures.BUTTON_ALLOW_IMPORT_EXPORT.getSubArea(0, 0.5, 1, 0.5), (c, p) -> { if (!isRemote()) { tank.setAllowInputFromOutputSide(p); } @@ -300,11 +317,12 @@ private void initWidgets() { if (mte instanceof MetaTileEntityMaintenanceHatch) { addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) .setClickListener(clickData -> { - if (!isRemote()) { - ((MetaTileEntityMaintenanceHatch) mte).fixAllMaintenanceProblems(); - } + if (!isRemote()) { + ((MetaTileEntityMaintenanceHatch) mte).fixAllMaintenanceProblems(); + } }) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.maintenance", -1))); y += 25; } @@ -316,18 +334,21 @@ private void initWidgets() { this.addWidget(new SlotWidget(new ItemStackHandler(NonNullList.withSize(1, cover.getPickItem())), 0, 10, y, false, false)); addWidget(new SimpleTextWidget(58, y + 10, "terminal.console.cover_rs", -1, - ()-> String.valueOf(cover.getRedstoneSignalOutput())).setShadow(true).setCenter(true)); + () -> String.valueOf(cover.getRedstoneSignalOutput())).setShadow(true).setCenter(true)); if (cover instanceof CoverWithUI) { addWidget(new RectButtonWidget(83, y, 40, 20, 1) - .setClickListener(clickData -> uiWidgetGroup.openUI(((CoverWithUI) cover).createUI(gui.entityPlayer))) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setClickListener( + clickData -> uiWidgetGroup.openUI(((CoverWithUI) cover).createUI(gui.entityPlayer))) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.cover_gui", -1))); } y += 25; } addWidget(new RectButtonWidget(10, y, size.width - 20, 20, 1) .setClickListener(clickData -> uiWidgetGroup.openUI(mte.getModularUI(gui.entityPlayer))) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.console.gui", -1))); addWidget(uiWidgetGroup); @@ -351,7 +372,8 @@ public void drawInForeground(int mouseX, int mouseY) { super.drawInForeground(mouseX, mouseY); } - private static class UIWidgetGroup extends WidgetGroup{ + private static class UIWidgetGroup extends WidgetGroup { + private IGuiTexture background; public void clearUI() { diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java b/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java index 469aeb6968f..bd944c9d9da 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/MazeApp.java @@ -11,6 +11,7 @@ import gregtech.common.terminal.app.game.maze.widget.EnemyWidget; import gregtech.common.terminal.app.game.maze.widget.MazeWidget; import gregtech.common.terminal.app.game.maze.widget.PlayerWidget; + import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -19,6 +20,7 @@ import java.util.List; public class MazeApp extends AbstractApplication { + private int gameState = 0; private PlayerWidget player; private EnemyWidget enemy; @@ -48,7 +50,8 @@ public AbstractApplication initApp() { this.setOs(os); this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2)); // enemy 0: Title - this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.title", 0xFFFFFFFF).setXCentered(true), 0); + this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.title", 0xFFFFFFFF).setXCentered(true), + 0); this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 30, 30, "terminal.maze.play", (clickData -> { this.setGameState(1); @@ -60,19 +63,27 @@ public AbstractApplication initApp() { this.setEnemy(new EnemyWidget(-100, -100, this)); // GameState 2: Pause this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, new ColorRectTexture(0xFF000000)), 2, 3); - this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "terminal.maze.continue", (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2); - this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.pause", 0xFFFFFFFF).setXCentered(true), 2); + this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "terminal.maze.continue", + (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2); + this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.pause", 0xFFFFFFFF).setXCentered(true), + 2); // GameState 3: Death - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "terminal.maze.death.1", true), 3); - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "terminal.maze.death.2", 0xFFFFFFFF, () -> String.valueOf(this.getMazesSolved()),true), 3); - this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "terminal.maze.death.3", true), 3); - this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "terminal.maze.retry", (clickData -> { - this.setGameState(1); - this.setMazesSolved(0); - MAZE_SIZE = 9; - speed = 25; - this.resetGame(); - })).setShouldClientCallback(true), 3); + this.addWidget( + new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "terminal.maze.death.1", true), + 3); + this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "terminal.maze.death.2", 0xFFFFFFFF, + () -> String.valueOf(this.getMazesSolved()), true), 3); + this.addWidget( + new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "terminal.maze.death.3", true), + 3); + this.addWidget( + new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "terminal.maze.retry", (clickData -> { + this.setGameState(1); + this.setMazesSolved(0); + MAZE_SIZE = 9; + speed = 25; + this.resetGame(); + })).setShouldClientCallback(true), 3); } return this; } @@ -82,7 +93,7 @@ public void addWidget(Widget widget, int... visibleStates) { for (int state : visibleStates) { FSM[state].add(widget); } - widget.setVisible(Arrays.stream(visibleStates).allMatch(state->state==gameState)); + widget.setVisible(Arrays.stream(visibleStates).allMatch(state -> state == gameState)); } public void setPlayer(PlayerWidget player) { @@ -142,9 +153,9 @@ public void updateScreen() { } } if (gameState == 2) { - if(!Keyboard.isKeyDown(Keyboard.KEY_P)) + if (!Keyboard.isKeyDown(Keyboard.KEY_P)) lastPausePress = false; - if(Keyboard.isKeyDown(Keyboard.KEY_P) && !lastPausePress) + if (Keyboard.isKeyDown(Keyboard.KEY_P) && !lastPausePress) gameState = 1; } if (gameState != lastState) { diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java index f3ec600aee8..e16117666e2 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/EnemyWidget.java @@ -14,5 +14,4 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender this.setSelfPosition(new Position(app.getRenderX(posX), app.getRenderY(posY))); drawSolidRect(this.getPosition().x, this.getPosition().y, 10, 10, 0xFFFFAAAA); } - } diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java index edcb57664c9..d3f71ebf18e 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/MazeWidget.java @@ -4,6 +4,7 @@ import gregtech.api.gui.Widget; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.util.math.Vec2f; import java.util.ArrayList; @@ -37,14 +38,17 @@ public void recalculateSize() { this.setSize(new Size(MAZE_SIZE * 10, MAZE_SIZE * 10)); topWalls = new boolean[MAZE_SIZE][MAZE_SIZE]; leftWalls = new boolean[MAZE_SIZE][MAZE_SIZE]; - } public void createBorder() { List lineBuffer = new ArrayList<>(); lineBuffer.add(new Vec2f(getPosition().x + 10, getPosition().y)); lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, getPosition().y)); - lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, this.getSize().height + getPosition().y + 2)); // Corrects for line width misalignment + lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x, this.getSize().height + getPosition().y + 2)); // Corrects + // for + // line + // width + // misalignment drawLines(lineBuffer, 0xFFFFFFFF, 0xFFFFFFFF, 4); lineBuffer.clear(); lineBuffer.add(new Vec2f(this.getSize().width + getPosition().x - 10, this.getSize().height + getPosition().y)); @@ -95,10 +99,11 @@ public void initMaze() { } } - includedSpots[(int) (Math.random() * MAZE_SIZE)][(int) (Math.random() * MAZE_SIZE)] = true; // Can seed our particular maze + includedSpots[(int) (Math.random() * MAZE_SIZE)][(int) (Math.random() * MAZE_SIZE)] = true; // Can seed our + // particular maze // Improves maze randomization. List positions = new ArrayList<>(); - for(int i = 0; i < MAZE_SIZE * MAZE_SIZE; i++) { + for (int i = 0; i < MAZE_SIZE * MAZE_SIZE; i++) { positions.add(i); } Collections.shuffle(positions); @@ -107,7 +112,8 @@ public void initMaze() { if (!includedSpots[position / MAZE_SIZE][position % MAZE_SIZE]) { do { resetStuckCounter(); - } while (!this.createPath(position / MAZE_SIZE, position % MAZE_SIZE, new boolean[MAZE_SIZE][MAZE_SIZE])); + } while (!this.createPath(position / MAZE_SIZE, position % MAZE_SIZE, + new boolean[MAZE_SIZE][MAZE_SIZE])); } } } @@ -115,11 +121,11 @@ public void initMaze() { // Wilson random walk maze generation public boolean createPath(int x, int y, boolean[][] walkedPaths) { squaresChecked++; - if(squaresChecked > 20000) // Probably stuck. + if (squaresChecked > 20000) // Probably stuck. return false; - if(walkedPaths[x][y]) + if (walkedPaths[x][y]) return false; - if(this.includedSpots[x][y]) + if (this.includedSpots[x][y]) return true; this.includedSpots[x][y] = true; walkedPaths[x][y] = true; diff --git a/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java b/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java index 16dbea8b46b..2198456833c 100644 --- a/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/maze/widget/PlayerWidget.java @@ -6,9 +6,11 @@ import gregtech.common.terminal.app.game.maze.MazeApp; public class PlayerWidget extends Widget { + protected MazeApp app; public int posX; public int posY; + public PlayerWidget(int posX, int posY, MazeApp app) { super(app.getRenderX(posX), app.getRenderY(posY), 10, 10); this.app = app; @@ -27,7 +29,6 @@ public void move(int deltaX, int deltaY) { this.posY += deltaY; } - public void setGridPosition(int posX, int posY) { this.posX = posX; this.posY = posY; diff --git a/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java b/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java index ebe4fc13782..7608e54b85d 100644 --- a/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/minesweeper/MinesweeperApp.java @@ -6,6 +6,7 @@ import gregtech.common.terminal.app.game.minesweeper.widget.MineMapWidget; public class MinesweeperApp extends AbstractApplication { + private MineMapWidget mineField; private WidgetGroup textGroup; private int timer; @@ -35,8 +36,8 @@ public boolean canOpenMenuOnEdge() { @Override public void updateScreen() { super.updateScreen(); - if(mineField.hasWon() || mineField.hasLost()) { - if(mineField.hasWon()) { + if (mineField.hasWon() || mineField.hasLost()) { + if (mineField.hasWon()) { mineField.notifyWon(); } resetCountdown--; @@ -55,21 +56,23 @@ public String getFlagsPercentage() { return mineField.flagsPlaced + "/" + mineField.mineCount; } - public void setTextStatus() { //swap widget for localization + public void setTextStatus() { // swap widget for localization if (resetCountdown == 100) { textGroup.clearAllWidgets(); - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.time", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Normal - } - else if(resetCountdown==99){ + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.time", 0xFFCCCCCC, + () -> String.valueOf(timer / 20), true)); // Normal + } else if (resetCountdown == 99) { textGroup.clearAllWidgets(); - if(mineField.hasLost()){ - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.lose", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true)); // Losing condition - } else{ - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.win.1", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Winning condition - textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 20, "terminal.minesweeper.win.2", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true)); + if (mineField.hasLost()) { + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.lose", 0xFFCCCCCC, + () -> String.valueOf(resetCountdown / 20), true)); // Losing condition + } else { + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.win.1", 0xFFCCCCCC, + () -> String.valueOf(timer / 20), true)); // Winning condition + textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 20, "terminal.minesweeper.win.2", 0xFFCCCCCC, + () -> String.valueOf(resetCountdown / 20), true)); } } - } @Override diff --git a/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java b/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java index ec3ad0f73fa..5037833c929 100644 --- a/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/minesweeper/widget/MineMapWidget.java @@ -4,14 +4,18 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.resources.TextureArea; import gregtech.api.util.interpolate.RGBInterpolator; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; public class MineMapWidget extends Widget { - private static final TextureArea COVERED = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/covered.png"), 0, 0, 1, 1); - private static final TextureArea FLAG = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/flag.png"), 0, 0, 1, 1); - private static final TextureArea BOMB = new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/bomb.png"), 0, 0, 1, 1); + private static final TextureArea COVERED = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/covered.png"), 0, 0, 1, 1); + private static final TextureArea FLAG = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/flag.png"), 0, 0, 1, 1); + private static final TextureArea BOMB = new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/bomb.png"), 0, 0, 1, 1); private static final TextureArea[] NUMBERS = { new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/minesweeper/blank.png"), 0, 0, 1, 1), @@ -90,12 +94,11 @@ public void initMines(int startX, int startY) { } } - // Add to surrounding numbers for the mine // The weird ternaries here are making sure to not cause overflows for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { - if(mines[x][y]) { + if (mines[x][y]) { for (int xMod = x == 0 ? 0 : -1; xMod < (x == width - 1 ? 1 : 2); xMod++) { for (int yMod = y == 0 ? 0 : -1; yMod < (y == height - 1 ? 1 : 2); yMod++) { generatedNumbers[x + xMod][y + yMod]++; @@ -139,7 +142,8 @@ else if (!checkedSpaces[i][j]) { else COVERED.draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); } else if (!mines[i][j]) - NUMBERS[generatedNumbers[i][j]].draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); + NUMBERS[generatedNumbers[i][j]].draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), + 16, 16); else BOMB.draw(i * 16 + getPosition().getX(), j * 16 + getPosition().getY(), 16, 16); } @@ -148,7 +152,7 @@ else if (!checkedSpaces[i][j]) { @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { - if(isWon || isLost) { + if (isWon || isLost) { return false; // Don't let them interact now... } @@ -158,7 +162,6 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { return false; } - if (button == 0 && !flags[gridX][gridY]) { if (!isPrepared) initMines(gridX, gridY); @@ -181,7 +184,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private void uncoverSafeTiles(int x, int y) { checkedSpaces[x][y] = true; - if(generatedNumbers[x][y] != 0) + if (generatedNumbers[x][y] != 0) return; // Weird ternaries again for preventing ArrayIndexOutOfBounds exceptions for (int xMod = x == 0 ? 0 : -1; xMod < (x == width - 1 ? 1 : 2); xMod++) { @@ -201,7 +204,9 @@ public boolean hasWon() { return false; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { - if (mines[i][j] != flags[i][j] || checkedSpaces[i][j] == mines[i][j]) { // If there is an unchecked safe square, or an uncovered bomb... + if (mines[i][j] != flags[i][j] || checkedSpaces[i][j] == mines[i][j]) { // If there is an unchecked safe + // square, or an uncovered + // bomb... return false; } } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java b/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java index 173b024b764..32d3ad523aa 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/PongApp.java @@ -8,6 +8,7 @@ import gregtech.api.util.Position; import gregtech.common.terminal.app.game.pong.widget.BallWidget; import gregtech.common.terminal.app.game.pong.widget.PaddleWidget; + import org.lwjgl.input.Keyboard; import org.lwjgl.util.vector.Vector2f; @@ -15,7 +16,6 @@ import java.util.ArrayList; import java.util.List; - public class PongApp extends AbstractApplication { private BallWidget ball; @@ -39,7 +39,8 @@ public AbstractApplication initApp() { this.addWidget(new ImageWidget(333 / 2 - 4, 5, 6, 232 - 10, new ColorRectTexture(0xAAAAAAAA))); this.setBall(new BallWidget(333 / 2 - 1, 232 / 2 - 1)); this.addWidget(new SimpleTextWidget(50, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(true)), true)); - this.addWidget(new SimpleTextWidget(283, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(false)), true)); + this.addWidget( + new SimpleTextWidget(283, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(false)), true)); this.initPaddles(); } return this; @@ -90,11 +91,12 @@ public void updateScreenOnFrame() { paddles.forEach((paddle) -> solidObjects.add(new Rectangle(paddle.toSelfRectangleBox()))); int timeLeft = 1; - TwoDimensionalRayTracer.TwoDimensionalRayTraceResult result = TwoDimensionalRayTracer.nearestBoxSegmentCollision( - new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), - new Vector2f((float) (Math.cos(ball.theta) * 2), (float) (Math.sin(ball.theta) * 2)), - solidObjects, - new Vector2f(4, 4)); + TwoDimensionalRayTracer.TwoDimensionalRayTraceResult result = TwoDimensionalRayTracer + .nearestBoxSegmentCollision( + new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), + new Vector2f((float) (Math.cos(ball.theta) * 2), (float) (Math.sin(ball.theta) * 2)), + solidObjects, + new Vector2f(4, 4)); while (result.time != 1 && timeLeft != 0) { float angleMod = 0; if (result.pos.y < result.collidedWith.getCenterY() - 2) { @@ -102,7 +104,12 @@ public void updateScreenOnFrame() { } else if (result.pos.x > result.collidedWith.getCenterY() + 2) { angleMod += Math.signum(result.normal.x) * 0.6; } - ball.theta = (float) (Math.acos(result.normal.x) * 2 - ball.theta + Math.PI + angleMod) % (2 * Math.PI); // Reflects with a slight angle modification. + ball.theta = (float) (Math.acos(result.normal.x) * 2 - ball.theta + Math.PI + angleMod) % (2 * Math.PI); // Reflects + // with + // a + // slight + // angle + // modification. if (ball.theta > Math.PI / 2 - 0.5 && ball.theta < Math.PI / 2 + 0.5) { if (ball.theta <= Math.PI / 2) @@ -119,11 +126,13 @@ public void updateScreenOnFrame() { timeLeft -= result.time * timeLeft; result = TwoDimensionalRayTracer.nearestBoxSegmentCollision( new Vector2f(ball.getSelfPosition().x, ball.getSelfPosition().y), - new Vector2f((float) (Math.cos(ball.theta) * 3 * timeLeft), (float) (Math.sin(ball.theta) * 3 * timeLeft)), + new Vector2f((float) (Math.cos(ball.theta) * 3 * timeLeft), + (float) (Math.sin(ball.theta) * 3 * timeLeft)), solidObjects, new Vector2f(4, 4)); // To prevent it getting permanently lodged into something. - ball.addSelfPosition((Math.cos(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1)), (Math.sin(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1))); + ball.addSelfPosition((Math.cos(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1)), + (Math.sin(ball.theta) * 2 * (result.time + 0.1) * (timeLeft + 0.1))); } ball.addSelfPosition((Math.cos(ball.theta) * 2 * timeLeft), (Math.sin(ball.theta) * 2 * timeLeft)); solidObjects.remove(2); @@ -150,7 +159,8 @@ public int simplePaddleAI(PaddleWidget paddle) { return -1; if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 < paddle.getSelfPosition().getY()) return 1; - else if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 > paddle.getSelfPosition().getY()) + else if ((ball.getSelfPosition().getY() + 2 * paddle.getSelfPosition().getY()) / 3 > + paddle.getSelfPosition().getY()) return 0; return -1; } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java b/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java index cfca6f473a5..a32469e6fcb 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/TwoDimensionalRayTracer.java @@ -9,7 +9,9 @@ // Huge thanks to https://noonat.github.io/intersect! public class TwoDimensionalRayTracer { + public static class TwoDimensionalRayTraceResult { + public Vector2f pos = new Vector2f(); public Vector2f delta = new Vector2f(); public Vector2f normal = new Vector2f(); @@ -25,7 +27,8 @@ public static class TwoDimensionalRayTraceResult { * @param boxSize The half-width and half-height of the box * @return The resulting intersection between a segment and a box, or else null */ - public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vector2f delta, Vector2f boxCenter, Vector2f boxSize) { + public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vector2f delta, Vector2f boxCenter, + Vector2f boxSize) { float scaleX = (float) (1.0 / delta.x); float scaleY = (float) (1.0 / delta.y); float signX = Math.signum(scaleX); @@ -63,7 +66,8 @@ public static TwoDimensionalRayTraceResult intersectBoxSegment(Vector2f pos, Vec return result; } - public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f pos, Vector2f delta, List boxes, Vector2f padding) { + public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f pos, Vector2f delta, + List boxes, Vector2f padding) { TwoDimensionalRayTraceResult result = new TwoDimensionalRayTraceResult(); result.time = 1; result.pos.x = pos.x + delta.x; @@ -79,5 +83,4 @@ public static TwoDimensionalRayTraceResult nearestBoxSegmentCollision(Vector2f p } return result; } - } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java b/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java index b4e9b63e9e2..49aa63629af 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/widget/BallWidget.java @@ -3,16 +3,20 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.util.Position; + import net.minecraft.util.ResourceLocation; + import org.lwjgl.util.vector.Vector2f; public class BallWidget extends ImageWidget { + public double theta; private double xAccurate; private double yAccurate; public BallWidget(int xPosition, int yPosition) { - super(xPosition, yPosition, 8, 8, new TextureArea(new ResourceLocation("gregtech:textures/gui/widget/pong_ball.png"), 0, 0, 1, 1)); + super(xPosition, yPosition, 8, 8, + new TextureArea(new ResourceLocation("gregtech:textures/gui/widget/pong_ball.png"), 0, 0, 1, 1)); theta = (Math.random() > 0.5 ? Math.PI : Math.PI / 2) + Math.random() * 0.2; xAccurate = xPosition; yAccurate = yPosition; @@ -39,6 +43,6 @@ public void addSelfPosition(double addX, double addY) { } public Vector2f getPreciseSelfPosition() { - return new Vector2f((float) xAccurate , (float) yAccurate); + return new Vector2f((float) xAccurate, (float) yAccurate); } } diff --git a/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java b/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java index 31a59aaa5fc..758f2c80a20 100644 --- a/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java +++ b/src/main/java/gregtech/common/terminal/app/game/pong/widget/PaddleWidget.java @@ -3,10 +3,12 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.util.Position; + import java.awt.*; import java.util.function.Function; public class PaddleWidget extends Widget { + Function controlSupplier; public PaddleWidget(int x, int y, int width, int height, Function controlSupplier) { @@ -16,7 +18,9 @@ public PaddleWidget(int x, int y, int width, int height, Function extends AbstractApplication implements - SearchComponent.IWidgetSearch>> { + SearchComponent.IWidgetSearch>> { + private GuidePageWidget pageWidget; private TreeListWidget tree; private TreeNode ROOT; @@ -90,6 +93,7 @@ protected IGuiTexture itemIcon(T item) { /** * Should return a localised representation of the item + * * @param item item * @return localised name */ @@ -130,7 +134,7 @@ public final void loadJsonFiles() { jsonObjectMap = new HashMap<>(); for (JsonObject json : jsons) { T t = ofJson(json); - if(t != null) { + if (t != null) { registerItem(t, json.get("section").getAsString()); jsonObjectMap.put(t, json); } @@ -153,13 +157,14 @@ public boolean isManualInterrupt() { @Override public void search(String word, Consumer>> find) { Stack> stack = new Stack<>(); - if(getTree() != null) { + if (getTree() != null) { stack.push(getTree()); dfsSearch(Thread.currentThread(), stack, word.toLowerCase(), find); } } - private boolean dfsSearch(Thread thread, Stack> stack, String regex, Consumer>> find) { + private boolean dfsSearch(Thread thread, Stack> stack, String regex, + Consumer>> find) { if (thread.isInterrupted()) { return true; } else { @@ -191,7 +196,7 @@ protected void registerItem(T item, String path) { String[] parts = path.split("/"); TreeNode child = ROOT; if (!parts[0].isEmpty()) { - for(String sub : parts) { + for (String sub : parts) { child = child.getOrCreateChild(sub); } } @@ -211,13 +216,13 @@ public void selectResult(Stack> result) { @Override public String resultDisplay(Stack> result) { Iterator> iterator = result.iterator(); - if(!iterator.hasNext()) return ""; + if (!iterator.hasNext()) return ""; iterator.next(); // skip root StringBuilder builder = new StringBuilder(); while (iterator.hasNext()) { TreeNode node = iterator.next(); builder.append(node.getContent() == null ? node.getKey() : itemName(node.getContent())); - if(iterator.hasNext()) + if (iterator.hasNext()) builder.append(" / "); } return builder.toString(); @@ -229,11 +234,12 @@ public List getMenuComponents() { } private void buildTree() { - this.tree = new TreeListWidget<>(0, 0, getOs().getSize().width - 200, getOs().getSize().height, getTree(), this::loadPage).setContentIconSupplier(this::itemIcon) - .setContentNameSupplier(this::itemName) - .setKeyNameSupplier(key -> key) - .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) - .setLeafTexture(GuiTextures.SLOT_DARKENED); + this.tree = new TreeListWidget<>(0, 0, getOs().getSize().width - 200, getOs().getSize().height, getTree(), + this::loadPage).setContentIconSupplier(this::itemIcon) + .setContentNameSupplier(this::itemName) + .setKeyNameSupplier(key -> key) + .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) + .setLeafTexture(GuiTextures.SLOT_DARKENED); this.addWidget(this.tree); } @@ -244,13 +250,12 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, Position position = this.pageWidget.getPosition(); mouseX = (int) ((mouseX - position.x * (1 - scale)) / scale); mouseY = (int) (mouseY / scale); - GlStateManager.translate(position.x * (1- scale), 0, 0); + GlStateManager.translate(position.x * (1 - scale), 0, 0); GlStateManager.scale(scale, scale, 1); this.pageWidget.drawInBackground(mouseX, mouseY, partialTicks, context); GlStateManager.scale(1 / scale, 1 / scale, 1); GlStateManager.translate(position.x * (scale - 1), 0, 0); } - } @Override @@ -260,11 +265,11 @@ protected void hookDrawInForeground(int mouseX, int mouseY) { Position position = this.pageWidget.getPosition(); mouseX = (int) ((mouseX - position.x * (1 - scale)) / scale); mouseY = (int) (mouseY / scale); - GlStateManager.translate(position.x * (1- scale), 0, 0); + GlStateManager.translate(position.x * (1 - scale), 0, 0); GlStateManager.scale(scale, scale, 1); this.pageWidget.drawInForeground(mouseX, mouseY); GlStateManager.scale(1 / scale, 1 / scale, 1); - GlStateManager.translate(position.x * (scale - 1) , 0, 0); + GlStateManager.translate(position.x * (scale - 1), 0, 0); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java index e1793934482..d86bfe35d0c 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/ItemGuideApp.java @@ -1,14 +1,16 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.ItemStackTexture; import gregtech.api.items.metaitem.MetaItem; import gregtech.common.items.MetaItems; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.Objects; public class ItemGuideApp extends GuideApp { @@ -25,7 +27,8 @@ protected String itemName(GuideItem item) { @Override protected String rawItemName(GuideItem item) { if (item.stack.getItem() instanceof MetaItem) { - MetaItem.MetaValueItem metaValueItem = ((MetaItem) item.stack.getItem()).getItem((short) item.stack.getMetadata()); + MetaItem.MetaValueItem metaValueItem = ((MetaItem) item.stack.getItem()) + .getItem((short) item.stack.getMetadata()); if (metaValueItem != null) return metaValueItem.unlocalizedName; } return item.stack.getTranslationKey(); @@ -42,6 +45,7 @@ public GuideItem ofJson(JsonObject json) { } public static class GuideItem { + public final ItemStack stack; public final String name; @@ -75,7 +79,8 @@ public static GuideItem ofJson(JsonObject json) { if (json.has("metaitem")) { String metaItemId = json.get("metaitem").getAsString(); for (MetaItem metaItem : MetaItem.getMetaItems()) { - MetaItem.MetaValueItem metaValueItem = metaItem.getAllItems().stream().filter(m -> m.unlocalizedName.equals(metaItemId)).findFirst().orElse(null); + MetaItem.MetaValueItem metaValueItem = metaItem.getAllItems().stream() + .filter(m -> m.unlocalizedName.equals(metaItemId)).findFirst().orElse(null); if (metaValueItem != null) return new GuideItem(metaValueItem); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java index b0acc8b419d..6e261666def 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/MultiBlockGuideApp.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.resources.ItemStackTexture; @@ -9,6 +7,9 @@ import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.MetaTileEntities; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public class MultiBlockGuideApp extends GuideApp { public MultiBlockGuideApp() { @@ -17,7 +18,7 @@ public MultiBlockGuideApp() { @Override public MetaTileEntity ofJson(JsonObject json) { - String[] valids = {"multiblock", "metatileentity"}; + String[] valids = { "multiblock", "metatileentity" }; if (json.isJsonObject()) { for (String valid : valids) { JsonElement id = json.getAsJsonObject().get(valid); diff --git a/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java index 3e57cb3f3e8..171f108dfbb 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/SimpleMachineGuideApp.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.gui.resources.IGuiTexture; @@ -10,6 +8,9 @@ import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.MetaTileEntities; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public class SimpleMachineGuideApp extends GuideApp { public SimpleMachineGuideApp() { @@ -33,7 +34,7 @@ protected String rawItemName(MetaTileEntity item) { @Override public MetaTileEntity ofJson(JsonObject json) { - String[] valids = {"machine", "generator", "metatileentity"}; + String[] valids = { "machine", "generator", "metatileentity" }; if (json.isJsonObject()) { for (String valid : valids) { JsonElement id = json.getAsJsonObject().get(valid); diff --git a/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java b/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java index 3bf5f1da190..eeed5585413 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java +++ b/src/main/java/gregtech/common/terminal/app/guide/TutorialGuideApp.java @@ -1,10 +1,12 @@ package gregtech.common.terminal.app.guide; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ItemStackTexture; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; +import com.google.gson.JsonObject; + public class TutorialGuideApp extends GuideApp { public TutorialGuideApp() { diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java index 7169c47c3af..3d59cc9f862 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/CardWidget.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -9,12 +8,15 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.BooleanConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; +import com.google.gson.JsonObject; + import java.util.function.Consumer; -public class CardWidget extends GuideWidget{ +public class CardWidget extends GuideWidget { + public final static String NAME = "card"; - //config + // config public int width; public int height; public boolean isShadow; @@ -35,7 +37,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new BooleanConfigurator(group, config, "isShadow", true).setOnUpdated(needUpdate)); if (!isFixed) { group.addWidget(new NumberConfigurator(group, config, "width").setOnUpdated(needUpdate)); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java index e0cd3599b4f..bf388e66b09 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuidePageWidget.java @@ -1,9 +1,5 @@ package gregtech.common.terminal.app.guide.widget; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -12,14 +8,19 @@ import gregtech.api.util.interpolate.Eases; import gregtech.api.util.interpolate.Interpolator; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; public class GuidePageWidget extends DraggableScrollableWidgetGroup { + public static final Map REGISTER_WIDGETS = new HashMap<>(); - static { //register guide widgets + static { // register guide widgets REGISTER_WIDGETS.put(TextBoxWidget.NAME, new TextBoxWidget()); REGISTER_WIDGETS.put(ImageWidget.NAME, new ImageWidget()); REGISTER_WIDGETS.put(CardWidget.NAME, new CardWidget()); @@ -42,7 +43,6 @@ public GuidePageWidget(int xPosition, int yPosition, int width, int height, int .setYBarStyle(new ColorRectTexture(new Color(142, 142, 142)), new ColorRectTexture(new Color(148, 226, 193))); this.setUseScissor(false); - } public int getPageWidth() { @@ -108,7 +108,8 @@ public void loadJsonConfig(JsonObject config) { int y = title.getSize().height + 10; for (JsonElement element : config.getAsJsonArray("stream")) { JsonObject widgetConfig = element.getAsJsonObject(); - Widget widget = REGISTER_WIDGETS.get(widgetConfig.get("type").getAsString()).updateOrCreateStreamWidget(margin, y, pageWidth - 2 * margin, widgetConfig); + Widget widget = REGISTER_WIDGETS.get(widgetConfig.get("type").getAsString()) + .updateOrCreateStreamWidget(margin, y, pageWidth - 2 * margin, widgetConfig); y += widget.getSize().height + 5; stream.add(widget); this.addWidget(widget); @@ -170,7 +171,8 @@ public void jumpToRef(String ref) { if (interpolator != null && !interpolator.isFinish()) return; for (Widget widget : widgets) { if (widget instanceof IGuideWidget && ref.equals(((IGuideWidget) widget).getRef())) { - interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, Eases.QUAD_OUT, + interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, + Eases.QUAD_OUT, value -> setScrollYOffset(value.intValue()), value -> interpolator = null); interpolator.start(); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java index e28909fe599..9055e6cf1cb 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidget.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; @@ -11,14 +9,19 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; + import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public abstract class GuideWidget extends Widget implements IGuideWidget { - //config + + // config public String ref; public int fill; public int stroke; @@ -34,7 +37,7 @@ public GuideWidget(int x, int y, int width, int height) { super(x, y, width, height); } - public GuideWidget(){ + public GuideWidget() { super(Position.ORIGIN, Size.ZERO); } @@ -50,7 +53,7 @@ public boolean isFixed() { protected abstract Widget initFixed(); - protected Widget initStream(){ + protected Widget initStream() { return initFixed(); } @@ -97,7 +100,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new ColorConfigurator(group, config, "fill", 0).setOnUpdated(needUpdate)); group.addWidget(new ColorConfigurator(group, config, "stroke", 0).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "stroke_width", 1).setOnUpdated(needUpdate)); @@ -162,7 +166,7 @@ public void drawInForeground(int mouseX, int mouseY) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { Position position = getPosition(); Size size = getSize(); - if(stroke != 0) { + if (stroke != 0) { drawBorder(position.x, position.y, size.width, size.height, stroke, stroke_width); } if (fill != 0) { @@ -173,8 +177,8 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (link != null && isMouseOverElement(mouseX, mouseY) && isCtrlDown()) { - page.jumpToRef(link); - return true; + page.jumpToRef(link); + return true; } return false; } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java index db80974f163..51a91cf93dc 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/GuideWidgetGroup.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.WidgetGroup; @@ -12,14 +10,19 @@ import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; + import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public abstract class GuideWidgetGroup extends WidgetGroup implements IGuideWidget { - //config + + // config public String ref; public int fill; public int stroke; @@ -35,7 +38,7 @@ public GuideWidgetGroup(int x, int y, int width, int height) { super(x, y, width, height); } - public GuideWidgetGroup(){ + public GuideWidgetGroup() { super(Position.ORIGIN, Size.ZERO); } @@ -92,7 +95,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new ColorConfigurator(group, config, "fill", 0).setOnUpdated(needUpdate)); group.addWidget(new ColorConfigurator(group, config, "stroke", 0).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "stroke_width", 1).setOnUpdated(needUpdate)); @@ -172,7 +176,7 @@ public void drawInForeground(int mouseX, int mouseY) { public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { Position position = getPosition(); Size size = getSize(); - if(stroke != 0) { + if (stroke != 0) { drawBorder(position.x, position.y, size.width, size.height, stroke, stroke_width); } if (fill != 0) { @@ -189,5 +193,4 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { } return super.mouseClicked(mouseX, mouseY, button); } - } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java index 77fe7a8b4a1..7fb947c8c26 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/IGuideWidget.java @@ -1,17 +1,19 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.Position; import gregtech.api.util.Size; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.lang.reflect.Field; import java.util.function.Consumer; public interface IGuideWidget { + String getRegistryName(); JsonObject getConfig(); @@ -24,7 +26,7 @@ public interface IGuideWidget { void setPage(GuidePageWidget page); - default void updateValue(String field){ + default void updateValue(String field) { JsonObject config = getConfig(); if (config != null && config.has(field)) { try { @@ -36,9 +38,9 @@ default void updateValue(String field){ f.set(this, new Gson().fromJson(value, f.getGenericType())); } if (isFixed()) { - updateOrCreateFixedWidget(0,0,0,0,null); + updateOrCreateFixedWidget(0, 0, 0, 0, null); } else { - updateOrCreateStreamWidget(0,0,0,null); + updateOrCreateStreamWidget(0, 0, 0, null); } } catch (Exception ignored) {} } @@ -48,11 +50,12 @@ default void updateValue(String field){ JsonObject getTemplate(boolean isFixed); - void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate); + void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate); void setStroke(int color); default void onFixedPositionSizeChanged(Position position, Size size) { - updateOrCreateFixedWidget(0,0,0,0,null); + updateOrCreateFixedWidget(0, 0, 0, 0, null); } } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java index 9570dc7b01f..b5f6fd5d71b 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/ImageWidget.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.IGuiTexture; @@ -8,21 +7,25 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.resources.URLTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; +import gregtech.api.util.Position; +import gregtech.api.util.Size; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.SelectorConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.StringConfigurator; -import gregtech.api.util.Position; -import gregtech.api.util.Size; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import com.google.gson.JsonObject; + import java.util.Arrays; import java.util.function.Consumer; -public class ImageWidget extends GuideWidget{ +public class ImageWidget extends GuideWidget { + public final static String NAME = "image"; - //config + // config public String form; public String source; public int width; @@ -46,12 +49,14 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { if (!isFixed) { group.addWidget(new NumberConfigurator(group, config, "width").setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "height").setOnUpdated(needUpdate)); } - group.addWidget(new SelectorConfigurator(group, config, "form", Arrays.asList("url", "item", "resource")).setOnUpdated(needUpdate)); + group.addWidget(new SelectorConfigurator(group, config, "form", Arrays.asList("url", "item", "resource")) + .setOnUpdated(needUpdate)); group.addWidget(new StringConfigurator(group, config, "source").setOnUpdated(needUpdate)); super.loadConfigurator(group, config, isFixed, needUpdate); } @@ -98,8 +103,8 @@ protected Widget initFixed() { @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { if (image != null) { - super.drawInBackground(mouseX, mouseY, partialTicks,context); - GlStateManager.color(1,1,1,1); + super.drawInBackground(mouseX, mouseY, partialTicks, context); + GlStateManager.color(1, 1, 1, 1); Position position = getPosition(); image.draw(position.x, position.y, getSize().width, getSize().height); } diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java index 7b5e20d5cbf..4fcb005954c 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/SlotListWidget.java @@ -1,24 +1,27 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -import gregtech.common.terminal.app.guideeditor.widget.configurator.ItemStackConfigurator; import gregtech.api.util.Size; +import gregtech.common.terminal.app.guideeditor.widget.configurator.ItemStackConfigurator; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.ItemStackHandler; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class SlotListWidget extends GuideWidgetGroup { + public final static String NAME = "slots"; // config @@ -62,17 +65,20 @@ public String getRegistryName() { @Override public JsonObject getTemplate(boolean isFixed) { JsonObject template = super.getTemplate(isFixed); - template.add("item_list", new Gson().toJsonTree(Collections.singletonList(new ItemStackInfo("minecraft:ender_pearl", 0, 1)))); + template.add("item_list", + new Gson().toJsonTree(Collections.singletonList(new ItemStackInfo("minecraft:ender_pearl", 0, 1)))); return template; } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { super.loadConfigurator(group, config, isFixed, needUpdate); group.addWidget(new ItemStackConfigurator(group, config, "item_list").setOnUpdated(needUpdate)); } public static class ItemStackInfo { + // config public String id; public int damage; @@ -80,9 +86,7 @@ public static class ItemStackInfo { private transient ItemStack itemStack; - public ItemStackInfo() { - - } + public ItemStackInfo() {} public void update(ItemStack itemStack) { ResourceLocation resourceLocation = itemStack.getItem().getRegistryName(); diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java index 847e4c21124..8de6641bd72 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/TankListWidget.java @@ -1,25 +1,28 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.Widget; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.IGuiTexture; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -import gregtech.common.terminal.app.guideeditor.widget.configurator.FluidStackConfigurator; import gregtech.api.util.Size; +import gregtech.common.terminal.app.guideeditor.widget.configurator.FluidStackConfigurator; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.awt.*; import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class TankListWidget extends GuideWidgetGroup { + public final static String NAME = "tanks"; // config @@ -46,7 +49,8 @@ public Widget initFixed() { int i = x + y * maxXSize; if (i < size) { FluidStack fluidStack = fluid_list.get(i).getInstance(); - TankWidget widget = new TankWidget(new FluidTank(fluidStack, fluid_list.get(i).amount), xPos + x * 18, y * 18, 18, 18); + TankWidget widget = new TankWidget(new FluidTank(fluidStack, fluid_list.get(i).amount), + xPos + x * 18, y * 18, 18, 18); widget.setBackgroundTexture(background).setAlwaysShowFull(true).setClient(); this.addWidget(widget); } @@ -64,26 +68,27 @@ public String getRegistryName() { @Override public JsonObject getTemplate(boolean isFixed) { JsonObject template = super.getTemplate(isFixed); - template.add("fluid_list", new Gson().toJsonTree(Collections.singletonList(new FluidStackInfo("distilled_water", 1)))); + template.add("fluid_list", + new Gson().toJsonTree(Collections.singletonList(new FluidStackInfo("distilled_water", 1)))); return template; } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { super.loadConfigurator(group, config, isFixed, needUpdate); group.addWidget(new FluidStackConfigurator(group, config, "fluid_list").setOnUpdated(needUpdate)); } public static class FluidStackInfo { + // config public String id; public int amount = 1; private transient FluidStack fluidStack; - public FluidStackInfo() { - - } + public FluidStackInfo() {} public void update(FluidStack itemStack) { if (itemStack != null) { diff --git a/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java b/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java index 756ba8875c9..465a4679b60 100644 --- a/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guide/widget/TextBoxWidget.java @@ -1,27 +1,30 @@ package gregtech.common.terminal.app.guide.widget; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; +import gregtech.api.util.Position; +import gregtech.api.util.Size; import gregtech.common.terminal.app.guideeditor.widget.configurator.BooleanConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.ColorConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.NumberConfigurator; import gregtech.common.terminal.app.guideeditor.widget.configurator.TextListConfigurator; -import gregtech.api.util.Position; -import gregtech.api.util.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Consumer; public class TextBoxWidget extends GuideWidget { + public final static String NAME = "textbox"; // config @@ -34,7 +37,8 @@ public class TextBoxWidget extends GuideWidget { private transient List textLines; - public TextBoxWidget(int x, int y, int width, List content, int space, int fontSize, int fontColor, int fill, int stroke, boolean isCenter, boolean isShadow) { + public TextBoxWidget(int x, int y, int width, List content, int space, int fontSize, int fontColor, + int fill, int stroke, boolean isCenter, boolean isShadow) { super(x, y, width, 0); this.content = content; this.space = space; @@ -67,7 +71,8 @@ public JsonObject getTemplate(boolean isFixed) { } @Override - public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, Consumer needUpdate) { + public void loadConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, boolean isFixed, + Consumer needUpdate) { group.addWidget(new TextListConfigurator(group, 200, config, "content").setOnUpdated(needUpdate)); group.addWidget(new BooleanConfigurator(group, config, "isCenter", false).setOnUpdated(needUpdate)); group.addWidget(new NumberConfigurator(group, config, "fontSize", 9).setOnUpdated(needUpdate)); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java b/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java index 8bd82660669..a8d19adf9e7 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/GuideEditorApp.java @@ -33,21 +33,24 @@ public AbstractApplication initApp() { @Override public List getMenuComponents() { - ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE).setHoverText("terminal.component.new_page").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.newPage(); - } - }); - ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD).setHoverText("terminal.component.load_file").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.loadJson(); - } - }); - ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE).setHoverText("terminal.component.save_file").setClickConsumer(cd->{ - if (configEditor != null) { - configEditor.saveJson(); - } - }); + ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE) + .setHoverText("terminal.component.new_page").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.newPage(); + } + }); + ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD) + .setHoverText("terminal.component.load_file").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.loadJson(); + } + }); + ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE) + .setHoverText("terminal.component.save_file").setClickConsumer(cd -> { + if (configEditor != null) { + configEditor.saveJson(); + } + }); return Arrays.asList(newPage, importPage, exportPage); } @@ -55,5 +58,4 @@ public List getMenuComponents() { public boolean isClientSideApp() { return true; } - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java index 86a982affc0..83f6ad93091 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuideConfigEditor.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget; -import com.google.gson.JsonObject; import gregtech.api.GregTechAPI; import gregtech.api.block.machines.MachineItemBlock; import gregtech.api.gui.GuiTextures; @@ -30,10 +29,13 @@ import gregtech.common.terminal.app.guide.widget.GuidePageWidget; import gregtech.common.terminal.app.guide.widget.IGuideWidget; import gregtech.common.terminal.app.guideeditor.GuideEditorApp; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.gson.JsonObject; + import java.awt.*; import java.io.File; import java.util.List; @@ -42,6 +44,7 @@ import java.util.stream.Collectors; public class GuideConfigEditor extends TabGroup { + public String json; private IGuideWidget selected; private GuidePageEditorWidget pageEditor; @@ -57,23 +60,27 @@ public class GuideConfigEditor extends TabGroup { public GuideConfigEditor(int x, int y, int width, int height, GuideEditorApp app) { super(x, y + 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, TerminalTheme.COLOR_B_3, 30, 10)); setSize(new Size(width, height)); - candidates = TerminalRegistry.getAllApps().stream().filter(GuideApp.class::isInstance).map(AbstractApplication::getUnlocalizedName).collect(Collectors.toList()); + candidates = TerminalRegistry.getAllApps().stream().filter(GuideApp.class::isInstance) + .map(AbstractApplication::getUnlocalizedName).collect(Collectors.toList()); type = candidates.get(candidates.size() - 1); handler = new SingleItemStackHandler(1); addButton = new CircleButtonWidget[2]; widgetSelector = createWidgetSelector(); widgetConfigurator = createConfigurator(); - this.addTab(new IGuiTextureTabInfo(new TextTexture("P", -1), "terminal.guide_editor.page_config"), createPageConfig()); - this.addTab(new IGuiTextureTabInfo(new TextTexture("W", -1), "terminal.guide_editor.widgets_box"), widgetSelector); - this.addTab(new IGuiTextureTabInfo(new TextTexture("C", -1), "terminal.guide_editor.widget_config"), widgetConfigurator); - this.setOnTabChanged((oldIndex, newIndex)->{ - if (newIndex == 1) { - addButton[0].setVisible(true); - addButton[1].setVisible(true); - } else { - addButton[0].setVisible(false); - addButton[1].setVisible(false); - } + this.addTab(new IGuiTextureTabInfo(new TextTexture("P", -1), "terminal.guide_editor.page_config"), + createPageConfig()); + this.addTab(new IGuiTextureTabInfo(new TextTexture("W", -1), "terminal.guide_editor.widgets_box"), + widgetSelector); + this.addTab(new IGuiTextureTabInfo(new TextTexture("C", -1), "terminal.guide_editor.widget_config"), + widgetConfigurator); + this.setOnTabChanged((oldIndex, newIndex) -> { + if (newIndex == 1) { + addButton[0].setVisible(true); + addButton[1].setVisible(true); + } else { + addButton[0].setVisible(false); + addButton[1].setVisible(false); + } }); addButton[0] = new CircleButtonWidget(115, 15, 8, 1, 8) .setColors(new Color(255, 255, 255, 0).getRGB(), @@ -105,34 +112,36 @@ public GuidePageEditorWidget getPageEditor() { } private DraggableScrollableWidgetGroup createPageConfig() { - DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10) - .setBackground(TerminalTheme.COLOR_B_3) - .setYScrollBarWidth(4) - .setYBarStyle(null, TerminalTheme.COLOR_F_1); + DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, + getSize().height - 10) + .setBackground(TerminalTheme.COLOR_B_3) + .setYScrollBarWidth(4) + .setYBarStyle(null, TerminalTheme.COLOR_F_1); group.addWidget(new LabelWidget(5, 5, "section", -1).setShadow(true)); group.addWidget(new TextFieldWidget(5, 15, 116, 20, new ColorRectTexture(0x9f000000), null, null) - .setTextResponder(s->{ + .setTextResponder(s -> { if (pageEditor != null) { pageEditor.setSection(s); } }, true) - .setTextSupplier(()-> getPageEditor().getSection(), true) + .setTextSupplier(() -> getPageEditor().getSection(), true) .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true)); - group.addWidget(new ImageWidget(5, 40,116, 1, new ColorRectTexture(-1))); + .setValidator(s -> true)); + group.addWidget(new ImageWidget(5, 40, 116, 1, new ColorRectTexture(-1))); group.addWidget(new LabelWidget(5, 45, "type", -1).setShadow(true)); group.addWidget(new SelectorWidget(30, 55, 91, 20, candidates, -1, - ()->type, true).setIsUp(true) - .setOnChanged(type-> this.type = type) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + () -> type, true).setIsUp(true) + .setOnChanged(type -> this.type = type) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); group.addWidget(new PhantomSlotWidget(handler, 0, 6, 56).setBackgroundTexture(TerminalTheme.COLOR_B_2)); - group.addWidget(new ImageWidget(5, 80,116, 1, new ColorRectTexture(-1))); + group.addWidget(new ImageWidget(5, 80, 116, 1, new ColorRectTexture(-1))); group.addWidget(new LabelWidget(5, 85, "title", -1).setShadow(true)); - titleEditor = new TextEditorWidget(5, 95, 116, 70, s->{ + titleEditor = new TextEditorWidget(5, 95, 116, 70, s -> { if (pageEditor != null) { pageEditor.setTitle(s); } @@ -146,16 +155,18 @@ public void updateTitle(String title) { } private DraggableScrollableWidgetGroup createWidgetSelector() { - DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10) - .setBackground(TerminalTheme.COLOR_B_3) - .setYScrollBarWidth(4) - .setYBarStyle(null, TerminalTheme.COLOR_F_1); - int y = 10; //133 + DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, + getSize().height - 10) + .setBackground(TerminalTheme.COLOR_B_3) + .setYScrollBarWidth(4) + .setYBarStyle(null, TerminalTheme.COLOR_F_1); + int y = 10; // 133 for (Map.Entry entry : GuidePageWidget.REGISTER_WIDGETS.entrySet()) { IGuideWidget widgetTemplate = entry.getValue(); JsonObject template = widgetTemplate.getTemplate(false); Widget guideWidget = widgetTemplate.updateOrCreateStreamWidget(5, y + 10, getSize().width - 14, template); - group.addWidget(new LabelWidget(getSize().width / 2 - 1, y - 3, entry.getKey(), -1).setXCentered(true).setShadow(true)); + group.addWidget(new LabelWidget(getSize().width / 2 - 1, y - 3, entry.getKey(), -1).setXCentered(true) + .setShadow(true)); y += guideWidget.getSize().height + 25; group.addWidget(guideWidget); } @@ -173,71 +184,76 @@ private DraggableScrollableWidgetGroup createConfigurator() { public void loadConfigurator(IGuideWidget widget) { widgetConfigurator.clearAllWidgets(); if (widget != null) { - widget.loadConfigurator(widgetConfigurator, widget.getConfig(), widget.isFixed(), type->{ + widget.loadConfigurator(widgetConfigurator, widget.getConfig(), widget.isFixed(), type -> { widget.updateValue(type); if (pageEditor != null) { pageEditor.computeMax(); } }); - widgetConfigurator.addWidget(new WidgetGroup(new Position(5, widgetConfigurator.getWidgetBottomHeight() + 5), Size.ZERO)); + widgetConfigurator.addWidget( + new WidgetGroup(new Position(5, widgetConfigurator.getWidgetBottomHeight() + 5), Size.ZERO)); } } public void newPage() { - TerminalDialogWidget.showConfirmDialog(app.getOs(), "terminal.component.new_page", "terminal.component.confirm", res->{ - if (res) { - pageEditor.loadJsonConfig("{\"section\":\"default\",\"title\":\"Template\",\"stream\":[],\"fixed\":[]}"); - getPageEditor().setSection("default"); - updateTitle("Template"); - type = candidates.get(candidates.size() - 1); - handler.setStackInSlot(0, ItemStack.EMPTY); - } - }).setClientSide().open(); + TerminalDialogWidget + .showConfirmDialog(app.getOs(), "terminal.component.new_page", "terminal.component.confirm", res -> { + if (res) { + pageEditor.loadJsonConfig( + "{\"section\":\"default\",\"title\":\"Template\",\"stream\":[],\"fixed\":[]}"); + getPageEditor().setSection("default"); + updateTitle("Template"); + type = candidates.get(candidates.size() - 1); + handler.setStackInSlot(0, ItemStack.EMPTY); + } + }).setClientSide().open(); } public void loadJson() { if (pageEditor != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH,"guide"); - TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.load_file", file, true, result->{ - if (result != null && result.isFile()) { - try { - JsonObject config = Objects.requireNonNull(FileUtility.loadJson(result)).getAsJsonObject(); - pageEditor.loadJsonConfig(config); - getPageEditor().setSection(config.get("section").getAsString()); - updateTitle(config.get("title").getAsString()); - for (AbstractApplication app : TerminalRegistry.getAllApps()) { - if (app instanceof GuideApp) { - Object object = ((GuideApp) app).ofJson(config); - if (object != null) { - type = app.getUnlocalizedName(); - if (object instanceof ItemGuideApp.GuideItem) { - handler.setStackInSlot(0, ((ItemGuideApp.GuideItem) object).stack.copy()); - } else if (object instanceof MetaTileEntity) { - handler.setStackInSlot(0, ((MetaTileEntity) object).getStackForm()); - } else if (object instanceof ItemStack) { - handler.setStackInSlot(0, ((ItemStack) object).copy()); - } else { - handler.setStackInSlot(0, ItemStack.EMPTY); - } - break; - } - } - } - } catch (Exception e) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", "terminal.component.load_file.error").setClientSide().open(); - } - } + File file = new File(TerminalRegistry.TERMINAL_PATH, "guide"); + TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.load_file", file, true, result -> { + if (result != null && result.isFile()) { + try { + JsonObject config = Objects.requireNonNull(FileUtility.loadJson(result)).getAsJsonObject(); + pageEditor.loadJsonConfig(config); + getPageEditor().setSection(config.get("section").getAsString()); + updateTitle(config.get("title").getAsString()); + for (AbstractApplication app : TerminalRegistry.getAllApps()) { + if (app instanceof GuideApp) { + Object object = ((GuideApp) app).ofJson(config); + if (object != null) { + type = app.getUnlocalizedName(); + if (object instanceof ItemGuideApp.GuideItem) { + handler.setStackInSlot(0, ((ItemGuideApp.GuideItem) object).stack.copy()); + } else if (object instanceof MetaTileEntity) { + handler.setStackInSlot(0, ((MetaTileEntity) object).getStackForm()); + } else if (object instanceof ItemStack) { + handler.setStackInSlot(0, ((ItemStack) object).copy()); + } else { + handler.setStackInSlot(0, ItemStack.EMPTY); + } + break; + } + } + } + } catch (Exception e) { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", + "terminal.component.load_file.error").setClientSide().open(); + } + } }).setClientSide().open(); } } public void saveJson() { - if(pageEditor != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH,"guide"); - TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.save_file", file, false, result->{ + if (pageEditor != null) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "guide"); + TerminalDialogWidget.showFileDialog(app.getOs(), "terminal.component.save_file", file, false, result -> { if (result != null) { - if(!FileUtility.saveJson(result, saveType(pageEditor.getJsonConfig()))) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); + if (!FileUtility.saveJson(result, saveType(pageEditor.getJsonConfig()))) { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.error", + "terminal.component.save_file.error").setClientSide().open(); } } }).setClientSide().open(); @@ -251,19 +267,23 @@ private JsonObject saveType(JsonObject jsonObject) { if (type.equals(app.getUnlocalizedName())) { if (app instanceof ItemGuideApp) { if (stack.isEmpty()) { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", "terminal.guide_editor.error_type").setClientSide().open(); + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", + "terminal.guide_editor.error_type").setClientSide().open(); } else { - jsonObject.addProperty("item", Item.REGISTRY.getNameForObject(stack.getItem()).toString() + ":" + stack.getMetadata()); + jsonObject.addProperty("item", Item.REGISTRY.getNameForObject(stack.getItem()).toString() + + ":" + stack.getMetadata()); } - } else if ((app instanceof MultiBlockGuideApp || app instanceof SimpleMachineGuideApp) - && stack.getItem() instanceof MachineItemBlock) { - MetaTileEntity mte = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); - if (mte != null) { - jsonObject.addProperty("metatileentity", GregTechAPI.MTE_REGISTRY.getNameForObject(mte).getPath()); - } else { - TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", "terminal.guide_editor.error_type").setClientSide().open(); - } - } + } else if ((app instanceof MultiBlockGuideApp || app instanceof SimpleMachineGuideApp) && + stack.getItem() instanceof MachineItemBlock) { + MetaTileEntity mte = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); + if (mte != null) { + jsonObject.addProperty("metatileentity", + GregTechAPI.MTE_REGISTRY.getNameForObject(mte).getPath()); + } else { + TerminalDialogWidget.showInfoDialog(app.getOs(), "terminal.component.warning", + "terminal.guide_editor.error_type").setClientSide().open(); + } + } return jsonObject; } } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java index 1c78005ebd0..9f15e37b052 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/GuidePageEditorWidget.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -15,10 +13,15 @@ import gregtech.api.util.interpolate.Interpolator; import gregtech.common.terminal.app.guide.widget.GuidePageWidget; import gregtech.common.terminal.app.guide.widget.IGuideWidget; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + public class GuidePageEditorWidget extends GuidePageWidget { + private Widget selected; private final WidgetGroup toolButtons; private final CustomPositionSizeWidget customPositionSizeWidget; @@ -29,7 +32,8 @@ public GuidePageEditorWidget(int xPosition, int yPosition, int width, int height super(xPosition, yPosition, width, height, margin); this.setDraggable(false); setTitle("Template"); - customPositionSizeWidget = new CustomPositionSizeWidget(0xff0000ff, 0xffff0000, 2).setOnUpdated(this::onPosSizeChanged); + customPositionSizeWidget = new CustomPositionSizeWidget(0xff0000ff, 0xffff0000, 2) + .setOnUpdated(this::onPosSizeChanged); toolButtons = new WidgetGroup(Position.ORIGIN, Size.ZERO); toolButtons.setVisible(false); toolButtons.addWidget(new CircleButtonWidget(-20, -4, 8, 1, 12) @@ -99,7 +103,8 @@ private void setToolButton(Widget widget) { customPositionSizeWidget.setVisible(true); customPositionSizeWidget.setActive(!(widget instanceof IGuideWidget) || ((IGuideWidget) widget).isFixed()); toolButtons.setVisible(true); - toolButtons.setSelfPosition(new Position(widget.getSelfPosition().x + widget.getSize().width / 2, widget.getSelfPosition().y)); + toolButtons.setSelfPosition( + new Position(widget.getSelfPosition().x + widget.getSize().width / 2, widget.getSelfPosition().y)); } private void delete(ClickData clickData) { @@ -170,7 +175,8 @@ public JsonObject addGuideWidget(IGuideWidget widget, boolean isFixed) { } stream.add(index + 1, guideWidget); } else { - guideWidget = widget.updateOrCreateStreamWidget(margin, getStreamBottom() + 5, pageWidth - 2 * margin, widgetConfig); + guideWidget = widget.updateOrCreateStreamWidget(margin, getStreamBottom() + 5, pageWidth - 2 * margin, + widgetConfig); stream.add(guideWidget); } this.addWidget(guideWidget); @@ -179,7 +185,6 @@ public JsonObject addGuideWidget(IGuideWidget widget, boolean isFixed) { return widgetConfig; } - public void moveUp(Widget widget) { int index = stream.indexOf(widget); if (index > 0) { @@ -190,13 +195,17 @@ public void moveUp(Widget widget) { int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { - widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU))); - target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD))); + widget.setSelfPosition( + new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU))); + target.setSelfPosition( + new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD))); if (widget == selected) { setToolButton(selected); } - widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && widget.getSelfPosition().y + widget.getSize().height > 0); - target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && target.getSelfPosition().y + target.getSize().height > 0); + widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && + widget.getSelfPosition().y + widget.getSize().height > 0); + target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && + target.getSelfPosition().y + target.getSize().height > 0); }, value -> { interpolator = null; stream.remove(widget); @@ -223,13 +232,17 @@ public void moveDown(Widget widget) { int y1 = widget.getSelfPosition().y; int y2 = target.getSelfPosition().y; interpolator = new Interpolator(0, 1, 10, Eases.LINEAR, value -> { - widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 + value.floatValue() * offsetD))); - target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 - value.floatValue() * offsetU))); + widget.setSelfPosition( + new Position(widget.getSelfPosition().x, (int) (y1 + value.floatValue() * offsetD))); + target.setSelfPosition( + new Position(target.getSelfPosition().x, (int) (y2 - value.floatValue() * offsetU))); if (widget == selected) { setToolButton(selected); } - widget.setVisible(widget.getSelfPosition().y < getSize().height - xBarHeight && widget.getSelfPosition().y + widget.getSize().height > 0); - target.setVisible(target.getSelfPosition().y < getSize().height - xBarHeight && target.getSelfPosition().y + target.getSize().height > 0); + widget.setVisible(widget.getSelfPosition().y < getSize().height - xBarHeight && + widget.getSelfPosition().y + widget.getSize().height > 0); + target.setVisible(target.getSelfPosition().y < getSize().height - xBarHeight && + target.getSelfPosition().y + target.getSize().height > 0); }, value -> { interpolator = null; stream.remove(widget); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java index ad021c5cc07..8814b973136 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/BooleanConfigurator.java @@ -1,28 +1,30 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; +import com.google.gson.JsonObject; + import java.awt.*; -public class BooleanConfigurator extends ConfiguratorWidget{ +public class BooleanConfigurator extends ConfiguratorWidget { public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); } - public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, boolean defaultValue) { + public BooleanConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + boolean defaultValue) { super(group, config, name, defaultValue); } - protected void init(){ + protected void init() { this.addWidget(new RectButtonWidget(0, 15, 10, 10, 2) - .setToggleButton(new ColorRectTexture(new Color(198, 198, 198).getRGB()), (c, p)->updateValue(p)) - .setValueSupplier(true, ()->{ - if(config.get(name).isJsonNull()) { + .setToggleButton(new ColorRectTexture(new Color(198, 198, 198).getRGB()), (c, p) -> updateValue(p)) + .setValueSupplier(true, () -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsBoolean(); diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java index fa36c712544..5ed6aec5fe6 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ColorConfigurator.java @@ -1,10 +1,11 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.terminal.gui.widgets.ColorWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; -public class ColorConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonObject; + +public class ColorConfigurator extends ConfiguratorWidget { public ColorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, int defaultValue) { super(group, config, name, defaultValue); @@ -14,14 +15,12 @@ public ColorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config super(group, config, name); } - protected void init(){ - this.addWidget(new ColorWidget(0, 15, 85, 10).setColorSupplier(()->{ - if(config.get(name).isJsonNull()) { + protected void init() { + this.addWidget(new ColorWidget(0, 15, 85, 10).setColorSupplier(() -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsInt(); - },true).setOnColorChanged(this::updateValue)); + }, true).setOnColorChanged(this::updateValue)); } - - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java index 706efc8f659..6d05bbac593 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ConfiguratorWidget.java @@ -1,20 +1,23 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.util.Position; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + import java.util.Collections; import java.util.function.Consumer; public class ConfiguratorWidget extends WidgetGroup { + protected T defaultValue; protected String name; protected boolean canDefault; @@ -36,7 +39,7 @@ public ConfiguratorWidget(DraggableScrollableWidgetGroup group, JsonObject confi this.canDefault = defaultValue != null; this.config = config; if (config.get(name) == null) { - config.addProperty(name, (String)null); + config.addProperty(name, (String) null); } if (canDefault && config.get(name).isJsonNull()) { isDefault = true; @@ -48,9 +51,7 @@ public ConfiguratorWidget(DraggableScrollableWidgetGroup group, JsonObject confi init(); } - protected void init() { - - } + protected void init() {} protected void updateValue(T value) { if (canDefault && isDefault) return; @@ -63,7 +64,7 @@ public ConfiguratorWidget setOnUpdated(Consumer onUpdated) { return this; } - protected void update(){ + protected void update() { if (onUpdated != null) { onUpdated.accept(name); } @@ -74,7 +75,8 @@ public void drawInForeground(int mouseX, int mouseY) { int x = getPosition().x; int y = getPosition().y; if (canDefault && isMouseOver(x + nameWidth + 4, y + 6, 5, 5, mouseX, mouseY)) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList(I18n.format("terminal.guide_editor.default")), 100, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList(I18n.format("terminal.guide_editor.default")), + 100, mouseX, mouseY); } if (!isDefault) { super.drawInForeground(mouseX, mouseY); @@ -95,10 +97,9 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender if (canDefault && isDefault) { super.drawInBackground(-100, -100, partialTicks, context); drawSolidRect(x, y + 15, this.getSize().width, this.getSize().height - 15, 0x99000000); - } else { + } else { super.drawInBackground(mouseX, mouseY, partialTicks, context); } - } @Override @@ -121,6 +122,5 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { return false; } - protected void onDefault() { - } + protected void onDefault() {} } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java index 3ef59fb6823..21ab8671f03 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/FluidStackConfigurator.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -14,10 +11,15 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.terminal.app.guide.widget.TankListWidget; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; -public class FluidStackConfigurator extends ConfiguratorWidget>{ +public class FluidStackConfigurator extends ConfiguratorWidget> { + DraggableScrollableWidgetGroup container; List tanks; @@ -26,11 +28,11 @@ public FluidStackConfigurator(DraggableScrollableWidgetGroup group, JsonObject c } protected void init() { - container = new DraggableScrollableWidgetGroup(0, 27,116, 100); + container = new DraggableScrollableWidgetGroup(0, 27, 116, 100); this.addWidget(container); this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1) .setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)) - .setClickListener(cd->{ + .setClickListener(cd -> { addSlot(container, new TankListWidget.FluidStackInfo(null, 0)); updateValue(); }) @@ -52,16 +54,17 @@ private void addSlot(DraggableScrollableWidgetGroup container, TankListWidget.Fl group.addWidget(new PhantomFluidWidget(1, 1, 18, 18, null, null) .setBackgroundTexture(TerminalTheme.COLOR_B_2) .setFluidStackSupplier(fluidStackInfo::getInstance, true) - .setFluidStackUpdater(fluidStack->{ + .setFluidStackUpdater(fluidStack -> { fluidStackInfo.update(fluidStack); updateValue(); - }, true)); + }, true)); group.addWidget(new RectButtonWidget(20, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) .setClickListener(data -> { - fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount - (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick? 100: 1)); + fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount - + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1)); updateValue(); }) .setHoverText("Shift -10|Ctrl -100|Shift+Ctrl -1000") @@ -71,13 +74,15 @@ private void addSlot(DraggableScrollableWidgetGroup container, TankListWidget.Fl TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) .setClickListener(data -> { - fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick? 100: 1)); + fluidStackInfo.amount = Math.max(0, fluidStackInfo.amount + + (data.isShiftClick ? data.isCtrlClick ? 1000 : 10 : data.isCtrlClick ? 100 : 1)); updateValue(); }) .setHoverText("Shift +10|Ctrl +100|Shift+Ctrl +1000") .setIcon(new TextTexture("+1", -1))); group.addWidget(new ImageWidget(40, 0, 36, 20, TerminalTheme.COLOR_B_2)); - group.addWidget(new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(fluidStackInfo.amount), true)); + group.addWidget( + new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(fluidStackInfo.amount), true)); group.addWidget(new RectButtonWidget(96, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java index 5091280f5ac..5171fd0cab7 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/ItemStackConfigurator.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -14,12 +11,18 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.inventory.handlers.SingleItemStackHandler; import gregtech.common.terminal.app.guide.widget.SlotListWidget; + import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; -public class ItemStackConfigurator extends ConfiguratorWidget>{ +public class ItemStackConfigurator extends ConfiguratorWidget> { + DraggableScrollableWidgetGroup container; List slots; @@ -28,11 +31,11 @@ public ItemStackConfigurator(DraggableScrollableWidgetGroup group, JsonObject co } protected void init() { - container = new DraggableScrollableWidgetGroup(0, 27,116, 100); + container = new DraggableScrollableWidgetGroup(0, 27, 116, 100); this.addWidget(container); this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1) .setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)) - .setClickListener(cd->{ + .setClickListener(cd -> { addSlot(container, new SlotListWidget.ItemStackInfo("minecraft:air", 0, 0)); updateValue(); }) @@ -49,14 +52,15 @@ protected void init() { } private void addSlot(DraggableScrollableWidgetGroup container, SlotListWidget.ItemStackInfo itemStackInfo) { - WidgetGroup group = new WidgetGroup(0,slots.size() * 20, 116, 20); + WidgetGroup group = new WidgetGroup(0, slots.size() * 20, 116, 20); slots.add(itemStackInfo); IItemHandlerModifiable handler = new SingleItemStackHandler(1); handler.setStackInSlot(0, itemStackInfo.getInstance()); - group.addWidget(new PhantomSlotWidget(handler, 0, 1, 1).setBackgroundTexture(TerminalTheme.COLOR_B_2).setChangeListener(()->{ - itemStackInfo.update(handler.getStackInSlot(0)); - updateValue(); - })); + group.addWidget(new PhantomSlotWidget(handler, 0, 1, 1).setBackgroundTexture(TerminalTheme.COLOR_B_2) + .setChangeListener(() -> { + itemStackInfo.update(handler.getStackInSlot(0)); + updateValue(); + })); group.addWidget(new RectButtonWidget(20, 0, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java index e3140aced5e..7435a9fdfce 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/NumberConfigurator.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.gui.widgets.SimpleTextWidget; @@ -9,7 +7,10 @@ import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; -public class NumberConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +public class NumberConfigurator extends ConfiguratorWidget { public NumberConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); @@ -19,7 +20,7 @@ public NumberConfigurator(DraggableScrollableWidgetGroup group, JsonObject confi super(group, config, name, defaultValue); } - protected void init(){ + protected void init() { int y = 15; this.addWidget(new RectButtonWidget(0, y, 20, 20) .setColors(TerminalTheme.COLOR_B_1.getColor(), diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java index ec5e57a6f16..e529beb7f32 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/SelectorConfigurator.java @@ -1,26 +1,30 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.SelectorWidget; import gregtech.api.terminal.os.TerminalTheme; +import com.google.gson.JsonObject; + import java.util.List; -public class SelectorConfigurator extends ConfiguratorWidget{ - public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, List candidates, String defaultValue) { +public class SelectorConfigurator extends ConfiguratorWidget { + + public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + List candidates, String defaultValue) { super(group, config, name, defaultValue); init(candidates); } - public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, List candidates) { + public SelectorConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + List candidates) { super(group, config, name); init(candidates); } - protected void init(List candidates){ - this.addWidget(new SelectorWidget(0, 15, 80, 20, candidates, -1, ()->{ - if(config.get(name).isJsonNull()) { + protected void init(List candidates) { + this.addWidget(new SelectorWidget(0, 15, 80, 20, candidates, -1, () -> { + if (config.get(name).isJsonNull()) { return defaultValue; } return config.get(name).getAsString(); @@ -31,5 +35,4 @@ protected void init(List candidates){ .setIsUp(true) .setOnChanged(this::updateValue)); } - } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java index ca45ce8dbd6..a838e3952aa 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/StringConfigurator.java @@ -1,20 +1,23 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.JsonObject; import gregtech.api.gui.resources.TextTexture; import gregtech.api.gui.widgets.TextFieldWidget; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.os.TerminalTheme; -public class StringConfigurator extends ConfiguratorWidget{ +import com.google.gson.JsonObject; + +public class StringConfigurator extends ConfiguratorWidget { + private TextFieldWidget textFieldWidget; public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name) { super(group, config, name); } - public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, String defaultValue) { + public StringConfigurator(DraggableScrollableWidgetGroup group, JsonObject config, String name, + String defaultValue) { super(group, config, name, defaultValue); } @@ -27,7 +30,7 @@ protected void init() { .setIcon(new TextTexture("terminal.guide_editor.update", -1))); textFieldWidget = new TextFieldWidget(0, 15, 76, 20, TerminalTheme.COLOR_B_2, null, null) .setMaxStringLength(Integer.MAX_VALUE) - .setValidator(s->true); + .setValidator(s -> true); if (config.has(name) && config.get(name).isJsonPrimitive()) { textFieldWidget.setCurrentString(config.get(name).getAsString()); } diff --git a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java index 1d41381a464..f40ed1f8255 100644 --- a/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java +++ b/src/main/java/gregtech/common/terminal/app/guideeditor/widget/configurator/TextListConfigurator.java @@ -1,14 +1,16 @@ package gregtech.common.terminal.app.guideeditor.widget.configurator; -import com.google.gson.*; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup; import gregtech.api.terminal.gui.widgets.TextEditorWidget; +import com.google.gson.*; + import java.util.Collections; import java.util.List; -public class TextListConfigurator extends ConfiguratorWidget>{ +public class TextListConfigurator extends ConfiguratorWidget> { + private TextEditorWidget editor; public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name) { @@ -16,7 +18,8 @@ public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, Js init(height); } - public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name, String defaultValue) { + public TextListConfigurator(DraggableScrollableWidgetGroup group, int height, JsonObject config, String name, + String defaultValue) { super(group, config, name, Collections.singletonList(defaultValue)); init(height); } @@ -29,7 +32,8 @@ protected void init(int height) { initValue = String.join("\n", init); } - editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue).setBackground(new ColorRectTexture(0xA3FFFFFF)); + editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue) + .setBackground(new ColorRectTexture(0xA3FFFFFF)); this.addWidget(editor); } diff --git a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java index 07cbf4e6d97..21554ada83b 100644 --- a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java +++ b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareManagerApp.java @@ -3,13 +3,14 @@ import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.*; import gregtech.api.gui.widgets.WidgetGroup; -import gregtech.client.shader.Shaders; import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.app.AbstractApplication; import gregtech.api.terminal.gui.widgets.RectButtonWidget; import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.os.TerminalTheme; +import gregtech.client.shader.Shaders; import gregtech.common.items.MetaItems; + import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -17,7 +18,9 @@ import java.util.concurrent.atomic.AtomicInteger; public class HardwareManagerApp extends AbstractApplication { - private static final TextureArea CIRCUIT_LINE = TextureArea.fullImage("textures/gui/terminal/hardware_manager/circuit.png"); + + private static final TextureArea CIRCUIT_LINE = TextureArea + .fullImage("textures/gui/terminal/hardware_manager/circuit.png"); @SideOnly(Side.CLIENT) private ShaderTexture circuit; private HardwareSlotWidget selected; @@ -46,13 +49,17 @@ public AbstractApplication initApp() { apps.clearAllWidgets(); AtomicInteger index = new AtomicInteger(0); for (AbstractApplication installed : getOs().installedApps) { - TerminalRegistry.getAppHardwareDemand(installed.getRegistryName(), getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")).stream() + TerminalRegistry + .getAppHardwareDemand(installed.getRegistryName(), + getOs().tabletNBT.getCompoundTag(installed.getRegistryName()).getInteger("_tier")) + .stream() .filter(hardware::isHardwareAdequate).findFirst() .ifPresent(X -> { - apps.addWidget(new RectButtonWidget(162 + (index.get() % 4) * 25, 122 + (index.get() / 4) * 30, 20, 20, 2) - .setIcon(installed.getIcon()) - .setHoverText(installed.getUnlocalizedName()) - .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); + apps.addWidget(new RectButtonWidget(162 + (index.get() % 4) * 25, + 122 + (index.get() / 4) * 30, 20, 20, 2) + .setIcon(installed.getIcon()) + .setHoverText(installed.getUnlocalizedName()) + .setColors(0, TerminalTheme.COLOR_7.getColor(), 0)); index.getAndIncrement(); }); } diff --git a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java index 216495054f5..25c0e795dd3 100644 --- a/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java +++ b/src/main/java/gregtech/common/terminal/app/hardwaremanager/HardwareSlotWidget.java @@ -5,6 +5,7 @@ import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -14,6 +15,7 @@ import java.util.Collections; public class HardwareSlotWidget extends WidgetGroup { + private final Hardware hardware; private final TerminalOSWidget os; private Runnable onSelected; @@ -39,7 +41,8 @@ private void showDialog(int button) { NBTTagCompound tag = hardware.acceptItemStack(itemStack); if (tag != null) { tag.setTag("item", itemStack.serializeNBT()); - os.hardwareProvider.getOrCreateHardwareCompound().setTag(hardware.getRegistryName(), tag); + os.hardwareProvider.getOrCreateHardwareCompound().setTag(hardware.getRegistryName(), + tag); os.hardwareProvider.cleanCache(hardware.getRegistryName()); } }).open(); @@ -54,22 +57,26 @@ private void showDialog(int button) { } } if (emptySlot) { - TerminalDialogWidget.showConfirmDialog(os, "terminal.hardware.remove", "terminal.component.confirm", result -> { - if (result) { - NBTTagCompound tag = os.hardwareProvider.getOrCreateHardwareCompound().getCompoundTag(hardware.getRegistryName()); - if (!tag.isEmpty() && tag.hasKey("item")) { - gui.entityPlayer.inventory.addItemStackToInventory(hardware.onHardwareRemoved(new ItemStack(tag.getCompoundTag("item")))); - } - os.hardwareProvider.getOrCreateHardwareCompound().removeTag(hardware.getRegistryName()); - os.hardwareProvider.cleanCache(hardware.getRegistryName()); - } - }).open(); + TerminalDialogWidget + .showConfirmDialog(os, "terminal.hardware.remove", "terminal.component.confirm", result -> { + if (result) { + NBTTagCompound tag = os.hardwareProvider.getOrCreateHardwareCompound() + .getCompoundTag(hardware.getRegistryName()); + if (!tag.isEmpty() && tag.hasKey("item")) { + gui.entityPlayer.inventory.addItemStackToInventory( + hardware.onHardwareRemoved(new ItemStack(tag.getCompoundTag("item")))); + } + os.hardwareProvider.getOrCreateHardwareCompound() + .removeTag(hardware.getRegistryName()); + os.hardwareProvider.cleanCache(hardware.getRegistryName()); + } + }).open(); } else { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.warning", "terminal.hardware.remove.full").open(); + TerminalDialogWidget + .showInfoDialog(os, "terminal.component.warning", "terminal.hardware.remove.full").open(); } } } - } @Override @@ -93,13 +100,19 @@ public void handleClientAction(int id, PacketBuffer buffer) { public void drawInForeground(int mouseX, int mouseY) { if (hardware != null && isMouseOverElement(mouseX, mouseY)) { if (!hardware.hasHW()) { - drawHoveringText(ItemStack.EMPTY, Collections.singletonList(hardware.getLocalizedName()), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, Collections.singletonList(hardware.getLocalizedName()), 300, mouseX, + mouseY); } else { String info = hardware.addInformation(); if (info == null) { - drawHoveringText(ItemStack.EMPTY, Arrays.asList(hardware.getLocalizedName(), I18n.format("terminal.hardware.tip.remove")), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, + Arrays.asList(hardware.getLocalizedName(), I18n.format("terminal.hardware.tip.remove")), + 300, mouseX, mouseY); } else { - drawHoveringText(ItemStack.EMPTY, Arrays.asList(String.format("%s (%s)", hardware.getLocalizedName(), info), I18n.format("terminal.hardware.tip.remove")), 300, mouseX, mouseY); + drawHoveringText(ItemStack.EMPTY, + Arrays.asList(String.format("%s (%s)", hardware.getLocalizedName(), info), + I18n.format("terminal.hardware.tip.remove")), + 300, mouseX, mouseY); } } } diff --git a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java index 406dfca18ab..899e1dc9d37 100644 --- a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java +++ b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MachineBuilderWidget.java @@ -18,6 +18,7 @@ import gregtech.api.util.BlockInfo; import gregtech.client.utils.RenderBufferHelper; import gregtech.common.inventory.handlers.CycleItemStackHandler; + import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.state.IBlockState; @@ -37,6 +38,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -52,6 +54,7 @@ * @Description: */ public class MachineBuilderWidget extends WidgetGroup { + private BlockPos pos; private EnumFacing facing; private SlotWidget[] slotWidgets; @@ -67,22 +70,26 @@ public class MachineBuilderWidget extends WidgetGroup { @SideOnly(Side.CLIENT) private List handlers; - public MachineBuilderWidget(int x, int y, int width, int height, MultiblockControllerBase controllerBase, TerminalOSWidget os) { + public MachineBuilderWidget(int x, int y, int width, int height, MultiblockControllerBase controllerBase, + TerminalOSWidget os) { super(x, y, width, height); this.os = os; this.controllerBase = controllerBase; addWidget(new ImageWidget(0, 0, width, height, GuiTextures.BACKGROUND)); addWidget(new RectButtonWidget(12, 125, width - 24, 20, 1) .setClickListener(this::autoBuildButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.auto", -1))); addWidget(new RectButtonWidget(12, 125 + 25, width - 24, 20, 1) .setClickListener(this::placeButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.place", -1))); addWidget(new RectButtonWidget(12, 125 + 50, width - 24, 20, 1) .setClickListener(this::debugButton) - .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), TerminalTheme.COLOR_B_2.getColor()) + .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_7.getColor(), + TerminalTheme.COLOR_B_2.getColor()) .setIcon(new TextTexture("terminal.multiblock_ar.builder.debug", -1))); if (os.isRemote()) { candidates = new DraggableScrollableWidgetGroup(-20, 0, 20, 180); @@ -94,7 +101,7 @@ public MachineBuilderWidget(int x, int y, int width, int height, MultiblockContr public void handleClientAction(int id, PacketBuffer buffer) { if (id == -2) { // select this.selected = buffer.readVarInt(); - } else if (id == -3) { // update pos facing + } else if (id == -3) { // update pos facing this.pos = buffer.readBlockPos(); this.facing = EnumFacing.VALUES[buffer.readByte()]; } else { @@ -103,7 +110,8 @@ public void handleClientAction(int id, PacketBuffer buffer) { } /** - * I had to add slotWidget after parent widget be added, because of gtce's {@link gregtech.api.gui.INativeWidget} interface. + * I had to add slotWidget after parent widget be added, because of gtce's {@link gregtech.api.gui.INativeWidget} + * interface. * Hopefully one day I can remove this worse interface. */ public void addPlayerInventory() { @@ -113,24 +121,26 @@ public void addPlayerInventory() { for (int col = 0; col < 6; col++) { int index = col + row * 6; boolean isActive = inventoryPlayer.getStackInSlot(index).getItem() instanceof ItemBlock; - slotWidgets[index] = new SlotWidget(inventoryPlayer, index, 12 + col * 18, 12 + row * 18, false, false) { + slotWidgets[index] = new SlotWidget(inventoryPlayer, index, 12 + col * 18, 12 + row * 18, false, + false) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (isMouseOverElement(mouseX, mouseY) && isActive()) { if (selected != index) { selected = index; - MachineBuilderWidget.this.writeClientAction(-2, buf->buf.writeVarInt(index)); + MachineBuilderWidget.this.writeClientAction(-2, buf -> buf.writeVarInt(index)); } } return super.mouseClicked(mouseX, mouseY, button); } - @Override public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) { super.drawInBackground(mouseX, mouseY, partialTicks, context); if (selected == index) { - drawSolidRect(getPosition().x, getPosition().y, getSize().width, getSize().height, 0x4f00ff00); + drawSolidRect(getPosition().x, getPosition().y, getSize().width, getSize().height, + 0x4f00ff00); } } }.setBackgroundTexture(GuiTextures.SLOT); @@ -166,12 +176,11 @@ public void setSceneWidget(MachineSceneWidget sceneWidget) { } } - @SideOnly(Side.CLIENT) private void setFocus(BlockPos pos, EnumFacing facing) { this.pos = new BlockPos(pos); this.facing = facing; - writeClientAction(-3, buf->{ + writeClientAction(-3, buf -> { buf.writeBlockPos(pos); buf.writeByte(facing.getIndex()); }); @@ -190,11 +199,12 @@ private void placeButton(ClickData clickData) { float hitZ = pos.getZ() + 0.5f; Block block = itemBlock.getBlock(); IBlockState state = block.getStateFromMeta(itemBlock.getMetadata(itemStack.getMetadata())); - if(block instanceof BlockBush) { + if (block instanceof BlockBush) { // Prevent placing lilypads, grass, etc where they should not be - if(!((BlockBush) block).canBlockStay(world, offset, state)) { - if(clickData.isClient) { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", "This Block cannot be placed here").setClientSide().open(); + if (!((BlockBush) block).canBlockStay(world, offset, state)) { + if (clickData.isClient) { + TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", + "This Block cannot be placed here").setClientSide().open(); } return; } @@ -222,7 +232,7 @@ private void highLightRender(boolean isTESR, int pass, BlockRenderLayer layer) { for (BlockPos pos : highLightBlocks) { RenderBufferHelper.renderCubeFrame(buffer, - pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1,pos.getY() + 1, pos.getZ() + 1, + pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1, 1, 0, 0, 1); } @@ -237,7 +247,8 @@ private void debugButton(ClickData clickData) { if (clickData.isClient && controllerBase != null) { highLightBlocks.clear(); if (controllerBase.structurePattern.checkPatternFastAt( - controllerBase.getWorld(), controllerBase.getPos(), controllerBase.getFrontFacing().getOpposite(), controllerBase.getUpwardsFacing(), controllerBase.allowsFlip()) == null) { + controllerBase.getWorld(), controllerBase.getPos(), controllerBase.getFrontFacing().getOpposite(), + controllerBase.getUpwardsFacing(), controllerBase.allowsFlip()) == null) { PatternError error = controllerBase.structurePattern.getError(); highLightBlocks.add(new BlockPos(error.getPos())); List> candidatesItemStack = error.getCandidates(); @@ -245,12 +256,15 @@ private void debugButton(ClickData clickData) { int y = 1; handlers = new ArrayList<>(); for (List candidate : candidatesItemStack) { - CycleItemStackHandler handler = new CycleItemStackHandler(NonNullList.from(ItemStack.EMPTY, candidate.toArray(new ItemStack[0]))); + CycleItemStackHandler handler = new CycleItemStackHandler( + NonNullList.from(ItemStack.EMPTY, candidate.toArray(new ItemStack[0]))); handlers.add(handler); - candidates.addWidget(new SlotWidget(handler, 0, 1, y, false, false).setBackgroundTexture(TerminalTheme.COLOR_B_2)); + candidates.addWidget(new SlotWidget(handler, 0, 1, y, false, false) + .setBackgroundTexture(TerminalTheme.COLOR_B_2)); y += 20; } - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", error.getErrorInfo()).setClientSide().open(); + TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", error.getErrorInfo()) + .setClientSide().open(); } } } @@ -262,5 +276,4 @@ private void autoBuildButton(ClickData clickData) { } } } - } diff --git a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java index 8c1b63da68b..6e9d04b4705 100644 --- a/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java +++ b/src/main/java/gregtech/common/terminal/app/multiblockhelper/MultiBlockPreviewARApp.java @@ -21,6 +21,7 @@ import gregtech.client.shader.Shaders; import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GlStateManager; @@ -33,12 +34,14 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import java.util.*; public class MultiBlockPreviewARApp extends ARApplication { + @SideOnly(Side.CLIENT) int lastMouseX; @SideOnly(Side.CLIENT) @@ -58,18 +61,21 @@ public AbstractApplication initApp() { // 232 333 addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); addWidget(new ImageWidget(333 / 2, 20, 1, 222 - 40, new ColorRectTexture(-1))); - addWidget(new LabelWidget(10 + 313 / 4, 35, "terminal.multiblock_ar.tier.0", -1).setXCentered(true).setYCentered(true)); + addWidget(new LabelWidget(10 + 313 / 4, 35, "terminal.multiblock_ar.tier.0", -1).setXCentered(true) + .setYCentered(true)); addWidget(new RectButtonWidget(10 + (313 / 2 - bW) / 2, 50, bW, bH) .setIcon(TextureArea.fullImage("textures/gui/terminal/multiblock_ar/profile.png")) .setColors(-1, 0xff00ff00, 0) .setHoverText("terminal.ar.open") .setClickListener(clickData -> openAR())); - addWidget(new LabelWidget(333 / 2 + 313 / 4, 35, "terminal.multiblock_ar.tier.1", getAppTier() == 0 ? 0xffff0000 : -1).setXCentered(true).setYCentered(true)); + addWidget(new LabelWidget(333 / 2 + 313 / 4, 35, "terminal.multiblock_ar.tier.1", + getAppTier() == 0 ? 0xffff0000 : -1).setXCentered(true).setYCentered(true)); addWidget(new RectButtonWidget(333 / 2 + (313 / 2 - bW) / 2, 50, bW, bH) .setIcon(this::drawBuilderButton) .setColors(getAppTier() == 0 ? 0xffff0000 : -1, getAppTier() == 0 ? 0xffff0000 : 0xff00ff00, 0) - .setHoverText(getAppTier() > 0 ? "terminal.multiblock_ar.builder.hover" : "terminal.multiblock_ar.unlock") + .setHoverText( + getAppTier() > 0 ? "terminal.multiblock_ar.builder.hover" : "terminal.multiblock_ar.unlock") .setClickListener(clickData -> buildMode())); return this; } @@ -93,11 +99,12 @@ private void drawBuilderButton(double x, double y, int width, int height) { uniformCache.glUniform1I("faceTexture", 0); uniformCache.glUniform1I("baseTexture", 1); uniformCache.glUniform1F("u_time", time); - uniformCache.glUniform3F("f_color", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F); + uniformCache.glUniform3F("f_color", (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, + (color & 255) / 255.0F); uniformCache.glUniformBoolean("block", controllerBase != null); - if (isMouseOver((int)x, (int)y, width, height, lastMouseX, lastMouseY)) { + if (isMouseOver((int) x, (int) y, width, height, lastMouseX, lastMouseY)) { uniformCache.glUniform2F("u_mouse", - (float) (((lastMouseX - x) / 2 + width / 3) * ConfigHolder.client.resolution), + (float) (((lastMouseX - x) / 2 + width / 3) * ConfigHolder.client.resolution), (float) (height / 2 * ConfigHolder.client.resolution)); } }); @@ -121,7 +128,8 @@ public int getMaxTier() { private MultiblockControllerBase getController() { if (os.clickPos != null) { TileEntity te = gui.entityPlayer.world.getTileEntity(os.clickPos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MultiblockControllerBase) { + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MultiblockControllerBase) { return (MultiblockControllerBase) ((IGregTechTileEntity) te).getMetaTileEntity(); } } @@ -130,7 +138,8 @@ private MultiblockControllerBase getController() { private void buildMode() { if (getAppTier() == 0) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.dialog.notice", "terminal.multiblock_ar.unlock").open(); + TerminalDialogWidget.showInfoDialog(getOs(), "terminal.dialog.notice", "terminal.multiblock_ar.unlock") + .open(); } else if (getController() != null) { widgets.forEach(this::waitToRemoved); MultiblockControllerBase controllerBase = getController(); @@ -138,7 +147,7 @@ private void buildMode() { this.addWidget(builderWidget); builderWidget.addPlayerInventory(); if (isClient) { - MachineSceneWidget sceneWidget = new MachineSceneWidget(0, 16, 200, 200, controllerBase); + MachineSceneWidget sceneWidget = new MachineSceneWidget(0, 16, 200, 200, controllerBase); builderWidget.setSceneWidget(sceneWidget); this.addWidget(0, sceneWidget); this.addWidget(new ImageWidget(0, 0, 333, 16, GuiTextures.UI_FRAME_SIDE_UP)); @@ -157,11 +166,9 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, lastMouseY = mouseY; this.partialTicks = partialTicks; super.hookDrawInBackground(mouseX, mouseY, partialTicks, context); - } - - //////////////////////////////////////AR///////////////////////////////////////// + ////////////////////////////////////// AR///////////////////////////////////////// @SideOnly(Side.CLIENT) private static Map controllerList; @@ -194,7 +201,8 @@ public void tickAR(EntityPlayer player) { Iterator iterator = controllerList.keySet().iterator(); if (iterator.hasNext()) { MultiblockControllerBase controller = iterator.next(); - if (!controller.isValid() || controller.isStructureFormed() || !inRange(player.getPosition(), controller.getPos())) { + if (!controller.isValid() || controller.isStructureFormed() || + !inRange(player.getPosition(), controller.getPos())) { iterator.remove(); reRender = true; } @@ -213,7 +221,8 @@ public void tickAR(EntityPlayer player) { if (reRender) { opList = GLAllocation.generateDisplayLists(1); // allocate op list GlStateManager.glNewList(opList, GL11.GL_COMPILE); - controllerList.forEach((controller, shapes) -> MultiblockPreviewRenderer.renderControllerInList(controller, shapes, 0)); + controllerList.forEach((controller, shapes) -> MultiblockPreviewRenderer + .renderControllerInList(controller, shapes, 0)); GlStateManager.glEndList(); } } @@ -261,5 +270,4 @@ public void drawARScreen(RenderWorldLastEvent event) { GlStateManager.color(1F, 1F, 1F, 0F); } } - } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java index c13ca5dfa70..86fe9c217cc 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java @@ -4,6 +4,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.client.utils.RenderUtil; import gregtech.core.network.packets.PacketProspecting; + import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.AbstractTexture; @@ -13,12 +14,12 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.awt.*; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.util.HashMap; +import javax.annotation.Nullable; public class ProspectingTexture extends AbstractTexture { @@ -40,10 +41,10 @@ public ProspectingTexture(ProspectorMode mode, int radius, boolean darkMode) { this.radius = radius; this.mode = mode; if (this.mode == ProspectorMode.FLUID) { - //noinspection unchecked + // noinspection unchecked map = new HashMap[(radius * 2 - 1)][(radius * 2 - 1)]; } else { - //noinspection unchecked + // noinspection unchecked map = new HashMap[(radius * 2 - 1) * 16][(radius * 2 - 1) * 16]; } } @@ -101,15 +102,17 @@ private BufferedImage getImage() { for (int i = 0; i < wh; i++) { for (int j = 0; j < wh; j++) { - HashMap data = this.map[this.mode == ProspectorMode.ORE ? i : i / 16][this.mode == ProspectorMode.ORE ? j : j / 16]; + HashMap data = this.map[this.mode == ProspectorMode.ORE ? i : i / 16][this.mode == + ProspectorMode.ORE ? j : j / 16]; // draw bg image.setRGB(i, j, ((data == null) ^ darkMode) ? Color.darkGray.getRGB() : Color.WHITE.getRGB()); - //draw ore + // draw ore if (this.mode == ProspectorMode.ORE && data != null) { for (String orePrefix : data.values()) { if (!selected.equals(SELECTED_ALL) && !selected.equals(orePrefix)) continue; MaterialStack mterialStack = OreDictUnifier.getMaterial(OreDictUnifier.get(orePrefix)); - image.setRGB(i, j, mterialStack == null ? orePrefix.hashCode() : mterialStack.material.getMaterialRGB() | 0XFF000000); + image.setRGB(i, j, mterialStack == null ? orePrefix.hashCode() : + mterialStack.material.getMaterialRGB() | 0XFF000000); break; } } @@ -158,24 +161,24 @@ public void draw(int x, int y) { if (this.map[cx][cz] != null && !this.map[cx][cz].isEmpty()) { Fluid fluid = FluidRegistry.getFluid(this.map[cx][cz].get((byte) 1)); if (selected.equals(SELECTED_ALL) || selected.equals(fluid.getName())) { - RenderUtil.drawFluidForGui(new FluidStack(fluid, 1), 1, x + cx * 16 + 1, y + cz * 16 + 1, 16, 16); + RenderUtil.drawFluidForGui(new FluidStack(fluid, 1), 1, x + cx * 16 + 1, y + cz * 16 + 1, + 16, 16); } } } } } - //draw red vertical line + // draw red vertical line if (playerXGui % 16 > 7 || playerXGui % 16 == 0) { Gui.drawRect(x + playerXGui - 1, y, x + playerXGui, y + imageHeight, Color.RED.getRGB()); } else { Gui.drawRect(x + playerXGui, y, x + playerXGui + 1, y + imageHeight, Color.RED.getRGB()); } - //draw red horizontal line + // draw red horizontal line if (playerYGui % 16 > 7 || playerYGui % 16 == 0) { Gui.drawRect(x, y + playerYGui - 1, x + imageWidth, y + playerYGui, Color.RED.getRGB()); } else { Gui.drawRect(x, y + playerYGui, x + imageWidth, y + playerYGui + 1, Color.RED.getRGB()); } } - } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java index 8ee1f2cb73b..72acb2a302f 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java @@ -1,8 +1,5 @@ package gregtech.common.terminal.app.prospector; -import com.google.common.collect.Maps; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.widgets.ImageWidget; @@ -17,12 +14,16 @@ import gregtech.common.terminal.component.ClickComponent; import gregtech.common.terminal.component.SearchComponent; import gregtech.core.network.packets.PacketProspecting; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import com.google.common.collect.Tables; + import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -30,7 +31,10 @@ import java.util.Map; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class ProspectorApp extends AbstractApplication implements SearchComponent.IWidgetSearch { + private WidgetOreList widgetOreList; private WidgetProspectingMap widgetProspectingMap; private ColorRectTexture background; @@ -60,10 +64,12 @@ public AbstractApplication initApp() { if (isClient) { this.addWidget(new ImageWidget(0, 0, 333, offset, GuiTextures.UI_FRAME_SIDE_UP)); this.addWidget(new ImageWidget(0, 232 - offset, 333, offset, GuiTextures.UI_FRAME_SIDE_DOWN)); - this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, 232 - 2 * offset); + this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, + 232 - 2 * offset); this.addWidget(this.widgetOreList); } - this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, this.widgetOreList, mode, 1); + this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, + this.widgetOreList, mode, 1); if (isClient) { persist = Tables.newCustomTable(Maps.newHashMap(), Maps::newHashMap); widgetProspectingMap.setOnPacketReceived(packet -> persist.put(packet.chunkX, packet.chunkZ, packet)); @@ -76,11 +82,15 @@ public AbstractApplication initApp() { }); if (isClient) { loadPacketLocalConfig(); - //Cardinal directions - this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset, "N", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset - 6 + 16 * (chunkRadius * 2 - 1), "S", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(0, offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "W", this::labelColor).setShadow(true)); - this.addWidget(new LabelWidget(-6 + 16 * (chunkRadius * 2 - 1), offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "E", this::labelColor).setShadow(true)); + // Cardinal directions + this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, offset, "N", this::labelColor) + .setShadow(true)); + this.addWidget(new LabelWidget(-2 + (16 * (chunkRadius * 2 - 1)) / 2, + offset - 6 + 16 * (chunkRadius * 2 - 1), "S", this::labelColor).setShadow(true)); + this.addWidget(new LabelWidget(0, offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "W", this::labelColor) + .setShadow(true)); + this.addWidget(new LabelWidget(-6 + 16 * (chunkRadius * 2 - 1), + offset - 3 + (16 * (chunkRadius * 2 - 1)) / 2, "E", this::labelColor).setShadow(true)); } return this; } @@ -100,7 +110,7 @@ protected void loadPacketLocalConfig() { } else { posX += 1; } - //draw red horizontal line + // draw red horizontal line if (posZ % 16 > 7 || posZ % 16 == 0) { posZ -= 1; } else { @@ -114,7 +124,8 @@ protected void loadPacketLocalConfig() { for (int j = playerChunkZ - chunkRadius; j <= playerChunkZ + chunkRadius; j++) { NBTTagCompound nbt = null; try { - nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, String.format("%s/%d/%d_%d.nbt", getRegistryName(), mode.ordinal(), i, j))); + nbt = CompressedStreamTools.read(new File(TerminalRegistry.TERMINAL_PATH, + String.format("%s/%d/%d_%d.nbt", getRegistryName(), mode.ordinal(), i, j))); } catch (IOException e) { GTLog.logger.error("error while loading local nbt for {}", getRegistryName(), e); } @@ -135,7 +146,8 @@ protected void loadPacketLocalConfig() { @SideOnly(Side.CLIENT) protected void savePacketLocalConfig() { new Thread(() -> { // thread for better QoL - File folder = new File(TerminalRegistry.TERMINAL_PATH, String.format("%s/%d", getRegistryName(), mode.ordinal())); + File folder = new File(TerminalRegistry.TERMINAL_PATH, + String.format("%s/%d", getRegistryName(), mode.ordinal())); if (!folder.exists()) { if (!folder.mkdirs()) return; } @@ -144,7 +156,8 @@ protected void savePacketLocalConfig() { NBTTagCompound nbt = cell.getValue().writePacketData(); try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(folder, String.format("%d_%d.nbt", cell.getRowKey(), cell.getColumnKey()))); + CompressedStreamTools.safeWrite(nbt, new File(folder, + String.format("%d_%d.nbt", cell.getRowKey(), cell.getColumnKey()))); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for {}", getRegistryName(), e); @@ -170,12 +183,13 @@ public int getMaxTier() { @Override public List getMenuComponents() { - ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE).setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { - if (cd.isClient) { - widgetProspectingMap.setDarkMode(!widgetProspectingMap.getDarkMode()); - background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff); - } - }); + ClickComponent darkMode = new ClickComponent().setIcon(GuiTextures.ICON_VISIBLE) + .setHoverText("terminal.prospector.vis_mode").setClickConsumer(cd -> { + if (cd.isClient) { + widgetProspectingMap.setDarkMode(!widgetProspectingMap.getDarkMode()); + background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff); + } + }); return Arrays.asList(darkMode, new SearchComponent<>(this)); } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java index 3b5fb04da0c..cf5cbcae306 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; public enum ProspectorMode { + ORE("ore_prospector", "metaitem.prospector.mode.ores"), FLUID("fluid_prospector", "metaitem.prospector.mode.fluid"); diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java index c43fc5db363..40435e51b5e 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetOreList.java @@ -1,7 +1,5 @@ package gregtech.common.terminal.app.prospector.widget; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.Widget; @@ -12,6 +10,7 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.Position; import gregtech.common.terminal.app.prospector.ProspectorMode; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; @@ -21,10 +20,14 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.items.ItemStackHandler; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + import java.util.*; import java.util.function.Consumer; public class WidgetOreList extends DraggableScrollableWidgetGroup { + protected WidgetGroup selected; protected final BiMap widgetMap; protected Consumer onSelected = null; @@ -75,7 +78,8 @@ private void addOre(String orePrefix) { itemStackHandler.insertItem(0, itemStack, false); WidgetGroup widgetGroup = new WidgetGroup(0, 0, getSize().width - 5, 18); widgetGroup.addWidget(new SlotWidget(itemStackHandler, 0, 0, 0, false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, itemStack.getDisplayName(), materialStack==null? orePrefix.hashCode():materialStack.material.getMaterialRGB() | 0XFF000000)); + widgetGroup.addWidget(new LabelWidget(20, 5, itemStack.getDisplayName(), + materialStack == null ? orePrefix.hashCode() : materialStack.material.getMaterialRGB() | 0XFF000000)); addOrePrefix(orePrefix, widgetGroup); } @@ -107,7 +111,8 @@ private void addOil(String orePrefix) { .setClient() .setHideTooltip(true) .setContainerClicking(false, false)); - widgetGroup.addWidget(new LabelWidget(20, 5, fluidStack.getLocalizedName(), getFluidColor(fluidStack.getFluid()))); + widgetGroup + .addWidget(new LabelWidget(20, 5, fluidStack.getLocalizedName(), getFluidColor(fluidStack.getFluid()))); addOrePrefix(orePrefix, widgetGroup); } @@ -131,7 +136,8 @@ protected boolean hookDrawInBackground(int mouseX, int mouseY, float partialTick if (widget.isVisible()) { widget.drawInBackground(mouseX, mouseY, partialTicks, context); - GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), 1.0F); + GlStateManager.color(gui.getRColorForOverlay(), gui.getGColorForOverlay(), gui.getBColorForOverlay(), + 1.0F); } } return true; @@ -142,8 +148,8 @@ protected boolean checkClickedDragged(int mouseX, int mouseY, int button) { draggedWidget = null; for (int i = widgets.size() - 1; i >= 0; i--) { Widget widget = widgets.get(i); - if(widget.isVisible() && widget instanceof WidgetGroup) { - if(widget.isMouseOverElement(mouseX, mouseY)) { + if (widget.isVisible() && widget instanceof WidgetGroup) { + if (widget.isMouseOverElement(mouseX, mouseY)) { if (isMouseOverElement(mouseX, mouseY) && this.selected != widget) { this.setSelected(widgetMap.get(widget)); } @@ -162,10 +168,10 @@ public void updateScreen() { widgets.forEach(widget -> { if (widget instanceof WidgetGroup) { Widget widget1 = ((WidgetGroup) widget).getContainedWidgets(true).get(0); - if (widget1 instanceof SlotWidget){ + if (widget1 instanceof SlotWidget) { SlotWidget slotWidget = (SlotWidget) widget1; List list = OreDictUnifier.getAllWithOreDictionaryName(widgetMap.get(widget)); - if (list.size() > 0 ) { + if (list.size() > 0) { slotWidget.getHandle().decrStackSize(64); slotWidget.getHandle().putStack(list.get(Math.floorMod(tickCounter / 20, list.size()))); } @@ -185,7 +191,5 @@ public static int getFluidColor(Fluid fluid) { } @Override - protected void writeClientAction(int id, Consumer packetBufferWriter) { - - } + protected void writeClientAction(int id, Consumer packetBufferWriter) {} } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java index 5fa4256668b..60a18f58247 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java @@ -16,6 +16,7 @@ import gregtech.common.terminal.app.prospector.ProspectorMode; import gregtech.core.network.packets.PacketProspecting; import gregtech.integration.xaero.ColorUtility; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -37,15 +38,16 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; import java.awt.*; import java.io.IOException; +import java.util.*; import java.util.List; import java.util.Queue; -import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; +import javax.annotation.Nonnull; + public class WidgetProspectingMap extends Widget { private final int chunkRadius; @@ -66,7 +68,8 @@ public class WidgetProspectingMap extends Widget { private final List hoveredNames = new ArrayList<>(); private int color; - public WidgetProspectingMap(int xPosition, int yPosition, int chunkRadius, WidgetOreList widgetOreList, @Nonnull ProspectorMode mode, int scanTick) { + public WidgetProspectingMap(int xPosition, int yPosition, int chunkRadius, WidgetOreList widgetOreList, + @Nonnull ProspectorMode mode, int scanTick) { super(new Position(xPosition, yPosition), new Size(16 * (chunkRadius * 2 - 1), 16 * (chunkRadius * 2 - 1))); this.chunkRadius = chunkRadius; this.mode = mode; @@ -105,7 +108,8 @@ public boolean getDarkMode() { public void detectAndSendChanges() { EntityPlayer player = gui.entityPlayer; World world = player.world; - if (FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter() % scanTick == 0 && chunkIndex < (chunkRadius * 2 - 1) * (chunkRadius * 2 - 1)) { + if (FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter() % scanTick == 0 && + chunkIndex < (chunkRadius * 2 - 1) * (chunkRadius * 2 - 1)) { int playerChunkX = player.chunkCoordX; int playerChunkZ = player.chunkCoordZ; @@ -117,7 +121,8 @@ public void detectAndSendChanges() { int oz = row - chunkRadius + 1; Chunk chunk = world.getChunk(playerChunkX + ox, playerChunkZ + oz); - PacketProspecting packet = new PacketProspecting(playerChunkX + ox, playerChunkZ + oz, playerChunkX, playerChunkZ, (int) player.posX, (int) player.posZ, this.mode); + PacketProspecting packet = new PacketProspecting(playerChunkX + ox, playerChunkZ + oz, playerChunkX, + playerChunkZ, (int) player.posX, (int) player.posZ, this.mode); switch (mode) { case ORE: @@ -144,7 +149,8 @@ public void detectAndSendChanges() { } else if (type.processingPrefix == prefix) { MaterialStack materialStack = OreDictUnifier.getMaterial(itemBlock); if (materialStack != null) { - String oreDict = "ore" + oreDictString.replaceFirst(prefix.name(), ""); + String oreDict = "ore" + + oreDictString.replaceFirst(prefix.name(), ""); packet.addBlock(x, y, z, oreDict); added = true; break; @@ -163,11 +169,15 @@ public void detectAndSendChanges() { } break; case FLUID: - BedrockFluidVeinHandler.FluidVeinWorldEntry fStack = BedrockFluidVeinHandler.getFluidVeinWorldEntry(world, chunk.x, chunk.z); + BedrockFluidVeinHandler.FluidVeinWorldEntry fStack = BedrockFluidVeinHandler + .getFluidVeinWorldEntry(world, chunk.x, chunk.z); if (fStack != null && fStack.getDefinition() != null) { - packet.addBlock(0, 3, 0, TextFormattingUtil.formatNumbers(100.0 * BedrockFluidVeinHandler.getOperationsRemaining(world, chunk.x, chunk.z) - / BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS)); - packet.addBlock(0, 2, 0, String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, chunk.x, chunk.z))); + packet.addBlock(0, 3, 0, + TextFormattingUtil.formatNumbers(100.0 * + BedrockFluidVeinHandler.getOperationsRemaining(world, chunk.x, chunk.z) / + BedrockFluidVeinHandler.MAXIMUM_VEIN_OPERATIONS)); + packet.addBlock(0, 2, 0, + String.valueOf(BedrockFluidVeinHandler.getFluidYield(world, chunk.x, chunk.z))); Fluid fluid = BedrockFluidVeinHandler.getFluidInChunk(world, chunk.x, chunk.z); if (fluid != null) { packet.addBlock(0, 1, 0, fluid.getName()); @@ -246,8 +256,8 @@ public void drawInForeground(int mouseX, int mouseY) { (cZ + 1) * 16 + this.getPosition().y, new Color(0x4B6C6C6C, true).getRGB()); - //pick the color of the highest element for the waypoint color - final int[] maxAmount = {0}; + // pick the color of the highest element for the waypoint color + final int[] maxAmount = { 0 }; if (this.mode == ProspectorMode.ORE) { // draw ore tooltips.add(I18n.format("terminal.prospector.ore")); @@ -257,7 +267,8 @@ public void drawInForeground(int mouseX, int mouseY) { if (texture.map[cX * 16 + i][cZ * 16 + j] != null) { texture.map[cX * 16 + i][cZ * 16 + j].values().forEach(dict -> { String name = OreDictUnifier.get(dict).getDisplayName(); - if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || texture.getSelected().equals(dict)) { + if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || + texture.getSelected().equals(dict)) { oreInfo.put(name, oreInfo.getOrDefault(name, 0) + 1); if (oreInfo.get(name) > maxAmount[0]) { maxAmount[0] = oreInfo.get(name); @@ -278,7 +289,8 @@ public void drawInForeground(int mouseX, int mouseY) { } else if (this.mode == ProspectorMode.FLUID) { tooltips.add(I18n.format("terminal.prospector.fluid")); if (texture.map[cX][cZ] != null && !texture.map[cX][cZ].isEmpty()) { - if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || texture.getSelected().equals(texture.map[cX][cZ].get((byte) 1))) { + if (ProspectingTexture.SELECTED_ALL.equals(texture.getSelected()) || + texture.getSelected().equals(texture.map[cX][cZ].get((byte) 1))) { FluidStack fluidStack = FluidRegistry.getFluidStack(texture.map[cX][cZ].get((byte) 1), 1); if (fluidStack != null) { tooltips.add(I18n.format("terminal.prospector.fluid.info", @@ -332,7 +344,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { added = addXaeroMapWaypoint(b); } if (added) { - Minecraft.getMinecraft().player.sendStatusMessage(new TextComponentTranslation("behavior.prospector.added_waypoint"), true); + Minecraft.getMinecraft().player + .sendStatusMessage(new TextComponentTranslation("behavior.prospector.added_waypoint"), true); } } this.lastClicked = System.currentTimeMillis(); @@ -389,8 +402,10 @@ private boolean addVoxelMapWaypoint(@Nonnull BlockPos b) { TreeSet world = new TreeSet<>(); world.add(Minecraft.getMinecraft().world.provider.getDimension()); - com.mamiyaotaru.voxelmap.interfaces.IWaypointManager waypointManager = com.mamiyaotaru.voxelmap.interfaces.AbstractVoxelMap.getInstance().getWaypointManager(); - com.mamiyaotaru.voxelmap.util.Waypoint voxelMapWaypoint = new com.mamiyaotaru.voxelmap.util.Waypoint(createVeinName(), + com.mamiyaotaru.voxelmap.interfaces.IWaypointManager waypointManager = com.mamiyaotaru.voxelmap.interfaces.AbstractVoxelMap + .getInstance().getWaypointManager(); + com.mamiyaotaru.voxelmap.util.Waypoint voxelMapWaypoint = new com.mamiyaotaru.voxelmap.util.Waypoint( + createVeinName(), b.getX(), b.getZ(), Minecraft.getMinecraft().world.getHeight(b.getX(), b.getZ()), diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java index 6fac10c4fd4..e55f040f585 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/FluidStackHelper.java @@ -3,6 +3,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -44,7 +45,8 @@ public String getDisplayName(FluidStack fluidStack) { @Override public Widget createWidget(FluidStack fluidStack) { FluidTank tank = new FluidTank(fluidStack, Integer.MAX_VALUE); - return new TankWidget(tank, 0, 0, 18, 18).setAlwaysShowFull(true).setBackgroundTexture(TerminalTheme.COLOR_B_2).setClient(); + return new TankWidget(tank, 0, 0, 18, 18).setAlwaysShowFull(true).setBackgroundTexture(TerminalTheme.COLOR_B_2) + .setClient(); } @Override diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java index dfdec218ef3..74d5fcbf5a1 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/IngredientHelper.java @@ -1,6 +1,7 @@ package gregtech.common.terminal.app.recipechart; import gregtech.api.gui.Widget; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java b/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java index 43a2cc03a0f..268f6799226 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/ItemStackHelper.java @@ -3,6 +3,7 @@ import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.items.ItemHandlerHelper; diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java b/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java index 3ece66a8a42..e4abbcd2497 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/RecipeChartApp.java @@ -18,7 +18,7 @@ import gregtech.common.terminal.app.recipechart.widget.RGContainer; import gregtech.common.terminal.app.recipechart.widget.RGNode; import gregtech.common.terminal.component.ClickComponent; -import mezz.jei.api.gui.IRecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTBase; @@ -26,12 +26,15 @@ import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants; +import mezz.jei.api.gui.IRecipeLayout; + import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; public class RecipeChartApp extends AbstractApplication implements IRecipeTransferHandlerWidget { + private TabGroup tabGroup; public RecipeChartApp() { @@ -46,7 +49,8 @@ public int getThemeColor() { @Override public AbstractApplication initApp() { if (isClient) { - this.tabGroup = new TabGroup<>(0, 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, TerminalTheme.COLOR_B_3, 333 / getMaxPages(), 10)); + this.tabGroup = new TabGroup<>(0, 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, + TerminalTheme.COLOR_B_3, 333 / getMaxPages(), 10)); this.tabGroup.setOnTabChanged(this::onPagesChanged); this.addWidget(this.tabGroup); loadLocalConfig(nbt -> { @@ -80,7 +84,8 @@ private RGContainer addTab(String name) { RGContainer container = new RGContainer(0, 0, 333, 222, getOs()); container.setBackground(TerminalTheme.COLOR_B_3); tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(333 / getMaxPages() - 5) - .setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), container); + .setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), + container); return container; } @@ -90,74 +95,96 @@ public int getMaxPages() { @Override public List getMenuComponents() { - ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE).setHoverText("terminal.component.new_page").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() < getMaxPages()) { - TerminalDialogWidget.showTextFieldDialog(getOs(), "terminal.component.page_name", s -> true, s -> { - if (s != null) { - addTab(s); + ClickComponent newPage = new ClickComponent().setIcon(GuiTextures.ICON_NEW_PAGE) + .setHoverText("terminal.component.new_page").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() < getMaxPages()) { + TerminalDialogWidget + .showTextFieldDialog(getOs(), "terminal.component.page_name", s -> true, s -> { + if (s != null) { + addTab(s); + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent deletePage = new ClickComponent().setIcon(GuiTextures.ICON_REMOVE).setHoverText("terminal.recipe_chart.delete").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() > 1) { - TerminalDialogWidget.showConfirmDialog(getOs(), "terminal.recipe_chart.delete", "terminal.component.confirm", r -> { - if (r) { - tabGroup.removeTab(tabGroup.getAllTag().indexOf(tabGroup.getCurrentTag())); + }); + ClickComponent deletePage = new ClickComponent().setIcon(GuiTextures.ICON_REMOVE) + .setHoverText("terminal.recipe_chart.delete").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() > 1) { + TerminalDialogWidget.showConfirmDialog(getOs(), "terminal.recipe_chart.delete", + "terminal.component.confirm", r -> { + if (r) { + tabGroup.removeTab(tabGroup.getAllTag().indexOf(tabGroup.getCurrentTag())); + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent addSlot = new ClickComponent().setIcon(GuiTextures.ICON_ADD).setHoverText("terminal.recipe_chart.add_slot").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getCurrentTag() != null) { - tabGroup.getCurrentTag().addNode(50, 100); - } - }); - ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD).setHoverText("terminal.component.load_file").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getAllTag().size() < getMaxPages()) { - File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); - TerminalDialogWidget.showFileDialog(getOs(), "terminal.component.load_file", file, true, result -> { - if (result != null && result.isFile()) { - try { - NBTTagCompound nbt = CompressedStreamTools.read(result); - addTab(result.getName()).loadFromNBT(nbt); - } catch (IOException e) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.error", "terminal.component.load_file.error").setClientSide().open(); - } + }); + ClickComponent addSlot = new ClickComponent().setIcon(GuiTextures.ICON_ADD) + .setHoverText("terminal.recipe_chart.add_slot").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getCurrentTag() != null) { + tabGroup.getCurrentTag().addNode(50, 100); } - }).setClientSide().open(); - } else { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit").setClientSide().open(); - } - }); - ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE).setHoverText("terminal.component.save_file").setClickConsumer(cd -> { - if (tabGroup == null) return; - if (tabGroup.getCurrentTag() != null) { - File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); - TerminalDialogWidget.showFileDialog(getOs(), "terminal.component.save_file", file, false, result -> { - if (result != null) { - try { - CompressedStreamTools.safeWrite(tabGroup.getCurrentTag().saveAsNBT(), result); - } catch (IOException e) { - TerminalDialogWidget.showInfoDialog(getOs(), "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); - } + }); + ClickComponent importPage = new ClickComponent().setIcon(GuiTextures.ICON_LOAD) + .setHoverText("terminal.component.load_file").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getAllTag().size() < getMaxPages()) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); + TerminalDialogWidget + .showFileDialog(getOs(), "terminal.component.load_file", file, true, result -> { + if (result != null && result.isFile()) { + try { + NBTTagCompound nbt = CompressedStreamTools.read(result); + addTab(result.getName()).loadFromNBT(nbt); + } catch (IOException e) { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.error", + "terminal.component.load_file.error") + .setClientSide().open(); + } + } + }).setClientSide().open(); + } else { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.warning", "terminal.recipe_chart.limit") + .setClientSide().open(); } - }).setClientSide().open(); - } - }); + }); + ClickComponent exportPage = new ClickComponent().setIcon(GuiTextures.ICON_SAVE) + .setHoverText("terminal.component.save_file").setClickConsumer(cd -> { + if (tabGroup == null) return; + if (tabGroup.getCurrentTag() != null) { + File file = new File(TerminalRegistry.TERMINAL_PATH, "recipe_chart"); + TerminalDialogWidget + .showFileDialog(getOs(), "terminal.component.save_file", file, false, result -> { + if (result != null) { + try { + CompressedStreamTools.safeWrite(tabGroup.getCurrentTag().saveAsNBT(), + result); + } catch (IOException e) { + TerminalDialogWidget + .showInfoDialog(getOs(), "terminal.component.error", + "terminal.component.save_file.error") + .setClientSide().open(); + } + } + }).setClientSide().open(); + } + }); return Arrays.asList(newPage, deletePage, addSlot, importPage, exportPage); } @Override - public NBTTagCompound closeApp() { //synced data to server side. + public NBTTagCompound closeApp() { // synced data to server side. saveLocalConfig(nbt -> { NBTTagList list = new NBTTagList(); for (int i = 0; i < tabGroup.getAllTag().size(); i++) { @@ -179,9 +206,11 @@ public boolean isClientSideApp() { } @Override - public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { for (Widget widget : getContainedWidgets(false)) { - if (widget instanceof RGNode && ((RGNode) widget).transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer)) { + if (widget instanceof RGNode && + ((RGNode) widget).transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer)) { return null; } } diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java index 1e8b574a842..280722e7dbc 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/PhantomWidget.java @@ -7,19 +7,22 @@ import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.terminal.os.TerminalTheme; import gregtech.common.inventory.handlers.SingleItemStackHandler; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import mezz.jei.api.gui.IGhostIngredientHandler; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; public class PhantomWidget extends WidgetGroup implements IGhostIngredientTarget { + private final IItemHandlerModifiable itemHandler; private FluidStack fluidStack; private PhantomFluidWidget fluidWidget; @@ -31,25 +34,26 @@ public PhantomWidget(int x, int y, Object defaultObj) { itemHandler = new SingleItemStackHandler(1); fluidStack = null; fluidWidget = new PhantomFluidWidget(0, 0, 18, 18, null, null) - .setFluidStackUpdater(fluid -> { - fluidStack = fluid.copy(); - if (fluidStack != null && fluidStack.amount > 0) { - itemHandler.setStackInSlot(0, ItemStack.EMPTY); - slotWidget.setVisible(false); - fluidWidget.setVisible(true); - if (onChanged != null) { - onChanged.accept(fluidStack); - } - } - }, true).setBackgroundTexture(TerminalTheme.COLOR_B_2).showTip(true) - .setFluidStackSupplier(() -> fluidStack,true); + .setFluidStackUpdater(fluid -> { + fluidStack = fluid.copy(); + if (fluidStack != null && fluidStack.amount > 0) { + itemHandler.setStackInSlot(0, ItemStack.EMPTY); + slotWidget.setVisible(false); + fluidWidget.setVisible(true); + if (onChanged != null) { + onChanged.accept(fluidStack); + } + } + }, true).setBackgroundTexture(TerminalTheme.COLOR_B_2).showTip(true) + .setFluidStackSupplier(() -> fluidStack, true); slotWidget = new PhantomSlotWidget(itemHandler, 0, 0, 0) { + @Override public boolean isEnabled() { return isActive(); } }; - slotWidget.setChangeListener(()-> { + slotWidget.setChangeListener(() -> { if (!itemHandler.getStackInSlot(0).isEmpty()) { fluidStack = null; fluidWidget.setVisible(false); @@ -125,7 +129,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { if (isMouseOverElement(mouseX, mouseY)) { ItemStack itemStack = gui.entityPlayer.inventory.getItemStack(); if (!itemStack.isEmpty()) { - IFluidHandler handlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + IFluidHandler handlerItem = itemStack + .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (handlerItem != null && handlerItem.getTankProperties().length > 0) { FluidStack fluidStack = handlerItem.getTankProperties()[0].getContents(); if (fluidStack != null) { diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java index a3d925daf4d..b6988b8e0a6 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGContainer.java @@ -6,6 +6,7 @@ import gregtech.api.terminal.os.TerminalDialogWidget; import gregtech.api.terminal.os.TerminalOSWidget; import gregtech.api.terminal.os.TerminalTheme; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -17,6 +18,7 @@ import java.util.Optional; public class RGContainer extends DraggableScrollableWidgetGroup { + protected TerminalOSWidget os; private RGNode selectedNode; private RGLine selectedLine; @@ -83,7 +85,8 @@ public void removeNode(RGNode node) { } public void addOrUpdateLine(RGNode parent, RGNode child) { - Optional optional = lines.stream().filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); + Optional optional = lines.stream() + .filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); if (!optional.isPresent()) { RGLine line = new RGLine(parent, child, this); lines.add(line); @@ -94,7 +97,8 @@ public void addOrUpdateLine(RGNode parent, RGNode child) { } public RGLine getLine(RGNode parent, RGNode child) { - Optional optional = lines.stream().filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); + Optional optional = lines.stream() + .filter(line -> line.getParent() == parent && line.getChild() == child).findFirst(); return optional.orElse(null); } @@ -115,11 +119,11 @@ public void loadFromNBT(NBTTagCompound nbt) { this.lines.clear(); NBTTagList nodesList = nbt.getTagList("nodes", Constants.NBT.TAG_COMPOUND); for (NBTBase node : nodesList) { // build nodes - nodes.add(RGNode.deserializeNodeNBT((NBTTagCompound)node, this)); + nodes.add(RGNode.deserializeNodeNBT((NBTTagCompound) node, this)); } Iterator iterator = nodesList.iterator(); // build relations for (RGNode node : nodes) { - NBTTagCompound nodeTag = (NBTTagCompound)iterator.next(); + NBTTagCompound nodeTag = (NBTTagCompound) iterator.next(); node.deserializeRelationNBT(nodeTag.getTagList("parents", Constants.NBT.TAG_INT_ARRAY), nodeTag.getTagList("children", Constants.NBT.TAG_INT_ARRAY)); this.addWidget(node); @@ -130,7 +134,7 @@ public void loadFromNBT(NBTTagCompound nbt) { lines.clear(); NBTTagList linesList = nbt.getTagList("lines", Constants.NBT.TAG_COMPOUND); for (NBTBase node : linesList) { // build nodes - RGLine line = RGLine.deserializeLineNBT((NBTTagCompound)node, this); + RGLine line = RGLine.deserializeLineNBT((NBTTagCompound) node, this); lines.add(line); this.addWidget(0, line); } @@ -200,5 +204,4 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { } return false; } - } diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java index ea5f0a99754..4fca6a6ea70 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGLine.java @@ -16,6 +16,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -26,6 +27,7 @@ import java.util.List; public class RGLine extends WidgetGroup { + protected final RGNode parent; protected final RGNode child; protected final ItemStack catalyst; @@ -48,10 +50,14 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { if (catalyst != null) { ItemStackHandler handler = new ItemStackHandler(); handler.setStackInSlot(0, catalyst); - infoGroup.addWidget(new SlotWidget(handler, 0, 0, 0, false, false).setBackgroundTexture(new ColorRectTexture(0))); + infoGroup.addWidget( + new SlotWidget(handler, 0, 0, 0, false, false).setBackgroundTexture(new ColorRectTexture(0))); MetaTileEntity mte = GTUtility.getMetaTileEntity(catalyst); if (mte instanceof SimpleMachineMetaTileEntity) { - infoGroup.addWidget(new LabelWidget(9, -10, I18n.format("terminal.recipe_chart.tier") + GTValues.VN[((SimpleMachineMetaTileEntity) mte).getTier()], -1).setXCentered(true).setShadow(true)); + infoGroup.addWidget(new LabelWidget(9, -10, + I18n.format("terminal.recipe_chart.tier") + + GTValues.VN[((SimpleMachineMetaTileEntity) mte).getTier()], + -1).setXCentered(true).setShadow(true)); } } @@ -72,18 +78,19 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_CALCULATOR) .setHoverText("terminal.recipe_chart.ratio") - .setClickListener(cd -> TerminalDialogWidget.showTextFieldDialog(container.os, "terminal.recipe_chart.ratio", s->{ - try { - return Integer.parseInt(s) > 0; - } catch (Exception ignored){ - return false; - } - }, s -> { - if (s != null) { - ratio = Integer.parseInt(s); - parent.updateDemand(parent.getHeadDemand()); - } - }).setClientSide().open())); + .setClickListener(cd -> TerminalDialogWidget + .showTextFieldDialog(container.os, "terminal.recipe_chart.ratio", s -> { + try { + return Integer.parseInt(s) > 0; + } catch (Exception ignored) { + return false; + } + }, s -> { + if (s != null) { + ratio = Integer.parseInt(s); + parent.updateDemand(parent.getHeadDemand()); + } + }).setClientSide().open())); toolGroup.addWidget(new SimpleTextWidget(0, -18, "", -1, () -> Integer.toString(ratio), true).setShadow(true)); toolGroup.setVisible(false); this.addWidget(toolGroup); @@ -92,7 +99,8 @@ public RGLine(RGNode parent, RGNode child, RGContainer container) { } public static RGLine deserializeLineNBT(NBTTagCompound nbt, RGContainer container) { - RGLine line = new RGLine(container.nodes.get(nbt.getInteger("parent")), container.nodes.get(nbt.getInteger("child")), container); + RGLine line = new RGLine(container.nodes.get(nbt.getInteger("parent")), + container.nodes.get(nbt.getInteger("child")), container); line.ratio = nbt.getInteger("ratio"); boolean visible = nbt.getBoolean("visible"); line.infoGroup.setVisible(visible); @@ -177,7 +185,8 @@ public boolean isMouseOver(int mouseX, int mouseY) { float y = points.get(0).y; float x2 = points.get(points.size() - 1).x; float y2 = points.get(points.size() - 1).y; - if (mouseX >= Math.min(x, x2) && mouseY >= Math.min(y, y2) && Math.max(x, x2) > mouseX && Math.max(y, y2) > mouseY) { + if (mouseX >= Math.min(x, x2) && mouseY >= Math.min(y, y2) && Math.max(x, x2) > mouseX && + Math.max(y, y2) > mouseY) { for (Vec2f point : points) { if ((mouseX - point.x) * (mouseX - point.x) + (mouseY - point.y) * (mouseY - point.y) < 4) { return true; @@ -196,13 +205,13 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender drawLines(points, 0x2fffff00, 0xff00ff00, 2); } Vec2f point = points.get(points.size() - 1); - drawSolidRect((int)(point.x - 1.5), (int)(point.y - 1.5), 3, 3, 0XFF00FF00); + drawSolidRect((int) (point.x - 1.5), (int) (point.y - 1.5), 3, 3, 0XFF00FF00); super.drawInBackground(mouseX, mouseY, partialTicks, context); } @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { - if (super.mouseClicked(mouseX, mouseY, button)){ + if (super.mouseClicked(mouseX, mouseY, button)) { return true; } else if (isMouseOver(mouseX, mouseY)) { if (!isSelected) { diff --git a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java index e9f1d8e3344..b8b466fb311 100644 --- a/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java +++ b/src/main/java/gregtech/common/terminal/app/recipechart/widget/RGNode.java @@ -20,12 +20,7 @@ import gregtech.common.terminal.app.recipechart.IngredientHelper; import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.recipe.GTRecipeWrapper; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.recipe.IFocus; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.gui.Focus; -import mezz.jei.gui.recipes.RecipeLayout; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; @@ -41,6 +36,13 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.items.ItemStackHandler; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.IFocus; +import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import mezz.jei.gui.Focus; +import mezz.jei.gui.recipes.RecipeLayout; + import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -87,46 +89,51 @@ public RGNode(int x, int y, RGContainer container, Object head, boolean isPhanto .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_CALCULATOR) .setHoverText("terminal.recipe_chart.calculator") - .setClickListener(cd -> TerminalDialogWidget.showTextFieldDialog(container.os, "terminal.recipe_chart.demand", s -> { - try { - return Integer.parseInt(s) > 0; - } catch (Exception ignored) { - return false; - } - }, s -> { - if (s != null && !s.isEmpty()) { - updateDemand(Integer.parseInt(s)); - } - }).setClientSide().open())); + .setClickListener(cd -> TerminalDialogWidget + .showTextFieldDialog(container.os, "terminal.recipe_chart.demand", s -> { + try { + return Integer.parseInt(s) > 0; + } catch (Exception ignored) { + return false; + } + }, s -> { + if (s != null && !s.isEmpty()) { + updateDemand(Integer.parseInt(s)); + } + }).setClientSide().open())); toolGroup.addWidget(new CircleButtonWidget(9, 49, 8, 1, 12) .setColors(0, TerminalTheme.COLOR_7.getColor(), 0) .setIcon(GuiTextures.ICON_ADD) .setHoverText("terminal.recipe_chart.add") - .setClickListener(cd -> TerminalDialogWidget.showItemSelector(container.os, "terminal.recipe_chart.demand", false, itemStack -> true, - itemStack -> { - if (itemStack != null && !itemStack.isEmpty()) { - IFluidHandler handlerItem = itemStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); - if (handlerItem != null && handlerItem.getTankProperties().length > 0) { - FluidStack fluidStack = handlerItem.getTankProperties()[0].getContents(); - if (fluidStack != null) { - phantom.setObject(fluidStack); - return; + .setClickListener(cd -> TerminalDialogWidget + .showItemSelector(container.os, "terminal.recipe_chart.demand", false, itemStack -> true, + itemStack -> { + if (itemStack != null && !itemStack.isEmpty()) { + IFluidHandler handlerItem = itemStack.getCapability( + CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); + if (handlerItem != null && handlerItem.getTankProperties().length > 0) { + FluidStack fluidStack = handlerItem.getTankProperties()[0] + .getContents(); + if (fluidStack != null) { + phantom.setObject(fluidStack); + return; + } + } + phantom.setObject(itemStack); + + // Reset any children nodes, now that the parent has changed + for (Set childs : children.values()) { + for (RGNode child : childs) { + child.removeParent(this); + } + } + children.clear(); + + // Clear the Inputs for the replaced parent + this.inputsGroup.widgets.clear(); } - } - phantom.setObject(itemStack); - - // Reset any children nodes, now that the parent has changed - for (Set childs : children.values()) { - for (RGNode child : childs) { - child.removeParent(this); - } - } - children.clear(); - - // Clear the Inputs for the replaced parent - this.inputsGroup.widgets.clear(); - } - }).setClientSide().open())); + }) + .setClientSide().open())); } else { addWidget(this.headHelper.createWidget(head)); } @@ -134,7 +141,9 @@ public RGNode(int x, int y, RGContainer container, Object head, boolean isPhanto private void init(RGContainer container) { this.container = container; - textWidget = new SimpleTextWidget(9, -5, "", -1, () -> this.head != null ? this.headHelper.getDisplayName(this.head) : "terminal.recipe_chart.drag", true).setShadow(true); + textWidget = new SimpleTextWidget(9, -5, "", -1, + () -> this.head != null ? this.headHelper.getDisplayName(this.head) : "terminal.recipe_chart.drag", + true).setShadow(true); textWidget.setVisible(false); textWidget.setActive(false); this.addWidget(textWidget); @@ -186,7 +195,8 @@ public int getChildDemand(RGNode child) { perC = ((TankWidget) entry.getKey()).fluidTank.getFluidAmount(); } int ratioSum = entry.getValue().stream().mapToInt(it -> container.getLine(RGNode.this, it).ratio).sum(); - return MathHelper.ceil(perC * MathHelper.ceil(getHeadDemand() / (float) recipePer) * container.getLine(RGNode.this, child).ratio / (float) ratioSum); + return MathHelper.ceil(perC * MathHelper.ceil(getHeadDemand() / (float) recipePer) * + container.getLine(RGNode.this, child).ratio / (float) ratioSum); } } return 0; @@ -322,7 +332,8 @@ protected void onPositionUpdate() { } } - public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (isSelected) { Object obj = recipeLayout.getFocus() == null ? null : recipeLayout.getFocus().getValue(); IngredientHelper otherHelper = IngredientHelper.getFor(obj); @@ -378,7 +389,8 @@ public boolean transferRecipe(ModularUIContainer x, IRecipeLayout recipeLayout, // CHECK GTCE RECIPES Recipe recipe = null; if (recipeLayout instanceof RecipeLayout) { - IRecipeWrapper recipeWrapper = ObfuscationReflectionHelper.getPrivateValue(RecipeLayout.class, (RecipeLayout) recipeLayout, "recipeWrapper"); + IRecipeWrapper recipeWrapper = ObfuscationReflectionHelper.getPrivateValue(RecipeLayout.class, + (RecipeLayout) recipeLayout, "recipeWrapper"); if (recipeWrapper instanceof GTRecipeWrapper) { recipe = ((GTRecipeWrapper) recipeWrapper).getRecipe(); } @@ -424,7 +436,8 @@ public void deserializeRelationNBT(NBTTagList parentsTag, NBTTagList childrenTag Iterator iterator = children.keySet().iterator(); for (NBTBase nbtBase : childrenTag) { int[] nbt = ((NBTTagIntArray) nbtBase).getIntArray(); - children.get(iterator.next()).addAll(Arrays.stream(nbt).mapToObj(it -> container.nodes.get(it)).collect(Collectors.toList())); + children.get(iterator.next()) + .addAll(Arrays.stream(nbt).mapToObj(it -> container.nodes.get(it)).collect(Collectors.toList())); } } @@ -436,7 +449,8 @@ public static RGNode deserializeNodeNBT(NBTTagCompound nodeTag, RGContainer cont head = headHelper.deserialize(nodeTag.getCompoundTag("nbt")); headHelper.setAmount(head, nodeTag.getInteger("count")); } - RGNode node = new RGNode(nodeTag.getInteger("x"), nodeTag.getInteger("y"), container, head, nodeTag.getBoolean("phantom")); + RGNode node = new RGNode(nodeTag.getInteger("x"), nodeTag.getInteger("y"), container, head, + nodeTag.getBoolean("phantom")); NBTTagList itemsList = nodeTag.getTagList("items", Constants.NBT.TAG_COMPOUND); NBTTagList fluidsList = nodeTag.getTagList("fluids", Constants.NBT.TAG_COMPOUND); List itemInputs = new LinkedList<>(); @@ -461,7 +475,7 @@ public static RGNode deserializeNodeNBT(NBTTagCompound nodeTag, RGContainer cont } public NBTTagCompound serializeNodeNBT() { - //head + // head NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("x", getSelfPosition().x + container.getScrollXOffset()); nbt.setInteger("y", getSelfPosition().y + container.getScrollYOffset()); @@ -484,7 +498,8 @@ public NBTTagCompound serializeNodeNBT() { } else { continue; } - NBTTagIntArray childList = new NBTTagIntArray(entry.getValue().stream().mapToInt(it -> container.nodes.indexOf(it)).toArray()); + NBTTagIntArray childList = new NBTTagIntArray( + entry.getValue().stream().mapToInt(it -> container.nodes.indexOf(it)).toArray()); childrenList.appendTag(childList); } nbt.setTag("items", itemsList); @@ -497,14 +512,16 @@ public NBTTagCompound serializeNodeNBT() { // parent NBTTagList parentsList = new NBTTagList(); for (Map.Entry entry : parentNodes.entrySet()) { - parentsList.appendTag(new NBTTagIntArray(new int[]{container.nodes.indexOf(entry.getKey()), entry.getValue()})); + parentsList.appendTag( + new NBTTagIntArray(new int[] { container.nodes.indexOf(entry.getKey()), entry.getValue() })); } nbt.setTag("parents", parentsList); nbt.setBoolean("visible", textWidget.isVisible()); return nbt; } - private void setRecipe(List itemInputs, List fluidInputs, ItemStack catalyst, int recipePer) { + private void setRecipe(List itemInputs, List fluidInputs, ItemStack catalyst, + int recipePer) { this.recipePer = recipePer; this.catalyst = catalyst; inputsGroup.clearAllWidgets(); @@ -519,6 +536,7 @@ private void setRecipe(List itemInputs, List fluidInputs, ItemStackHandler handler = new ItemStackHandler(1); handler.setStackInSlot(0, itemInput); Widget widget = new SlotWidget(handler, 0, 0, y.addAndGet(20), false, false) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { return RGNode.this.handleTipsSlotClick(mouseX, mouseY, this, handler.getStackInSlot(0).copy()); @@ -530,6 +548,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { for (FluidStack fluidInput : fluidInputs) { FluidTank tank = new FluidTank(fluidInput, Integer.MAX_VALUE); Widget widget = new TankWidget(tank, 0, y.addAndGet(20), 18, 18) { + @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { return RGNode.this.handleTipsSlotClick(mouseX, mouseY, this, tank.getFluid().copy()); @@ -544,7 +563,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { private boolean handleTipsSlotClick(int mouseX, int mouseY, Widget slot, Object object) { if (slot.isMouseOverElement(mouseX, mouseY)) { Position position = inputsGroup.getSelfPosition(); - RGNode child = container.addNode(RGNode.this.getSelfPosition().x + 50, RGNode.this.getSelfPosition().y + position.y + slot.getSelfPosition().y, object); + RGNode child = container.addNode(RGNode.this.getSelfPosition().x + 50, + RGNode.this.getSelfPosition().y + position.y + slot.getSelfPosition().y, object); Set childs = RGNode.this.children.get(slot); childs.add(child); diff --git a/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java b/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java index 9e750afc318..a04035afc07 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java +++ b/src/main/java/gregtech/common/terminal/app/settings/SettingsApp.java @@ -15,6 +15,7 @@ import gregtech.common.terminal.app.settings.widgets.ThemeSettings; public class SettingsApp extends AbstractApplication { + private TabGroup tabGroup; public SettingsApp() { @@ -25,7 +26,8 @@ public SettingsApp() { public AbstractApplication initApp() { if (isClient) { this.addWidget(new ImageWidget(5, 15, 323, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - this.tabGroup = new TabGroup<>(5, 15, new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10)); + this.tabGroup = new TabGroup<>(5, 15, + new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10)); this.addWidget(this.tabGroup); this.tabGroup.setOnTabChanged(this::onPagesChanged); addTab("terminal.settings.theme", new ThemeSettings(getOs())); @@ -47,7 +49,12 @@ private void onPagesChanged(int oldPage, int newPage) { } private void addTab(String name, AbstractWidgetGroup widget) { - tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(323 / 3 - 5).setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), widget); + tabGroup.addTab( + new IGuiTextureTabInfo( + new TextTexture(name, -1).setWidth(323 / 3 - 5).setType( + tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), + name), + widget); } @Override diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java index ccc8c740d5e..48ab589601f 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/HomeButtonSettings.java @@ -13,7 +13,9 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.client.resources.I18n; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -22,19 +24,23 @@ import java.util.stream.Collectors; public class HomeButtonSettings extends AbstractWidgetGroup { + final TerminalOSWidget os; public HomeButtonSettings(TerminalOSWidget os) { super(Position.ORIGIN, new Size(323, 212)); this.os = os; - List candidates = Arrays.stream(SystemCall.values()).map(SystemCall::getTranslateKey).collect(Collectors.toList()); + List candidates = Arrays.stream(SystemCall.values()).map(SystemCall::getTranslateKey) + .collect(Collectors.toList()); candidates.add(0, "terminal.system_call.null"); TerminalHomeButtonWidget home = this.os.home; this.addWidget(new LabelWidget(10, 15, "terminal.settings.home.double", -1).setYCentered(true)); this.addWidget(new LabelWidget(50, 15, "+Ctrl", -1).setYCentered(true)); this.addWidget(new LabelWidget(85, 15, "+Shift", -1).setYCentered(true)); - this.addWidget(new LabelWidget(170, 15, "terminal.settings.home.action", -1).setXCentered(true).setYCentered(true)); - this.addWidget(new LabelWidget(270, 15, "terminal.settings.home.args", -1).setXCentered(true).setYCentered(true)); + this.addWidget( + new LabelWidget(170, 15, "terminal.settings.home.action", -1).setXCentered(true).setYCentered(true)); + this.addWidget( + new LabelWidget(270, 15, "terminal.settings.home.args", -1).setXCentered(true).setYCentered(true)); for (int shift = 0; shift < 2; shift++) { for (int ctrl = 0; ctrl < 2; ctrl++) { @@ -51,15 +57,16 @@ public HomeButtonSettings(TerminalOSWidget os) { if (shift == 1) { this.addWidget(new ImageWidget(90, y + 5, 10, 10, GuiTextures.ICON_VISIBLE)); } - TextFieldWidget textFieldWidget = new TextFieldWidget(230, y, 80, 20, TerminalTheme.COLOR_B_3, null, null) - .setMaxStringLength(Integer.MAX_VALUE) - .setTextResponder(arg -> { - if (arg != null && home.getActions()[i] != null) { - home.getActions()[i].setValue(arg); - } - home.saveConfig(); - }, true) - .setValidator(s -> true); + TextFieldWidget textFieldWidget = new TextFieldWidget(230, y, 80, 20, TerminalTheme.COLOR_B_3, null, + null) + .setMaxStringLength(Integer.MAX_VALUE) + .setTextResponder(arg -> { + if (arg != null && home.getActions()[i] != null) { + home.getActions()[i].setValue(arg); + } + home.saveConfig(); + }, true) + .setValidator(s -> true); if (pair != null && pair.getValue() != null) { textFieldWidget.setCurrentString(pair.getValue()); } else { @@ -74,32 +81,37 @@ public HomeButtonSettings(TerminalOSWidget os) { } return "terminal.system_call.null"; }, true) - .setIsUp(i > 3) - .setHoverText(I18n.format(doubleClick == 1 ? "terminal.settings.home.double_click" : "terminal.settings.home.click") + (ctrl == 1 ? "+Ctrl" : "") + (shift == 1 ? "+Shift" : "")) - .setOnChanged(selected -> { - SystemCall action = SystemCall.getFromName(selected); - if (action != null) { - if (home.getActions()[i] == null) { - home.getActions()[i] = new MutablePair<>(action, null); - } else { - home.getActions()[i] = new MutablePair<>(action, home.getActions()[i].getValue()); - } - } else { - home.getActions()[i] = null; - } - home.saveConfig(); - }) - .setOnShowChange(isShow -> { - if (isShow) { - for (Widget widget : widgets) { - if (widget instanceof SelectorWidget) { - ((SelectorWidget) widget).hide(); + .setIsUp(i > 3) + .setHoverText(I18n + .format(doubleClick == 1 ? "terminal.settings.home.double_click" : + "terminal.settings.home.click") + + (ctrl == 1 ? "+Ctrl" : "") + (shift == 1 ? "+Shift" : "")) + .setOnChanged(selected -> { + SystemCall action = SystemCall.getFromName(selected); + if (action != null) { + if (home.getActions()[i] == null) { + home.getActions()[i] = new MutablePair<>(action, null); + } else { + home.getActions()[i] = new MutablePair<>(action, + home.getActions()[i].getValue()); + } + } else { + home.getActions()[i] = null; } - } - } - }) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + home.saveConfig(); + }) + .setOnShowChange(isShow -> { + if (isShow) { + for (Widget widget : widgets) { + if (widget instanceof SelectorWidget) { + ((SelectorWidget) widget).hide(); + } + } + } + }) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); this.addWidget(textFieldWidget); } diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java index 51c0ad80043..1ed390a5352 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/OsSettings.java @@ -10,6 +10,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -18,6 +19,7 @@ import java.io.IOException; public class OsSettings extends AbstractWidgetGroup { + public static boolean DOUBLE_CHECK; static { if (FMLCommonHandler.instance().getSide().isClient()) { @@ -42,7 +44,8 @@ public static void saveConfig() { nbt.setBoolean("double_check", DOUBLE_CHECK); try { if (!nbt.isEmpty()) { - CompressedStreamTools.safeWrite(nbt, new File(TerminalRegistry.TERMINAL_PATH, "config/os_settings.nbt")); + CompressedStreamTools.safeWrite(nbt, + new File(TerminalRegistry.TERMINAL_PATH, "config/os_settings.nbt")); } } catch (IOException e) { GTLog.logger.error("error while saving local nbt for the os settings", e); @@ -55,11 +58,11 @@ public OsSettings(TerminalOSWidget os) { this.os = os; this.addWidget(new LabelWidget(25, 15, "terminal.settings.os.double_check", -1).setYCentered(true)); this.addWidget(new RectButtonWidget(10, 10, 10, 10, 2) - .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p)->{ - DOUBLE_CHECK=!p; + .setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p) -> { + DOUBLE_CHECK = !p; saveConfig(); }) - .setValueSupplier(true, ()->!DOUBLE_CHECK) + .setValueSupplier(true, () -> !DOUBLE_CHECK) .setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()) diff --git a/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java b/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java index 829a8fa6db4..d0894a487c1 100644 --- a/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java +++ b/src/main/java/gregtech/common/terminal/app/settings/widgets/ThemeSettings.java @@ -12,12 +12,14 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.Position; import gregtech.api.util.Size; + import net.minecraft.util.ResourceLocation; import java.util.Arrays; import java.util.function.Consumer; public class ThemeSettings extends AbstractWidgetGroup { + private final WidgetGroup textureGroup; final TerminalOSWidget os; @@ -48,32 +50,40 @@ public ThemeSettings(TerminalOSWidget os) { "terminal.settings.theme.wallpaper.color", "terminal.settings.theme.wallpaper.file"), -1, this::getLocalizedWallpaperTypeName, true) - .setIsUp(true) - .setOnChanged(this::onModifyTextureChanged) - .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()) - .setBackground(TerminalTheme.COLOR_6)); + .setIsUp(true) + .setOnChanged(this::onModifyTextureChanged) + .setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), + TerminalTheme.COLOR_B_2.getColor()) + .setBackground(TerminalTheme.COLOR_6)); textureGroup = new WidgetGroup((int) (x + 170), 122, (int) (x * 11 - 170), 65); this.addWidget(textureGroup); } - private String getLocalizedWallpaperTypeName(){ - switch(TerminalTheme.WALL_PAPER.getTypeName()){ - case "resource": return "terminal.settings.theme.wallpaper.resource"; - case "url": return "terminal.settings.theme.wallpaper.url"; - case "color": return "terminal.settings.theme.wallpaper.color"; - case "file": return "terminal.settings.theme.wallpaper.file"; + private String getLocalizedWallpaperTypeName() { + switch (TerminalTheme.WALL_PAPER.getTypeName()) { + case "resource": + return "terminal.settings.theme.wallpaper.resource"; + case "url": + return "terminal.settings.theme.wallpaper.url"; + case "color": + return "terminal.settings.theme.wallpaper.color"; + case "file": + return "terminal.settings.theme.wallpaper.file"; } return null; } private void addColorButton(ColorRectTexture texture, String name, int x, int y) { - CircleButtonWidget buttonWidget = new CircleButtonWidget(x, y, 8, 1, 0).setFill(texture.getColor()).setStrokeAnima(-1).setHoverText(name); + CircleButtonWidget buttonWidget = new CircleButtonWidget(x, y, 8, 1, 0).setFill(texture.getColor()) + .setStrokeAnima(-1).setHoverText(name); buttonWidget.setClickListener(cd -> TerminalDialogWidget.showColorDialog(os, name, color -> { if (color != null) { buttonWidget.setFill(color); texture.setColor(color); if (!TerminalTheme.saveConfig()) { - TerminalDialogWidget.showInfoDialog(os, "terminal.component.error", "terminal.component.save_file.error").setClientSide().open(); + TerminalDialogWidget + .showInfoDialog(os, "terminal.component.error", "terminal.component.save_file.error") + .setClientSide().open(); } } }, texture.color).setClientSide().open()); @@ -85,12 +95,15 @@ private void onModifyTextureChanged(String type) { switch (type) { case "terminal.settings.theme.wallpaper.resource": if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof TextureArea)) { - TerminalTheme.WALL_PAPER.setTexture(new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/terminal_background.png"), 0.0, 0.0, 1.0, 1.0)); + TerminalTheme.WALL_PAPER.setTexture(new TextureArea( + new ResourceLocation("gregtech:textures/gui/terminal/terminal_background.png"), 0.0, 0.0, + 1.0, 1.0)); TerminalTheme.saveConfig(); } - addStringSetting(((TextureArea)TerminalTheme.WALL_PAPER.getTexture()).imageLocation.toString(), + addStringSetting(((TextureArea) TerminalTheme.WALL_PAPER.getTexture()).imageLocation.toString(), s -> { - TerminalTheme.WALL_PAPER.setTexture(new TextureArea(new ResourceLocation(s), 0.0, 0.0, 1.0, 1.0)); + TerminalTheme.WALL_PAPER + .setTexture(new TextureArea(new ResourceLocation(s), 0.0, 0.0, 1.0, 1.0)); TerminalTheme.saveConfig(); }); break; @@ -99,7 +112,7 @@ private void onModifyTextureChanged(String type) { TerminalTheme.WALL_PAPER.setTexture(new URLTexture(null)); TerminalTheme.saveConfig(); } - addStringSetting(((URLTexture)TerminalTheme.WALL_PAPER.getTexture()).url, s -> { + addStringSetting(((URLTexture) TerminalTheme.WALL_PAPER.getTexture()).url, s -> { TerminalTheme.WALL_PAPER.setTexture(new URLTexture(s)); TerminalTheme.saveConfig(); }); @@ -126,12 +139,13 @@ private void onModifyTextureChanged(String type) { .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) - .setClickListener(cd-> TerminalDialogWidget.showFileDialog(os, "terminal.settings.theme.image", TerminalRegistry.TERMINAL_PATH, true, file->{ - if (file != null && file.isFile()) { - TerminalTheme.WALL_PAPER.setTexture(new FileTexture(file)); - TerminalTheme.saveConfig(); - } - }).setClientSide().open()) + .setClickListener(cd -> TerminalDialogWidget.showFileDialog(os, "terminal.settings.theme.image", + TerminalRegistry.TERMINAL_PATH, true, file -> { + if (file != null && file.isFile()) { + TerminalTheme.WALL_PAPER.setTexture(new FileTexture(file)); + TerminalTheme.saveConfig(); + } + }).setClientSide().open()) .setIcon(new TextTexture("terminal.settings.theme.select", -1))); break; } @@ -147,7 +161,7 @@ private void addStringSetting(String init, Consumer callback) { .setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()) - .setClickListener(cd->callback.accept(textFieldWidget.getCurrentString())) + .setClickListener(cd -> callback.accept(textFieldWidget.getCurrentString())) .setIcon(new TextTexture("terminal.guide_editor.update", -1))); } } diff --git a/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java b/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java index a7a5d5a0b8b..288f5f39bd2 100644 --- a/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java +++ b/src/main/java/gregtech/common/terminal/app/teleport/TeleportApp.java @@ -7,6 +7,7 @@ import gregtech.api.terminal.os.TerminalTheme; import gregtech.api.util.TeleportHandler; import gregtech.common.entities.PortalEntity; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -48,7 +49,8 @@ public AbstractApplication initApp() { this.addWidget(new LabelWidget(10, 15, "X: ", 0xFFFFFF)); this.addWidget(new LabelWidget(10, 35, "Y: ", 0xFFFFFF)); this.addWidget(new LabelWidget(10, 55, "Z: ", 0xFFFFFF)); - this.addWidget(new SimpleTextWidget(10, 95, "terminal.teleporter.dimension", 0xFFFFFF, () -> "").setCenter(false)); + this.addWidget( + new SimpleTextWidget(10, 95, "terminal.teleporter.dimension", 0xFFFFFF, () -> "").setCenter(false)); this.addWidget(new TextFieldWidget2(10, 105, 75, 16, () -> String.valueOf(dimension), value -> { if (!value.isEmpty()) { @@ -71,7 +73,8 @@ public AbstractApplication initApp() { } }).setMaxLength(9).setNumbersOnly(-30000000, 30000000)); - this.addWidget(new ClickButtonWidget(15, 140, 65, 20, "terminal.teleporter.spawn_portal", data -> this.spawnPortals())); + this.addWidget(new ClickButtonWidget(15, 140, 65, 20, "terminal.teleporter.spawn_portal", + data -> this.spawnPortals())); return this; } @@ -85,26 +88,28 @@ public NBTTagCompound closeApp() { } /** - * Creates two portals, one 5 blocks in front of the player targeting the other portal, the other at the destination targeting the first portal + * Creates two portals, one 5 blocks in front of the player targeting the other portal, the other at the destination + * targeting the first portal */ public void spawnPortals() { Vec3d position = new Vec3d( gui.entityPlayer.getPosition().getX() + gui.entityPlayer.getLookVec().x * 5, gui.entityPlayer.getPosition().getY(), - gui.entityPlayer.getPosition().getZ() + gui.entityPlayer.getLookVec().z * 5 - ); + gui.entityPlayer.getPosition().getZ() + gui.entityPlayer.getLookVec().z * 5); PortalEntity portal1 = new PortalEntity(gui.entityPlayer.getEntityWorld(), position.x, position.y, position.z); portal1.setRotation(gui.entityPlayer.rotationYaw, 0.F); - PortalEntity portal2 = new PortalEntity(gui.entityPlayer.getEntityWorld(), coordinateX, coordinateY, coordinateZ); + PortalEntity portal2 = new PortalEntity(gui.entityPlayer.getEntityWorld(), coordinateX, coordinateY, + coordinateZ); portal2.setRotation(gui.entityPlayer.rotationYaw, 0.F); portal1.setTargetCoordinates(dimension, coordinateX, coordinateY, coordinateZ); portal2.setTargetCoordinates(gui.entityPlayer.dimension, position.x, position.y, position.z); gui.entityPlayer.getEntityWorld().spawnEntity(portal1); - Chunk destination = TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider().provideChunk(coordinateX >> 4, coordinateZ >> 4); + Chunk destination = TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider() + .provideChunk(coordinateX >> 4, coordinateZ >> 4); TeleportHandler.getWorldByDimensionID(dimension).spawnEntity(portal2); TeleportHandler.getWorldByDimensionID(dimension).getChunkProvider().queueUnload(destination); diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java index 31f5c82d9ea..abb454892e7 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java @@ -1,6 +1,5 @@ package gregtech.common.terminal.app.worldprospector; -import com.google.common.collect.Lists; import gregtech.api.gui.IRenderContext; import gregtech.api.gui.resources.ColorRectTexture; import gregtech.api.gui.resources.ItemStackTexture; @@ -26,7 +25,7 @@ import gregtech.common.items.MetaItems; import gregtech.common.terminal.app.worldprospector.matcher.BlockStateMatcher; import gregtech.common.terminal.app.worldprospector.matcher.IMatcher; -import mezz.jei.api.gui.IGhostIngredientHandler; + import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.client.Minecraft; @@ -52,15 +51,18 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import mezz.jei.api.gui.IGhostIngredientHandler; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; import java.awt.*; import java.io.IOException; import java.util.*; import java.util.List; +import javax.annotation.Nonnull; + public class WorldProspectorARApp extends ARApplication { private SingleItemStackHandler[] handlers; @@ -73,10 +75,11 @@ public WorldProspectorARApp() { @Override public AbstractApplication initApp() { addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()))); - addWidget(new LabelWidget(15 + 150 / 2, 232 / 2, "terminal.world_prospector.radius", -1, new Object[]{getMaxRadius()}) - .setShadow(true) - .setYCentered(true) - .setXCentered(true)); + addWidget(new LabelWidget(15 + 150 / 2, 232 / 2, "terminal.world_prospector.radius", -1, + new Object[] { getMaxRadius() }) + .setShadow(true) + .setYCentered(true) + .setXCentered(true)); int slotSize = (int) Math.pow(2, getAppTier()); int x = 250 - slotSize * 12; int y = 232 / 2 - 18; @@ -102,6 +105,7 @@ public List> getPhantomTargets(Object ingredie } Rectangle rectangle = toRectangleBox(); return Collections.singletonList(new IGhostIngredientHandler.Target() { + @Nonnull @Override public Rectangle getArea() { @@ -114,7 +118,8 @@ public void accept(@Nonnull Object ingredient) { int mouseButton = Mouse.getEventButton(); boolean shiftDown = TooltipHelper.isShiftDown(); ClickType clickType = shiftDown ? ClickType.QUICK_MOVE : ClickType.PICKUP; - PhantomSlotUtil.slotClickPhantom(slotReference, mouseButton, clickType, (ItemStack) ingredient); + PhantomSlotUtil.slotClickPhantom(slotReference, mouseButton, clickType, + (ItemStack) ingredient); updateBlockSelectionAndColor((ItemStack) ingredient, index, buttonWidget); writeClientAction(1, buffer -> { buffer.writeItemStack((ItemStack) ingredient); @@ -126,7 +131,6 @@ public void accept(@Nonnull Object ingredient) { }); } - @Override public boolean mouseClicked(int mouseX, int mouseY, int button) { if (handlers[index].getStackInSlot(0).isEmpty() && isMouseOverElement(mouseX, mouseY)) { @@ -144,11 +148,9 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) { public void handleClientAction(int id, PacketBuffer buffer) { if (id == -1) { selectReference(index, buttonWidget); - } - else if (id == 0) { + } else if (id == 0) { updateBlockSelectionAndColor(ItemStack.EMPTY, index, buttonWidget); - } - else if (id == 1) { + } else if (id == 1) { try { buffer.markReaderIndex(); // just want to reset reader index, not both with .clear ItemStack stack = buffer.readItemStack(); @@ -166,16 +168,16 @@ else if (id == 1) { addWidget(buttonWidget .setHoverText("terminal.world_prospector.color") .setColors(0x4fffffff, -1, colors[i]) - .setClickListener(cd -> TerminalDialogWidget.showColorDialog(getOs(), "terminal.world_prospector.color", res->{ - if (res != null) { - buttonWidget.setFill(res | 0xff000000); - colors[index] = res | 0xff000000; - } - }, colors[index]).open()) - ); + .setClickListener(cd -> TerminalDialogWidget + .showColorDialog(getOs(), "terminal.world_prospector.color", res -> { + if (res != null) { + buttonWidget.setFill(res | 0xff000000); + colors[index] = res | 0xff000000; + } + }, colors[index]).open())); } addWidget(new CircleButtonWidget(333 / 2, 200) - .setClickListener(cd->openAR()) + .setClickListener(cd -> openAR()) .setHoverText("terminal.ar.open") .setColors(0, -1, TerminalTheme.COLOR_B_3.getColor()) .setIcon(new ItemStackTexture(MetaItems.CAMERA.getStackForm()))); @@ -195,7 +197,8 @@ private void updateBlockSelectionAndColor(ItemStack stack, int index, RectButton } else if (ms != null) { colors[index] = ms.material.getMaterialRGB(); } else { - colors[index] = block.getStateFromMeta(copy.getMetadata()).getMaterial().getMaterialMapColor().colorValue; + colors[index] = block.getStateFromMeta(copy.getMetadata()).getMaterial() + .getMaterialMapColor().colorValue; } if (colors[index] == 0) { colors[index] = block.hashCode(); @@ -237,7 +240,8 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); if (Shaders.allowedShader()) { - ShaderTexture.createShader("lightring.frag").draw(getPosition().x + 15, getPosition().y + (232 - 150) / 2f, 150, 150, uniformCache -> uniformCache.glUniform1F("u_time", time)); + ShaderTexture.createShader("lightring.frag").draw(getPosition().x + 15, getPosition().y + (232 - 150) / 2f, + 150, 150, uniformCache -> uniformCache.glUniform1F("u_time", time)); } GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } @@ -245,8 +249,7 @@ protected void hookDrawInBackground(int mouseX, int mouseY, float partialTicks, private void selectReference(int index, RectButtonWidget buttonWidget) { TerminalDialogWidget.showItemSelector(getOs(), "terminal.world_prospector.reference", false, stack -> stack.getItem() instanceof ItemBlock, - stack -> updateBlockSelectionAndColor(stack, index, buttonWidget) - ).open(); + stack -> updateBlockSelectionAndColor(stack, index, buttonWidget)).open(); } private int getMaxRadius() { @@ -276,7 +279,7 @@ private List> getAllSlotStack() { return stacks; } - //////////////////////////////////////AR///////////////////////////////////////// + ////////////////////////////////////// AR///////////////////////////////////////// @SideOnly(Side.CLIENT) private static Set matchers; @@ -302,11 +305,12 @@ public void onAROpened() { Block block = ((ItemBlock) stack.getFirst().getItem()).getBlock(); if (block != Blocks.AIR) { - matchers.add(new BlockStateMatcher(block.getStateFromMeta(stack.getFirst().getMetadata()), stack.getSecond())); + matchers.add(new BlockStateMatcher(block.getStateFromMeta(stack.getFirst().getMetadata()), + stack.getSecond())); } } } - matchers.forEach(matcher->founds.put(matcher, new HashMap<>())); + matchers.forEach(matcher -> founds.put(matcher, new HashMap<>())); } @SideOnly(Side.CLIENT) @@ -317,17 +321,17 @@ private static List bresenhamCircle(int xc, int zc, int r) { z = r; d = 3 - 2 * r; circlePlot(blockPos, xc, zc, x, z); - while(x < z) { - if(d < 0) { + while (x < z) { + if (d < 0) { d = d + 4 * x + 6; } else { - d = d + 4 * ( x - z ) + 10; + d = d + 4 * (x - z) + 10; z--; } x++; circlePlot(blockPos, xc, zc, x, z); } - return blockPos; + return blockPos; } @SideOnly(Side.CLIENT) @@ -403,7 +407,7 @@ public void tickAR(EntityPlayer player) { for (BlockPos pos : bresenhamCircle(lastPos.getX(), lastPos.getZ(), radius)) { for (int y = minY; y <= maxY; y++) { for (IMatcher matcher : matchers) { - BlockPos blockPos =new BlockPos(pos.getX(), y, pos.getZ()); + BlockPos blockPos = new BlockPos(pos.getX(), y, pos.getZ()); if (matcher.match(world.getBlockState(blockPos))) { addCluster(blockPos, founds.get(matcher)); } @@ -466,7 +470,8 @@ private static void renderAxisAlignedBB(float partialTicks) { final float b = (color & 0xFF) / 255f; final float a = 1; for (AxisAlignedBB bound : founds.get(matcher).keySet()) { - RenderBufferHelper.renderCubeFace(buffer, bound.minX, bound.minY, bound.minZ, bound.maxX, bound.maxY, bound.maxZ, r, g, b, a); + RenderBufferHelper.renderCubeFace(buffer, bound.minX, bound.minY, bound.minZ, bound.maxX, bound.maxY, + bound.maxZ, r, g, b, a); } } diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java index a0f64ef8a0b..1848972b122 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/BlockStateMatcher.java @@ -7,7 +7,8 @@ import java.util.List; import java.util.Objects; -public class BlockStateMatcher implements IMatcher{ +public class BlockStateMatcher implements IMatcher { + private final IBlockState reference; private final List> properties = new ArrayList<>(); private final int meta; @@ -17,7 +18,8 @@ public BlockStateMatcher(IBlockState state, int color) { this.reference = state; for (final IProperty property : state.getPropertyKeys()) { if (Objects.equals(property.getName(), "variant") || // Vanilla Minecraft. - Objects.equals(property.getName(), "type") || // E.g. ThermalFoundation, TiCon, IC2, Immersive Engineering. + Objects.equals(property.getName(), "type") || // E.g. ThermalFoundation, TiCon, IC2, Immersive + // Engineering. Objects.equals(property.getName(), "ore") || // E.g. BigReactors. Objects.equals(property.getName(), "oretype") || // E.g. DeepResonance. Objects.equals(property.getName(), "stone_type") || // E.g. gtce. @@ -27,7 +29,6 @@ public BlockStateMatcher(IBlockState state, int color) { } this.meta = reference.getBlock().getMetaFromState(reference); this.color = color; - } public boolean match(final IBlockState state) { @@ -56,7 +57,7 @@ public boolean match(final IBlockState state) { } @Override - public int getColor() { + public int getColor() { return color; } diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java index 0d23e42e1ef..c96a6c22c36 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/matcher/IMatcher.java @@ -10,6 +10,8 @@ * @Description: */ public interface IMatcher { + boolean match(final IBlockState state); + int getColor(); } diff --git a/src/main/java/gregtech/common/terminal/component/ClickComponent.java b/src/main/java/gregtech/common/terminal/component/ClickComponent.java index 4e41ac96637..24031ee4c73 100644 --- a/src/main/java/gregtech/common/terminal/component/ClickComponent.java +++ b/src/main/java/gregtech/common/terminal/component/ClickComponent.java @@ -7,6 +7,7 @@ import java.util.function.Consumer; public class ClickComponent implements IMenuComponent { + private IGuiTexture icon; private String hoverText; private Consumer consumer; diff --git a/src/main/java/gregtech/common/terminal/component/SearchComponent.java b/src/main/java/gregtech/common/terminal/component/SearchComponent.java index 22d7ef70386..b0b99d8f154 100644 --- a/src/main/java/gregtech/common/terminal/component/SearchComponent.java +++ b/src/main/java/gregtech/common/terminal/component/SearchComponent.java @@ -9,6 +9,7 @@ import gregtech.api.terminal.os.menu.IMenuComponent; import gregtech.api.terminal.util.ISearch; import gregtech.api.terminal.util.SearchEngine; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.Tuple; @@ -18,6 +19,7 @@ import java.util.List; public class SearchComponent extends WidgetGroup implements IMenuComponent { + private final static TextureArea SEARCHING = TextureArea.fullImage("textures/gui/terminal/icon/search_hover.png"); private final static int SIZE = 10; private final SearchEngine engine; @@ -26,14 +28,14 @@ public class SearchComponent extends WidgetGroup implements IMenuComponent { private boolean isUp; private int offset; - public SearchComponent(IWidgetSearch search){ - super(0,0,280,20); + public SearchComponent(IWidgetSearch search) { + super(0, 0, 280, 20); this.search = search; results = new ArrayList<>(); engine = new SearchEngine<>(search, r -> results.add(new Tuple<>(r, search.resultDisplay(r)))); this.addWidget(new TextFieldWidget(0, 5, 280, 20, new ColorRectTexture(0xcf000000), null, null) - .setValidator(s->true) - .setTextResponder(s->{ + .setValidator(s -> true) + .setTextResponder(s -> { results.clear(); engine.searchWord(s); offset = 0; @@ -107,8 +109,10 @@ public boolean mouseWheelMove(int mouseX, int mouseY, int wheelDelta) { return super.mouseWheelMove(mouseX, mouseY, wheelDelta); } - public interface IWidgetSearch extends ISearch{ + public interface IWidgetSearch extends ISearch { + String resultDisplay(T result); + void selectResult(T result); } } diff --git a/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java b/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java index bd0618ccf28..add78dfa301 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java +++ b/src/main/java/gregtech/common/terminal/component/setting/GuiTextureSetter.java @@ -6,7 +6,8 @@ import java.util.function.Consumer; -public class GuiTextureSetter extends WidgetGroup implements ISetting{ +public class GuiTextureSetter extends WidgetGroup implements ISetting { + private final String name; private Consumer updated; diff --git a/src/main/java/gregtech/common/terminal/component/setting/ISetting.java b/src/main/java/gregtech/common/terminal/component/setting/ISetting.java index db0649d75b0..2b3f2fa05d2 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/ISetting.java +++ b/src/main/java/gregtech/common/terminal/component/setting/ISetting.java @@ -4,7 +4,10 @@ import gregtech.api.gui.resources.IGuiTexture; public interface ISetting { + String getName(); + IGuiTexture getIcon(); + Widget getWidget(); } diff --git a/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java b/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java index 94a2f13db4a..e3affc80eb1 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java +++ b/src/main/java/gregtech/common/terminal/component/setting/IWidgetSettings.java @@ -3,5 +3,6 @@ import gregtech.api.terminal.util.TreeNode; public interface IWidgetSettings { + TreeNode getSettings(); } diff --git a/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java b/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java index 74397632eae..1f011df5a03 100644 --- a/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java +++ b/src/main/java/gregtech/common/terminal/component/setting/SettingComponent.java @@ -7,6 +7,7 @@ import gregtech.api.terminal.os.menu.IMenuComponent; public class SettingComponent extends WidgetGroup implements IMenuComponent { + private Widget settingWidget; public SettingComponent(IWidgetSettings settings) { @@ -25,5 +26,4 @@ public SettingComponent(IWidgetSettings settings) { .setNodeTexture(GuiTextures.BORDERED_BACKGROUND) .setLeafTexture(GuiTextures.SLOT_DARKENED)); } - } diff --git a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java index 5f93d46de0a..141baa80c02 100644 --- a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java +++ b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java @@ -9,16 +9,18 @@ import gregtech.api.terminal.hardware.Hardware; import gregtech.api.terminal.hardware.IHardwareCapability; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * Created with IntelliJ IDEA. * @@ -27,14 +29,15 @@ * @Description: */ public class BatteryHardware extends Hardware implements IElectricItem, IHardwareCapability { + protected final List> listeners = new ArrayList<>(); - public BatteryHardware() { - } + public BatteryHardware() {} @Override public boolean isHardwareAdequate(Hardware demand) { - return demand instanceof BatteryHardware && ((BatteryHardware) demand).getTier() <= this.getTier() && this.getCharge() > 0; + return demand instanceof BatteryHardware && ((BatteryHardware) demand).getTier() <= this.getTier() && + this.getCharge() > 0; } @Override @@ -127,7 +130,8 @@ public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, bo } @Override - public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, + boolean simulate) { if (provider.getItemStack().getCount() != 1) { return 0L; } @@ -158,7 +162,8 @@ public boolean hasCapability(@Nonnull Capability capability) { @Nullable @Override public T getCapability(@Nonnull Capability capability) { - return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM.cast(this) : null; + return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? + GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM.cast(this) : null; } @Override diff --git a/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java b/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java index 43bfe52072f..ccfa77d077d 100644 --- a/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java +++ b/src/main/java/gregtech/common/terminal/hardware/DeviceHardware.java @@ -5,6 +5,7 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.terminal.hardware.Hardware; import gregtech.common.items.MetaItems; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -12,6 +13,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class DeviceHardware extends Hardware { + private final int slot; public DeviceHardware(int slot) { @@ -77,7 +79,8 @@ public DEVICE getDevice() { return DEVICE.values()[getNBT().getInteger("d") % DEVICE.values().length]; } - public enum DEVICE{ + public enum DEVICE { + PROSPECTOR_LV(MetaItems.PROSPECTOR_LV, "prospector"), PROSPECTOR_HV(MetaItems.PROSPECTOR_HV, "advanced_prospector"), WIRELESS(MetaItems.WIRELESS, "wireless"), @@ -92,14 +95,16 @@ public enum DEVICE{ ItemStack itemStack; String name; - DEVICE(ItemStack itemStack, String name){ + DEVICE(ItemStack itemStack, String name) { this.itemStack = itemStack; this.name = name; } - DEVICE(MetaItem.MetaValueItem metaItem, String name){ + + DEVICE(MetaItem.MetaValueItem metaItem, String name) { this.itemStack = metaItem.getStackForm(); this.name = name; } + public static DEVICE fromString(String name) { for (DEVICE device : values()) { if (device.name.equals(name.toLowerCase())) { @@ -110,7 +115,8 @@ public static DEVICE fromString(String name) { } } - public static class DeviceDemand extends DeviceHardware{ + public static class DeviceDemand extends DeviceHardware { + private final DEVICE device; public DeviceDemand(DEVICE device) { diff --git a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java index ce71d0cb941..4b578cc3a74 100644 --- a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java +++ b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java @@ -1,7 +1,5 @@ package gregtech.common.worldgen; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; import net.minecraft.item.ItemStack; import net.minecraft.world.storage.loot.LootContext; import net.minecraft.world.storage.loot.LootEntry; @@ -9,15 +7,20 @@ import net.minecraft.world.storage.loot.conditions.LootConditionManager; import net.minecraft.world.storage.loot.functions.LootFunction; -import javax.annotation.Nonnull; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; + import java.util.Collection; import java.util.Random; +import javax.annotation.Nonnull; + public abstract class AbstractItemLootEntry extends LootEntry { private final LootFunction[] functions; - protected AbstractItemLootEntry(int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected AbstractItemLootEntry(int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, conditionsIn, entryName); this.functions = functionsIn; } diff --git a/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java b/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java index 55e77227bfa..016d2a71def 100644 --- a/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java +++ b/src/main/java/gregtech/common/worldgen/LootEntryMetaItem.java @@ -1,19 +1,22 @@ package gregtech.common.worldgen; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.world.storage.loot.conditions.LootCondition; import net.minecraft.world.storage.loot.functions.LootFunction; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + public class LootEntryMetaItem extends AbstractItemLootEntry { private final MetaValueItem metaValueItem; - protected LootEntryMetaItem(MetaValueItem metaValueItem, int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected LootEntryMetaItem(MetaValueItem metaValueItem, int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, functionsIn, conditionsIn, entryName); this.metaValueItem = metaValueItem; } @@ -31,7 +34,8 @@ public static MetaValueItem getMetaItem(String name) { .findFirst().orElse(null); } - public static LootEntryMetaItem deserialize(JsonObject object, JsonDeserializationContext context, int weight, int quality, LootCondition[] conditions) { + public static LootEntryMetaItem deserialize(JsonObject object, JsonDeserializationContext context, int weight, + int quality, LootCondition[] conditions) { String entryName = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item"); LootFunction[] lootFunctions; if (object.has("functions")) { diff --git a/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java b/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java index 377a02d8169..991fa19d883 100644 --- a/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java +++ b/src/main/java/gregtech/common/worldgen/LootEntryOreDict.java @@ -1,18 +1,21 @@ package gregtech.common.worldgen; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.unification.OreDictUnifier; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.world.storage.loot.conditions.LootCondition; import net.minecraft.world.storage.loot.functions.LootFunction; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + public class LootEntryOreDict extends AbstractItemLootEntry { private final String oreDictName; - protected LootEntryOreDict(String oreDictName, int weightIn, int qualityIn, LootFunction[] functionsIn, LootCondition[] conditionsIn, String entryName) { + protected LootEntryOreDict(String oreDictName, int weightIn, int qualityIn, LootFunction[] functionsIn, + LootCondition[] conditionsIn, String entryName) { super(weightIn, qualityIn, functionsIn, conditionsIn, entryName); this.oreDictName = oreDictName; } @@ -22,8 +25,8 @@ protected ItemStack createItemStack() { return OreDictUnifier.get(oreDictName); } - public static LootEntryOreDict deserialize(JsonObject object, JsonDeserializationContext context, int weight, int quality, LootCondition[] conditions) { - + public static LootEntryOreDict deserialize(JsonObject object, JsonDeserializationContext context, int weight, + int quality, LootCondition[] conditions) { String entryName = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item"); LootFunction[] lootFunctions; if (object.has("functions")) { diff --git a/src/main/java/gregtech/common/worldgen/LootTableHelper.java b/src/main/java/gregtech/common/worldgen/LootTableHelper.java index 6df40234524..0f288beece1 100644 --- a/src/main/java/gregtech/common/worldgen/LootTableHelper.java +++ b/src/main/java/gregtech/common/worldgen/LootTableHelper.java @@ -1,8 +1,7 @@ package gregtech.common.worldgen; -import com.google.common.collect.Lists; -import com.google.gson.*; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraft.util.JsonUtils; import net.minecraft.util.math.MathHelper; @@ -12,6 +11,9 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import com.google.common.collect.Lists; +import com.google.gson.*; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.lang.reflect.Type; @@ -23,10 +25,13 @@ public class LootTableHelper { private static final Map> serializerMap = new HashMap<>(); public interface LootTableEntrySerializer { - T deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn); + + T deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, + LootCondition[] conditionsIn); } public interface SerializableLootEntry { + String getType(); int getWeight(); @@ -58,20 +63,22 @@ public static void initialize() { registerLootEntry("gregtech:ore_dict", LootEntryOreDict::deserialize); } - private static class LootTableEntrySerializerDelegate implements JsonSerializer, JsonDeserializer { + private static class LootTableEntrySerializerDelegate implements JsonSerializer, + JsonDeserializer { private final JsonSerializer delegatedSerializer; private final JsonDeserializer delegatedDeserializer; - @SuppressWarnings("unchecked") - public LootTableEntrySerializerDelegate(JsonSerializer delegatedSerializer, JsonDeserializer delegatedDeserializer) { + public LootTableEntrySerializerDelegate(JsonSerializer delegatedSerializer, + JsonDeserializer delegatedDeserializer) { this.delegatedSerializer = (JsonSerializer) delegatedSerializer; this.delegatedDeserializer = (JsonDeserializer) delegatedDeserializer; } @Override - public LootEntry deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + public LootEntry deserialize(JsonElement json, Type typeOfT, + JsonDeserializationContext context) throws JsonParseException { JsonObject jsonobject = JsonUtils.getJsonObject(json, "loot item"); String type = JsonUtils.getString(jsonobject, "type"); if (serializerMap.containsKey(type)) { @@ -79,7 +86,8 @@ public LootEntry deserialize(JsonElement json, Type typeOfT, JsonDeserialization int quality = JsonUtils.getInt(jsonobject, "quality", 0); LootCondition[] lootConditions; if (jsonobject.has("conditions")) { - lootConditions = JsonUtils.deserializeClass(jsonobject, "conditions", context, LootCondition[].class); + lootConditions = JsonUtils.deserializeClass(jsonobject, "conditions", context, + LootCondition[].class); } else { lootConditions = new LootCondition[0]; } @@ -108,13 +116,14 @@ public JsonElement serialize(LootEntry src, Type typeOfSrc, JsonSerializationCon } } - @SuppressWarnings("unchecked") - private static void replaceGsonTypeHierarchySerializer(Gson gson, Class type, BiFunction, JsonDeserializer, Object> replacer) { + private static void replaceGsonTypeHierarchySerializer(Gson gson, Class type, + BiFunction, JsonDeserializer, Object> replacer) { try { Field field = Gson.class.getDeclaredField("factories"); field.setAccessible(true); - Class singleTypeFactoryClass = Class.forName("com.google.gson.internal.bind.TreeTypeAdapter$SingleTypeFactory"); + Class singleTypeFactoryClass = Class + .forName("com.google.gson.internal.bind.TreeTypeAdapter$SingleTypeFactory"); Field hierarchyTypeField = singleTypeFactoryClass.getDeclaredField("hierarchyType"); hierarchyTypeField.setAccessible(true); List factories = (List) field.get(gson); diff --git a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java index 2eacfd8c395..b39f31569cf 100644 --- a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java +++ b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java @@ -1,6 +1,7 @@ package gregtech.common.worldgen; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; @@ -11,9 +12,10 @@ import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; import net.minecraftforge.fml.common.eventhandler.Event; -import javax.annotation.Nonnull; import java.util.Random; +import javax.annotation.Nonnull; + import static gregtech.common.blocks.wood.BlockRubberLog.NATURAL; public class WorldGenRubberTree extends WorldGenerator { @@ -66,8 +68,9 @@ public boolean grow(World world, BlockPos pos, Random random) { int dx = Math.abs(cx - pos.getX()); int dz = Math.abs(cz - pos.getZ()); if ((dx <= 1 && dz <= 1) || (dx <= 1 && random - .nextInt(chance) == 0) || (dz <= 1 && random - .nextInt(chance) == 0)) { + .nextInt(chance) == 0) || (dz <= 1 && + random + .nextInt(chance) == 0)) { tmpPos.setPos(cx, pos.getY() + cHeight, cz); if (world.isAirBlock(tmpPos)) { setBlockAndNotifyAdequately(world, new BlockPos(tmpPos), leaves); @@ -90,8 +93,8 @@ public int getGrowHeight(@Nonnull World world, @Nonnull BlockPos pos) { IBlockState baseState = world.getBlockState(below); Block baseBlock = baseState.getBlock(); if (baseBlock.isAir(baseState, world, below) || - !baseBlock.canSustainPlant(baseState, world, below, EnumFacing.UP, MetaBlocks.RUBBER_SAPLING) || ( - !world.isAirBlock(pos.up()) && world.getBlockState(pos.up()).getBlock() != MetaBlocks.RUBBER_SAPLING)) + !baseBlock.canSustainPlant(baseState, world, below, EnumFacing.UP, MetaBlocks.RUBBER_SAPLING) || + (!world.isAirBlock(pos.up()) && world.getBlockState(pos.up()).getBlock() != MetaBlocks.RUBBER_SAPLING)) return 0; int height = 1; pos = pos.up(); diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index 88ca4b65d0c..4899ce55371 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -54,6 +54,7 @@ import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.loaders.dungeon.DungeonLootLoader; import gregtech.modules.GregTechModules; + import net.minecraft.block.state.IBlockState; import net.minecraft.world.World; import net.minecraftforge.classloading.FMLForgePlugin; @@ -63,26 +64,29 @@ import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.relauncher.Side; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Map; +import javax.annotation.Nonnull; + import static gregtech.api.GregTechAPI.*; @GregTechModule( - moduleID = GregTechModules.MODULE_CORE, - containerID = GTValues.MODID, - name = "GregTech Core", - description = "Core GregTech content. Disabling this disables the entire mod and all its addons.", - coreModule = true -) + moduleID = GregTechModules.MODULE_CORE, + containerID = GTValues.MODID, + name = "GregTech Core", + description = "Core GregTech content. Disabling this disables the entire mod and all its addons.", + coreModule = true) public class CoreModule implements IGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Core"); - @SidedProxy(modId = GTValues.MODID, clientSide = "gregtech.client.ClientProxy", serverSide = "gregtech.common.CommonProxy") + @SidedProxy(modId = GTValues.MODID, + clientSide = "gregtech.client.ClientProxy", + serverSide = "gregtech.common.CommonProxy") public static CommonProxy proxy; public CoreModule() { @@ -204,10 +208,12 @@ public void init(FMLInitializationEvent event) { proxy.onLoad(); if (RecipeMap.isFoundInvalidRecipe()) { logger.fatal("Seems like invalid recipe was found."); - //crash if config setting is set to false, or we are in deobfuscated environment + // crash if config setting is set to false, or we are in deobfuscated environment if (!ConfigHolder.misc.ignoreErrorOrInvalidRecipes || !FMLForgePlugin.RUNTIME_DEOBF) { - logger.fatal("Loading cannot continue. Either fix or report invalid recipes, or enable ignoreErrorOrInvalidRecipes in the config as a temporary solution"); - throw new LoaderException("Found at least one invalid recipe. Please read the log above for more details."); + logger.fatal( + "Loading cannot continue. Either fix or report invalid recipes, or enable ignoreErrorOrInvalidRecipes in the config as a temporary solution"); + throw new LoaderException( + "Found at least one invalid recipe. Please read the log above for more details."); } else { logger.fatal("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); logger.fatal("Ignoring invalid recipes and continuing loading"); @@ -273,7 +279,8 @@ public void serverStarted(FMLServerStartedEvent event) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { World world = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld(); if (!world.isRemote) { - BedrockFluidVeinSaveData saveData = (BedrockFluidVeinSaveData) world.loadData(BedrockFluidVeinSaveData.class, BedrockFluidVeinSaveData.dataName); + BedrockFluidVeinSaveData saveData = (BedrockFluidVeinSaveData) world + .loadData(BedrockFluidVeinSaveData.class, BedrockFluidVeinSaveData.dataName); if (saveData == null) { saveData = new BedrockFluidVeinSaveData(BedrockFluidVeinSaveData.dataName); world.setData(BedrockFluidVeinSaveData.dataName, saveData); diff --git a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java index 4bd7057c501..46737ccab59 100644 --- a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java +++ b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java @@ -1,6 +1,7 @@ package gregtech.core.advancement.criterion; import gregtech.api.advancement.IAdvancementCriterion; + import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java b/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java index a5a44060c3d..d5ad2bba555 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementListeners.java @@ -1,12 +1,14 @@ package gregtech.core.advancement.internal; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import gregtech.api.advancement.IAdvancementCriterion; + import net.minecraft.advancements.ICriterionTrigger.Listener; import net.minecraft.advancements.PlayerAdvancements; import net.minecraft.entity.player.EntityPlayerMP; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + import java.util.List; import java.util.Set; diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java b/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java index ed5167ca768..d1cde600d6b 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementManager.java @@ -6,14 +6,14 @@ import gregtech.api.advancement.IAdvancementTrigger; import gregtech.api.modules.ModuleStage; import gregtech.core.CoreModule; + import net.minecraft.advancements.CriteriaTriggers; public class AdvancementManager implements IAdvancementManager { private static final AdvancementManager INSTANCE = new AdvancementManager(); - private AdvancementManager() { - } + private AdvancementManager() {} public static AdvancementManager getInstance() { return INSTANCE; @@ -22,7 +22,8 @@ public static AdvancementManager getInstance() { @Override public IAdvancementTrigger registerTrigger(String id, T criterion) { if (GregTechAPI.moduleManager.hasPassedStage(ModuleStage.PRE_INIT)) { - CoreModule.logger.error("Could not register advancement trigger {}, as trigger registration has ended!", id); + CoreModule.logger.error("Could not register advancement trigger {}, as trigger registration has ended!", + id); return null; } IAdvancementTrigger trigger = new AdvancementTrigger<>(id, criterion); diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java index b480b47b8ab..8117511b7b9 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java @@ -1,18 +1,21 @@ package gregtech.core.advancement.internal; -import com.google.common.collect.Maps; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; import gregtech.api.advancement.IAdvancementCriterion; import gregtech.api.advancement.IAdvancementTrigger; import gregtech.api.util.GTUtility; + import net.minecraft.advancements.PlayerAdvancements; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; +import com.google.common.collect.Maps; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; + import java.util.Map; +import javax.annotation.Nonnull; + public class AdvancementTrigger implements IAdvancementTrigger { private final ResourceLocation id; diff --git a/src/main/java/gregtech/core/command/internal/CommandManager.java b/src/main/java/gregtech/core/command/internal/CommandManager.java index 8f1169477af..39b489939ac 100644 --- a/src/main/java/gregtech/core/command/internal/CommandManager.java +++ b/src/main/java/gregtech/core/command/internal/CommandManager.java @@ -1,6 +1,7 @@ package gregtech.core.command.internal; import gregtech.api.command.ICommandManager; + import net.minecraft.command.ICommand; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.server.command.CommandTreeBase; diff --git a/src/main/java/gregtech/core/command/internal/GregTechCommand.java b/src/main/java/gregtech/core/command/internal/GregTechCommand.java index 733dc8a8a5e..f0f18a7e3f0 100644 --- a/src/main/java/gregtech/core/command/internal/GregTechCommand.java +++ b/src/main/java/gregtech/core/command/internal/GregTechCommand.java @@ -1,7 +1,7 @@ package gregtech.core.command.internal; -import com.google.common.collect.Lists; import gregtech.api.util.ClipboardUtil; + import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; @@ -12,9 +12,12 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.server.command.CommandTreeBase; -import javax.annotation.Nonnull; +import com.google.common.collect.Lists; + import java.util.List; +import javax.annotation.Nonnull; + class GregTechCommand extends CommandTreeBase { @Nonnull @@ -36,7 +39,8 @@ public String getUsage(@Nonnull ICommandSender sender) { } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, String[] args) throws CommandException { + public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, + String[] args) throws CommandException { if (args.length > 0) { if (args[0].equals("copy")) { StringBuilder message = new StringBuilder(); @@ -50,14 +54,16 @@ public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sen if (sender.getCommandSenderEntity() instanceof EntityPlayerMP) { ClipboardUtil.copyToClipboard((EntityPlayerMP) sender.getCommandSenderEntity(), message.toString()); sender.sendMessage(new TextComponentTranslation("gregtech.command.copy.copied_start") - .appendSibling(new TextComponentString(message.toString()).setStyle(new Style().setColor(TextFormatting.GOLD))) + .appendSibling(new TextComponentString(message.toString()) + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_end"))); } return; } if (args[0].equals("util")) { if (sender.getCommandSenderEntity() instanceof EntityPlayerMP) { - sender.sendMessage(new TextComponentString("\u00A76/gt util hand\u00A7r was yeeted. The new command is \u00A76/gt hand\u00A7r")); + sender.sendMessage(new TextComponentString( + "\u00A76/gt util hand\u00A7r was yeeted. The new command is \u00A76/gt hand\u00A7r")); } return; } diff --git a/src/main/java/gregtech/core/network/NetworkUtils.java b/src/main/java/gregtech/core/network/NetworkUtils.java index 13194fd359c..1b690192c17 100644 --- a/src/main/java/gregtech/core/network/NetworkUtils.java +++ b/src/main/java/gregtech/core/network/NetworkUtils.java @@ -1,7 +1,5 @@ package gregtech.core.network; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import net.minecraft.block.state.IBlockState; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -10,6 +8,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + public class NetworkUtils { public static void writePacketBuffer(PacketBuffer writeTo, PacketBuffer writeFrom) { @@ -33,6 +34,7 @@ public static IBlockState getIBlockStateServer(int dimension, BlockPos pos) { } public static NetworkRegistry.TargetPoint blockPoint(World world, BlockPos blockPos) { - return new NetworkRegistry.TargetPoint(world.provider.getDimension(), blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 128.0); + return new NetworkRegistry.TargetPoint(world.provider.getDimension(), blockPos.getX() + 0.5, + blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 128.0); } } diff --git a/src/main/java/gregtech/core/network/internal/NetworkHandler.java b/src/main/java/gregtech/core/network/internal/NetworkHandler.java index 5ef87737917..60849c35415 100644 --- a/src/main/java/gregtech/core/network/internal/NetworkHandler.java +++ b/src/main/java/gregtech/core/network/internal/NetworkHandler.java @@ -1,14 +1,14 @@ package gregtech.core.network.internal; import gregtech.api.GTValues; +import gregtech.api.GregTechAPI; +import gregtech.api.modules.ModuleStage; import gregtech.api.network.IClientExecutor; import gregtech.api.network.INetworkHandler; import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; -import gregtech.api.GregTechAPI; -import gregtech.api.modules.ModuleStage; import gregtech.core.CoreModule; -import io.netty.buffer.Unpooled; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,6 +25,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import io.netty.buffer.Unpooled; + public class NetworkHandler implements INetworkHandler { private static final NetworkHandler INSTANCE = new NetworkHandler(); @@ -44,7 +46,8 @@ public static INetworkHandler getInstance() { public void registerPacket(Class packetClass) { if (GregTechAPI.moduleManager.hasPassedStage(ModuleStage.PRE_INIT)) { - CoreModule.logger.error("Could not register packet {}, as packet registration has ended!", packetClass.getName()); + CoreModule.logger.error("Could not register packet {}, as packet registration has ended!", + packetClass.getName()); return; } @@ -52,11 +55,15 @@ public void registerPacket(Class packetClass) { boolean hasClientExecutor = IClientExecutor.class.isAssignableFrom(packetClass); if (hasServerExecutor && hasClientExecutor) { - CoreModule.logger.error("Could not register packet {}, as it is both a Server and Client executor! Only one allowed. Skipping...", packetClass.getName()); + CoreModule.logger.error( + "Could not register packet {}, as it is both a Server and Client executor! Only one allowed. Skipping...", + packetClass.getName()); return; } if (!hasServerExecutor && !hasClientExecutor) { - CoreModule.logger.error("Could not register packet {}, as it does not have an executor! Must have either IServerExecutor OR IClientExecutor. Skipping...", packetClass.getName()); + CoreModule.logger.error( + "Could not register packet {}, as it does not have an executor! Must have either IServerExecutor OR IClientExecutor. Skipping...", + packetClass.getName()); return; } packetHandler.registerPacket(packetClass); diff --git a/src/main/java/gregtech/core/network/internal/PacketHandler.java b/src/main/java/gregtech/core/network/internal/PacketHandler.java index ed299d511d2..975f46c7f82 100644 --- a/src/main/java/gregtech/core/network/internal/PacketHandler.java +++ b/src/main/java/gregtech/core/network/internal/PacketHandler.java @@ -1,6 +1,7 @@ package gregtech.core.network.internal; import gregtech.api.network.IPacket; + import net.minecraft.util.IntIdentityHashBiMap; public class PacketHandler { @@ -31,4 +32,3 @@ public Class getPacketClass(int packetId) { return packetMap.get(packetId); } } - diff --git a/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java b/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java index d77f466371a..91b017465e2 100644 --- a/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java +++ b/src/main/java/gregtech/core/network/packets/PacketBlockParticle.java @@ -1,9 +1,9 @@ package gregtech.core.network.packets; -import codechicken.lib.vec.Vector3; import gregtech.api.block.ICustomParticleBlock; import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetHandlerPlayClient; @@ -14,6 +14,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import codechicken.lib.vec.Vector3; + public class PacketBlockParticle implements IPacket, IClientExecutor { private BlockPos blockPos; @@ -51,6 +53,7 @@ public void executeClient(NetHandlerPlayClient handler) { World world = Minecraft.getMinecraft().world; IBlockState blockState = world.getBlockState(blockPos); ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer; - ((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, blockPos, particleManager, entityPos, particlesAmount); + ((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, blockPos, particleManager, entityPos, + particlesAmount); } } diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboard.java b/src/main/java/gregtech/core/network/packets/PacketClipboard.java index 26fe1f3312d..04bee1cb681 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboard.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboard.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.util.ClipboardUtil; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java b/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java index c01c8eaf4b0..6a9479cc34d 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboardNBTUpdate.java @@ -5,12 +5,14 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.MetaTileEntityClipboard; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; public class PacketClipboardNBTUpdate implements IPacket, IServerExecutor { + private int dimension; private BlockPos pos; private int id; @@ -46,11 +48,12 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { try { - ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).setClipboardNBT(updateData.readCompoundTag()); - } catch (Exception ignored) { - } + ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()) + .setClipboardNBT(updateData.readCompoundTag()); + } catch (Exception ignored) {} } } } diff --git a/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java b/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java index d24ee9942a8..eee14f2340d 100644 --- a/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketClipboardUIWidgetUpdate.java @@ -5,6 +5,7 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.MetaTileEntityClipboard; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -47,8 +48,10 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { - ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).readUIAction(handler.player, id, updateData); + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityClipboard) { + ((MetaTileEntityClipboard) ((IGregTechTileEntity) te).getMetaTileEntity()).readUIAction(handler.player, id, + updateData); } } } diff --git a/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java b/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java index ff649a185d3..34dade2e3f0 100644 --- a/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java +++ b/src/main/java/gregtech/core/network/packets/PacketFluidVeinList.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.worldgen.bedrockFluids.BedrockFluidVeinHandler; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; @@ -42,7 +43,8 @@ public void decode(PacketBuffer buf) { NBTTagCompound tag = ByteBufUtils.readTag(buf); if (tag == null || tag.isEmpty()) continue; - BedrockFluidVeinHandler.FluidVeinWorldEntry entry = BedrockFluidVeinHandler.FluidVeinWorldEntry.readFromNBT(tag); + BedrockFluidVeinHandler.FluidVeinWorldEntry entry = BedrockFluidVeinHandler.FluidVeinWorldEntry + .readFromNBT(tag); this.map.put(entry, tag.getInteger("weight")); } } diff --git a/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java b/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java index d7f4f222491..8b5d4198f91 100644 --- a/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java +++ b/src/main/java/gregtech/core/network/packets/PacketKeysPressed.java @@ -3,8 +3,10 @@ import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; import gregtech.api.util.input.KeyBind; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; + import org.apache.commons.lang3.tuple.Pair; import java.util.List; diff --git a/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java b/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java index c1b2d8d54f8..530d81b55af 100644 --- a/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java +++ b/src/main/java/gregtech/core/network/packets/PacketNotifyCapeChange.java @@ -3,6 +3,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.api.util.CapesRegistry; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; @@ -41,5 +42,4 @@ public void decode(PacketBuffer buf) { public void executeClient(NetHandlerPlayClient handler) { CapesRegistry.giveRawCape(uuid, cape); } - } diff --git a/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java b/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java index 16c8cf3ec70..a2dd163919b 100644 --- a/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java +++ b/src/main/java/gregtech/core/network/packets/PacketPluginSynced.java @@ -6,6 +6,7 @@ import gregtech.api.network.IServerExecutor; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; import gregtech.core.network.NetworkUtils; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; @@ -48,8 +49,10 @@ public void decode(PacketBuffer buf) { @Override public void executeServer(NetHandlerPlayServer handler) { TileEntity te = NetworkUtils.getTileEntityServer(dimension, pos); - if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { - MonitorPluginBaseBehavior plugin = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) te).getMetaTileEntity()).plugin; + if (te instanceof IGregTechTileEntity && + ((IGregTechTileEntity) te).getMetaTileEntity() instanceof MetaTileEntityMonitorScreen) { + MonitorPluginBaseBehavior plugin = ((MetaTileEntityMonitorScreen) ((IGregTechTileEntity) te) + .getMetaTileEntity()).plugin; if (plugin != null) { plugin.readPluginAction(handler.player, id, updateData); } diff --git a/src/main/java/gregtech/core/network/packets/PacketProspecting.java b/src/main/java/gregtech/core/network/packets/PacketProspecting.java index 6f89142cf4c..47a1780f930 100644 --- a/src/main/java/gregtech/core/network/packets/PacketProspecting.java +++ b/src/main/java/gregtech/core/network/packets/PacketProspecting.java @@ -1,15 +1,18 @@ package gregtech.core.network.packets; import gregtech.common.terminal.app.prospector.ProspectorMode; -import io.netty.buffer.Unpooled; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; +import io.netty.buffer.Unpooled; + import java.util.HashMap; import java.util.HashSet; import java.util.Set; public class PacketProspecting { + public int chunkX; public int chunkZ; public int playerChunkX; @@ -23,7 +26,8 @@ public class PacketProspecting { @SuppressWarnings("unused") public PacketProspecting() {} - public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChunkZ, int posX, int posZ, ProspectorMode mode) { + public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChunkZ, int posX, int posZ, + ProspectorMode mode) { this.chunkX = chunkX; this.chunkZ = chunkZ; this.playerChunkX = playerChunkX; @@ -32,10 +36,10 @@ public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChu this.posZ = posZ; this.mode = mode; if (mode == ProspectorMode.FLUID) { - //noinspection unchecked + // noinspection unchecked map = new HashMap[1][1]; } else { - //noinspection unchecked + // noinspection unchecked map = new HashMap[16][16]; } @@ -43,7 +47,8 @@ public PacketProspecting(int chunkX, int chunkZ, int playerChunkX, int playerChu } public static PacketProspecting readPacketData(PacketBuffer buffer) { - PacketProspecting packet = new PacketProspecting(buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt(), ProspectorMode.VALUES[buffer.readInt()]); + PacketProspecting packet = new PacketProspecting(buffer.readInt(), buffer.readInt(), buffer.readInt(), + buffer.readInt(), buffer.readInt(), buffer.readInt(), ProspectorMode.VALUES[buffer.readInt()]); int aSize = 0; if (packet.mode == ProspectorMode.ORE) aSize = 16; @@ -71,10 +76,10 @@ else if (packet.mode == ProspectorMode.FLUID) return packet; } - public static PacketProspecting readPacketData(NBTTagCompound nbt) { if (nbt.hasKey("buffer")) { - return PacketProspecting.readPacketData(new PacketBuffer(Unpooled.wrappedBuffer(nbt.getByteArray("buffer")))); + return PacketProspecting + .readPacketData(new PacketBuffer(Unpooled.wrappedBuffer(nbt.getByteArray("buffer")))); } return null; } @@ -133,5 +138,4 @@ public void addBlock(int x, int y, int z, String orePrefix) { } } } - } diff --git a/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java b/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java index a39c1d1397e..f90fb9af678 100644 --- a/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java +++ b/src/main/java/gregtech/core/network/packets/PacketRecoverMTE.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; + import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketBlockChange; @@ -47,7 +48,8 @@ public void executeServer(NetHandlerPlayServer handler) { if (te instanceof IGregTechTileEntity && ((IGregTechTileEntity) te).isValid()) { IGregTechTileEntity holder = (IGregTechTileEntity) te; holder.writeCustomData(INITIALIZE_MTE, buffer -> { - buffer.writeVarInt(GregTechAPI.MTE_REGISTRY.getIdByObjectName(holder.getMetaTileEntity().metaTileEntityId)); + buffer.writeVarInt( + GregTechAPI.MTE_REGISTRY.getIdByObjectName(holder.getMetaTileEntity().metaTileEntityId)); holder.getMetaTileEntity().writeInitialSyncData(buffer); }); } else if (!(world.getBlockState(pos).getBlock() instanceof BlockMachine)) { diff --git a/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java b/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java index 06e9ade138c..69296cc69bd 100644 --- a/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java +++ b/src/main/java/gregtech/core/network/packets/PacketReloadShaders.java @@ -4,6 +4,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.client.shader.Shaders; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; @@ -13,12 +14,10 @@ public class PacketReloadShaders implements IPacket, IClientExecutor { public PacketReloadShaders() {} @Override - public void encode(PacketBuffer buf) { - } + public void encode(PacketBuffer buf) {} @Override - public void decode(PacketBuffer buf) { - } + public void decode(PacketBuffer buf) {} @Override public void executeClient(NetHandlerPlayClient handler) { diff --git a/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java b/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java index 182b569d369..f8a5c0721ae 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIClientAction.java @@ -5,6 +5,7 @@ import gregtech.api.network.IPacket; import gregtech.api.network.IServerExecutor; import gregtech.core.network.NetworkUtils; + import net.minecraft.inventory.Container; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; diff --git a/src/main/java/gregtech/core/network/packets/PacketUIOpen.java b/src/main/java/gregtech/core/network/packets/PacketUIOpen.java index 2155dc73e7e..7edd515cae5 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIOpen.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIOpen.java @@ -6,6 +6,7 @@ import gregtech.api.network.IPacket; import gregtech.api.util.GTLog; import gregtech.core.network.NetworkUtils; + import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.relauncher.Side; @@ -24,7 +25,8 @@ public class PacketUIOpen implements IPacket, IClientExecutor { @SuppressWarnings("unused") public PacketUIOpen() {} - public PacketUIOpen(int uiFactoryId, PacketBuffer serializedHolder, int windowId, List initialWidgetUpdates) { + public PacketUIOpen(int uiFactoryId, PacketBuffer serializedHolder, int windowId, + List initialWidgetUpdates) { this.uiFactoryId = uiFactoryId; this.serializedHolder = serializedHolder; this.windowId = windowId; diff --git a/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java b/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java index 1369ea2f6f2..c896c5adedd 100644 --- a/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java +++ b/src/main/java/gregtech/core/network/packets/PacketUIWidgetUpdate.java @@ -4,6 +4,7 @@ import gregtech.api.network.IClientExecutor; import gregtech.api.network.IPacket; import gregtech.core.network.NetworkUtils; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.network.NetHandlerPlayClient; diff --git a/src/main/java/gregtech/core/sound/internal/SoundManager.java b/src/main/java/gregtech/core/sound/internal/SoundManager.java index 6e7b23e2368..ded6917c296 100644 --- a/src/main/java/gregtech/core/sound/internal/SoundManager.java +++ b/src/main/java/gregtech/core/sound/internal/SoundManager.java @@ -3,8 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.sound.ISoundManager; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.PositionedSoundRecord; @@ -16,6 +15,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + public class SoundManager implements ISoundManager { private static final SoundManager INSTANCE = new SoundManager(); diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java index aef7595b68a..c35ac9e7a8b 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java @@ -4,10 +4,11 @@ import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.core.CoreModule; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; + public class MaterialRegistryImpl extends MaterialRegistry { private static int networkIdCounter; @@ -31,7 +32,9 @@ public void register(Material material) { @Override public void register(int id, @Nonnull String key, @Nonnull Material value) { if (isRegistryClosed) { - CoreModule.logger.error("Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", key); + CoreModule.logger.error( + "Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", + key); return; } super.register(id, key, value); diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java index 8b4664196d8..4f812a8f0f8 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java @@ -1,21 +1,23 @@ package gregtech.core.unification.material.internal; -import com.google.common.base.Preconditions; import gregtech.api.GTValues; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.registry.IMaterialRegistryManager; import gregtech.api.unification.material.registry.MaterialRegistry; + +import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public final class MaterialRegistryManager implements IMaterialRegistryManager { private static MaterialRegistryManager INSTANCE; diff --git a/src/main/java/gregtech/integration/IntegrationModule.java b/src/main/java/gregtech/integration/IntegrationModule.java index 0245d051f57..5dfb77b2d0f 100644 --- a/src/main/java/gregtech/integration/IntegrationModule.java +++ b/src/main/java/gregtech/integration/IntegrationModule.java @@ -1,31 +1,33 @@ package gregtech.integration; -import blusunrize.immersiveengineering.api.tool.BelljarHandler; -import crazypants.enderio.api.farm.IFertilizer; -import crazypants.enderio.base.farming.fertilizer.Bonemeal; import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; import gregtech.common.items.MetaItems; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; + import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import blusunrize.immersiveengineering.api.tool.BelljarHandler; +import crazypants.enderio.api.farm.IFertilizer; +import crazypants.enderio.base.farming.fertilizer.Bonemeal; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_INTEGRATION, - containerID = GTValues.MODID, - name = "GregTech Mod Integration", - description = "General GregTech Integration Module. Disabling this disables all integration modules." -) + moduleID = GregTechModules.MODULE_INTEGRATION, + containerID = GTValues.MODID, + name = "GregTech Mod Integration", + description = "General GregTech Integration Module. Disabling this disables all integration modules.") public class IntegrationModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Mod Integration"); diff --git a/src/main/java/gregtech/integration/IntegrationSubmodule.java b/src/main/java/gregtech/integration/IntegrationSubmodule.java index e445bb53c96..3f66d8bd5e9 100644 --- a/src/main/java/gregtech/integration/IntegrationSubmodule.java +++ b/src/main/java/gregtech/integration/IntegrationSubmodule.java @@ -3,13 +3,16 @@ import gregtech.api.util.GTUtility; import gregtech.modules.BaseGregTechModule; import gregtech.modules.GregTechModules; + import net.minecraft.util.ResourceLocation; + import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; + /** * Abstract class meant to be used by mod-specific compatibility modules. * Implements some shared skeleton code that should be shared by other modules. diff --git a/src/main/java/gregtech/integration/IntegrationUtil.java b/src/main/java/gregtech/integration/IntegrationUtil.java index ed4a015b218..88cfe6ec990 100644 --- a/src/main/java/gregtech/integration/IntegrationUtil.java +++ b/src/main/java/gregtech/integration/IntegrationUtil.java @@ -10,6 +10,7 @@ import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,7 +51,8 @@ public static ItemStack getModItem(@NotNull String modid, @NotNull String name, } @NotNull - public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, @Nullable String nbt) { + public static ItemStack getModItem(@NotNull String modid, @NotNull String name, int meta, int amount, + @Nullable String nbt) { if (!Loader.isModLoaded(modid)) { return ItemStack.EMPTY; } @@ -74,11 +76,11 @@ public ModIncompatibilityException(List messages) { } @Override - public void initGui(GuiErrorScreen guiErrorScreen, FontRenderer fontRenderer) { - } + public void initGui(GuiErrorScreen guiErrorScreen, FontRenderer fontRenderer) {} @Override - public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseX, int mouseY, float time) { + public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseX, int mouseY, + float time) { int x = errorScreen.width / 2; int y = 75; for (String message : messages) { diff --git a/src/main/java/gregtech/integration/RecipeCompatUtil.java b/src/main/java/gregtech/integration/RecipeCompatUtil.java index 4d2c537b2ed..67f7b788e22 100644 --- a/src/main/java/gregtech/integration/RecipeCompatUtil.java +++ b/src/main/java/gregtech/integration/RecipeCompatUtil.java @@ -16,10 +16,12 @@ import gregtech.integration.crafttweaker.CTRecipeHelper; import gregtech.integration.groovy.GrSRecipeHelper; import gregtech.modules.GregTechModules; + import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.ApiStatus; import javax.annotation.Nonnull; @@ -60,7 +62,8 @@ public static String getMetaItemId(ItemStack item) { if (item.getItem() instanceof MachineItemBlock) { MetaTileEntity mte = GTUtility.getMetaTileEntity(item); if (mte != null) { - return (mte.metaTileEntityId.getNamespace().equals(GTValues.MODID) ? mte.metaTileEntityId.getPath() : mte.metaTileEntityId.toString()); + return (mte.metaTileEntityId.getNamespace().equals(GTValues.MODID) ? + mte.metaTileEntityId.getPath() : mte.metaTileEntityId.toString()); } } if (block instanceof BlockCompressed) { @@ -119,6 +122,7 @@ public static String getTweakerName() { } public enum TweakerType { + CRAFTTWEAKER("CraftTweaker"), GROOVYSCRIPT("GroovyScript"), NONE(""); diff --git a/src/main/java/gregtech/integration/baubles/BaubleBehavior.java b/src/main/java/gregtech/integration/baubles/BaubleBehavior.java index 3b64bdf981a..9eb8b186bdb 100644 --- a/src/main/java/gregtech/integration/baubles/BaubleBehavior.java +++ b/src/main/java/gregtech/integration/baubles/BaubleBehavior.java @@ -1,14 +1,16 @@ package gregtech.integration.baubles; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import baubles.api.cap.BaublesCapabilities; import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import baubles.api.cap.BaublesCapabilities; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/integration/baubles/BaublesModule.java b/src/main/java/gregtech/integration/baubles/BaublesModule.java index 4d73036565c..4371d5a032d 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesModule.java +++ b/src/main/java/gregtech/integration/baubles/BaublesModule.java @@ -1,31 +1,32 @@ package gregtech.integration.baubles; -import baubles.api.BaubleType; -import baubles.api.BaublesApi; -import baubles.api.cap.IBaublesItemHandler; import gregtech.api.GTValues; import gregtech.api.modules.GregTechModule; import gregtech.common.items.MetaItems; import gregtech.integration.IntegrationSubmodule; import gregtech.modules.GregTechModules; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import baubles.api.BaubleType; +import baubles.api.BaublesApi; +import baubles.api.cap.IBaublesItemHandler; import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; @GregTechModule( - moduleID = GregTechModules.MODULE_BAUBLES, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_BAUBLES, - name = "GregTech Baubles Integration", - description = "Baubles Integration Module" -) + moduleID = GregTechModules.MODULE_BAUBLES, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_BAUBLES, + name = "GregTech Baubles Integration", + description = "Baubles Integration Module") public class BaublesModule extends IntegrationSubmodule { @NotNull diff --git a/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java b/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java index 5cf7d823892..6cda484f2d3 100644 --- a/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java +++ b/src/main/java/gregtech/integration/baubles/BaublesWrappedInventory.java @@ -1,11 +1,12 @@ package gregtech.integration.baubles; -import baubles.api.cap.IBaublesItemHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; + +import baubles.api.cap.IBaublesItemHandler; import org.jetbrains.annotations.NotNull; /** Wrapped player inventory and Baubles inventory. */ @@ -82,8 +83,7 @@ public boolean isEmpty() { } @Override - public void markDirty() { - } + public void markDirty() {} @Override public boolean isUsableByPlayer(@NotNull EntityPlayer player) { @@ -91,12 +91,10 @@ public boolean isUsableByPlayer(@NotNull EntityPlayer player) { } @Override - public void openInventory(@NotNull EntityPlayer player) { - } + public void openInventory(@NotNull EntityPlayer player) {} @Override - public void closeInventory(@NotNull EntityPlayer player) { - } + public void closeInventory(@NotNull EntityPlayer player) {} @Override public int getField(int id) { @@ -104,8 +102,7 @@ public int getField(int id) { } @Override - public void setField(int id, int value) { - } + public void setField(int id, int value) {} @Override public int getFieldCount() { @@ -113,8 +110,7 @@ public int getFieldCount() { } @Override - public void clear() { - } + public void clear() {} @Override public @NotNull String getName() { diff --git a/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java b/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java index 6d0dc4bf5f7..6b48f790b86 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java +++ b/src/main/java/gregtech/integration/crafttweaker/CTRecipeHelper.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker; -import crafttweaker.mc1120.data.NBTConverter; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.integration.IntegrationModule; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; +import crafttweaker.mc1120.data.NBTConverter; + public class CTRecipeHelper { public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) { @@ -53,7 +55,6 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) builder.append("null"); } - builder.append(").remove();"); return builder.toString(); } diff --git a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java index 3ac8c77ddda..195eec12b72 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java +++ b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java @@ -1,6 +1,5 @@ package gregtech.integration.crafttweaker; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaOreDictItem; import gregtech.api.modules.GregTechModule; @@ -10,6 +9,7 @@ import gregtech.integration.crafttweaker.recipe.MetaItemBracketHandler; import gregtech.integration.crafttweaker.terminal.CTTerminalRegistry; import gregtech.modules.GregTechModules; + import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; @@ -18,17 +18,19 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; +import crafttweaker.CraftTweakerAPI; + import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_CT, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_CT, - name = "GregTech CraftTweaker Integration", - description = "CraftTweaker Integration Module" -) + moduleID = GregTechModules.MODULE_CT, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_CT, + name = "GregTech CraftTweaker Integration", + description = "CraftTweaker Integration Module") public class CraftTweakerModule extends IntegrationSubmodule { public static MetaOreDictItem CT_OREDICT_ITEM; diff --git a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java index c9a72ddf1a6..926621f180e 100644 --- a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java +++ b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.block; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.block.IBlockState; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GregTechAPI; import gregtech.api.block.IHeatingCoilBlockStats; import gregtech.api.unification.material.Material; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.block.IBlockState; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -32,7 +33,8 @@ public class CTHeatingCoilBlockStats implements IHeatingCoilBlockStats { * @param tier the tier of the Heating Coil - used for cracker pyrolyse discounts * @param material the {@link Material} of the Heating Coil, use null for no specific material */ - public CTHeatingCoilBlockStats(String name, int coilTemperature, int level, int energyDiscount, int tier, @Nullable Material material) { + public CTHeatingCoilBlockStats(String name, int coilTemperature, int level, int energyDiscount, int tier, + @Nullable Material material) { this.name = name; this.coilTemperature = coilTemperature; this.level = level; @@ -74,8 +76,10 @@ public Material getMaterial() { } @ZenMethod - public static void add(@Nonnull IBlockState state, @Nonnull String name, int coilTemperature, int level, int energyDiscount, int tier, @Nullable Material material) { - GregTechAPI.HEATING_COILS.put(CraftTweakerMC.getBlockState(state), new CTHeatingCoilBlockStats(name, coilTemperature, level, energyDiscount, tier, material)); + public static void add(@Nonnull IBlockState state, @Nonnull String name, int coilTemperature, int level, + int energyDiscount, int tier, @Nullable Material material) { + GregTechAPI.HEATING_COILS.put(CraftTweakerMC.getBlockState(state), + new CTHeatingCoilBlockStats(name, coilTemperature, level, energyDiscount, tier, material)); } @ZenMethod diff --git a/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java b/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java index 07b29fb9f8f..cfd4b5a4d54 100644 --- a/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/item/CTItemRegistry.java @@ -1,8 +1,9 @@ package gregtech.integration.crafttweaker.item; -import crafttweaker.annotations.ZenRegister; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.ore.OrePrefix; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -15,9 +16,10 @@ public class CTItemRegistry { @ZenMethod("registerItem") - public static void registerItem(String name, short id, int rgb, String materialIconSet, String orePrefix, @Optional String chemicalFormula) { + public static void registerItem(String name, short id, int rgb, String materialIconSet, String orePrefix, + @Optional String chemicalFormula) { CT_OREDICT_ITEM.addOreDictItem( - id, name, rgb, MaterialIconSet.ICON_SETS.get(materialIconSet), OrePrefix.getPrefix(orePrefix), chemicalFormula.isEmpty() ? null : chemicalFormula); + id, name, rgb, MaterialIconSet.ICON_SETS.get(materialIconSet), OrePrefix.getPrefix(orePrefix), + chemicalFormula.isEmpty() ? null : chemicalFormula); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java index afbca2e0c2c..b8dc8e77a9b 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialBuilder.java @@ -1,7 +1,5 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.enchantments.IEnchantment; import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; @@ -16,7 +14,11 @@ import gregtech.api.unification.material.properties.ToolProperty; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.enchantments.IEnchantment; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenConstructor; @@ -53,7 +55,8 @@ public CTMaterialBuilder fluid() { @ZenMethod public CTMaterialBuilder fluid(@Optional String type, @Optional boolean hasBlock) { FluidState state = validateFluidState(type); - FluidStorageKey key = state == FluidState.GAS ? FluidStorageKeys.GAS : state == FluidState.PLASMA ? FluidStorageKeys.PLASMA : FluidStorageKeys.LIQUID; + FluidStorageKey key = state == FluidState.GAS ? FluidStorageKeys.GAS : + state == FluidState.PLASMA ? FluidStorageKeys.PLASMA : FluidStorageKeys.LIQUID; FluidBuilder builder = new FluidBuilder().state(state); if (hasBlock) builder.block(); backingBuilder.fluid(key, builder); @@ -80,7 +83,6 @@ public CTMaterialBuilder ingot(@Optional int harvestLevel, @Optional int burnTim return this; } - @ZenMethod public CTMaterialBuilder gem(@Optional int harvestLevel, @Optional int burnTime) { if (harvestLevel == 0) harvestLevel = 2; @@ -148,11 +150,14 @@ public CTMaterialBuilder element(Element element) { } @ZenMethod - public CTMaterialBuilder toolStats(float speed, float damage, int durability, int harvestLevel, @Optional int enchantability) { + public CTMaterialBuilder toolStats(float speed, float damage, int durability, int harvestLevel, + @Optional int enchantability) { if (enchantability == 0) enchantability = 10; - backingBuilder.toolStats(ToolProperty.Builder.of(speed, damage, durability, harvestLevel).enchantability(enchantability).build()); + backingBuilder.toolStats(ToolProperty.Builder.of(speed, damage, durability, harvestLevel) + .enchantability(enchantability).build()); return this; } + @ZenMethod public CTMaterialBuilder rotorStats(float speed, float damage, int durability) { backingBuilder.rotorStats(speed, damage, durability); @@ -160,7 +165,9 @@ public CTMaterialBuilder rotorStats(float speed, float damage, int durability) { } @ZenMethod - public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional int eutOverride, @Optional int durationOverride, @Optional int vacuumEUtOverride, @Optional int vacuumDurationOverride) { + public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional int eutOverride, + @Optional int durationOverride, @Optional int vacuumEUtOverride, + @Optional int vacuumDurationOverride) { BlastProperty.GasTier tier = BlastProperty.validateGasTier(gasTier); final int blastEUt = eutOverride != 0 ? eutOverride : -1; final int blastDuration = durationOverride != 0 ? durationOverride : -1; @@ -174,7 +181,8 @@ public CTMaterialBuilder blastTemp(int temp, @Optional String gasTier, @Optional } @ZenMethod - public CTMaterialBuilder ore(@Optional int oreMultiplier, @Optional int byproductMultiplier, @Optional boolean emissive) { + public CTMaterialBuilder ore(@Optional int oreMultiplier, @Optional int byproductMultiplier, + @Optional boolean emissive) { if (oreMultiplier == 0) oreMultiplier = 1; if (byproductMultiplier == 0) byproductMultiplier = 1; backingBuilder.ore(oreMultiplier, byproductMultiplier, emissive); @@ -243,7 +251,8 @@ public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolea } @ZenMethod - public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public CTMaterialBuilder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { backingBuilder.fluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof); return this; } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java index ede8ce57ffc..751be8aa3ef 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialHelpers.java @@ -1,12 +1,13 @@ package gregtech.integration.crafttweaker.material; -import com.google.common.collect.ImmutableList; -import crafttweaker.CraftTweakerAPI; import gregtech.api.GregTechAPI; import gregtech.api.fluids.FluidState; import gregtech.api.unification.material.Material; import gregtech.api.unification.stack.MaterialStack; +import com.google.common.collect.ImmutableList; +import crafttweaker.CraftTweakerAPI; + public class CTMaterialHelpers { protected static ImmutableList validateComponentList(MaterialStack[] components) { @@ -28,13 +29,16 @@ protected static FluidState validateFluidState(String fluidTypeName) { protected static boolean checkFrozen(String description) { if (!GregTechAPI.materialManager.canModifyMaterials()) { - CraftTweakerAPI.logError("Cannot " + description + " now, must be done in a file labeled with \"#loader gregtech\""); + CraftTweakerAPI.logError( + "Cannot " + description + " now, must be done in a file labeled with \"#loader gregtech\""); return true; - } return false; + } + return false; } protected static void logError(Material m, String cause, String type) { - CraftTweakerAPI.logError("Cannot " + cause + " of a Material with no " + type + "! Try calling \"add" + type + "\" in your \"#loader gregtech\" file first if this is intentional. Material: " + m.getUnlocalizedName()); + CraftTweakerAPI.logError("Cannot " + cause + " of a Material with no " + type + "! Try calling \"add" + type + + "\" in your \"#loader gregtech\" file first if this is intentional. Material: " + + m.getUnlocalizedName()); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java index def2a327199..6a368df6128 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/CTMaterialRegistry.java @@ -1,9 +1,10 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java index 01f48ead6a9..1a0481d4a81 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialBracketHandler.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.material; +import gregtech.api.GregTechAPI; +import gregtech.api.unification.material.Material; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.GregTechAPI; -import gregtech.api.unification.material.Material; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -46,5 +47,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java index 755d4926878..3f8e854cb29 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialExpansion.java @@ -1,17 +1,19 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.enchantments.IEnchantment; -import crafttweaker.api.liquid.ILiquidDefinition; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.properties.*; + import net.minecraft.enchantment.Enchantment; + +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.enchantments.IEnchantment; +import crafttweaker.api.liquid.ILiquidDefinition; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenExpansion; import stanhebben.zenscript.annotations.ZenGetter; @@ -26,7 +28,7 @@ public class MaterialExpansion { //////////////////////////////////// - // Material Methods // + // Material Methods // //////////////////////////////////// @ZenMethod @@ -52,7 +54,7 @@ public static String getIconSet(Material m) { } //////////////////////////////////// - // Fluid Property // + // Fluid Property // //////////////////////////////////// @ZenGetter @@ -73,7 +75,7 @@ public static ILiquidDefinition getFluid(Material m) { } /////////////////////////////////// - // Dust Property // + // Dust Property // /////////////////////////////////// @ZenGetter("harvestLevel") @@ -113,7 +115,7 @@ public static void setBurnTime(Material m, int burnTime) { } /////////////////////////////////// - // Tool Property // + // Tool Property // /////////////////////////////////// @ZenGetter("toolSpeed") @@ -203,14 +205,15 @@ public static void setToolStats(Material m, float toolSpeed, float toolAttackDam // Wire/Item Pipe/Fluid Pipe stuff? //////////////////////////////////// - // Blast Property // + // Blast Property // //////////////////////////////////// @ZenMethod public static void setBlastTemp(Material m, int blastTemp) { if (checkFrozen("set blast temperature")) return; if (blastTemp <= 0) { - CraftTweakerAPI.logError("Blast Temperature must be greater than zero! Material: " + m.getUnlocalizedName()); + CraftTweakerAPI + .logError("Blast Temperature must be greater than zero! Material: " + m.getUnlocalizedName()); return; } BlastProperty prop = m.getProperty(PropertyKey.BLAST); @@ -228,7 +231,7 @@ public static int blastTemp(Material m) { } //////////////////////////////////// - // Ore Property // + // Ore Property // //////////////////////////////////// @ZenGetter diff --git a/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java b/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java index 82fa2fed3b5..0f2c7a3d882 100644 --- a/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java +++ b/src/main/java/gregtech/integration/crafttweaker/material/MaterialPropertyExpansion.java @@ -1,6 +1,5 @@ package gregtech.integration.crafttweaker.material; -import crafttweaker.annotations.ZenRegister; import gregtech.api.fluids.FluidBuilder; import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttributes; @@ -8,6 +7,8 @@ import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.*; + +import crafttweaker.annotations.ZenRegister; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenExpansion; import stanhebben.zenscript.annotations.ZenMethod; @@ -21,7 +22,7 @@ public class MaterialPropertyExpansion { ///////////////////////////////////// - // Property Checkers // + // Property Checkers // ///////////////////////////////////// @ZenMethod @@ -75,7 +76,7 @@ public static boolean hasWires(Material m) { } //////////////////////////////////// - // Property Setters // + // Property Setters // //////////////////////////////////// @ZenMethod @@ -86,7 +87,9 @@ public static void addBlastTemp(Material m, int blastTemp) { } @ZenMethod - public static void addBlastProperty(Material m, int blastTemp, @Optional String gasTier, @Optional int durationOverride, @Optional int eutOverride, @Optional int vacuumDurationOverride, @Optional int vacuumEUtOverride) { + public static void addBlastProperty(Material m, int blastTemp, @Optional String gasTier, + @Optional int durationOverride, @Optional int eutOverride, + @Optional int vacuumDurationOverride, @Optional int vacuumEUtOverride) { if (checkFrozen("add blast property")) return; if (m.hasProperty(PropertyKey.BLAST)) { BlastProperty property = m.getProperty(PropertyKey.BLAST); @@ -98,9 +101,11 @@ public static void addBlastProperty(Material m, int blastTemp, @Optional String if (vacuumEUtOverride != 0) property.setVacuumEutOverride(vacuumEUtOverride); } else { BlastProperty.Builder builder = new BlastProperty.Builder(); - builder.temp(blastTemp, gasTier == null ? BlastProperty.GasTier.LOW : BlastProperty.validateGasTier(gasTier)); + builder.temp(blastTemp, + gasTier == null ? BlastProperty.GasTier.LOW : BlastProperty.validateGasTier(gasTier)); builder.blastStats(durationOverride == 0 ? -1 : durationOverride, eutOverride == 0 ? -1 : eutOverride); - builder.vacuumStats(vacuumEUtOverride == 0 ? -1 : vacuumEUtOverride, vacuumDurationOverride == 0 ? -1 : vacuumDurationOverride); + builder.vacuumStats(vacuumEUtOverride == 0 ? -1 : vacuumEUtOverride, + vacuumDurationOverride == 0 ? -1 : vacuumDurationOverride); m.setProperty(PropertyKey.BLAST, builder.build()); } } @@ -121,7 +126,8 @@ public static void addFluidPipes(Material m, int maxFluidTemperature, int throug } @ZenMethod - public static void addFluidPipes(Material m, int maxFluidTemperature, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public static void addFluidPipes(Material m, int maxFluidTemperature, int throughput, boolean gasProof, + boolean acidProof, boolean cryoProof, boolean plasmaProof) { if (checkFrozen("add fluid pipes to a material")) return; if (m.hasProperty(PropertyKey.FLUID_PIPE)) { m.getProperty(PropertyKey.FLUID_PIPE).setMaxFluidTemperature(maxFluidTemperature); @@ -131,7 +137,8 @@ public static void addFluidPipes(Material m, int maxFluidTemperature, int throug m.getProperty(PropertyKey.FLUID_PIPE).setCryoProof(cryoProof); m.getProperty(PropertyKey.FLUID_PIPE).setPlasmaProof(plasmaProof); } else { - m.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxFluidTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof)); + m.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxFluidTemperature, throughput, gasProof, + acidProof, cryoProof, plasmaProof)); } } @@ -178,7 +185,8 @@ public static void addIngot(Material m) { } @ZenMethod - public static void addOre(Material m, @Optional int oreMultiplier, @Optional int byproductMultiplier, @Optional boolean emissive) { + public static void addOre(Material m, @Optional int oreMultiplier, @Optional int byproductMultiplier, + @Optional boolean emissive) { if (checkFrozen("add an Ore to a material")) return; oreMultiplier = oreMultiplier == 0 ? 1 : oreMultiplier; byproductMultiplier = byproductMultiplier == 0 ? 1 : byproductMultiplier; @@ -186,8 +194,7 @@ public static void addOre(Material m, @Optional int oreMultiplier, @Optional int m.getProperty(PropertyKey.ORE).setOreMultiplier(oreMultiplier); m.getProperty(PropertyKey.ORE).setByProductMultiplier(byproductMultiplier); m.getProperty(PropertyKey.ORE).setEmissive(emissive); - } - else m.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier, emissive)); + } else m.setProperty(PropertyKey.ORE, new OreProperty(oreMultiplier, byproductMultiplier, emissive)); } @ZenMethod @@ -204,13 +211,16 @@ public static void addPlasma(Material m) { if (checkFrozen("add a Plasma to a material")) return; if (!m.hasProperty(PropertyKey.FLUID)) { FluidProperty property = new FluidProperty(); - property.getStorage().enqueueRegistration(FluidStorageKeys.PLASMA, new FluidBuilder().state(FluidState.PLASMA)); + property.getStorage().enqueueRegistration(FluidStorageKeys.PLASMA, + new FluidBuilder().state(FluidState.PLASMA)); m.setProperty(PropertyKey.FLUID, property); } } @ZenMethod - public static void addTools(Material m, float toolSpeed, float toolAttackDamage, float toolAttackSpeed, int toolDurability, @Optional int toolHarvestLevel, @Optional int toolEnchantability, @Optional int durabilityMultiplier) { + public static void addTools(Material m, float toolSpeed, float toolAttackDamage, float toolAttackSpeed, + int toolDurability, @Optional int toolHarvestLevel, @Optional int toolEnchantability, + @Optional int durabilityMultiplier) { if (checkFrozen("add Tools to a material")) return; if (toolEnchantability == 0) toolEnchantability = 10; if (durabilityMultiplier <= 0) durabilityMultiplier = 1; @@ -222,12 +232,15 @@ public static void addTools(Material m, float toolSpeed, float toolAttackDamage, m.getProperty(PropertyKey.TOOL).setToolHarvestLevel(toolHarvestLevel); m.getProperty(PropertyKey.TOOL).setToolEnchantability(toolEnchantability); m.getProperty(PropertyKey.TOOL).setDurabilityMultiplier(durabilityMultiplier); - } else m.setProperty(PropertyKey.TOOL, ToolProperty.Builder.of(toolSpeed, toolAttackDamage, toolDurability, toolHarvestLevel) - .attackSpeed(toolAttackSpeed).enchantability(toolEnchantability).durabilityMultiplier(durabilityMultiplier).build()); + } else m.setProperty(PropertyKey.TOOL, + ToolProperty.Builder.of(toolSpeed, toolAttackDamage, toolDurability, toolHarvestLevel) + .attackSpeed(toolAttackSpeed).enchantability(toolEnchantability) + .durabilityMultiplier(durabilityMultiplier).build()); } @ZenMethod - public static void addWires(Material m, int voltage, int baseAmperage, int lossPerBlock, @Optional boolean isSuperCon, @Optional int criticalTemp) { + public static void addWires(Material m, int voltage, int baseAmperage, int lossPerBlock, + @Optional boolean isSuperCon, @Optional int criticalTemp) { if (checkFrozen("add Wires to a material")) return; if (m.hasProperty(PropertyKey.WIRE)) { m.getProperty(PropertyKey.WIRE).setVoltage(voltage); @@ -235,6 +248,7 @@ public static void addWires(Material m, int voltage, int baseAmperage, int lossP m.getProperty(PropertyKey.WIRE).setLossPerBlock(lossPerBlock); m.getProperty(PropertyKey.WIRE).setSuperconductor(isSuperCon); m.getProperty(PropertyKey.WIRE).setSuperconductorCriticalTemperature(criticalTemp); - } else m.setProperty(PropertyKey.WIRE, new WireProperties(voltage, baseAmperage, lossPerBlock, isSuperCon, criticalTemp)); + } else m.setProperty(PropertyKey.WIRE, + new WireProperties(voltage, baseAmperage, lossPerBlock, isSuperCon, criticalTemp)); } } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java index 126c6cca723..d099b499df2 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java @@ -2,14 +2,16 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CTNBTMatcher implements NBTMatcher { private final Set> requiredNBT; diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java index a43d82a0d0b..ef8ebfff5d8 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java @@ -1,19 +1,22 @@ package gregtech.integration.crafttweaker.recipe; -import com.google.common.base.Preconditions; import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.base.Preconditions; + import java.util.List; import java.util.Map; import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class CTNBTMultiItemMatcher implements NBTMatcher { private final Map> map; @@ -31,7 +34,8 @@ public CTNBTMultiItemMatcher(@Nonnull Map> map) @Override public boolean evaluate(@Nullable NBTTagCompound nbtTagCompound, @Nullable NBTCondition nbtCondition) { // should never get called - GTLog.logger.warn("CTNBTMultiItemMatcher#evaluate(NBTTagCompound, NBTCondition) was called. This should not happen."); + GTLog.logger.warn( + "CTNBTMultiItemMatcher#evaluate(NBTTagCompound, NBTCondition) was called. This should not happen."); return false; } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java index 0decd789653..40db5cdb817 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipe.java @@ -1,14 +1,15 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.util.GTUtility; + import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.IItemStack; import crafttweaker.api.liquid.ILiquidStack; import crafttweaker.api.minecraft.CraftTweakerMC; import crafttweaker.mc1120.item.MCItemStack; import crafttweaker.mc1120.liquid.MCLiquidStack; -import gregtech.api.recipes.Recipe; -import gregtech.api.recipes.RecipeMap; -import gregtech.api.util.GTUtility; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; @@ -103,5 +104,4 @@ public Object getProperty(String key) { public boolean remove() { return this.recipeMap.removeRecipe(this.backingRecipe); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java index d947900092c..f523f3c5c8c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java @@ -1,13 +1,5 @@ package gregtech.integration.crafttweaker.recipe; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.data.DataMap; -import crafttweaker.api.data.IData; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; -import crafttweaker.api.oredict.IOreDictEntry; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeFluidInput; import gregtech.api.recipes.ingredients.GTRecipeInput; @@ -16,20 +8,31 @@ import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition; import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher; import gregtech.api.util.ItemStackHashStrategy; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.data.DataMap; +import crafttweaker.api.data.IData; +import crafttweaker.api.item.IIngredient; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; +import crafttweaker.api.oredict.IOreDictEntry; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @ZenClass("mods.gregtech.recipe.RecipeBuilder") @ZenRegister public class CTRecipeBuilder { @@ -113,7 +116,8 @@ private static GTRecipeInput getInputFromCTIngredient(@Nullable IIngredient ingr return tryConstructNBTInput(new GTRecipeItemInput(stack, ingredient.getAmount()), tagCompound); } else { // multiple inputs for a single input entry - final Map> map = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingItemDamageCount()); + final Map> map = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingItemDamageCount()); ItemStack[] stacks = new ItemStack[items.size()]; for (int i = 0; i < stacks.length; i++) { @@ -165,7 +169,8 @@ private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, * @return the nbt matching input if successful, otherwise the original recipe input */ @Nonnull - private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, @Nonnull Map> map) { + private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, + @Nonnull Map> map) { if (map.isEmpty()) return input; // do not use nbt matching, if there are no tags to check return input.setNBTMatchingCondition(new CTNBTMultiItemMatcher(map), null); } @@ -182,7 +187,7 @@ public CTRecipeBuilder circuit(int num) { return this; } - //note that fluid input predicates are not supported + // note that fluid input predicates are not supported @ZenMethod public CTRecipeBuilder fluidInputs(ILiquidStack... ingredients) { this.backingBuilder.fluidInputs(Arrays.stream(ingredients) @@ -275,7 +280,8 @@ public CTRecipeBuilder property(String key, IItemStack item) { if (!applied) { throw new IllegalArgumentException("Property " + key + " cannot be applied to recipe type " + - backingBuilder.getClass().getSimpleName() + " for Item " + CraftTweakerMC.getItemStack(item).getDisplayName()); + backingBuilder.getClass().getSimpleName() + " for Item " + + CraftTweakerMC.getItemStack(item).getDisplayName()); } return this; } @@ -290,5 +296,4 @@ public void buildAndRegister() { public String toString() { return this.backingBuilder.toString(); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java index 217316e1710..0aefcd1e778 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeUtils.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker.recipe; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.recipes.GTRecipeHandler; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTLog; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.liquid.ILiquidStack; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -27,7 +29,8 @@ public class CTRecipeUtils { // TODO YEET @ZenMethod("removeRecipeByOutput") - public static void removeRecipeByOutput(RecipeMap recipeMap, IItemStack[] outputs, ILiquidStack[] fluidOutputs, boolean useAmounts) { + public static void removeRecipeByOutput(RecipeMap recipeMap, IItemStack[] outputs, ILiquidStack[] fluidOutputs, + boolean useAmounts) { List recipesToRemove = new ArrayList<>(); List mcItemOutputs = outputs == null ? Collections.emptyList() : Arrays.stream(outputs) diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java b/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java index fd0c0778336..d8c94cc683b 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/InputIngredient.java @@ -1,11 +1,12 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.ingredients.GTRecipeInput; + import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.*; import crafttweaker.api.liquid.ILiquidStack; import crafttweaker.api.minecraft.CraftTweakerMC; import crafttweaker.api.player.IPlayer; -import gregtech.api.recipes.ingredients.GTRecipeInput; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java index 3c5ce8ff422..c47733d6a0c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaItemBracketHandler.java @@ -1,12 +1,5 @@ package gregtech.integration.crafttweaker.recipe; -import com.cleanroommc.groovyscript.api.GroovyLog; -import crafttweaker.CraftTweakerAPI; -import crafttweaker.annotations.BracketHandler; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.mc1120.item.MCItemStack; -import crafttweaker.zenscript.IBracketHandler; import gregtech.api.GregTechAPI; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; @@ -19,8 +12,17 @@ import gregtech.common.pipelike.fluidpipe.BlockFluidPipe; import gregtech.common.pipelike.itempipe.BlockItemPipe; import gregtech.integration.groovy.GroovyScriptModule; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.annotations.BracketHandler; +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.mc1120.item.MCItemStack; +import crafttweaker.zenscript.IBracketHandler; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -35,6 +37,7 @@ @BracketHandler @ZenRegister public class MetaItemBracketHandler implements IBracketHandler { + private static final Map> metaItemNames = new Object2ObjectOpenHashMap<>(); private static final Map> metaBlockNames = new Object2ObjectOpenHashMap<>(); @@ -48,7 +51,8 @@ public static void rebuildComponentRegistry() { metaItemNames.clear(); for (MetaItem item : MetaItem.getMetaItems()) { String namespace = Objects.requireNonNull(item.getRegistryName()).getNamespace(); - Map map = metaItemNames.computeIfAbsent(namespace, k -> new Object2ObjectOpenHashMap<>()); + Map map = metaItemNames.computeIfAbsent(namespace, + k -> new Object2ObjectOpenHashMap<>()); for (MetaValueItem entry : item.getAllItems()) { if (!"meta_item".equals(entry.unlocalizedName)) { @@ -150,5 +154,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java index b6b99fd5946..018e2acf251 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java @@ -1,16 +1,18 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.GTValues; +import gregtech.api.GregTechAPI; +import gregtech.api.metatileentity.MetaTileEntity; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.api.item.IItemStack; import crafttweaker.mc1120.item.MCItemStack; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.GTValues; -import gregtech.api.GregTechAPI; -import gregtech.api.metatileentity.MetaTileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -18,9 +20,10 @@ import stanhebben.zenscript.symbols.IZenSymbol; import stanhebben.zenscript.type.natives.IJavaMethod; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + @BracketHandler @ZenRegister @SuppressWarnings("unused") @@ -31,7 +34,8 @@ public class MetaTileEntityBracketHandler implements IBracketHandler { private final IJavaMethod method; public MetaTileEntityBracketHandler() { - this.method = CraftTweakerAPI.getJavaMethod(MetaTileEntityBracketHandler.class, "getCtMetaTileEntityItem", String.class); + this.method = CraftTweakerAPI.getJavaMethod(MetaTileEntityBracketHandler.class, "getCtMetaTileEntityItem", + String.class); } @Nullable @@ -46,7 +50,7 @@ public static IItemStack getCtMetaTileEntityItem(String name) { } public static String[] splitObjectName(String toSplit) { - String[] resultSplit = new String[]{GTValues.MODID, toSplit}; + String[] resultSplit = new String[] { GTValues.MODID, toSplit }; int i = toSplit.indexOf(':'); if (i >= 0) { resultSplit[1] = toSplit.substring(i + 1); @@ -69,5 +73,4 @@ public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); } - } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java index bc33c3c22b1..cd3907ccbec 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/RecipeMapBracketHandler.java @@ -1,10 +1,11 @@ package gregtech.integration.crafttweaker.recipe; +import gregtech.api.recipes.RecipeMap; + import crafttweaker.CraftTweakerAPI; import crafttweaker.annotations.BracketHandler; import crafttweaker.annotations.ZenRegister; import crafttweaker.zenscript.IBracketHandler; -import gregtech.api.recipes.RecipeMap; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; diff --git a/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java b/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java index ae91b4a0e16..6b3989d8447 100644 --- a/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java +++ b/src/main/java/gregtech/integration/crafttweaker/terminal/CTTerminalRegistry.java @@ -1,15 +1,17 @@ package gregtech.integration.crafttweaker.terminal; -import crafttweaker.annotations.ZenRegister; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.terminal.TerminalRegistry; import gregtech.api.terminal.hardware.Hardware; import gregtech.api.util.GTLog; import gregtech.common.terminal.hardware.BatteryHardware; import gregtech.common.terminal.hardware.DeviceHardware; + import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; + +import crafttweaker.annotations.ZenRegister; +import crafttweaker.api.item.IItemStack; +import crafttweaker.api.minecraft.CraftTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -36,7 +38,8 @@ public static void registerDevice(IItemStack device, String name) { ItemStack itemStack = CraftTweakerMC.getItemStack(device).copy(); if (!itemStack.isEmpty()) { itemStack.setCount(1); - EnumHelper.addEnum(DeviceHardware.DEVICE.class, name.toUpperCase(), new Class[]{ItemStack.class, String.class}, itemStack, name.toLowerCase()); + EnumHelper.addEnum(DeviceHardware.DEVICE.class, name.toUpperCase(), + new Class[] { ItemStack.class, String.class }, itemStack, name.toLowerCase()); } } @@ -95,6 +98,7 @@ public static void register() { @ZenClass("mods.gregtech.AppRegistryBuilder") @ZenRegister public static class CTAppRegistryBuilder { + final String appName; Boolean isDefaultApp; Map battery; @@ -128,14 +132,16 @@ public CTAppRegistryBuilder battery(int tier, int batteryTier, long cost) { @ZenMethod public CTAppRegistryBuilder device(String... device) { - Hardware[] hw = Arrays.stream(device).map(DeviceHardware.DeviceDemand::new).filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new); + Hardware[] hw = Arrays.stream(device).map(DeviceHardware.DeviceDemand::new) + .filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new); hardware(hw); return this; } @ZenMethod public CTAppRegistryBuilder device(int tier, String... device) { - this.hardware(tier, Arrays.stream(device).map(DeviceHardware.DeviceDemand::new).filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new)); + this.hardware(tier, Arrays.stream(device).map(DeviceHardware.DeviceDemand::new) + .filter(deviceDemand -> deviceDemand.getDevice() != null).toArray(Hardware[]::new)); return this; } @@ -159,7 +165,8 @@ public CTAppRegistryBuilder upgrade(IItemStack... upgrades) { @ZenMethod public CTAppRegistryBuilder upgrade(int tier, IItemStack... upgrades) { this.upgrade.put(tier, new LinkedList<>()); - for (ItemStack up : Arrays.stream(upgrades).map(CraftTweakerMC::getItemStack).filter(itemStack -> !itemStack.isEmpty()).toArray(ItemStack[]::new)) { + for (ItemStack up : Arrays.stream(upgrades).map(CraftTweakerMC::getItemStack) + .filter(itemStack -> !itemStack.isEmpty()).toArray(ItemStack[]::new)) { this.upgrade.get(tier).add(up); } return this; diff --git a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java index 9fb4871153a..98bb74f60df 100644 --- a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java +++ b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java @@ -1,11 +1,13 @@ package gregtech.integration.ctm; import gregtech.api.GTValues; + import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.Optional; + import team.chisel.ctm.api.IFacade; import javax.annotation.Nonnull; @@ -19,5 +21,6 @@ public interface IFacadeWrapper extends IFacade { @Nonnull @Override - IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side, @Nonnull BlockPos connection); + IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side, + @Nonnull BlockPos connection); } diff --git a/src/main/java/gregtech/integration/forestry/ForestryConfig.java b/src/main/java/gregtech/integration/forestry/ForestryConfig.java index f148d6aa49d..c360e66194a 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryConfig.java +++ b/src/main/java/gregtech/integration/forestry/ForestryConfig.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry; import gregtech.api.GTValues; + import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.Config.*; @@ -8,11 +9,11 @@ @Config(modid = GTValues.MODID, name = GTValues.MODID + "/forestry_integration", category = "Forestry") public class ForestryConfig { - @Comment({"Enable GregTech Electron Tubes.", "Default: true"}) + @Comment({ "Enable GregTech Electron Tubes.", "Default: true" }) @RequiresMcRestart public static boolean enableGTElectronTubes = true; - @Comment({"Enable the GregTech Scoop.", "Default: true"}) + @Comment({ "Enable the GregTech Scoop.", "Default: true" }) @RequiresMcRestart public static boolean enableGTScoop = true; diff --git a/src/main/java/gregtech/integration/forestry/ForestryModule.java b/src/main/java/gregtech/integration/forestry/ForestryModule.java index d7b1233f091..edd4080c33b 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryModule.java +++ b/src/main/java/gregtech/integration/forestry/ForestryModule.java @@ -1,7 +1,5 @@ package gregtech.integration.forestry; -import forestry.api.core.ForestryAPI; -import forestry.core.items.IColoredItem; import gregtech.api.GTValues; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.StandardMetaItem; @@ -24,6 +22,7 @@ import gregtech.integration.forestry.recipes.*; import gregtech.integration.forestry.tools.ScoopBehavior; import gregtech.modules.GregTechModules; + import net.minecraft.client.Minecraft; import net.minecraft.item.Item; import net.minecraft.item.crafting.IRecipe; @@ -37,17 +36,20 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.registries.IForgeRegistry; + +import forestry.api.core.ForestryAPI; +import forestry.core.items.IColoredItem; import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; @GregTechModule( - moduleID = GregTechModules.MODULE_FR, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_FR, - name = "GregTech Forestry Integration", - description = "Forestry Integration Module") + moduleID = GregTechModules.MODULE_FR, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_FR, + name = "GregTech Forestry Integration", + description = "Forestry Integration Module") public class ForestryModule extends IntegrationSubmodule { private static MetaItem forestryMetaItem; @@ -102,7 +104,8 @@ public void preInit(FMLPreInitializationEvent event) { FRAME_STABILIZING = new GTItemFrame(GTFrameType.STABILIZING); FRAME_ARBORIST = new GTItemFrame(GTFrameType.ARBORIST); } else { - getLogger().warn("GregTech Frames are enabled, but Forestry Apiculture module is disabled. Skipping..."); + getLogger() + .warn("GregTech Frames are enabled, but Forestry Apiculture module is disabled. Skipping..."); } } @@ -216,7 +219,8 @@ public static void registerItems(RegistryEvent.Register event) { if (Loader.isModLoaded(GTValues.MODID_XU2)) { ELECTRODE_ORCHID = forestryMetaItem.addItem(13, "electrode.orchid"); } - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || + Loader.isModLoaded(GTValues.MODID_BINNIE)) { ELECTRODE_RUBBER = forestryMetaItem.addItem(14, "electrode.rubber"); } } diff --git a/src/main/java/gregtech/integration/forestry/ForestryUtil.java b/src/main/java/gregtech/integration/forestry/ForestryUtil.java index 4ea464f3a9b..32fff8e1e19 100644 --- a/src/main/java/gregtech/integration/forestry/ForestryUtil.java +++ b/src/main/java/gregtech/integration/forestry/ForestryUtil.java @@ -1,15 +1,17 @@ package gregtech.integration.forestry; -import forestry.api.apiculture.IAlleleBeeEffect; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAlleleFlowers; -import forestry.modules.ModuleHelper; import gregtech.api.GTValues; import gregtech.integration.IntegrationModule; import gregtech.integration.forestry.bees.GTCombType; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.item.ItemStack; + +import forestry.api.apiculture.IAlleleBeeEffect; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAlleleFlowers; +import forestry.modules.ModuleHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -68,7 +70,8 @@ public static ItemStack getCombStack(@NotNull GTCombType type) { @NotNull public static ItemStack getCombStack(@NotNull GTCombType type, int amount) { if (!ForestryConfig.enableGTBees) { - IntegrationModule.logger.error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); + IntegrationModule.logger + .error("Tried to get GregTech Comb stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } if (!apicultureEnabled()) { @@ -86,7 +89,8 @@ public static ItemStack getDropStack(@NotNull GTDropType type) { @NotNull public static ItemStack getDropStack(@NotNull GTDropType type, int amount) { if (!ForestryConfig.enableGTBees) { - IntegrationModule.logger.error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); + IntegrationModule.logger + .error("Tried to get GregTech Drop stack, but GregTech Bees config is not enabled!"); return ItemStack.EMPTY; } if (!apicultureEnabled()) { diff --git a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java index 9bc4fca61f7..65546dfe020 100644 --- a/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java +++ b/src/main/java/gregtech/integration/forestry/bees/BeeRemovals.java @@ -2,6 +2,7 @@ import gregtech.api.GTValues; import gregtech.integration.IntegrationModule; + import net.minecraftforge.fml.common.Loader; import java.lang.reflect.Field; @@ -51,7 +52,7 @@ private static void removeMagicBees() { enabledField.setAccessible(true); for (var o : mbBeeDefinition.getEnumConstants()) { - if (o instanceof Enum bee) { + if (o instanceof Enumbee) { String name = bee.name(); if (MB_REMOVALS.contains(name)) { try { @@ -110,7 +111,7 @@ private static void removeExtraBees() { modifiersField.setInt(speciesBuilderField, speciesBuilderField.getModifiers() & ~Modifier.FINAL); for (var o : ebBeeDefinition.getEnumConstants()) { - if (o instanceof Enum bee) { + if (o instanceof Enumbee) { String name = bee.name(); if (EB_REMOVALS.contains(name)) { branchField.set(bee, null); diff --git a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java index d9719821d2d..891a8277bc9 100644 --- a/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java +++ b/src/main/java/gregtech/integration/forestry/bees/ForestryScannerLogic.java @@ -1,5 +1,14 @@ package gregtech.integration.forestry.bees; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.recipes.machines.IScannerRecipeMap; +import gregtech.integration.forestry.ForestryUtil; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IIndividual; import forestry.apiculture.ModuleApiculture; @@ -9,13 +18,6 @@ import forestry.core.fluids.Fluids; import forestry.lepidopterology.ModuleLepidopterology; import forestry.lepidopterology.genetics.ButterflyDefinition; -import gregtech.api.recipes.Recipe; -import gregtech.api.recipes.RecipeMaps; -import gregtech.api.recipes.machines.IScannerRecipeMap; -import gregtech.integration.forestry.ForestryUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -28,7 +30,8 @@ public class ForestryScannerLogic implements IScannerRecipeMap.ICustomScannerLog private static final int HONEY_AMOUNT = 100; @Override - public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + public Recipe createCustomRecipe(long voltage, List inputs, List fluidInputs, + boolean exactVoltage) { FluidStack fluidStack = fluidInputs.get(0); if (fluidStack != null && fluidStack.containsFluid(Fluids.FOR_HONEY.getFluid(HONEY_AMOUNT))) { for (ItemStack stack : inputs) { @@ -117,7 +120,8 @@ public List getRepresentativeRecipes() { if (ForestryUtil.lepidopterologyEnabled()) { outputStack = ModuleLepidopterology.getItems().butterflyGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.butterfly"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().butterflyGE.getWildcard()) @@ -126,7 +130,8 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); outputStack = ModuleLepidopterology.getItems().serumGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.serum"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().serumGE.getWildcard()) @@ -135,7 +140,8 @@ public List getRepresentativeRecipes() { .duration(DURATION).EUt(EUT).build().getResult()); outputStack = ModuleLepidopterology.getItems().caterpillarGE.getItemStack(); - outputStack.setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); + outputStack + .setTagCompound(ButterflyDefinition.CabbageWhite.getIndividual().writeToNBT(new NBTTagCompound())); outputStack.setTranslatableName("gregtech.scanner.forestry.caterpillar"); recipes.add(RecipeMaps.SCANNER_RECIPES.recipeBuilder() .inputs(ModuleLepidopterology.getItems().caterpillarGE.getWildcard()) diff --git a/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java index 32824fd7242..b8b53f36e3d 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTAlleleBeeSpecies.java @@ -1,5 +1,11 @@ package gregtech.integration.forestry.bees; +import gregtech.api.GTValues; +import gregtech.integration.IntegrationModule; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.apiculture.IAlleleBeeSpeciesBuilder; import forestry.api.genetics.AlleleManager; @@ -7,10 +13,6 @@ import forestry.api.genetics.IClassification; import forestry.apiculture.genetics.alleles.AlleleBeeSpecies; import forestry.core.genetics.alleles.AlleleFloat; -import gregtech.api.GTValues; -import gregtech.integration.IntegrationModule; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; public class GTAlleleBeeSpecies extends AlleleBeeSpecies { @@ -20,7 +22,8 @@ public class GTAlleleBeeSpecies extends AlleleBeeSpecies { public GTAlleleBeeSpecies(String modId, String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) { - super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor); + super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, + secondaryColor); AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES); } @@ -28,11 +31,15 @@ public GTAlleleBeeSpecies(String modId, String uid, String unlocalizedName, Stri @Override public IAlleleBeeSpeciesBuilder addProduct(@NotNull ItemStack product, @NotNull Float chance) { if (product == ItemStack.EMPTY) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", + getUID()); product = new ItemStack(Items.BOAT); } if (chance <= 0.0f || chance > 1.0f) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed a chance value out of bounds for allele {}! Setting to 0.1", + getUID()); chance = 0.1f; } return super.addProduct(product, chance); @@ -42,11 +49,15 @@ public IAlleleBeeSpeciesBuilder addProduct(@NotNull ItemStack product, @NotNull @Override public IAlleleBeeSpeciesBuilder addSpecialty(@NotNull ItemStack specialty, @NotNull Float chance) { if (specialty == ItemStack.EMPTY) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addProduct() passed an empty ItemStack for allele {}! Setting default", + getUID()); specialty = new ItemStack(Items.BOAT); } if (chance <= 0.0f || chance > 1.0f) { - IntegrationModule.logger.warn("GTAlleleBeeSpecies#addSpecialty() passed a chance value out of bounds for allele {}! Setting to 0.1", getUID()); + IntegrationModule.logger.warn( + "GTAlleleBeeSpecies#addSpecialty() passed a chance value out of bounds for allele {}! Setting to 0.1", + getUID()); chance = 0.1f; } return super.addSpecialty(specialty, chance); diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java index 08a962fc646..827eb307c28 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTBeeDefinition.java @@ -1,20 +1,5 @@ package gregtech.integration.forestry.bees; -import appeng.core.Api; -import forestry.api.apiculture.*; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IMutationBuilder; -import forestry.apiculture.ModuleApiculture; -import forestry.apiculture.genetics.Bee; -import forestry.apiculture.genetics.BeeDefinition; -import forestry.apiculture.genetics.IBeeDefinition; -import forestry.apiculture.genetics.alleles.AlleleEffects; -import forestry.apiculture.items.EnumHoneyComb; -import forestry.core.ModuleCore; -import forestry.core.genetics.alleles.AlleleHelper; -import forestry.core.genetics.alleles.EnumAllele; import gregtech.api.GTValues; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Materials; @@ -24,12 +9,29 @@ import gregtech.integration.IntegrationUtil; import gregtech.integration.forestry.ForestryModule; import gregtech.integration.forestry.ForestryUtil; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; + +import appeng.core.Api; +import forestry.api.apiculture.*; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IMutationBuilder; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.genetics.Bee; +import forestry.apiculture.genetics.BeeDefinition; +import forestry.apiculture.genetics.IBeeDefinition; +import forestry.apiculture.genetics.alleles.AlleleEffects; +import forestry.apiculture.items.EnumHoneyComb; +import forestry.core.ModuleCore; +import forestry.core.genetics.alleles.AlleleHelper; +import forestry.core.genetics.alleles.EnumAllele; import org.apache.commons.lang3.text.WordUtils; import org.jetbrains.annotations.NotNull; @@ -63,10 +65,10 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA); }, dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DILIGENT, 10); + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DILIGENT, + 10); mutation.requireResource(Blocks.HARDENED_CLAY.getDefaultState()); - } - ), + }), SLIMEBALL(GTBranchDefinition.GT_ORGANIC, "Bituminipila", true, 0x4E9E55, 0x00FF15, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); @@ -76,7 +78,8 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); if (Loader.isModLoaded(GTValues.MODID_TCON)) { beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_TCON, "edible", 1), 0.10f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), 0.01f); + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_TCON, "slime_congealed", 2), + 0.01f); } else { beeSpecies.addSpecialty(new ItemStack(Blocks.SLIME_BLOCK), 0.01f); } @@ -87,14 +90,14 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); } }, dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MARSHY, CLAY, 7); mutation.requireResource(Blocks.SLIME_BLOCK.getDefaultState()); - } - ), + }), PEAT(GTBranchDefinition.GT_ORGANIC, "Limus", true, 0x906237, 0x58300B, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.15f); @@ -111,8 +114,7 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); }, - dis -> dis.registerMutation(BeeDefinition.RURAL, CLAY, 10) - ), + dis -> dis.registerMutation(BeeDefinition.RURAL, CLAY, 10)), STICKYRESIN(GTBranchDefinition.GT_ORGANIC, "Lenturesinae", true, 0x2E8F5B, 0xDCC289, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -128,8 +130,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(SLIMEBALL, PEAT, 15); mutation.requireResource("logRubber"); - } - ), + }), COAL(GTBranchDefinition.GT_ORGANIC, "Carbo", true, 0x666666, 0x525252, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.COAL), 0.30f); @@ -149,8 +150,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, PEAT, 9); mutation.requireResource("blockCoal"); - } - ), + }), OIL(GTBranchDefinition.GT_ORGANIC, "Oleum", true, 0x4C4C4C, 0x333333, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.30f); @@ -167,11 +167,11 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE); AlleleHelper.getInstance().set(template, HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "water")); } }, - dis -> dis.registerMutation(COAL, STICKYRESIN, 4) - ), + dis -> dis.registerMutation(COAL, STICKYRESIN, 4)), ASH(GTBranchDefinition.GT_ORGANIC, "Cinis", true, 0x1E1A18, 0xC6C6C6, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -193,8 +193,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COAL, CLAY, 10); mutation.restrictTemperature(EnumTemperature.HELLISH); - } - ), + }), APATITE(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -212,14 +211,14 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); if (Loader.isModLoaded(GTValues.MODID_EB)) { - AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); + AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, + ForestryUtil.getFlowers(GTValues.MODID_EB, "rock")); } }, dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ASH, COAL, 10); mutation.requireResource("blockApatite"); - } - ), + }), BIOMASS(GTBranchDefinition.GT_ORGANIC, "Taeda", true, 0x21E118, 0x17AF0E, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.MOSSY), 0.30f); @@ -236,8 +235,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.RURAL, 10); mutation.restrictBiomeType(BiomeDictionary.Type.FOREST); - } - ), + }), FERTILIZER(GTBranchDefinition.GT_ORGANIC, "Stercorat", true, 0x7FCEF5, 0x654525, beeSpecies -> { if (Loader.isModLoaded(GTValues.MODID_EB)) { @@ -258,8 +256,7 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT); AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.FASTER); }, - dis -> dis.registerMutation(ASH, APATITE, 8) - ), + dis -> dis.registerMutation(ASH, APATITE, 8)), PHOSPHORUS(GTBranchDefinition.GT_ORGANIC, "Phosphorus", false, 0xFFC826, 0xC1C1F6, beeSpecies -> { beeSpecies.addSpecialty(getGTComb(GTCombType.PHOSPHORUS), 0.35f); @@ -272,16 +269,19 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(APATITE, ASH, 12); mutation.restrictTemperature(EnumTemperature.HOT); mutation.requireResource("blockTricalciumPhosphate"); - } - ), + }), SANDWICH(GTBranchDefinition.GT_ORGANIC, "Sandwico", true, 0x32CD32, 0xDAA520, beeSpecies -> { - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion Slice - beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 81), 0.05f); // Cucumber + // Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 80), 0.05f); // Onion + // Slice + beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 79), 0.05f); // Tomato + // Slice beeSpecies.addSpecialty(new ItemStack(Items.COOKED_PORKCHOP), 0.05f); beeSpecies.addSpecialty(new ItemStack(Items.COOKED_BEEF), 0.15f); - beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar Slice + beeSpecies.addSpecialty(IntegrationUtil.getModItem(GTValues.MODID_GTFO, "gtfo_meta_item", 97), 0.05f); // Cheddar + // Slice beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); }, @@ -296,13 +296,13 @@ public enum GTBeeDefinition implements IBeeDefinition { }, dis -> { if (Loader.isModLoaded(GTValues.MODID_MB)) { - dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), 10); + dis.registerMutation(BeeDefinition.AGRARIAN, ForestryUtil.getSpecies(GTValues.MODID_MB, "Batty"), + 10); } else { dis.registerMutation(BeeDefinition.AGRARIAN, BeeDefinition.IMPERIAL, 10); } }, - () -> Loader.isModLoaded(GTValues.MODID_GTFO) - ), + () -> Loader.isModLoaded(GTValues.MODID_GTFO)), // Gems REDSTONE(GTBranchDefinition.GT_GEM, "Rubrumlapis", true, 0x7D0F0F, 0xD11919, @@ -315,10 +315,10 @@ public enum GTBeeDefinition implements IBeeDefinition { }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DEMONIC, 10); + IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.INDUSTRIOUS, BeeDefinition.DEMONIC, + 10); mutation.requireResource("blockRedstone"); - } - ), + }), LAPIS(GTBranchDefinition.GT_GEM, "Lapidi", true, 0x1947D1, 0x476CDA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -330,8 +330,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.IMPERIAL, 10); mutation.requireResource("blockLapis"); - } - ), + }), CERTUS(GTBranchDefinition.GT_GEM, "Quarzeus", true, 0x57CFFB, 0xBBEEFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -343,8 +342,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HERMITIC, LAPIS, 10); mutation.requireResource("blockCertusQuartz"); - } - ), + }), FLUIX(GTBranchDefinition.GT_GEM, "", true, 0xA375FF, 0xB591FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -355,11 +353,10 @@ public enum GTBeeDefinition implements IBeeDefinition { template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, LAPIS, 7); - Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock().ifPresent(block -> - mutation.requireResource(block.getDefaultState())); + Api.INSTANCE.definitions().blocks().fluixBlock().maybeBlock() + .ifPresent(block -> mutation.requireResource(block.getDefaultState())); }, - () -> Loader.isModLoaded(GTValues.MODID_APPENG) - ), + () -> Loader.isModLoaded(GTValues.MODID_APPENG)), DIAMOND(GTBranchDefinition.GT_GEM, "Adamas", false, 0xCCFFFF, 0xA3CCCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -372,8 +369,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, COAL, 3); mutation.requireResource("blockDiamond"); - } - ), + }), RUBY(GTBranchDefinition.GT_GEM, "Rubinus", false, 0xE6005C, 0xCC0052, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -386,8 +382,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, DIAMOND, 5); mutation.requireResource("blockRuby"); - } - ), + }), SAPPHIRE(GTBranchDefinition.GT_GEM, "Sapphirus", true, 0x0033CC, 0x00248F, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -399,8 +394,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CERTUS, LAPIS, 5); mutation.requireResource("blockSapphire"); - } - ), + }), OLIVINE(GTBranchDefinition.GT_GEM, "Olivinum", true, 0x248F24, 0xCCFFCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -410,8 +404,7 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.NORMAL); }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.SLOWER), - dis -> dis.registerMutation(CERTUS, BeeDefinition.ENDED, 5) - ), + dis -> dis.registerMutation(CERTUS, BeeDefinition.ENDED, 5)), EMERALD(GTBranchDefinition.GT_GEM, "Smaragdus", false, 0x248F24, 0x2EB82E, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.STONE), 0.30f); @@ -425,8 +418,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(OLIVINE, DIAMOND, 4); mutation.requireResource("blockEmerald"); - } - ), + }), SPARKLING(GTBranchDefinition.GT_GEM, "Vesperstella", true, 0x7A007A, 0xFFFFFF, beeSpecies -> { beeSpecies.addProduct(IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 3), 0.20f); @@ -444,12 +436,13 @@ public enum GTBeeDefinition implements IBeeDefinition { AlleleHelper.getInstance().set(template, FLOWERING, EnumAllele.Flowering.AVERAGE); }, dis -> { - IBeeMutationBuilder mutation = dis.registerMutation(ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); + IBeeMutationBuilder mutation = dis.registerMutation( + ForestryUtil.getSpecies(GTValues.MODID_MB, "Withering"), + ForestryUtil.getSpecies(GTValues.MODID_MB, "Draconic"), 1); mutation.requireResource("blockNetherStar"); mutation.restrictBiomeType(BiomeDictionary.Type.END); }, - () -> Loader.isModLoaded(GTValues.MODID_MB) - ), + () -> Loader.isModLoaded(GTValues.MODID_MB)), // Metals COPPER(GTBranchDefinition.GT_METAL, "Cuprum", true, 0xFF6600, 0xE65C00, @@ -464,8 +457,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.MAJESTIC, CLAY, 13); mutation.requireResource("blockCopper"); - } - ), + }), TIN(GTBranchDefinition.GT_METAL, "Stannum", true, 0xD4D4D4, 0xDDDDDD, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -478,8 +470,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CLAY, BeeDefinition.DILIGENT, 13); mutation.requireResource("blockTin"); - } - ), + }), LEAD(GTBranchDefinition.GT_METAL, "Plumbum", true, 0x666699, 0xA3A3CC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -492,8 +483,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COAL, COPPER, 13); mutation.requireResource("blockLead"); - } - ), + }), IRON(GTBranchDefinition.GT_METAL, "Ferrum", true, 0xDA9147, 0xDE9C59, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -506,8 +496,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TIN, COPPER, 13); mutation.requireResource("blockIron"); - } - ), + }), STEEL(GTBranchDefinition.GT_METAL, "Chalybe", true, 0x808080, 0x999999, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -521,8 +510,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(IRON, COAL, 10); mutation.requireResource("blockSteel"); mutation.restrictTemperature(EnumTemperature.HOT); - } - ), + }), NICKEL(GTBranchDefinition.GT_METAL, "Nichelium", true, 0x8585AD, 0x8585AD, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -535,8 +523,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRON, COPPER, 13); mutation.requireResource("blockNickel"); - } - ), + }), ZINC(GTBranchDefinition.GT_METAL, "Cadmiae", true, 0xF0DEF0, 0xF2E1F2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -549,8 +536,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRON, TIN, 13); mutation.requireResource("blockZinc"); - } - ), + }), SILVER(GTBranchDefinition.GT_METAL, "Argenti", true, 0xC2C2D6, 0xCECEDE, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -563,8 +549,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, TIN, 10); mutation.requireResource("blockSilver"); - } - ), + }), GOLD(GTBranchDefinition.GT_METAL, "Aurum", true, 0xEBC633, 0xEDCC47, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -578,8 +563,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, COPPER, 13); mutation.requireResource("blockGold"); mutation.restrictTemperature(EnumTemperature.HOT); - } - ), + }), ARSENIC(GTBranchDefinition.GT_METAL, "Arsenicum", true, 0x736C52, 0x292412, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -591,8 +575,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ZINC, SILVER, 10); mutation.requireResource("blockArsenic"); - } - ), + }), SILICON(GTBranchDefinition.GT_ORGANIC, "Silex", false, 0xADA2A7, 0x736675, beeSpecies -> { beeSpecies.addProduct(getForestryComb(EnumHoneyComb.HONEY), 0.10f); @@ -609,8 +592,7 @@ public enum GTBeeDefinition implements IBeeDefinition { } else { dis.registerMutation(IRON, BeeDefinition.IMPERIAL, 17); } - } - ), + }), // Rare Metals ALUMINIUM(GTBranchDefinition.GT_RAREMETAL, "Alumen", true, 0xB8B8FF, 0xD6D6FF, @@ -625,8 +607,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(NICKEL, ZINC, 9); mutation.requireResource("blockAluminium"); - } - ), + }), TITANIUM(GTBranchDefinition.GT_RAREMETAL, "Titanus", true, 0xCC99FF, 0xDBB8FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -639,8 +620,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, ALUMINIUM, 5); mutation.requireResource("blockTitanium"); - } - ), + }), // todo glowstone? CHROME(GTBranchDefinition.GT_RAREMETAL, "Chroma", true, 0xEBA1EB, 0xF2C3F2, beeSpecies -> { @@ -654,8 +634,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, RUBY, 5); mutation.requireResource("blockChrome"); - } - ), + }), MANGANESE(GTBranchDefinition.GT_RAREMETAL, "Manganum", true, 0xD5D5D5, 0xAAAAAA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -668,8 +647,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TITANIUM, ALUMINIUM, 5); mutation.requireResource("blockManganese"); - } - ), + }), TUNGSTEN(GTBranchDefinition.GT_RAREMETAL, "Wolframium", false, 0x5C5C8A, 0x7D7DA1, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -682,8 +660,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.HEROIC, MANGANESE, 5); mutation.requireResource("blockTungsten"); - } - ), + }), PLATINUM(GTBranchDefinition.GT_RAREMETAL, "Platina", false, 0xE6E6E6, 0xFFFFCC, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -696,8 +673,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(DIAMOND, CHROME, 5); mutation.requireResource("blockPlatinum"); - } - ), + }), IRIDIUM(GTBranchDefinition.GT_RAREMETAL, "Iris", false, 0xDADADA, 0xD1D1E0, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -711,8 +687,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); mutation.requireResource("blockIridium"); - } - ), + }), OSMIUM(GTBranchDefinition.GT_RAREMETAL, "Osmia", false, 0x2B2BDA, 0x8B8B8B, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -726,8 +701,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(TUNGSTEN, PLATINUM, 5); mutation.requireResource("blockOsmium"); - } - ), + }), SALTY(GTBranchDefinition.GT_RAREMETAL, "Sal", true, 0xF0C8C8, 0xFAFAFA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -740,8 +714,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CLAY, ALUMINIUM, 5); mutation.requireResource("blockSalt"); - } - ), + }), LITHIUM(GTBranchDefinition.GT_RAREMETAL, "Lithos", false, 0xF0328C, 0xE1DCFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -754,8 +727,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(SALTY, ALUMINIUM, 5); mutation.requireResource("blockLithium"); - } - ), + }), ELECTROTINE(GTBranchDefinition.GT_RAREMETAL, "Electrum", false, 0x1E90FF, 0x3CB4C8, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -768,8 +740,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(REDSTONE, GOLD, 5); mutation.requireResource("blockElectrotine"); - } - ), + }), SULFUR(GTBranchDefinition.GT_RAREMETAL, "Sulphur", false, 0x1E90FF, 0x3CB4C8, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SULFUR), 0.70f); @@ -777,8 +748,7 @@ public enum GTBeeDefinition implements IBeeDefinition { beeSpecies.setTemperature(EnumTemperature.HOT); }, template -> AlleleHelper.getInstance().set(template, SPEED, EnumAllele.Speed.NORMAL), - dis -> dis.registerMutation(ASH, PEAT, 15) - ), + dis -> dis.registerMutation(ASH, PEAT, 15)), INDIUM(GTBranchDefinition.GT_RAREMETAL, "Indicium", false, 0xFFA9FF, 0x8F5D99, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.INDIUM), 0.05f); @@ -791,8 +761,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LEAD, OSMIUM, 1); mutation.requireResource("blockIndium"); mutation.restrictBiomeType(BiomeDictionary.Type.END); - } - ), + }), // Industrial ENERGY(GTBranchDefinition.GT_INDUSTRIAL, "Industria", false, 0xC11F1F, 0xEBB9B9, @@ -819,13 +788,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_EB)) { - mutation = dis.registerMutation(BeeDefinition.DEMONIC, ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); + mutation = dis.registerMutation(BeeDefinition.DEMONIC, + ForestryUtil.getSpecies(GTValues.MODID_EB, "volcanic"), 10); } else { mutation = dis.registerMutation(BeeDefinition.DEMONIC, BeeDefinition.FIENDISH, 10); } mutation.requireResource("blockRedstone"); - } - ), + }), LAPOTRON(GTBranchDefinition.GT_INDUSTRIAL, "Azureus", false, 0xFFEBC4, 0xE36400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.LAPIS), 0.20f); @@ -848,8 +817,7 @@ public enum GTBeeDefinition implements IBeeDefinition { IBeeMutationBuilder mutation = dis.registerMutation(LAPIS, ENERGY, 6); mutation.requireResource("blockLapis"); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), EXPLOSIVE(GTBranchDefinition.GT_INDUSTRIAL, "Explosionis", false, 0x7E270F, 0x747474, beeSpecies -> { beeSpecies.addProduct(new ItemStack(Blocks.TNT), 0.2f); @@ -870,8 +838,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AUSTERE, COAL, 4); mutation.requireResource(Blocks.TNT.getDefaultState()); - } - ), + }), // Alloys REDALLOY(GTBranchDefinition.GT_ALLOY, "Rubrum", false, 0xE60000, 0xB80000, @@ -888,8 +855,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(COPPER, REDSTONE, 10); mutation.requireResource("blockRedAlloy"); - } - ), + }), STAINLESSSTEEL(GTBranchDefinition.GT_ALLOY, "Nonferrugo", false, 0xC8C8DC, 0x778899, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -907,8 +873,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(CHROME, STEEL, 9); mutation.requireResource("blockStainlessSteel"); - } - ), + }), // Radioactive URANIUM(GTBranchDefinition.GT_RADIOACTIVE, "Ouranos", true, 0x19AF19, 0x169E16, @@ -926,8 +891,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(BeeDefinition.AVENGING, PLATINUM, 2); mutation.requireResource("blockUranium"); - } - ), + }), PLUTONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Plutos", true, 0x570000, 0x240000, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -944,8 +908,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(URANIUM, EMERALD, 2); mutation.requireResource("blockPlutonium"); - } - ), + }), NAQUADAH(GTBranchDefinition.GT_RADIOACTIVE, "Nasquis", false, 0x003300, 0x002400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -962,8 +925,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); mutation.requireResource("blockNaquadah"); - } - ), + }), NAQUADRIA(GTBranchDefinition.GT_RADIOACTIVE, "Nasquidrius", false, 0x000000, 0x002400, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.SLAG), 0.30f); @@ -981,8 +943,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(PLUTONIUM, IRIDIUM, 1); mutation.requireResource("blockNaquadria"); - } - ), + }), TRINIUM(GTBranchDefinition.GT_RADIOACTIVE, "Trinium", false, 0xB0E0E6, 0xC8C8D2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.TRINIUM), 0.75f); @@ -996,8 +957,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(IRIDIUM, NAQUADAH, 4); mutation.requireResource("blockTrinium"); - } - ), + }), THORIUM(GTBranchDefinition.GT_RADIOACTIVE, "Thorax", false, 0x005000, 0x001E00, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.THORIUM), 0.75f); @@ -1012,8 +972,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(COAL, URANIUM, 2).setIsSecret(); mutation.requireResource("blockThorium"); - } - ), + }), LUTETIUM(GTBranchDefinition.GT_RADIOACTIVE, "Lutetia", false, 0x00AAFF, 0x0059FF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.LUTETIUM), 0.15f); @@ -1035,8 +994,7 @@ public enum GTBeeDefinition implements IBeeDefinition { } mutation.setIsSecret(); mutation.requireResource("blockLutetium"); - } - ), + }), AMERICIUM(GTBranchDefinition.GT_RADIOACTIVE, "Libertas", false, 0x287869, 0x0C453A, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.AMERICIUM), 0.05f); @@ -1052,8 +1010,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(LUTETIUM, CHROME, 1).setIsSecret(); mutation.requireResource("blockAmericium"); - } - ), + }), NEUTRONIUM(GTBranchDefinition.GT_RADIOACTIVE, "Media", false, 0xFFF0F0, 0xFAFAFA, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NEUTRONIUM), 0.0001f); @@ -1069,8 +1026,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IMutationBuilder mutation = dis.registerMutation(NAQUADRIA, AMERICIUM, 1).setIsSecret(); mutation.requireResource(new UnificationEntry(OrePrefix.block, Materials.Neutronium).toString()); - } - ), + }), // Noble Gases HELIUM(GTBranchDefinition.GT_NOBLEGAS, "Helium", false, 0xFFA9FF, 0xC8B8B4, @@ -1085,13 +1041,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(STAINLESSSTEEL, ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); + mutation = dis.registerMutation(STAINLESSSTEEL, + ForestryUtil.getSpecies(GTValues.MODID_MB, "Watery"), 10); } else { mutation = dis.registerMutation(STAINLESSSTEEL, BeeDefinition.INDUSTRIOUS, 10); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), ARGON(GTBranchDefinition.GT_NOBLEGAS, "Argon", false, 0x89D9E1, 0xBDA5C2, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.ARGON), 0.35f); @@ -1104,13 +1060,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 8); + mutation = dis.registerMutation(HELIUM, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), + 8); } else { mutation = dis.registerMutation(HELIUM, BeeDefinition.IMPERIAL, 8); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), NEON(GTBranchDefinition.GT_NOBLEGAS, "Novum", false, 0xFFC826, 0xFF7200, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NEON), 0.35f); @@ -1123,8 +1079,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(ARGON, IRON, 6); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), KRYPTON(GTBranchDefinition.GT_NOBLEGAS, "Kryptos", false, 0x8A97B0, 0x160822, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.KRYPTON), 0.35f); @@ -1137,13 +1092,13 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation; if (Loader.isModLoaded(GTValues.MODID_MB)) { - mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), 4); + mutation = dis.registerMutation(NEON, ForestryUtil.getSpecies(GTValues.MODID_MB, "Supernatural"), + 4); } else { mutation = dis.registerMutation(NEON, BeeDefinition.AVENGING, 4); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), XENON(GTBranchDefinition.GT_NOBLEGAS, "Hostis", false, 0x8A97B0, 0x160822, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.XENON), 0.525f); @@ -1156,8 +1111,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(KRYPTON, BeeDefinition.EDENIC, 2); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), OXYGEN(GTBranchDefinition.GT_NOBLEGAS, "Oxygeni", false, 0xFFFFFF, 0x8F8FFF, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.OXYGEN), 0.45f); @@ -1171,8 +1125,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(HELIUM, BeeDefinition.ENDED, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), HYDROGEN(GTBranchDefinition.GT_NOBLEGAS, "Hydrogenium", false, 0xFFFFFF, 0xFF1493, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.HYDROGEN), 0.45f); @@ -1191,8 +1144,7 @@ public enum GTBeeDefinition implements IBeeDefinition { mutation = dis.registerMutation(OXYGEN, BeeDefinition.INDUSTRIOUS, 15); } mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), NITROGEN(GTBranchDefinition.GT_NOBLEGAS, "Nitrogenium", false, 0xFFC832, 0xA52A2A, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.NITROGEN), 0.45f); @@ -1206,8 +1158,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(OXYGEN, HYDROGEN, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ), + }), FLUORINE(GTBranchDefinition.GT_NOBLEGAS, "Fluens", false, 0x86AFF0, 0xFF6D00, beeSpecies -> { beeSpecies.addProduct(getGTComb(GTCombType.FLUORINE), 0.45f); @@ -1221,8 +1172,7 @@ public enum GTBeeDefinition implements IBeeDefinition { dis -> { IBeeMutationBuilder mutation = dis.registerMutation(NITROGEN, HYDROGEN, 15); mutation.restrictTemperature(EnumTemperature.ICY); - } - ); + }); private final GTBranchDefinition branch; private final GTAlleleBeeSpecies species; @@ -1264,7 +1214,8 @@ public enum GTBeeDefinition implements IBeeDefinition { String name = "for.bees.species." + lowercaseName; this.branch = branch; - this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant, branch.getBranch(), binomial, primary, secondary); + this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant, + branch.getBranch(), binomial, primary, secondary); this.generationCondition = generationCondition; } @@ -1317,7 +1268,7 @@ private void init() { AlleleHelper.getInstance().set(template, SPECIES, species); setAlleles(template); - //noinspection ConstantConditions + // noinspection ConstantConditions genome = BeeManager.beeRoot.templateAsGenome(template); BeeManager.beeRoot.registerTemplate(template); @@ -1337,7 +1288,7 @@ private IBeeMutationBuilder registerMutation(IBeeDefinition parent1, IAlleleBeeS } private IBeeMutationBuilder registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) { - //noinspection ConstantConditions + // noinspection ConstantConditions return BeeManager.beeMutationFactory.createMutation(parent1, parent2, getTemplate(), chance); } @@ -1361,7 +1312,7 @@ public final IBee getIndividual() { @NotNull @Override public final ItemStack getMemberStack(@NotNull EnumBeeType beeType) { - //noinspection ConstantConditions + // noinspection ConstantConditions return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType); } } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java index ce2c094e770..b65b77cc754 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTBranchDefinition.java @@ -91,7 +91,7 @@ public enum GTBranchDefinition { private final Consumer branchProperties; GTBranchDefinition(String scientific, Consumer branchProperties) { - //noinspection ConstantConditions + // noinspection ConstantConditions this.branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(), scientific); AlleleManager.alleleRegistry.getClassification("family.apidae").addMemberGroup(this.branch); this.branchProperties = branchProperties; diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java index ba1593ce53d..0769ad034bf 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombItem.java @@ -1,11 +1,7 @@ package gregtech.integration.forestry.bees; -import forestry.api.core.IItemModelRegister; -import forestry.api.core.IModelManager; -import forestry.api.core.Tabs; -import forestry.core.items.IColoredItem; -import forestry.core.utils.ItemTooltipUtil; import gregtech.api.GTValues; + import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -14,6 +10,12 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; +import forestry.core.items.IColoredItem; +import forestry.core.utils.ItemTooltipUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +65,8 @@ public int getColorFromItemstack(ItemStack stack, int tintIndex) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); ItemTooltipUtil.addInformation(stack, worldIn, tooltip, flagIn); } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java index ec773f29c8e..f774e6f68d0 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTCombType.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTCombType.java @@ -1,6 +1,7 @@ package gregtech.integration.forestry.bees; import gregtech.api.GTValues; + import net.minecraftforge.fml.common.Loader; public enum GTCombType { @@ -106,7 +107,7 @@ public enum GTCombType { GTCombType(String name, int primary, int secondary, boolean show) { this.name = name; - this.color = new int[]{primary, secondary}; + this.color = new int[] { primary, secondary }; this.showInList = show; } diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java index 27df7cf87b4..45a67068b2a 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropItem.java @@ -1,5 +1,12 @@ package gregtech.integration.forestry.bees; +import gregtech.api.GTValues; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + import forestry.api.apiculture.BeeManager; import forestry.api.arboriculture.TreeManager; import forestry.api.core.IItemModelRegister; @@ -9,11 +16,6 @@ import forestry.api.genetics.ISpeciesRoot; import forestry.api.lepidopterology.ButterflyManager; import forestry.core.items.IColoredItem; -import gregtech.api.GTValues; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/integration/forestry/bees/GTDropType.java b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java index f8781c4aafa..9625ee7d8e3 100644 --- a/src/main/java/gregtech/integration/forestry/bees/GTDropType.java +++ b/src/main/java/gregtech/integration/forestry/bees/GTDropType.java @@ -14,7 +14,7 @@ public enum GTDropType { GTDropType(String name, int primary, int secondary) { this.name = name; - this.color = new int[]{primary, secondary}; + this.color = new int[] { primary, secondary }; } public static GTDropType getDrop(int meta) { diff --git a/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java index a6d6e80d1bc..f16df9d6539 100644 --- a/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java +++ b/src/main/java/gregtech/integration/forestry/frames/GTFrameType.java @@ -36,7 +36,8 @@ public enum GTFrameType implements IBeeModifier { private final float floweringMod; private final float geneticDecayMod; - GTFrameType(String name, int maxDamage, float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay) { + GTFrameType(String name, int maxDamage, float territory, float mutation, float lifespan, float production, + float flowering, float geneticDecay) { this.frameName = name; this.maxDamage = maxDamage; this.territoryMod = territory; diff --git a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java index 2bf1b1d4638..088c5ed7e73 100644 --- a/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java +++ b/src/main/java/gregtech/integration/forestry/frames/GTItemFrame.java @@ -1,19 +1,21 @@ package gregtech.integration.forestry.frames; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IHiveFrame; -import forestry.api.core.IItemModelRegister; -import forestry.api.core.IModelManager; -import forestry.api.core.Tabs; import gregtech.api.GTValues; + import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.apiculture.IBeeModifier; +import forestry.api.apiculture.IHiveFrame; +import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; +import forestry.api.core.Tabs; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,7 +37,8 @@ public GTItemFrame(GTFrameType type) { @SideOnly(Side.CLIENT) @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, @NotNull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { // TODO super.addInformation(stack, worldIn, tooltip, flagIn); } diff --git a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java index f78f52ff6ca..66df87dc408 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/CombRecipes.java @@ -1,12 +1,5 @@ package gregtech.integration.forestry.recipes; -import appeng.core.Api; -import com.google.common.collect.ImmutableMap; -import forestry.api.recipes.ICentrifugeRecipe; -import forestry.api.recipes.RecipeManagers; -import forestry.core.ModuleCore; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.metatileentity.multiblock.CleanroomType; import gregtech.api.recipes.RecipeBuilder; @@ -25,10 +18,19 @@ import gregtech.integration.forestry.bees.GTCombItem; import gregtech.integration.forestry.bees.GTCombType; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import appeng.core.Api; +import com.google.common.collect.ImmutableMap; +import forestry.api.recipes.ICentrifugeRecipe; +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + import java.util.Arrays; import java.util.Map; @@ -61,82 +63,156 @@ public static void initForestryCombs() { // forgive me for the code i am about to write public static void initGTCombs() { // Organic - addProcessGT(GTCombType.COAL, new Material[]{Materials.Coal}, Voltage.LV); - addProcessGT(GTCombType.COKE, new Material[]{Materials.Coke}, Voltage.LV); - addCentrifugeToItemStack(GTCombType.STICKY, new ItemStack[]{MetaItems.STICKY_RESIN.getStackForm(), MetaItems.PLANT_BALL.getStackForm(), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{50 * 100, 15 * 100, 50 * 100}, Voltage.ULV); - addProcessGT(GTCombType.OIL, new Material[]{Materials.Oilsands}, Voltage.LV); - addProcessGT(GTCombType.APATITE, new Material[]{Materials.Apatite, Materials.TricalciumPhosphate}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.ASH, new Material[]{Materials.DarkAsh, Materials.Ash}, new int[]{50 * 100, 50 * 100}, new int[]{9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); - addCentrifugeToItemStack(GTCombType.BIOMASS, new ItemStack[]{ForestryUtil.getDropStack(GTDropType.BIOMASS), ForestryUtil.getDropStack(GTDropType.ETHANOL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 30 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.PHOSPHORUS, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Phosphorus), OreDictUnifier.get(OrePrefix.dust, Materials.TricalciumPhosphate), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{100 * 100, 100 * 100, 100 * 100}, Voltage.HV); - addCentrifugeToItemStack(GTCombType.COAL, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coal), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.COKE, new ItemStack[]{OreDictUnifier.get(OrePrefix.gem, Materials.Coke), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{5 * 100, 50 * 100}, Voltage.ULV); - addCentrifugeToItemStack(GTCombType.OIL, new ItemStack[]{OreDictUnifier.get(OrePrefix.dustTiny, Materials.Oilsands), ForestryUtil.getDropStack(GTDropType.OIL), ModuleCore.getItems().beeswax.getItemStack()}, new int[]{70 * 100, 100 * 100, 50 * 100}, Voltage.ULV); + addProcessGT(GTCombType.COAL, new Material[] { Materials.Coal }, Voltage.LV); + addProcessGT(GTCombType.COKE, new Material[] { Materials.Coke }, Voltage.LV); + addCentrifugeToItemStack(GTCombType.STICKY, + new ItemStack[] { MetaItems.STICKY_RESIN.getStackForm(), MetaItems.PLANT_BALL.getStackForm(), + ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 50 * 100, 15 * 100, 50 * 100 }, Voltage.ULV); + addProcessGT(GTCombType.OIL, new Material[] { Materials.Oilsands }, Voltage.LV); + addProcessGT(GTCombType.APATITE, new Material[] { Materials.Apatite, Materials.TricalciumPhosphate }, + Voltage.LV); + addCentrifugeToMaterial(GTCombType.ASH, new Material[] { Materials.DarkAsh, Materials.Ash }, + new int[] { 50 * 100, 50 * 100 }, new int[] { 9, 9 }, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + addCentrifugeToItemStack(GTCombType.BIOMASS, + new ItemStack[] { ForestryUtil.getDropStack(GTDropType.BIOMASS), + ForestryUtil.getDropStack(GTDropType.ETHANOL), ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 70 * 100, 30 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.PHOSPHORUS, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dust, Materials.Phosphorus), + OreDictUnifier.get(OrePrefix.dust, Materials.TricalciumPhosphate), + ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 100 * 100, 100 * 100, 100 * 100 }, Voltage.HV); + addCentrifugeToItemStack(GTCombType.COAL, new ItemStack[] { OreDictUnifier.get(OrePrefix.gem, Materials.Coal), + ModuleCore.getItems().beeswax.getItemStack() }, new int[] { 5 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.COKE, new ItemStack[] { OreDictUnifier.get(OrePrefix.gem, Materials.Coke), + ModuleCore.getItems().beeswax.getItemStack() }, new int[] { 5 * 100, 50 * 100 }, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.OIL, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dustTiny, Materials.Oilsands), + ForestryUtil.getDropStack(GTDropType.OIL), ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 70 * 100, 100 * 100, 50 * 100 }, Voltage.ULV); // Industrial - addCentrifugeToItemStack(GTCombType.ENERGY, new ItemStack[]{MetaItems.ENERGIUM_DUST.getStackForm(), ModuleCore.getItems().refractoryWax.getItemStack()}, new int[]{20 * 100, 50 * 100}, Voltage.HV, 196); + addCentrifugeToItemStack(GTCombType.ENERGY, + new ItemStack[] { MetaItems.ENERGIUM_DUST.getStackForm(), + ModuleCore.getItems().refractoryWax.getItemStack() }, + new int[] { 20 * 100, 50 * 100 }, Voltage.HV, 196); ItemStack wax = ModuleCore.getItems().beeswax.getItemStack(); if (Loader.isModLoaded(GTValues.MODID_MB)) { wax = IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 2); } - addCentrifugeToItemStack(GTCombType.LAPOTRON, new ItemStack[]{OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax}, new int[]{100 * 100, 40 * 100}, Voltage.HV, 196); + addCentrifugeToItemStack(GTCombType.LAPOTRON, + new ItemStack[] { OreDictUnifier.get(OrePrefix.dust, Materials.Lapotron), wax }, + new int[] { 100 * 100, 40 * 100 }, Voltage.HV, 196); // Alloy - addProcessGT(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy, Materials.Redstone, Materials.Copper}, Voltage.LV); - addProcessGT(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel, Materials.Iron, Materials.Chrome, Materials.Manganese, Materials.Nickel}, Voltage.HV); - addCentrifugeToMaterial(GTCombType.REDALLOY, new Material[]{Materials.RedAlloy}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); - addCentrifugeToMaterial(GTCombType.STAINLESSSTEEL, new Material[]{Materials.StainlessSteel}, new int[]{50 * 100}, new int[]{9}, Voltage.HV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + addProcessGT(GTCombType.REDALLOY, new Material[] { Materials.RedAlloy, Materials.Redstone, Materials.Copper }, + Voltage.LV); + addProcessGT(GTCombType.STAINLESSSTEEL, new Material[] { Materials.StainlessSteel, Materials.Iron, + Materials.Chrome, Materials.Manganese, Materials.Nickel }, Voltage.HV); + addCentrifugeToMaterial(GTCombType.REDALLOY, new Material[] { Materials.RedAlloy }, new int[] { 100 * 100 }, + new int[] { 9 }, Voltage.ULV, ModuleCore.getItems().refractoryWax.getItemStack(), 50 * 100); + addCentrifugeToMaterial(GTCombType.STAINLESSSTEEL, new Material[] { Materials.StainlessSteel }, + new int[] { 50 * 100 }, new int[] { 9 }, Voltage.HV, ModuleCore.getItems().refractoryWax.getItemStack(), + 50 * 100); // Gem - addProcessGT(GTCombType.STONE, new Material[]{Materials.Soapstone, Materials.Talc, Materials.Apatite, Materials.Phosphate, Materials.TricalciumPhosphate}, Voltage.LV); - addProcessGT(GTCombType.CERTUS, new Material[]{Materials.CertusQuartz, Materials.Quartzite, Materials.Barite}, Voltage.LV); - addProcessGT(GTCombType.REDSTONE, new Material[]{Materials.Redstone, Materials.Cinnabar}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.RAREEARTH, new Material[]{Materials.RareEarth}, new int[]{100 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addProcessGT(GTCombType.LAPIS, new Material[]{Materials.Lapis, Materials.Sodalite, Materials.Lazurite, Materials.Calcite}, Voltage.LV); - addProcessGT(GTCombType.RUBY, new Material[]{Materials.Ruby, Materials.Redstone}, Voltage.LV); - addProcessGT(GTCombType.SAPPHIRE, new Material[]{Materials.Sapphire, Materials.GreenSapphire, Materials.Almandine, Materials.Pyrope}, Voltage.LV); - addProcessGT(GTCombType.DIAMOND, new Material[]{Materials.Diamond, Materials.Graphite}, Voltage.LV); - addProcessGT(GTCombType.OLIVINE, new Material[]{Materials.Olivine, Materials.Bentonite, Materials.Magnesite, Materials.GlauconiteSand}, Voltage.LV); - addProcessGT(GTCombType.EMERALD, new Material[]{Materials.Emerald, Materials.Beryllium, Materials.Thorium}, Voltage.LV); - addProcessGT(GTCombType.PYROPE, new Material[]{Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon}, Voltage.LV); - addProcessGT(GTCombType.GROSSULAR, new Material[]{Materials.Grossular, Materials.Aluminium, Materials.Silicon}, Voltage.LV); - addCentrifugeToMaterial(GTCombType.STONE, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Basalt, Materials.Marble}, new int[]{70 * 100, 50 * 100, 50 * 100, 50 * 100, 50 * 100}, new int[]{9, 9, 9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 50 * 100); + addProcessGT(GTCombType.STONE, new Material[] { Materials.Soapstone, Materials.Talc, Materials.Apatite, + Materials.Phosphate, Materials.TricalciumPhosphate }, Voltage.LV); + addProcessGT(GTCombType.CERTUS, + new Material[] { Materials.CertusQuartz, Materials.Quartzite, Materials.Barite }, Voltage.LV); + addProcessGT(GTCombType.REDSTONE, new Material[] { Materials.Redstone, Materials.Cinnabar }, Voltage.LV); + addCentrifugeToMaterial(GTCombType.RAREEARTH, new Material[] { Materials.RareEarth }, new int[] { 100 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addProcessGT(GTCombType.LAPIS, + new Material[] { Materials.Lapis, Materials.Sodalite, Materials.Lazurite, Materials.Calcite }, + Voltage.LV); + addProcessGT(GTCombType.RUBY, new Material[] { Materials.Ruby, Materials.Redstone }, Voltage.LV); + addProcessGT(GTCombType.SAPPHIRE, + new Material[] { Materials.Sapphire, Materials.GreenSapphire, Materials.Almandine, Materials.Pyrope }, + Voltage.LV); + addProcessGT(GTCombType.DIAMOND, new Material[] { Materials.Diamond, Materials.Graphite }, Voltage.LV); + addProcessGT(GTCombType.OLIVINE, new Material[] { Materials.Olivine, Materials.Bentonite, Materials.Magnesite, + Materials.GlauconiteSand }, Voltage.LV); + addProcessGT(GTCombType.EMERALD, new Material[] { Materials.Emerald, Materials.Beryllium, Materials.Thorium }, + Voltage.LV); + addProcessGT(GTCombType.PYROPE, + new Material[] { Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon }, + Voltage.LV); + addProcessGT(GTCombType.GROSSULAR, + new Material[] { Materials.Grossular, Materials.Aluminium, Materials.Silicon }, Voltage.LV); + addCentrifugeToMaterial(GTCombType.STONE, + new Material[] { Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Basalt, + Materials.Marble }, + new int[] { 70 * 100, 50 * 100, 50 * 100, 50 * 100, 50 * 100 }, new int[] { 9, 9, 9, 9, 9 }, + Voltage.ULV, ItemStack.EMPTY, 50 * 100); // Metals - addProcessGT(GTCombType.COPPER, new Material[]{Materials.Copper, Materials.Tetrahedrite, Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite}, Voltage.LV); - addProcessGT(GTCombType.TIN, new Material[]{Materials.Tin, Materials.Cassiterite, Materials.CassiteriteSand}, Voltage.LV); - addProcessGT(GTCombType.LEAD, new Material[]{Materials.Lead, Materials.Galena}, Voltage.LV); - addProcessGT(GTCombType.NICKEL, new Material[]{Materials.Nickel, Materials.Garnierite, Materials.Pentlandite, Materials.Cobaltite, Materials.Wulfenite, Materials.Powellite}, Voltage.LV); - addProcessGT(GTCombType.ZINC, new Material[]{Materials.Sphalerite, Materials.Sulfur}, Voltage.LV); - addProcessGT(GTCombType.SILVER, new Material[]{Materials.Silver, Materials.Galena}, Voltage.LV); - addProcessGT(GTCombType.GOLD, new Material[]{Materials.Gold, Materials.Magnetite}, Voltage.LV); - addProcessGT(GTCombType.SULFUR, new Material[]{Materials.Sulfur, Materials.Pyrite, Materials.Sphalerite}, Voltage.LV); - addProcessGT(GTCombType.GALLIUM, new Material[]{Materials.Gallium, Materials.Niobium}, Voltage.LV); - addProcessGT(GTCombType.ARSENIC, new Material[]{Materials.Realgar, Materials.Cassiterite, Materials.Zeolite}, Voltage.LV); - addProcessGT(GTCombType.IRON, new Material[]{Materials.Iron, Materials.Magnetite, Materials.BrownLimonite, Materials.YellowLimonite, Materials.VanadiumMagnetite, Materials.BandedIron, Materials.Pyrite}, Voltage.LV); - - addCentrifugeToMaterial(GTCombType.SLAG, new Material[]{Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed}, new int[]{50 * 100, 20 * 100, 20 * 100}, new int[]{9, 9, 9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.COPPER, new Material[]{Materials.Copper}, new int[]{70 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.TIN, new Material[]{Materials.Tin}, new int[]{60 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.LEAD, new Material[]{Materials.Lead}, new int[]{45 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.IRON, new Material[]{Materials.Iron}, new int[]{30 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.STEEL, new Material[]{Materials.Steel}, new int[]{40 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); - addCentrifugeToMaterial(GTCombType.SILVER, new Material[]{Materials.Silver}, new int[]{80 * 100}, new int[]{9}, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addProcessGT(GTCombType.COPPER, new Material[] { Materials.Copper, Materials.Tetrahedrite, + Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite }, Voltage.LV); + addProcessGT(GTCombType.TIN, new Material[] { Materials.Tin, Materials.Cassiterite, Materials.CassiteriteSand }, + Voltage.LV); + addProcessGT(GTCombType.LEAD, new Material[] { Materials.Lead, Materials.Galena }, Voltage.LV); + addProcessGT(GTCombType.NICKEL, new Material[] { Materials.Nickel, Materials.Garnierite, Materials.Pentlandite, + Materials.Cobaltite, Materials.Wulfenite, Materials.Powellite }, Voltage.LV); + addProcessGT(GTCombType.ZINC, new Material[] { Materials.Sphalerite, Materials.Sulfur }, Voltage.LV); + addProcessGT(GTCombType.SILVER, new Material[] { Materials.Silver, Materials.Galena }, Voltage.LV); + addProcessGT(GTCombType.GOLD, new Material[] { Materials.Gold, Materials.Magnetite }, Voltage.LV); + addProcessGT(GTCombType.SULFUR, new Material[] { Materials.Sulfur, Materials.Pyrite, Materials.Sphalerite }, + Voltage.LV); + addProcessGT(GTCombType.GALLIUM, new Material[] { Materials.Gallium, Materials.Niobium }, Voltage.LV); + addProcessGT(GTCombType.ARSENIC, new Material[] { Materials.Realgar, Materials.Cassiterite, Materials.Zeolite }, + Voltage.LV); + addProcessGT( + GTCombType.IRON, new Material[] { Materials.Iron, Materials.Magnetite, Materials.BrownLimonite, + Materials.YellowLimonite, Materials.VanadiumMagnetite, Materials.BandedIron, Materials.Pyrite }, + Voltage.LV); + + addCentrifugeToMaterial(GTCombType.SLAG, + new Material[] { Materials.Stone, Materials.GraniteBlack, Materials.GraniteRed }, + new int[] { 50 * 100, 20 * 100, 20 * 100 }, new int[] { 9, 9, 9 }, Voltage.ULV, ItemStack.EMPTY, + 30 * 100); + addCentrifugeToMaterial(GTCombType.COPPER, new Material[] { Materials.Copper }, new int[] { 70 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.TIN, new Material[] { Materials.Tin }, new int[] { 60 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.LEAD, new Material[] { Materials.Lead }, new int[] { 45 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.IRON, new Material[] { Materials.Iron }, new int[] { 30 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.STEEL, new Material[] { Materials.Steel }, new int[] { 40 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); + addCentrifugeToMaterial(GTCombType.SILVER, new Material[] { Materials.Silver }, new int[] { 80 * 100 }, + new int[] { 9 }, Voltage.ULV, ItemStack.EMPTY, 30 * 100); // Rare Metals - addProcessGT(GTCombType.BAUXITE, new Material[]{Materials.Bauxite, Materials.Aluminium}, Voltage.LV); - addProcessGT(GTCombType.ALUMINIUM, new Material[]{Materials.Aluminium, Materials.Bauxite}, Voltage.LV); - addProcessGT(GTCombType.MANGANESE, new Material[]{Materials.Manganese, Materials.Grossular, Materials.Spessartine, Materials.Pyrolusite, Materials.Tantalite}, Voltage.LV); - addProcessGT(GTCombType.TITANIUM, new Material[]{Materials.Titanium, Materials.Ilmenite, Materials.Bauxite, Materials.Rutile}, Voltage.EV); - addProcessGT(GTCombType.MAGNESIUM, new Material[]{Materials.Magnesium, Materials.Magnesite}, Voltage.LV); - addProcessGT(GTCombType.CHROME, new Material[]{Materials.Chrome, Materials.Ruby, Materials.Chromite, Materials.Redstone, Materials.Neodymium, Materials.Bastnasite}, Voltage.HV); - addProcessGT(GTCombType.TUNGSTEN, new Material[]{Materials.Tungsten, Materials.Tungstate, Materials.Scheelite, Materials.Lithium}, Voltage.IV); - addProcessGT(GTCombType.PLATINUM, new Material[]{Materials.Platinum, Materials.Cooperite, Materials.Palladium}, Voltage.HV); - addProcessGT(GTCombType.MOLYBDENUM, new Material[]{Materials.Molybdenum, Materials.Molybdenite, Materials.Powellite, Materials.Wulfenite}, Voltage.LV); - addProcessGT(GTCombType.LITHIUM, new Material[]{Materials.Lithium, Materials.Lepidolite, Materials.Spodumene}, Voltage.MV); - addProcessGT(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, Voltage.MV); - addProcessGT(GTCombType.ELECTROTINE, new Material[]{Materials.Electrotine, Materials.Electrum, Materials.Redstone}, Voltage.MV); - addCentrifugeToMaterial(GTCombType.SALT, new Material[]{Materials.Salt, Materials.RockSalt, Materials.Saltpeter}, new int[]{100 * 100, 100 * 100, 25 * 100}, new int[]{9 * 6, 9 * 6, 9 * 6}, Voltage.MV, 160, ItemStack.EMPTY, 50 * 100); + addProcessGT(GTCombType.BAUXITE, new Material[] { Materials.Bauxite, Materials.Aluminium }, Voltage.LV); + addProcessGT(GTCombType.ALUMINIUM, new Material[] { Materials.Aluminium, Materials.Bauxite }, Voltage.LV); + addProcessGT(GTCombType.MANGANESE, new Material[] { Materials.Manganese, Materials.Grossular, + Materials.Spessartine, Materials.Pyrolusite, Materials.Tantalite }, Voltage.LV); + addProcessGT(GTCombType.TITANIUM, + new Material[] { Materials.Titanium, Materials.Ilmenite, Materials.Bauxite, Materials.Rutile }, + Voltage.EV); + addProcessGT(GTCombType.MAGNESIUM, new Material[] { Materials.Magnesium, Materials.Magnesite }, Voltage.LV); + addProcessGT(GTCombType.CHROME, new Material[] { Materials.Chrome, Materials.Ruby, Materials.Chromite, + Materials.Redstone, Materials.Neodymium, Materials.Bastnasite }, Voltage.HV); + addProcessGT(GTCombType.TUNGSTEN, + new Material[] { Materials.Tungsten, Materials.Tungstate, Materials.Scheelite, Materials.Lithium }, + Voltage.IV); + addProcessGT(GTCombType.PLATINUM, + new Material[] { Materials.Platinum, Materials.Cooperite, Materials.Palladium }, Voltage.HV); + addProcessGT(GTCombType.MOLYBDENUM, new Material[] { Materials.Molybdenum, Materials.Molybdenite, + Materials.Powellite, Materials.Wulfenite }, Voltage.LV); + addProcessGT(GTCombType.LITHIUM, + new Material[] { Materials.Lithium, Materials.Lepidolite, Materials.Spodumene }, Voltage.MV); + addProcessGT(GTCombType.SALT, new Material[] { Materials.Salt, Materials.RockSalt, Materials.Saltpeter }, + Voltage.MV); + addProcessGT(GTCombType.ELECTROTINE, + new Material[] { Materials.Electrotine, Materials.Electrum, Materials.Redstone }, Voltage.MV); + addCentrifugeToMaterial(GTCombType.SALT, + new Material[] { Materials.Salt, Materials.RockSalt, Materials.Saltpeter }, + new int[] { 100 * 100, 100 * 100, 25 * 100 }, new int[] { 9 * 6, 9 * 6, 9 * 6 }, Voltage.MV, 160, + ItemStack.EMPTY, 50 * 100); // Special Iridium Recipe RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -169,15 +245,22 @@ public static void initGTCombs() { .duration(50).EUt(600).buildAndRegister(); // Radioactive - addProcessGT(GTCombType.ALMANDINE, new Material[]{Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire}, Voltage.LV); - addProcessGT(GTCombType.URANIUM, new Material[]{Materials.Uranium238, Materials.Pitchblende, Materials.Uraninite, Materials.Uranium235}, Voltage.EV); - addProcessGT(GTCombType.PLUTONIUM, new Material[]{Materials.Plutonium239, Materials.Uranium235}, Voltage.EV); - addProcessGT(GTCombType.NAQUADAH, new Material[]{Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria}, Voltage.IV); - addProcessGT(GTCombType.NAQUADRIA, new Material[]{Materials.Naquadria, Materials.NaquadahEnriched, Materials.Naquadah}, Voltage.LUV); - addProcessGT(GTCombType.THORIUM, new Material[]{Materials.Thorium, Materials.Uranium238, Materials.Coal}, Voltage.EV); - addProcessGT(GTCombType.LUTETIUM, new Material[]{Materials.Lutetium, Materials.Thorium}, Voltage.IV); - addProcessGT(GTCombType.AMERICIUM, new Material[]{Materials.Americium, Materials.Lutetium}, Voltage.LUV); - addProcessGT(GTCombType.TRINIUM, new Material[]{Materials.Trinium, Materials.Naquadah, Materials.Naquadria}, Voltage.ZPM); + addProcessGT(GTCombType.ALMANDINE, + new Material[] { Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire }, + Voltage.LV); + addProcessGT(GTCombType.URANIUM, new Material[] { Materials.Uranium238, Materials.Pitchblende, + Materials.Uraninite, Materials.Uranium235 }, Voltage.EV); + addProcessGT(GTCombType.PLUTONIUM, new Material[] { Materials.Plutonium239, Materials.Uranium235 }, Voltage.EV); + addProcessGT(GTCombType.NAQUADAH, + new Material[] { Materials.Naquadah, Materials.NaquadahEnriched, Materials.Naquadria }, Voltage.IV); + addProcessGT(GTCombType.NAQUADRIA, + new Material[] { Materials.Naquadria, Materials.NaquadahEnriched, Materials.Naquadah }, Voltage.LUV); + addProcessGT(GTCombType.THORIUM, new Material[] { Materials.Thorium, Materials.Uranium238, Materials.Coal }, + Voltage.EV); + addProcessGT(GTCombType.LUTETIUM, new Material[] { Materials.Lutetium, Materials.Thorium }, Voltage.IV); + addProcessGT(GTCombType.AMERICIUM, new Material[] { Materials.Americium, Materials.Lutetium }, Voltage.LUV); + addProcessGT(GTCombType.TRINIUM, new Material[] { Materials.Trinium, Materials.Naquadah, Materials.Naquadria }, + Voltage.ZPM); // Special Neutronium Recipe RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -189,8 +272,12 @@ public static void initGTCombs() { .duration(3000).EUt(Voltage.UV.getChemicalEnergy()).buildAndRegister(); if (Loader.isModLoaded(GTValues.MODID_MB)) { - addProcessGT(GTCombType.SPARKLING, new Material[]{Materials.NetherStar}, Voltage.EV); - addCentrifugeToItemStack(GTCombType.SPARKLING, new ItemStack[]{IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar)}, new int[]{50 * 100, 10 * 100, 10 * 100}, Voltage.EV); + addProcessGT(GTCombType.SPARKLING, new Material[] { Materials.NetherStar }, Voltage.EV); + addCentrifugeToItemStack(GTCombType.SPARKLING, + new ItemStack[] { IntegrationUtil.getModItem(GTValues.MODID_MB, "wax", 0), + IntegrationUtil.getModItem(GTValues.MODID_MB, "resource", 5), + OreDictUnifier.get(OrePrefix.dustTiny, Materials.NetherStar) }, + new int[] { 50 * 100, 10 * 100, 10 * 100 }, Voltage.EV); } addExtractorProcess(GTCombType.HELIUM, Materials.Helium.getFluid(250), Voltage.HV, 100); @@ -209,13 +296,17 @@ public static void initGTCombs() { fluixDust = Api.INSTANCE.definitions().materials().fluixDust().maybeStack(1).orElse(ItemStack.EMPTY); } if (fluixDust != ItemStack.EMPTY) { - addCentrifugeToItemStack(GTCombType.FLUIX, new ItemStack[]{fluixDust, ModuleCore.getItems().beeswax.getItemStack()}, new int[]{25 * 100, 30 * 100}, Voltage.ULV); + addCentrifugeToItemStack(GTCombType.FLUIX, + new ItemStack[] { fluixDust, ModuleCore.getItems().beeswax.getItemStack() }, + new int[] { 25 * 100, 30 * 100 }, Voltage.ULV); } } } private static void addChemicalProcess(GTCombType comb, Material inMaterial, Material outMaterial, Voltage volt) { - if (OreDictUnifier.get(OrePrefix.crushedPurified, outMaterial, 4).isEmpty() || OreDictUnifier.get(OrePrefix.crushed, inMaterial).isEmpty() || inMaterial.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) + if (OreDictUnifier.get(OrePrefix.crushedPurified, outMaterial, 4).isEmpty() || + OreDictUnifier.get(OrePrefix.crushed, inMaterial).isEmpty() || + inMaterial.hasFlag(MaterialFlags.DISABLE_ORE_BLOCK)) return; RecipeBuilder builder = RecipeMaps.CHEMICAL_RECIPES.recipeBuilder() @@ -253,7 +344,8 @@ private static void addAutoclaveProcess(GTCombType comb, Material material, Volt RecipeBuilder builder = RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() .inputs(GTUtility.copy(9, ForestryUtil.getCombStack(comb))) .circuitMeta(circuitNumber) - .fluidInputs(Materials.Mutagen.getFluid((int) Math.max(1, material.getMass() + volt.getMutagenAmount()))) + .fluidInputs( + Materials.Mutagen.getFluid((int) Math.max(1, material.getMass() + volt.getMutagenAmount()))) .output(OrePrefix.crushedPurified, material, 4) .duration((int) (material.getMass() * 128)) .EUt(volt.getAutoclaveEnergy()); @@ -275,9 +367,11 @@ private static void addExtractorProcess(GTCombType comb, FluidStack fluidStack, /** * this only adds Chemical and AutoClave process. - * If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack + * If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack * - * @param volt This determines the required Tier of process for these recipes. This decides the required aEU/t, progress time, required additional Mutagen, requirement of cleanRoom, needed fluid stack for Chemical. + * @param volt This determines the required Tier of process for these recipes. This decides the required aEU/t, + * progress time, required additional Mutagen, requirement of cleanRoom, needed fluid stack for + * Chemical. * @param material result of Material that should be generated by this process. **/ private static void addProcessGT(GTCombType comb, Material[] material, Voltage volt) { @@ -288,21 +382,29 @@ private static void addProcessGT(GTCombType comb, Material[] material, Voltage v } /** - * this method only adds Centrifuge based on Material. If volt is lower than MV than it will also add forestry centrifuge recipe. + * this method only adds Centrifuge based on Material. If volt is lower than MV than it will also add forestry + * centrifuge recipe. * * @param comb BeeComb * @param material resulting Material of processing. must be less than or equal to 9. * @param chance chance to get result, 10000 == 100% - * @param volt required Voltage Tier for this recipe, this also affect the duration, amount of Mutagen, and needed liquid type and amount for chemical reactor - * @param stackSize This parameter can be null, in that case stack size will be just 1. This handle the stackSize of the resulting Item, and Also the Type of Item. if this value is multiple of 9, than related Material output will be dust, if this value is multiple of 4 than output will be Small dust, else the output will be Tiny dust - * @param beeWax if this is null, then the comb will product default Bee wax. But if material is more than 5, beeWax will be ignored in Gregtech Centrifuge. + * @param volt required Voltage Tier for this recipe, this also affect the duration, amount of Mutagen, and + * needed liquid type and amount for chemical reactor + * @param stackSize This parameter can be null, in that case stack size will be just 1. This handle the stackSize of + * the resulting Item, and Also the Type of Item. if this value is multiple of 9, than related + * Material output will be dust, if this value is multiple of 4 than output will be Small dust, + * else the output will be Tiny dust + * @param beeWax if this is null, then the comb will product default Bee wax. But if material is more than 5, + * beeWax will be ignored in Gregtech Centrifuge. * @param waxChance have same format like "chance" **/ - private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, ItemStack beeWax, int waxChance) { + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, + Voltage volt, ItemStack beeWax, int waxChance) { addCentrifugeToMaterial(comb, material, chance, stackSize, volt, volt.getCentrifugeTime(), beeWax, waxChance); } - private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, Voltage volt, int duration, ItemStack beeWax, int waxChance) { + private static void addCentrifugeToMaterial(GTCombType comb, Material[] material, int[] chance, int[] stackSize, + Voltage volt, int duration, ItemStack beeWax, int waxChance) { ItemStack[] output = new ItemStack[material.length + 1]; stackSize = Arrays.copyOf(stackSize, material.length); chance = Arrays.copyOf(chance, output.length); @@ -335,7 +437,8 @@ private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, addCentrifugeToItemStack(comb, item, chance, volt, volt.getCentrifugeTime()); } - private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt, int duration) { + private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, int[] chance, Voltage volt, + int duration) { ItemStack combStack = ForestryUtil.getCombStack(comb); // Start of the Forestry Map @@ -373,7 +476,22 @@ private static void addCentrifugeToItemStack(GTCombType comb, ItemStack[] item, } private enum Voltage { - ULV, LV, MV, HV, EV, IV, LUV, ZPM, UV, UHV, UEV, UIV, UXV, OPV, MAX; + + ULV, + LV, + MV, + HV, + EV, + IV, + LUV, + ZPM, + UV, + UHV, + UEV, + UIV, + UXV, + OPV, + MAX; public int getVoltage() { return (int) GTValues.V[ordinal()]; diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java index 40be7c4dc01..171f575bc32 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryElectrodeRecipes.java @@ -1,22 +1,24 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.core.ModuleCore; -import forestry.core.fluids.Fluids; -import forestry.core.items.EnumElectronTube; -import forestry.core.items.ItemElectronTube; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; -import forestry.factory.recipes.FabricatorRecipeManager; import gregtech.api.GTValues; import gregtech.api.unification.stack.UnificationEntry; import gregtech.integration.forestry.ForestryModule; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import forestry.api.recipes.RecipeManagers; +import forestry.core.ModuleCore; +import forestry.core.fluids.Fluids; +import forestry.core.items.EnumElectronTube; +import forestry.core.items.ItemElectronTube; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; +import forestry.factory.recipes.FabricatorRecipeManager; + import static gregtech.api.recipes.RecipeMaps.CIRCUIT_ASSEMBLER_RECIPES; import static gregtech.api.recipes.RecipeMaps.FORMING_PRESS_RECIPES; import static gregtech.api.unification.material.Materials.*; @@ -189,7 +191,8 @@ public static void addGregTechMachineRecipes() { } // todo mixin forestry to allow this tube always, since we have rubber (once mixin port is done) - if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || Loader.isModLoaded(GTValues.MODID_BINNIE)) { + if (Loader.isModLoaded(GTValues.MODID_IC2) || Loader.isModLoaded(GTValues.MODID_TR) || + Loader.isModLoaded(GTValues.MODID_BINNIE)) { CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().duration(150).EUt(16) .input(ForestryModule.ELECTRODE_RUBBER) .fluidInputs(Glass.getFluid(100)) diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java index 148be3f207b..5a57da584cc 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryExtractorRecipes.java @@ -1,21 +1,22 @@ package gregtech.integration.forestry.recipes; -import forestry.core.fluids.Fluids; import gregtech.api.GTValues; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.integration.IntegrationUtil; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Loader; +import forestry.core.fluids.Fluids; + public class ForestryExtractorRecipes { public static void init() { - // Commonly used items ItemStack mulch = IntegrationUtil.getModItem(GTValues.MODID_FR, "mulch", 0); ItemStack propolis = IntegrationUtil.getModItem(GTValues.MODID_FR, "propolis", 0); @@ -28,96 +29,160 @@ public static void init() { addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 0), 50, GTUtility.copy(mulch), 500); addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 1), 180, GTUtility.copy(mulch), 500); addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 2), 220, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), 6000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 3), 400, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 4), 100, GTUtility.copy(mulch), + 6000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 5), 50, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "fruits", 6), 600, GTUtility.copy(mulch), + 1000); // Honey, Honeydew - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honey_drop", 0), 100, GTUtility.copy(propolis), + 0); addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_FR, "honeydew", 0), 100); if (Loader.isModLoaded(GTValues.MODID_EB)) { // Propolis - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), Materials.Water.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), Materials.Oil.getFluid(500)); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), Materials.Creosote.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 0), + Materials.Water.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 1), + Materials.Oil.getFluid(500)); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "propolis", 2), + Materials.Creosote.getFluid(500)); // Drops addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 3), 200); - addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), Fluids.MILK.getFluid(200)); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, new ItemStack(Items.DYE, 1, 14), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, new ItemStack(Items.DYE, 1, 6), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, new ItemStack(Items.DYE, 1, 5), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, new ItemStack(Items.DYE, 1, 8), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, new ItemStack(Items.DYE, 1, 12), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, new ItemStack(Items.DYE, 1, 9), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, new ItemStack(Items.DYE, 1, 10), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, new ItemStack(Items.DYE, 1, 13), 0); - addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, new ItemStack(Items.DYE, 1, 7), 0); + addExtractorRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 6), + Fluids.MILK.getFluid(200)); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 13), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 19), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 14), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 20), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 15), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 21), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 16), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 22), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 17), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 24), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 18), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 23), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 19), 200, + IntegrationUtil.getModItem(GTValues.MODID_EB, "misc", 25), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 20), 200, + new ItemStack(Items.DYE, 1, 14), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 21), 200, + new ItemStack(Items.DYE, 1, 6), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 22), 200, + new ItemStack(Items.DYE, 1, 5), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 23), 200, + new ItemStack(Items.DYE, 1, 8), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 24), 200, + new ItemStack(Items.DYE, 1, 12), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 25), 200, + new ItemStack(Items.DYE, 1, 9), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 26), 200, + new ItemStack(Items.DYE, 1, 10), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 27), 200, + new ItemStack(Items.DYE, 1, 13), 0); + addHoneyRecipe(IntegrationUtil.getModItem(GTValues.MODID_EB, "honey_drop", 28), 200, + new ItemStack(Items.DYE, 1, 7), 0); } if (Loader.isModLoaded(GTValues.MODID_ET)) { // Fruits - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), 6000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), 4000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), 400); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), 3000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), 4000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), 1500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), 500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), 2500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), 1500); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), 1500); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), 1000); - addSeedOilRecipe( IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), 2000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), 1000); - addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 0), 150, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 1), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 2), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 3), 300, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 4), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 5), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 6), 50, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 7), 50, GTUtility.copy(mulch), + 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 8), 100, GTUtility.copy(mulch), + 6000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 9), 80, GTUtility.copy(mulch), 500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 10), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 11), 500, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 12), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 13), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 14), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 15), 400, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 16), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 17), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 18), 400, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 19), 150, GTUtility.copy(mulch), + 4000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 20), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 21), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 22), 300, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 23), 200, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 24), 150, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 25), 180, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 26), 100, GTUtility.copy(mulch), + 400); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 27), 50, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 28), 100, GTUtility.copy(mulch), + 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 29), 100, GTUtility.copy(mulch), + 3000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 30), 100, GTUtility.copy(mulch), + 4000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 31), 20, GTUtility.copy(mulch), 200); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 32), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 33), 50, GTUtility.copy(mulch), 300); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 34), 100, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 35), 50, GTUtility.copy(mulch), 300); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 36), 50, GTUtility.copy(mulch), 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 37), 20, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 38), 300, GTUtility.copy(mulch), + 1500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 39), 25, GTUtility.copy(mulch), 200); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 46), 50, GTUtility.copy(mulch), + 500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 50), 300, GTUtility.copy(mulch), + 2500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 51), 150, GTUtility.copy(mulch), + 1500); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 52), 300, GTUtility.copy(mulch), + 1500); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 53), 50, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 54), 50, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 55), 100, GTUtility.copy(mulch), + 1000); + addSeedOilRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 56), 100, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 57), 400, GTUtility.copy(mulch), + 2000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 58), 300, GTUtility.copy(mulch), + 1000); + addFruitJuiceRecipe(IntegrationUtil.getModItem(GTValues.MODID_ET, "food", 59), 50, GTUtility.copy(mulch), + 1000); } } @@ -149,7 +214,8 @@ private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFl addExtractorRecipe(inputStack, outputFluid, ItemStack.EMPTY, 0); } - private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid, ItemStack extraOutput, int chance) { + private static void addExtractorRecipe(ItemStack inputStack, FluidStack outputFluid, ItemStack extraOutput, + int chance) { RecipeBuilder builder = RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() .inputs(inputStack) .fluidOutputs(outputFluid); diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java index b9fffb8c773..fd78b9ad8ee 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryFrameRecipes.java @@ -1,18 +1,20 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.apiculture.ModuleApiculture; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.integration.forestry.ForestryModule; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + import static gregtech.api.unification.material.Materials.*; import static gregtech.api.unification.ore.OrePrefix.*; @@ -76,7 +78,8 @@ public static void init() { ModuleApiculture.getItems().frameImpregnated.getItemStack()); } - private static void registerRecipe(UnificationEntry cornerItem, UnificationEntry edgeItem, UnificationEntry centerItem, + private static void registerRecipe(UnificationEntry cornerItem, UnificationEntry edgeItem, + UnificationEntry centerItem, FluidStack fluid, ItemStack output, ItemStack frame) { RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .inputs(GTUtility.copy(4, OreDictUnifier.get(cornerItem))) diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java index ca7dcfa44e2..5f4f214c294 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryMiscRecipes.java @@ -1,12 +1,5 @@ package gregtech.integration.forestry.recipes; -import forestry.api.recipes.RecipeManagers; -import forestry.apiculture.ModuleApiculture; -import forestry.apiculture.items.EnumPropolis; -import forestry.core.config.Config; -import forestry.core.fluids.Fluids; -import forestry.factory.MachineUIDs; -import forestry.factory.ModuleFactory; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMaps; @@ -18,15 +11,23 @@ import gregtech.integration.forestry.ForestryConfig; import gregtech.integration.forestry.ForestryUtil; import gregtech.integration.forestry.bees.GTDropType; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; +import forestry.api.recipes.RecipeManagers; +import forestry.apiculture.ModuleApiculture; +import forestry.apiculture.items.EnumPropolis; +import forestry.core.config.Config; +import forestry.core.fluids.Fluids; +import forestry.factory.MachineUIDs; +import forestry.factory.ModuleFactory; + public class ForestryMiscRecipes { public static void init() { - if (ForestryConfig.enableGTBees) { // Oil Drop ItemStack dropStack = ForestryUtil.getDropStack(GTDropType.OIL); @@ -37,7 +38,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.OilHeavy.getFluid(100), ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.OilHeavy.getFluid(100), + ModuleApiculture.getItems().propolis.get(EnumPropolis.NORMAL, 1), 30); } // Biomass Drop @@ -53,7 +55,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Biomass.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Biomass.getFluid(100), propolisStack, + 30); } // Ethanol Drop @@ -65,7 +68,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Ethanol.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Ethanol.getFluid(100), propolisStack, + 30); } // Mutagen Drop @@ -77,7 +81,8 @@ public static void init() { .duration(32).EUt(8).buildAndRegister(); if (ModuleFactory.machineEnabled(MachineUIDs.SQUEEZER)) { - RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Mutagen.getFluid(100), propolisStack, 30); + RecipeManagers.squeezerManager.addRecipe(40, dropStack, Materials.Mutagen.getFluid(100), propolisStack, + 30); } } diff --git a/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java index 17977a86d2f..11213c4310c 100644 --- a/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java +++ b/src/main/java/gregtech/integration/forestry/recipes/ForestryToolRecipes.java @@ -8,6 +8,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.integration.forestry.ForestryModule; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java index b1be87d366e..221fadaa6f6 100644 --- a/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java +++ b/src/main/java/gregtech/integration/forestry/tools/ScoopBehavior.java @@ -1,11 +1,9 @@ package gregtech.integration.forestry.tools; -import forestry.api.lepidopterology.EnumFlutterType; -import forestry.api.lepidopterology.IAlleleButterflySpecies; -import forestry.api.lepidopterology.IEntityButterfly; import gregtech.api.GTValues; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.items.toolitem.behavior.IToolBehavior; + import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; @@ -16,6 +14,10 @@ import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.common.Loader; + +import forestry.api.lepidopterology.EnumFlutterType; +import forestry.api.lepidopterology.IAlleleButterflySpecies; +import forestry.api.lepidopterology.IEntityButterfly; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,16 +30,19 @@ public class ScoopBehavior implements IToolBehavior { private ScoopBehavior() {/**/} @Override - public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, @NotNull EntityLivingBase attacker) { + public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { if (!Loader.isModLoaded(GTValues.MODID_FR)) return; if (!(target instanceof IEntityButterfly butterfly)) return; if (!(attacker instanceof EntityPlayer player)) return; if (attacker.world == null || attacker.world.isRemote) return; IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary(); - species.getRoot().getBreedingTracker(target.world, player.getGameProfile()).registerCatch(butterfly.getButterfly()); + species.getRoot().getBreedingTracker(target.world, player.getGameProfile()) + .registerCatch(butterfly.getButterfly()); - ItemStack memberStack = species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY); + ItemStack memberStack = species.getRoot().getMemberStack(butterfly.getButterfly().copy(), + EnumFlutterType.BUTTERFLY); EntityItem entityItem = new EntityItem(player.world, target.posX, target.posY, target.posZ, memberStack); target.setDead(); NBTTagCompound behaviorTag = ToolHelper.getBehaviorsTag(stack); @@ -49,7 +54,8 @@ public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.scoop")); } } diff --git a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java index bf6107ba5a9..9c686f88946 100644 --- a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java +++ b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java @@ -1,13 +1,15 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; -import com.cleanroommc.groovyscript.helper.ingredient.NbtHelper; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.item.ItemStack; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.NbtHelper; + public class GrSRecipeHelper { public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) { @@ -48,7 +50,6 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) builder.append("null"); } - builder.append(")"); return builder.toString(); } diff --git a/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java b/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java index 0fe10e6c3dd..a7b7f812b42 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java +++ b/src/main/java/gregtech/integration/groovy/GroovyHandCommand.java @@ -1,13 +1,12 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.command.TextCopyable; -import com.cleanroommc.groovyscript.event.GsHandEvent; import gregtech.api.items.toolitem.IGTTool; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; import gregtech.api.util.ClipboardUtil; import gregtech.integration.RecipeCompatUtil; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.text.*; @@ -15,6 +14,9 @@ import net.minecraft.util.text.event.HoverEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import com.cleanroommc.groovyscript.command.TextCopyable; +import com.cleanroommc.groovyscript.event.GsHandEvent; + public class GroovyHandCommand { @SubscribeEvent @@ -25,26 +27,33 @@ public static void onHandCommand(GsHandEvent event) { if (id != null) { String copyText = "metaitem('" + id + "')"; ClipboardUtil.copyToClipboard((EntityPlayerMP) event.player, copyText); - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.meta_item").build().appendSibling(new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages + .add(TextCopyable.translation(copyText, "gregtech.command.hand.meta_item").build().appendSibling( + new TextComponentString(" " + id).setStyle(new Style().setColor(TextFormatting.GREEN)))); } // tool info if (stackInHand.getItem() instanceof IGTTool) { IGTTool tool = (IGTTool) stackInHand.getItem(); - event.messages.add(new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); + event.messages.add( + new TextComponentTranslation("gregtech.command.hand.tool_stats", tool.getToolClasses(stackInHand))); } // material info MaterialStack material = OreDictUnifier.getMaterial(stackInHand); if (material != null) { String copyText = "material('" + material.material + "')"; - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.material").build().appendSibling(new TextComponentString(" " + material.material).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.material").build() + .appendSibling(new TextComponentString(" " + material.material) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } // ore prefix info OrePrefix orePrefix = OreDictUnifier.getPrefix(stackInHand); if (orePrefix != null) { String copyText = "oreprefix('" + orePrefix.name + "')"; - event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.ore_prefix", id).build().appendSibling(new TextComponentString(" " + orePrefix.name).setStyle(new Style().setColor(TextFormatting.GREEN)))); + event.messages.add(TextCopyable.translation(copyText, "gregtech.command.hand.ore_prefix", id).build() + .appendSibling(new TextComponentString(" " + orePrefix.name) + .setStyle(new Style().setColor(TextFormatting.GREEN)))); } } @@ -54,10 +63,13 @@ public static Style getCopyStyle(String copyMessage, boolean alreadyCopied) { style.setClickEvent(click); ITextComponent text = alreadyCopied ? - new TextComponentString("").appendSibling(new TextComponentString(copyMessage + " ").setStyle(new Style().setColor(TextFormatting.GOLD))) + new TextComponentString("") + .appendSibling(new TextComponentString(copyMessage + " ") + .setStyle(new Style().setColor(TextFormatting.GOLD))) .appendSibling(new TextComponentTranslation("gregtech.command.copy.copied_and_click")) : new TextComponentTranslation("gregtech.command.copy.click_to_copy") - .appendSibling(new TextComponentString(" " + copyMessage).setStyle(new Style().setColor(TextFormatting.GOLD))); + .appendSibling(new TextComponentString(" " + copyMessage) + .setStyle(new Style().setColor(TextFormatting.GOLD))); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, text)); return style; diff --git a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java index ab7063bc39f..515a8261f6e 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java +++ b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.info.MaterialFlag; import gregtech.api.unification.material.info.MaterialIconSet; import gregtech.api.unification.material.properties.BlastProperty; + import net.minecraft.util.ResourceLocation; import java.util.ArrayList; @@ -20,7 +21,8 @@ public class GroovyMaterialBuilderExpansion { public static Material.Builder fluid(Material.Builder builder, String raw, FluidBuilder fluidBuilder) { FluidStorageKey key = FluidStorageKey.getByName(new ResourceLocation(raw)); if (key == null) key = FluidStorageKey.getByName(gregtechId(raw)); - if (GroovyScriptModule.validateNonNull(key, () -> "Can't find fluid type for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(key, + () -> "Can't find fluid type for " + raw + " in material builder")) { return builder.fluid(key, fluidBuilder); } return builder; @@ -28,7 +30,8 @@ public static Material.Builder fluid(Material.Builder builder, String raw, Fluid public static Material.Builder element(Material.Builder builder, String raw) { Element element = Elements.get(raw); - if (GroovyScriptModule.validateNonNull(element, () -> "Can't find element for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(element, + () -> "Can't find element for " + raw + " in material builder")) { return builder.element(element); } return builder; @@ -38,7 +41,8 @@ public static Material.Builder flags(Material.Builder builder, String... rawFlag List flags = new ArrayList<>(); for (String rawFlag : rawFlags) { MaterialFlag flag = MaterialFlag.getByName(rawFlag); - if (GroovyScriptModule.validateNonNull(flag, () -> "Can't find material flag for '" + rawFlag + "' in material builder")) { + if (GroovyScriptModule.validateNonNull(flag, + () -> "Can't find material flag for '" + rawFlag + "' in material builder")) { flags.add(flag); } } @@ -47,7 +51,8 @@ public static Material.Builder flags(Material.Builder builder, String... rawFlag public static Material.Builder iconSet(Material.Builder builder, String raw) { MaterialIconSet iconSet = MaterialIconSet.getByName(raw); - if (GroovyScriptModule.validateNonNull(iconSet, () -> "Can't find material icon set for " + raw + " in material builder")) { + if (GroovyScriptModule.validateNonNull(iconSet, + () -> "Can't find material icon set for " + raw + " in material builder")) { return builder.iconSet(iconSet); } return builder; @@ -61,11 +66,13 @@ public static Material.Builder blastTemp(Material.Builder builder, int temp, Str return blastTemp(builder, temp, raw, eutOverride, -1); } - public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, int durationOverride) { + public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, + int durationOverride) { return blastTemp(builder, temp, raw, eutOverride, durationOverride, -1, -1); } - public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { + public static Material.Builder blastTemp(Material.Builder builder, int temp, String raw, int eutOverride, + int durationOverride, int vacuumEUtOverride, int vacuumDurationOverride) { BlastProperty.GasTier gasTier = null; String name = raw.toUpperCase(); for (BlastProperty.GasTier gasTier1 : BlastProperty.GasTier.VALUES) { @@ -75,7 +82,8 @@ public static Material.Builder blastTemp(Material.Builder builder, int temp, Str } } final BlastProperty.GasTier finalGasTier = gasTier; - if (GroovyScriptModule.validateNonNull(gasTier, () -> "Can't find gas tier for " + name + " in material builder. Valid values are 'low', 'mid', 'high', 'higher', 'highest'!")) { + if (GroovyScriptModule.validateNonNull(gasTier, () -> "Can't find gas tier for " + name + + " in material builder. Valid values are 'low', 'mid', 'high', 'higher', 'highest'!")) { return builder.blast(b -> b .temp(temp, finalGasTier) .blastStats(eutOverride, durationOverride) diff --git a/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java b/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java index c91e9fff27d..90a0dc3753b 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java +++ b/src/main/java/gregtech/integration/groovy/GroovyRecipeBuilderExpansion.java @@ -1,11 +1,13 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.api.GroovyLog; import gregtech.api.recipes.RecipeBuilder; +import com.cleanroommc.groovyscript.api.GroovyLog; + public class GroovyRecipeBuilderExpansion { - public static > RecipeBuilder property(RecipeBuilder builder, String key, Object value) { + public static > RecipeBuilder property(RecipeBuilder builder, String key, + Object value) { if (!builder.applyProperty(key, value)) { GroovyLog.get().error("Failed to add property '{}' with '{}' to recipe", key, value); } diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index 7259ba0d9b4..9e064eb43b2 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -1,13 +1,5 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.GroovyScript; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.brackets.BracketHandlerManager; -import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.items.metaitem.MetaItem; @@ -28,7 +20,7 @@ import gregtech.integration.crafttweaker.material.MaterialExpansion; import gregtech.integration.crafttweaker.material.MaterialPropertyExpansion; import gregtech.modules.GregTechModules; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; @@ -37,20 +29,30 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.brackets.BracketHandlerManager; +import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Supplier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + @GregTechModule( - moduleID = GregTechModules.MODULE_GRS, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_GROOVYSCRIPT, - name = "GregTech GroovyScript Integration", - description = "GroovyScript Integration Module" -) + moduleID = GregTechModules.MODULE_GRS, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_GROOVYSCRIPT, + name = "GregTech GroovyScript Integration", + description = "GroovyScript Integration Module") public class GroovyScriptModule extends IntegrationSubmodule { private static ModSupport.Container modSupportContainer; @@ -73,8 +75,8 @@ public void construction(FMLConstructionEvent event) { } public static boolean isCurrentlyRunning() { - return GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) - && GroovyScript.getSandbox().isRunning(); + return GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) && + GroovyScript.getSandbox().isRunning(); } public static Container getInstance() { @@ -116,7 +118,7 @@ public static ItemStack getMetaTileEntityItem(String[] split) { } public static String[] splitObjectName(String toSplit) { - String[] resultSplit = {GTValues.MODID, toSplit}; + String[] resultSplit = { GTValues.MODID, toSplit }; int i = toSplit.indexOf(':'); if (i >= 0) { resultSplit[1] = toSplit.substring(i + 1); @@ -174,7 +176,8 @@ public static void loadMetaItemBracketHandler() { } for (MetaItem item : MetaItem.getMetaItems()) { - Map map = metaItems.computeIfAbsent(Objects.requireNonNull(item.getRegistryName()).getNamespace(), + Map map = metaItems.computeIfAbsent( + Objects.requireNonNull(item.getRegistryName()).getNamespace(), (k) -> new Object2ObjectOpenHashMap<>()); for (MetaItem.MetaValueItem entry : item.getAllItems()) { if (!entry.unlocalizedName.equals("meta_item")) { @@ -189,8 +192,7 @@ public static void loadMetaItemBracketHandler() { */ public static class Container extends ModPropertyContainer { - private Container() { - } + private Container() {} @Override protected void addRegistry(VirtualizedRegistry registry) { @@ -200,9 +202,11 @@ protected void addRegistry(VirtualizedRegistry registry) { @Override public void initialize() { BracketHandlerManager.registerBracketHandler(GTValues.MODID, "recipemap", RecipeMap::getByName); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "material", GregTechAPI.materialManager::getMaterial); + BracketHandlerManager.registerBracketHandler(GTValues.MODID, "material", + GregTechAPI.materialManager::getMaterial); BracketHandlerManager.registerBracketHandler(GTValues.MODID, "oreprefix", OrePrefix::getPrefix); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "metaitem", GroovyScriptModule::getMetaItem, ItemStack.EMPTY); + BracketHandlerManager.registerBracketHandler(GTValues.MODID, "metaitem", GroovyScriptModule::getMetaItem, + ItemStack.EMPTY); ExpansionHelper.mixinClass(Material.class, MaterialExpansion.class); ExpansionHelper.mixinClass(Material.class, MaterialPropertyExpansion.class); diff --git a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java index 06696ed85c1..a1a6d1f6151 100644 --- a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java +++ b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java @@ -1,15 +1,17 @@ package gregtech.integration.groovy; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import com.google.common.base.CaseFormat; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.google.common.base.CaseFormat; + import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAClient.java b/src/main/java/gregtech/integration/hwyla/HWYLAClient.java index ad916398f9f..b1c8ae282f6 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAClient.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAClient.java @@ -1,11 +1,13 @@ package gregtech.integration.hwyla; import gregtech.integration.hwyla.renderer.RendererOffsetString; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.WailaPlugin; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) @WailaPlugin diff --git a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java index 9287220af66..bce36365fc0 100644 --- a/src/main/java/gregtech/integration/hwyla/HWYLAModule.java +++ b/src/main/java/gregtech/integration/hwyla/HWYLAModule.java @@ -5,20 +5,21 @@ import gregtech.integration.IntegrationSubmodule; import gregtech.integration.hwyla.provider.*; import gregtech.modules.GregTechModules; + +import net.minecraft.item.ItemStack; + import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.SpecialChars; import mcp.mobius.waila.api.WailaPlugin; -import net.minecraft.item.ItemStack; @WailaPlugin @GregTechModule( - moduleID = GregTechModules.MODULE_HWYLA, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_HWYLA, - name = "GregTech HWYLA Integration", - description = "HWYLA (WAILA) Integration Module" -) + moduleID = GregTechModules.MODULE_HWYLA, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_HWYLA, + name = "GregTech HWYLA Integration", + description = "HWYLA (WAILA) Integration Module") public class HWYLAModule extends IntegrationSubmodule implements IWailaPlugin { @Override diff --git a/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java index 9a15bef0fdb..b8d6512742b 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/BlockOreDataProvider.java @@ -4,9 +4,11 @@ import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; import gregtech.integration.hwyla.HWYLAModule; -import mcp.mobius.waila.api.*; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; + +import mcp.mobius.waila.api.*; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -22,7 +24,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.block_ore")) { return tooltip; } @@ -31,7 +34,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai StoneType type = accessor.getBlockState().getValue(ore.STONE_TYPE); if (accessor.getPlayer().isSneaking() && !type.shouldBeDroppedAsItem) { tooltip.add(I18n.format("gregtech.top.block_drops") + ":"); - ItemStack itemDropped = ore.getItem(accessor.getWorld(), accessor.getPosition(), accessor.getBlockState()); + ItemStack itemDropped = ore.getItem(accessor.getWorld(), accessor.getPosition(), + accessor.getBlockState()); tooltip.add(HWYLAModule.wailaStackWithName(itemDropped)); } } diff --git a/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java index aeecd67a5f3..33e9d605b54 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/CapabilityDataProvider.java @@ -1,13 +1,14 @@ package gregtech.integration.hwyla.provider; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; public abstract class CapabilityDataProvider implements IWailaDataProvider { @@ -24,7 +25,8 @@ protected boolean allowDisplaying(@NotNull T capability) { protected abstract NBTTagCompound getNBTData(T capability, NBTTagCompound tag); @Override - public @NotNull NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public @NotNull NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te != null) { T capability = te.getCapability(getCapability(), null); if (capability != null && allowDisplaying(capability)) { diff --git a/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java index 4e7138bdc91..20791ab3e34 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ControllableDataProvider.java @@ -3,15 +3,17 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -42,7 +44,8 @@ protected NBTTagCompound getNBTData(IControllable capability, NBTTagCompound tag @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.controllable") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java index f75d871a0c0..341334681c7 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ConverterDataProvider.java @@ -5,9 +5,7 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -15,6 +13,10 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -47,7 +49,8 @@ protected NBTTagCompound getNBTData(ConverterTrait capability, NBTTagCompound ta } @Override - public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.converter") || accessor.getTileEntity() == null) { return tooltip; } @@ -63,16 +66,20 @@ protected NBTTagCompound getNBTData(ConverterTrait capability, NBTTagCompound ta if (isFeToEu) { tooltip.add(I18n.format("gregtech.top.convert_fe")); if (accessor.getSide() == frontFacing) { - tooltip.add(I18n.format("gregtech.top.transform_output") + " " + voltageName + TextFormatting.RESET + " (" + amperage + "A)"); + tooltip.add(I18n.format("gregtech.top.transform_output") + " " + voltageName + + TextFormatting.RESET + " (" + amperage + "A)"); } else { - tooltip.add(I18n.format("gregtech.top.transform_input") + " " + FeCompat.toFe(voltage * amperage, FeCompat.ratio(true)) + " FE"); + tooltip.add(I18n.format("gregtech.top.transform_input") + " " + + FeCompat.toFe(voltage * amperage, FeCompat.ratio(true)) + " FE"); } } else { tooltip.add(I18n.format("gregtech.top.convert_eu")); if (accessor.getSide() == frontFacing) { - tooltip.add(I18n.format("gregtech.top.transform_output") + " " + FeCompat.toFe(voltage * amperage, FeCompat.ratio(false)) + " FE"); + tooltip.add(I18n.format("gregtech.top.transform_output") + " " + + FeCompat.toFe(voltage * amperage, FeCompat.ratio(false)) + " FE"); } else { - tooltip.add(I18n.format("gregtech.top.transform_input") + " " + voltageName + TextFormatting.RESET + " (" + amperage + "A)"); + tooltip.add(I18n.format("gregtech.top.transform_input") + " " + voltageName + TextFormatting.RESET + + " (" + amperage + "A)"); } } } diff --git a/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java index 1e8ea29b56d..1000a11ff55 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/DiodeDataProvider.java @@ -4,14 +4,16 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityDiode; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -43,10 +45,10 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound } @Override - public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.diode") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof MetaTileEntityDiode)) { + public @NotNull List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.diode") || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof MetaTileEntityDiode)) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java index 04e80eb81ab..32eece51eeb 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/ElectricContainerDataProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -47,7 +49,8 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.energy") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java index 66cd6d6a2ca..a4473efa17a 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/LampDataProvider.java @@ -2,13 +2,15 @@ import gregtech.api.GTValues; import gregtech.common.blocks.BlockLamp; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; + import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaRegistrar; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -24,7 +26,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.block_lamp")) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java index e37d626be54..c776176fc2d 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MaintenanceDataProvider.java @@ -8,14 +8,16 @@ import gregtech.api.unification.material.Materials; import gregtech.common.items.ToolItems; import gregtech.integration.hwyla.HWYLAModule; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -54,7 +56,8 @@ protected NBTTagCompound getNBTData(IMaintenance capability, NBTTagCompound tag) @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.maintenance") || accessor.getTileEntity() == null) { return tooltip; } @@ -62,7 +65,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai if (accessor.getNBTData().hasKey("gregtech.IMaintenance")) { NBTTagCompound tag = accessor.getNBTData().getCompoundTag("gregtech.IMaintenance"); - IMultiblockController controller = accessor.getTileEntity().getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null); + IMultiblockController controller = accessor.getTileEntity() + .getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null); if (controller == null || !controller.isStructureFormed()) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java index 2bd098950f3..bc2e55e3a3f 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MultiRecipeMapDataProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -38,7 +40,8 @@ protected NBTTagCompound getNBTData(IMultipleRecipeMaps capability, NBTTagCompou @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.multi_recipemap") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java index 46c2b00e81a..8714631cf1b 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/MultiblockDataProvider.java @@ -3,15 +3,17 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IMultiblockController; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java index 72bdcaed793..4af2e2f8915 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/PrimitivePumpDataProvider.java @@ -3,10 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IPrimitivePump; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -15,6 +12,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -31,7 +33,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te instanceof IGregTechTileEntity gtte) { if (gtte.getMetaTileEntity() instanceof IPrimitivePump pump) { NBTTagCompound subTag = new NBTTagCompound(); @@ -44,17 +47,19 @@ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCom @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.primitive_pump") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof IPrimitivePump)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.primitive_pump") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof IPrimitivePump)) { return tooltip; } if (accessor.getNBTData().hasKey("gregtech.IPrimitivePump")) { NBTTagCompound tag = accessor.getNBTData().getCompoundTag("gregtech.IPrimitivePump"); int production = tag.getInteger("Production"); - tooltip.add(I18n.format("gregtech.top.primitive_pump_production") + " " + TextFormatting.AQUA + production + TextFormatting.RESET + " L/s"); + tooltip.add(I18n.format("gregtech.top.primitive_pump_production") + " " + TextFormatting.AQUA + production + + TextFormatting.RESET + " L/s"); } return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java index 70ab53b5c9a..f1a2a6b5a4c 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java @@ -10,15 +10,17 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -52,7 +54,8 @@ protected NBTTagCompound getNBTData(AbstractRecipeLogic capability, NBTTagCompou @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.recipe_logic") || accessor.getTileEntity() == null) { return tooltip; } @@ -67,8 +70,10 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai if (accessor.getTileEntity() instanceof IGregTechTileEntity gtte) { MetaTileEntity mte = gtte.getMetaTileEntity(); - if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName()); + if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || + mte instanceof RecipeMapSteamMultiblockController) { + endText = ": " + absEUt + TextFormatting.RESET + " L/t " + + I18n.format(Materials.Steam.getUnlocalizedName()); } AbstractRecipeLogic arl = mte.getRecipeLogic(); if (arl != null) { @@ -76,7 +81,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai } } if (endText == null) { - endText = ": " + absEUt + TextFormatting.RESET + " EU/t (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.RESET + ")"; + endText = ": " + absEUt + TextFormatting.RESET + " EU/t (" + + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.RESET + ")"; } if (EUt == 0) return tooltip; diff --git a/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java index a4443d710e8..85a3f738ca0 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/SteamBoilerDataProvider.java @@ -4,10 +4,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.common.metatileentities.steam.boiler.SteamBoiler; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -15,6 +12,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -31,7 +33,8 @@ public void register(@NotNull IWailaRegistrar registrar) { @NotNull @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, + BlockPos pos) { if (te instanceof IGregTechTileEntity gtte) { if (gtte.getMetaTileEntity() instanceof SteamBoiler boiler) { NBTTagCompound subTag = new NBTTagCompound(); @@ -46,10 +49,11 @@ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCom @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.steam_boiler") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof SteamBoiler)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.steam_boiler") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof SteamBoiler)) { return tooltip; } @@ -61,7 +65,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai // Creating steam if (steamRate > 0 && hasWater) { - tooltip.add(I18n.format("gregtech.top.energy_production") + ": " + (steamRate / 10) + " L/t " + I18n.format(Materials.Steam.getUnlocalizedName())); + tooltip.add(I18n.format("gregtech.top.energy_production") + ": " + (steamRate / 10) + " L/t " + + I18n.format(Materials.Steam.getUnlocalizedName())); } // Initial heat-up diff --git a/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java index acf86dc6ef4..49da30bf2da 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/TransformerDataProvider.java @@ -5,15 +5,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.electric.MetaTileEntityTransformer; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -59,10 +61,11 @@ protected NBTTagCompound getNBTData(IEnergyContainer capability, NBTTagCompound @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (!config.getConfig("gregtech.transformer") - || !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) - || !(gtte.getMetaTileEntity() instanceof MetaTileEntityTransformer)) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("gregtech.transformer") || + !(accessor.getTileEntity() instanceof IGregTechTileEntity gtte) || + !(gtte.getMetaTileEntity() instanceof MetaTileEntityTransformer)) { return tooltip; } if (accessor.getNBTData().hasKey("gregtech.MetaTileEntityTransformer")) { @@ -91,10 +94,8 @@ public List getWailaBody(ItemStack itemStack, List tooltip, IWai .append("A)"); // Step Up/Step Down line - tooltip.add((isTransformUp - ? I18n.format("gregtech.top.transform_up") - : I18n.format("gregtech.top.transform_down")) - + input + " -> " + output); + tooltip.add((isTransformUp ? I18n.format("gregtech.top.transform_up") : + I18n.format("gregtech.top.transform_down")) + input + " -> " + output); // Input/Output side line EnumFacing hitFace = accessor.getSide(); diff --git a/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java b/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java index 40b468cf6ff..febcc67b9f0 100644 --- a/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java +++ b/src/main/java/gregtech/integration/hwyla/provider/WorkableDataProvider.java @@ -4,14 +4,16 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.capability.impl.ComputationRecipeLogic; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaRegistrar; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -37,7 +39,8 @@ protected NBTTagCompound getNBTData(IWorkable capability, NBTTagCompound tag) { NBTTagCompound subTag = new NBTTagCompound(); subTag.setBoolean("Active", capability.isActive()); if (capability.isActive()) { - subTag.setBoolean("ShowAsComputation", capability instanceof ComputationRecipeLogic logic && !logic.shouldShowDuration()); + subTag.setBoolean("ShowAsComputation", + capability instanceof ComputationRecipeLogic logic && !logic.shouldShowDuration()); subTag.setInteger("Progress", capability.getProgress()); subTag.setInteger("MaxProgress", capability.getMaxProgress()); } @@ -47,7 +50,8 @@ protected NBTTagCompound getNBTData(IWorkable capability, NBTTagCompound tag) { @NotNull @Override - public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { if (!config.getConfig("gregtech.workable") || accessor.getTileEntity() == null) { return tooltip; } diff --git a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java index fed7f16fade..7be3a9f822c 100644 --- a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java +++ b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java @@ -6,9 +6,10 @@ import mcp.mobius.waila.overlay.DisplayUtil; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.awt.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** Adapted from Jade 1.12.2, a HWYLA addon mod. */ @ParametersAreNonnullByDefault public class RendererOffsetString implements IWailaTooltipRenderer { diff --git a/src/main/java/gregtech/integration/jei/JEIOptional.java b/src/main/java/gregtech/integration/jei/JEIOptional.java index 8065676e9d8..1ef357a65c4 100644 --- a/src/main/java/gregtech/integration/jei/JEIOptional.java +++ b/src/main/java/gregtech/integration/jei/JEIOptional.java @@ -3,18 +3,21 @@ import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.client.renderer.scene.WorldSceneRenderer; import gregtech.integration.jei.multiblock.MultiblockInfoRecipeWrapper; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Optional; + import mezz.jei.api.IRecipeRegistry; import mezz.jei.api.recipe.IFocus; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Optional; import java.util.List; public class JEIOptional { + @Optional.Method(modid = "jei") - public static WorldSceneRenderer getWorldSceneRenderer(MultiblockControllerBase controllerBase){ + public static WorldSceneRenderer getWorldSceneRenderer(MultiblockControllerBase controllerBase) { IRecipeRegistry rr = JustEnoughItemsModule.jeiRuntime.getRecipeRegistry(); IFocus focus = rr.createFocus(IFocus.Mode.INPUT, controllerBase.getStackForm()); return rr.getRecipeCategories(focus) diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index 1af01b4533a..545d2e56b41 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -36,6 +36,15 @@ import gregtech.integration.jei.utils.ModularUIGuiHandler; import gregtech.integration.jei.utils.MultiblockInfoRecipeFocusShower; import gregtech.modules.GregTechModules; + +import net.minecraft.client.resources.I18n; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; +import net.minecraftforge.fml.relauncher.Side; + import mezz.jei.Internal; import mezz.jei.api.*; import mezz.jei.api.ingredients.IIngredientRegistry; @@ -45,15 +54,7 @@ import mezz.jei.config.Constants; import mezz.jei.input.IShowsRecipeFocuses; import mezz.jei.input.InputHandler; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; -import net.minecraftforge.fml.relauncher.Side; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.Collection; import java.util.List; @@ -62,14 +63,15 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nonnull; + @JEIPlugin @GregTechModule( - moduleID = GregTechModules.MODULE_JEI, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_JEI, - name = "GregTech JEI Integration", - description = "JustEnoughItems Integration Module" -) + moduleID = GregTechModules.MODULE_JEI, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_JEI, + name = "GregTech JEI Integration", + description = "JustEnoughItems Integration Module") public class JustEnoughItemsModule extends IntegrationSubmodule implements IModPlugin { public static IIngredientRegistry ingredientRegistry; @@ -94,7 +96,8 @@ public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) { for (MetaItem metaItem : MetaItems.ITEMS) { subtypeRegistry.registerSubtypeInterpreter(metaItem, subtype); } - subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(MetaBlocks.MACHINE), new MachineSubtypeHandler()); + subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(MetaBlocks.MACHINE), + new MachineSubtypeHandler()); } @Override @@ -105,7 +108,8 @@ public void registerCategories(@Nonnull IRecipeCategoryRegistration registry) { for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { if (!recipeMap.isHidden) { for (GTRecipeCategory category : recipeMap.getRecipesByCategory().keySet()) { - registry.addRecipeCategories(new RecipeMapCategory(recipeMap, category, registry.getJeiHelpers().getGuiHelper())); + registry.addRecipeCategories( + new RecipeMapCategory(recipeMap, category, registry.getJeiHelpers().getGuiHelper())); } } } @@ -131,13 +135,16 @@ public void register(IModRegistry registry) { GTValues.MODID + ":material_tree", VanillaRecipeCategoryUid.INFORMATION, VanillaRecipeCategoryUid.FUEL); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(modularUIGuiHandler, Constants.UNIVERSAL_RECIPE_TRANSFER_UID); + registry.getRecipeTransferRegistry().addRecipeTransferHandler(modularUIGuiHandler, + Constants.UNIVERSAL_RECIPE_TRANSFER_UID); registry.addAdvancedGuiHandlers(modularUIGuiHandler); registry.addGhostIngredientHandler(modularUIGuiHandler.getGuiContainerClass(), modularUIGuiHandler); // register transfer handler for crafting recipes - ModularUIGuiHandler craftingStationGuiHandler = new ModularUIGuiHandler(jeiHelpers.recipeTransferHandlerHelper()); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(craftingStationGuiHandler, VanillaRecipeCategoryUid.CRAFTING); + ModularUIGuiHandler craftingStationGuiHandler = new ModularUIGuiHandler( + jeiHelpers.recipeTransferHandlerHelper()); + registry.getRecipeTransferRegistry().addRecipeTransferHandler(craftingStationGuiHandler, + VanillaRecipeCategoryUid.CRAFTING); for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { if (!recipeMap.isHidden) { @@ -160,9 +167,8 @@ public void register(IModRegistry registry) { } registry.addRecipes(recipeStream.map(r -> new GTRecipeWrapper(recipeMap, r)) - .collect(Collectors.toList()), - entry.getKey().getUniqueID() - ); + .collect(Collectors.toList()), + entry.getKey().getUniqueID()); } } } @@ -171,7 +177,8 @@ public void register(IModRegistry registry) { MetaTileEntity metaTileEntity = GregTechAPI.MTE_REGISTRY.getObject(metaTileEntityId); assert metaTileEntity != null; if (metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null) != null) { - IControllable workableCapability = metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); + IControllable workableCapability = metaTileEntity + .getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null); if (workableCapability instanceof AbstractRecipeLogic logic) { if (metaTileEntity instanceof IMultipleRecipeMaps) { @@ -199,7 +206,7 @@ public void register(IModRegistry registry) { } String oreByProductId = GTValues.MODID + ":" + "ore_by_product"; registry.addRecipes(oreByproductList, oreByProductId); - MetaTileEntity[][] machineLists = new MetaTileEntity[][]{ + MetaTileEntity[][] machineLists = new MetaTileEntity[][] { MetaTileEntities.MACERATOR, MetaTileEntities.ORE_WASHER, MetaTileEntities.CENTRIFUGE, @@ -213,7 +220,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(machine[GTValues.LV].getStackForm(), oreByProductId); } - //Material Tree + // Material Tree List materialTreeList = new CopyOnWriteArrayList<>(); for (Material material : GregTechAPI.materialManager.getRegisteredMaterials()) { if (material.hasProperty(PropertyKey.DUST)) { @@ -222,7 +229,7 @@ public void register(IModRegistry registry) { } registry.addRecipes(materialTreeList, GTValues.MODID + ":" + "material_tree"); - //Ore Veins + // Ore Veins List oreVeins = WorldGenRegistry.getOreDeposits(); List oreInfoList = new CopyOnWriteArrayList<>(); for (OreDepositDefinition vein : oreVeins) { @@ -234,7 +241,7 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(MetaItems.PROSPECTOR_LV.getStackForm(), oreSpawnID); registry.addRecipeCatalyst(MetaItems.PROSPECTOR_HV.getStackForm(), oreSpawnID); registry.addRecipeCatalyst(MetaItems.PROSPECTOR_LUV.getStackForm(), oreSpawnID); - //Ore Veins End + // Ore Veins End // Fluid Veins List fluidVeins = WorldGenRegistry.getBedrockVeinDeposits(); @@ -263,14 +270,15 @@ public void register(IModRegistry registry) { "gregtech.machine.canner.jei_description"); } - //Multiblock info page registration + // Multiblock info page registration MultiblockInfoCategory.REGISTER.forEach(mte -> { String[] desc = mte.getDescription(); if (desc.length > 0) { registry.addIngredientInfo(mte.getStackForm(), VanillaTypes.ITEM, mte.getDescription()); } }); - registry.addIngredientInfo(new ItemStack(MetaBlocks.BRITTLE_CHARCOAL), VanillaTypes.ITEM, I18n.format("tile.brittle_charcoal.tooltip.1", I18n.format("tile.brittle_charcoal.tooltip.2"))); + registry.addIngredientInfo(new ItemStack(MetaBlocks.BRITTLE_CHARCOAL), VanillaTypes.ITEM, + I18n.format("tile.brittle_charcoal.tooltip.1", I18n.format("tile.brittle_charcoal.tooltip.2"))); } private void setupInputHandler() { @@ -278,7 +286,8 @@ private void setupInputHandler() { Field inputHandlerField = Internal.class.getDeclaredField("inputHandler"); inputHandlerField.setAccessible(true); InputHandler inputHandler = (InputHandler) inputHandlerField.get(null); - List showsRecipeFocuses = ObfuscationReflectionHelper.getPrivateValue(InputHandler.class, inputHandler, "showsRecipeFocuses"); + List showsRecipeFocuses = ObfuscationReflectionHelper + .getPrivateValue(InputHandler.class, inputHandler, "showsRecipeFocuses"); showsRecipeFocuses.add(new MultiblockInfoRecipeFocusShower()); @@ -287,7 +296,8 @@ private void setupInputHandler() { } } - private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recipeMap, MetaTileEntity metaTileEntity) { + private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recipeMap, + MetaTileEntity metaTileEntity) { for (GTRecipeCategory category : recipeMap.getRecipesByCategory().keySet()) { RecipeMapCategory jeiCategory = RecipeMapCategory.getCategoryFor(category); if (jeiCategory != null) { @@ -300,7 +310,8 @@ private void registerRecipeMapCatalyst(IModRegistry registry, RecipeMap recip return; } if (recipeMap.getSmallRecipeMap() != null) { - registry.addRecipeCatalyst(metaTileEntity.getStackForm(), GTValues.MODID + ":" + recipeMap.getSmallRecipeMap().unlocalizedName); + registry.addRecipeCatalyst(metaTileEntity.getStackForm(), + GTValues.MODID + ":" + recipeMap.getSmallRecipeMap().unlocalizedName); return; } diff --git a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java index 427562551d4..0ecd821d697 100644 --- a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java @@ -1,20 +1,24 @@ package gregtech.integration.jei.basic; import gregtech.api.GTValues; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapperFactory; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; -public abstract class BasicRecipeCategory implements IRecipeCategory, IRecipeWrapperFactory { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class BasicRecipeCategory + implements IRecipeCategory, IRecipeWrapperFactory { public final String uniqueName; public final String localizedName; @@ -52,8 +56,7 @@ public IDrawable getBackground() { } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { - } + public void drawExtras(@Nonnull Minecraft minecraft) {} @Nonnull @Override diff --git a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java index 1bd0ad0fbb0..6f53f16de6c 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java @@ -4,19 +4,22 @@ import gregtech.api.util.GTStringUtils; import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + public class GTFluidVeinCategory extends BasicRecipeCategory { private static final int SLOT_CENTER = 79; @@ -44,11 +47,13 @@ public GTFluidVeinCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, @Nonnull IIngredients ingredients) { + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, + @Nonnull IIngredients ingredients) { IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); fluidStackGroup.init(0, true, SLOT_CENTER, 19, 16, 16, 1, false, null); @@ -97,12 +102,14 @@ public void drawExtras(@Nonnull Minecraft minecraft) { // Vein Depletion Chance information String veinDepletionChance = I18n.format("gregtech.jei.fluid.depletion_chance", depletionChance); depletionChanceLength = minecraft.fontRenderer.getStringWidth(veinDepletionChance); - minecraft.fontRenderer.drawString(veinDepletionChance, TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, 0x111111); + minecraft.fontRenderer.drawString(veinDepletionChance, TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, + 0x111111); // Vein Depletion Amount information String veinDepletionAmount = I18n.format("gregtech.jei.fluid.depletion_amount", depletionAmount); depletionAmountLength = minecraft.fontRenderer.getStringWidth(veinDepletionAmount); - minecraft.fontRenderer.drawString(veinDepletionAmount, TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, 0x111111); + minecraft.fontRenderer.drawString(veinDepletionAmount, TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, + 0x111111); // Vein Depleted Yield information String veinDepletedYield = I18n.format("gregtech.jei.fluid.depleted_rate", depletedYield); @@ -127,17 +134,26 @@ public void drawExtras(@Nonnull Minecraft minecraft) { public List getTooltipStrings(int mouseX, int mouseY) { if (isPointWithinRange(TEXT_START_X, START_POS_Y, weightLength, FONT_HEIGHT, mouseX, mouseY)) { return Collections.singletonList(I18n.format("gregtech.jei.fluid.weight_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + FONT_HEIGHT + 1, minYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.min_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 2 * FONT_HEIGHT + 1, maxYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.max_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, depletionChanceLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_chance_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, depletionAmountLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_amount_hover")); - } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + 5 * FONT_HEIGHT + 1, depletedYieldLength, FONT_HEIGHT + 1, mouseX, mouseY)) { - return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_yield_hover")); - } + } else if (isPointWithinRange(TEXT_START_X, START_POS_Y + FONT_HEIGHT + 1, minYieldLength, FONT_HEIGHT + 1, + mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.min_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 2 * FONT_HEIGHT + 1, maxYieldLength, FONT_HEIGHT + 1, + mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.max_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 3 * FONT_HEIGHT + 1, depletionChanceLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_chance_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 4 * FONT_HEIGHT + 1, depletionAmountLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_amount_hover")); + } else + if (isPointWithinRange(TEXT_START_X, START_POS_Y + 5 * FONT_HEIGHT + 1, depletedYieldLength, + FONT_HEIGHT + 1, mouseX, mouseY)) { + return Collections.singletonList(I18n.format("gregtech.jei.fluid.dep_yield_hover")); + } return Collections.emptyList(); } @@ -153,7 +169,8 @@ public List getTooltipStrings(int mouseX, int mouseY) { * @param pointY The Y value of the point to check * @return True if the provided (X,Y) point is within the described box, else false */ - private static boolean isPointWithinRange(int initialX, int initialY, int width, int height, int pointX, int pointY) { + private static boolean isPointWithinRange(int initialX, int initialY, int width, int height, int pointX, + int pointY) { return initialX <= pointX && pointX <= initialX + width && initialY <= pointY && pointY <= initialY + height; } } diff --git a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java index 695e72fc014..1e130453824 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java +++ b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinInfo.java @@ -3,14 +3,16 @@ import gregtech.api.util.FileUtility; import gregtech.api.worldgen.config.BedrockFluidDepositDefinition; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.item.ItemStack; import net.minecraft.world.biome.Biome; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -33,10 +35,9 @@ public class GTFluidVeinInfo implements IRecipeWrapper { private final List> bucketList = new ArrayList<>(); public GTFluidVeinInfo(BedrockFluidDepositDefinition definition) { - this.definition = definition; - //Get the Name and trim unneeded information + // Get the Name and trim unneeded information this.name = definition.getAssignedName(); if (this.name == null) { this.name = FileUtility.trimFileName(definition.getDepositName()); @@ -61,7 +62,6 @@ public GTFluidVeinInfo(BedrockFluidDepositDefinition definition) { fluidList.add(fluidList2); this.biomeFunction = definition.getBiomeWeightModifier(); - } @Override @@ -119,5 +119,4 @@ public int getDepletedYield() { public FluidStack getFluid() { return fluid; } - } diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java index 29e91bca4a5..6e6b14b8d1c 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java @@ -6,14 +6,16 @@ import gregtech.api.worldgen.config.WorldGenRegistry; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; import javax.annotation.Nonnull; @@ -38,7 +40,8 @@ public GTOreCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); } @Override @@ -46,12 +49,11 @@ public void setRecipe(IRecipeLayout recipeLayout, GTOreInfo recipeWrapper, @Nonn IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); int baseYPos = 19; - //The ore selected from JEI + // The ore selected from JEI itemStackGroup.init(0, true, 22, baseYPos); - //The Surface Identifier + // The Surface Identifier itemStackGroup.init(1, true, 22, 73); - for (int i = 0; i < recipeWrapper.getOutputCount(); i++) { int yPos = baseYPos + (i / NUM_OF_SLOTS) * SLOT_HEIGHT; int xPos = 70 + (i % NUM_OF_SLOTS) * SLOT_WIDTH; @@ -85,9 +87,9 @@ public void drawExtras(@Nonnull Minecraft minecraft) { int baseYPos = 19; int dimDisplayPos = 70; - //Selected Ore + // Selected Ore this.slot.draw(minecraft, 22, baseYPos); - //Surface Identifier + // Surface Identifier this.slot.draw(minecraft, 22, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1); int yPos = 0; @@ -98,28 +100,32 @@ public void drawExtras(@Nonnull Minecraft minecraft) { this.slot.draw(minecraft, xPos, yPos); } - //base positions set to position of last rendered slot for later use. - //Must account for the fact that yPos is the top corner of the slot, so add in another slot height + // base positions set to position of last rendered slot for later use. + // Must account for the fact that yPos is the top corner of the slot, so add in another slot height baseYPos = yPos + SLOT_HEIGHT; GTStringUtils.drawCenteredStringWithCutoff(veinName, minecraft.fontRenderer, 176); - //Begin Drawing information, depending on how many rows of ore outputs were created - //Give room for 5 lines of 5 ores each, so 25 unique ores in the vein - //73 is SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1 + // Begin Drawing information, depending on how many rows of ore outputs were created + // Give room for 5 lines of 5 ores each, so 25 unique ores in the vein + // 73 is SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1 if (baseYPos >= SLOT_HEIGHT * NUM_OF_SLOTS) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, baseYPos + 1, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), + baseXPos, baseYPos + 1, 0x111111); } else { - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); - //Update the position at which the spawn information ends + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.spawn_range", minHeight, maxHeight), + baseXPos, SLOT_HEIGHT * (NUM_OF_SLOTS - 1) + 1, 0x111111); + // Update the position at which the spawn information ends baseYPos = 73; } - //Create the Weight - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.vein_weight", weight), baseXPos, baseYPos + FONT_HEIGHT, 0x111111); + // Create the Weight + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.vein_weight", weight), baseXPos, + baseYPos + FONT_HEIGHT, 0x111111); - //Create the Dimensions - minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.dimension"), baseXPos, baseYPos + (2 * FONT_HEIGHT), 0x111111); + // Create the Dimensions + minecraft.fontRenderer.drawString(I18n.format("gregtech.jei.ore.dimension"), baseXPos, + baseYPos + (2 * FONT_HEIGHT), 0x111111); JEIResourceDepositCategoryUtils.drawMultiLineCommaSeparatedDimensionList(WorldGenRegistry.getNamedDimensions(), dimension, @@ -128,7 +134,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { baseYPos + 3 * FONT_HEIGHT, dimDisplayPos); - //Label the Surface Identifier - minecraft.fontRenderer.drawSplitString(I18n.format("gregtech.jei.ore.surfacematerial"), 15, 92, baseXPos - 20, 0x111111); + // Label the Surface Identifier + minecraft.fontRenderer.drawSplitString(I18n.format("gregtech.jei.ore.surfacematerial"), 15, 92, baseXPos - 20, + 0x111111); } } diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java index e91ab8815fd..0f5bd90bf9f 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreInfo.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.util.FileUtility; @@ -16,9 +15,7 @@ import gregtech.api.worldgen.populator.SurfaceRockPopulator; import gregtech.common.blocks.BlockOre; import gregtech.integration.jei.utils.JEIResourceDepositCategoryUtils; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; @@ -30,6 +27,11 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fml.common.Loader; + +import com.google.common.collect.ImmutableList; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -60,19 +62,21 @@ public class GTOreInfo implements IRecipeWrapper { public GTOreInfo(OreDepositDefinition definition) { this.definition = definition; - //Don't default to vanilla Maximums and minimums if the values are not defined and Cubic Chunks is loaded - //This could be improved to use the actual minimum and maximum heights, at the cost of including the CC Api + // Don't default to vanilla Maximums and minimums if the values are not defined and Cubic Chunks is loaded + // This could be improved to use the actual minimum and maximum heights, at the cost of including the CC Api if (Loader.isModLoaded(MODID_CC)) { - this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? Integer.MAX_VALUE : definition.getMaximumHeight(); - this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? Integer.MIN_VALUE : definition.getMinimumHeight(); + this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? Integer.MAX_VALUE : + definition.getMaximumHeight(); + this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? Integer.MIN_VALUE : + definition.getMinimumHeight(); } else { - //Some veins don't have a maximum height, so set it to the maximum world height? + // Some veins don't have a maximum height, so set it to the maximum world height? this.maxHeight = definition.getMaximumHeight() == Integer.MAX_VALUE ? 255 : definition.getMaximumHeight(); - //Some veins don't have a minimum height, so set it to 0 in that case + // Some veins don't have a minimum height, so set it to 0 in that case this.minHeight = definition.getMinimumHeight() == Integer.MIN_VALUE ? 0 : definition.getMinimumHeight(); } - //Get the Name and trim unneeded information + // Get the Name and trim unneeded information if (definition.getAssignedName() == null) { this.name = FileUtility.trimFileName(definition.getDepositName()); } else { @@ -83,7 +87,7 @@ public GTOreInfo(OreDepositDefinition definition) { this.weight = definition.getWeight(); - //Find the Vein Populator and use it to define the Surface Indicator + // Find the Vein Populator and use it to define the Surface Indicator veinPopulator = definition.getVeinPopulator(); ItemStack identifierStack = findSurfaceBlock(veinPopulator); @@ -100,7 +104,7 @@ public GTOreInfo(OreDepositDefinition definition) { if (blockFiller instanceof LayeredBlockFiller) { groupedOutputsAsItemStacks = getLayeredVeinOutputStacks(); } else { - //Group the output Ores + // Group the output Ores groupedOutputsAsItemStacks = findUniqueBlocksAsItemStack(generatedBlocksAsItemStacks); } @@ -182,8 +186,7 @@ private List> getLayeredVeinOutputStacks() { getStacksFromStates(getPossibleStates(filler.getPrimary(), new ArrayList<>()), new ArrayList<>()), getStacksFromStates(getPossibleStates(filler.getSecondary(), new ArrayList<>()), new ArrayList<>()), getStacksFromStates(getPossibleStates(filler.getBetween(), new ArrayList<>()), new ArrayList<>()), - getStacksFromStates(getPossibleStates(filler.getSporadic(), new ArrayList<>()), new ArrayList<>()) - ); + getStacksFromStates(getPossibleStates(filler.getSporadic(), new ArrayList<>()), new ArrayList<>())); } // Condenses the List of ores down to group together ores that share the same material but only vary in stone type. @@ -221,7 +224,6 @@ public List> findUniqueBlocksAsItemStack(List itemLis // Finds the generated surface block or material. In the case of Fluid generation, finds a bucket of the fluid. public static ItemStack findSurfaceBlock(IVeinPopulator veinPopulator) { - Material mat; IBlockState state; ItemStack stack = new ItemStack(Items.AIR); @@ -240,7 +242,7 @@ else if (veinPopulator instanceof SurfaceBlockPopulator) { stack = GTUtility.toItem(state); return stack; } - //Fluid generation support + // Fluid generation support else if (veinPopulator instanceof FluidSpringPopulator) { state = ((FluidSpringPopulator) veinPopulator).getFluidState(); Block temp = state.getBlock(); @@ -255,19 +257,18 @@ else if (veinPopulator instanceof FluidSpringPopulator) { return stack; } - //Creates a tooltip based on the specific slots + // Creates a tooltip based on the specific slots public void addTooltip(int slotIndex, boolean input, Object ingredient, List tooltip) { - - //Only add the Biome Information to the selected Ore + // Only add the Biome Information to the selected Ore if (slotIndex == 0) { tooltip.addAll(JEIResourceDepositCategoryUtils.createSpawnPageBiomeTooltip(biomeFunction, weight)); if (description != null) { tooltip.add(description); } } - //Surface Indicator slot + // Surface Indicator slot else if (slotIndex == 1) { - //Only add the special tooltip to the Material rock piles + // Only add the special tooltip to the Material rock piles if (veinPopulator instanceof SurfaceRockPopulator) { tooltip.add(I18n.format("gregtech.jei.ore.surface_rock_1")); tooltip.add(I18n.format("gregtech.jei.ore.surface_rock_2")); @@ -281,9 +282,8 @@ else if (slotIndex == 1) { } } - //Creates a tooltip show the weighting of the individual ores in the ore vein + // Creates a tooltip show the weighting of the individual ores in the ore vein public List createOreWeightingTooltip(int slotIndex) { - List tooltip = new ArrayList<>(); double weight; @@ -302,7 +302,8 @@ public List createOreWeightingTooltip(int slotIndex) { private List createOreLayeringTooltip(int slotIndex) { List tooltip = new ArrayList<>(); - FillerConfigUtils.LayeredFillerEntry filler = (FillerConfigUtils.LayeredFillerEntry) blockFiller.getAllPossibleStates().get(0); + FillerConfigUtils.LayeredFillerEntry filler = (FillerConfigUtils.LayeredFillerEntry) blockFiller + .getAllPossibleStates().get(0); switch (slotIndex) { // cases are offset by 2, being the "Ore Input" and the Surface Indicator case 2: { diff --git a/src/main/java/gregtech/integration/jei/basic/MaterialTree.java b/src/main/java/gregtech/integration/jei/basic/MaterialTree.java index 44dfafa4327..3babd634779 100644 --- a/src/main/java/gregtech/integration/jei/basic/MaterialTree.java +++ b/src/main/java/gregtech/integration/jei/basic/MaterialTree.java @@ -1,20 +1,23 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.List; public class MaterialTree implements IRecipeWrapper { + private final static ImmutableList PREFIXES = ImmutableList.of( OrePrefix.dustTiny, OrePrefix.dust, @@ -45,8 +48,7 @@ public class MaterialTree implements IRecipeWrapper { OrePrefix.ring, // fluid, OrePrefix.lens, - OrePrefix.foil - ); + OrePrefix.foil); private final List> itemInputs = new ArrayList<>(); private final List> fluidInputs = new ArrayList<>(); diff --git a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java index 625cfefb8ec..fc6ce4ff27c 100644 --- a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.recipes.recipeproperties.TemperatureProperty; @@ -8,6 +7,13 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.integration.jei.utils.render.DrawableRegistry; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; @@ -16,16 +22,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class MaterialTreeCategory extends BasicRecipeCategory { protected String materialName; @@ -43,32 +46,32 @@ public class MaterialTreeCategory extends BasicRecipeCategory ITEM_LOCATIONS = ImmutableList.of( // corresponds pair-to-one with PREFIXES in MaterialTree.java - 4, 67, // dustTiny 0 + 4, 67, // dustTiny 0 4, 101, // dust 4, 135, // dustSmall 29, 55, // cableGtSingle 29, 85, // ingotHot - 29, 117, // ingot 5 + 29, 117, // ingot 5 29, 117, // gem 29, 147, // block 54, 55, // wireGtSingle 54, 85, // stick - 54, 117, // nugget 10 + 54, 117, // nugget 10 54, 147, // plate 79, 55, // wireFine 79, 85, // frameGt 79, 117, // round - 79, 147, // pipeNormalFluid 15 + 79, 147, // pipeNormalFluid 15 79, 147, // pipeNormalItem 104, 55, // screw 104, 85, // bolt 104, 117, // gear - 104, 147, // plateDouble 20 + 104, 147, // plateDouble 20 129, 55, // spring 129, 85, // stickLong 129, 117, // gearSmall 129, 147, // plateDense - 154, 55, // springSmall 25 + 154, 55, // springSmall 25 154, 78, // ring 154, 124, // lens 154, 147 // foil @@ -83,16 +86,18 @@ public MaterialTreeCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); this.icon = guiHelper.createDrawableIngredient(OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium)); - /* couldn't think of a better way to register all these - generated with bash, requires imagemagick and sed - for file in ./*.png; do - dimstring=$(identify -ping -format '%w, %h' "$file") - basename "$file" .png | sed "s/\(.*\)/registerArrow(guiHelper, \"\1\", $dimstring);/" - done - */ + /* + * couldn't think of a better way to register all these + * generated with bash, requires imagemagick and sed + * for file in ./*.png; do + * dimstring=$(identify -ping -format '%w, %h' "$file") + * basename "$file" .png | sed "s/\(.*\)/registerArrow(guiHelper, \"\1\", $dimstring);/" + * done + */ registerArrow(guiHelper, "2d12", 5, 12); registerArrow(guiHelper, "2d16", 5, 16); registerArrow(guiHelper, "2r16d37", 18, 40); @@ -186,12 +191,12 @@ public void drawExtras(@Nonnull Minecraft minecraft) { drawArrow(minecraft, "2d16", 10, 85, itemExists.get(0) && itemExists.get(1)); // dust <-> dustSmall drawArrow(minecraft, "2d16", 10, 119, itemExists.get(1) && itemExists.get(2)); - // dust <-> block (if no ingot or gem) + // dust <-> block (if no ingot or gem) drawArrow(minecraft, "2r16d37", 22, 107, !itemExists.get(5) && !itemExists.get(6) && itemExists.get(1) && itemExists.get(7)); // dust -> ingotHot drawArrow(minecraft, "r3u15r4", 22, 92, itemExists.get(1) && itemExists.get(4)); - // dust -> ingot/gem (if no ingotHot) + // dust -> ingot/gem (if no ingotHot) drawArrow(minecraft, "r3d16r4", 22, 109, !itemExists.get(4) && itemExists.get(1) && (itemExists.get(5) || itemExists.get(6))); // ingotHot -> ingot @@ -273,7 +278,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { } // don't think theres a good way to get the coil tier other than this if (materialBFTemp != 0) { - TemperatureProperty.getInstance().drawInfo(minecraft, 0, FONT_HEIGHT * linesDrawn, 0x111111, materialBFTemp); + TemperatureProperty.getInstance().drawInfo(minecraft, 0, FONT_HEIGHT * linesDrawn, 0x111111, + materialBFTemp); linesDrawn++; } minecraft.fontRenderer.drawString(materialAvgM, 0, FONT_HEIGHT * linesDrawn, 0x111111); @@ -285,7 +291,8 @@ public void drawExtras(@Nonnull Minecraft minecraft) { // a couple wrappers to make the code look less terrible private static void registerArrow(IGuiHelper guiHelper, String name, int width, int height) { - DrawableRegistry.initDrawable(guiHelper, GTValues.MODID + ":textures/gui/arrows/" + name + ".png", width, height, name); + DrawableRegistry.initDrawable(guiHelper, GTValues.MODID + ":textures/gui/arrows/" + name + ".png", width, + height, name); } private static void drawArrow(Minecraft minecraft, String name, int x, int y, boolean shown) { diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java index 27252a551f8..825747c51e6 100755 --- a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.recipes.chance.output.impl.ChancedItemOutput; import gregtech.api.unification.OreDictUnifier; @@ -11,17 +10,20 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.common.metatileentities.MetaTileEntities; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; + import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import com.google.common.collect.ImmutableList; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; import org.apache.commons.lang3.tuple.Pair; import java.util.ArrayList; @@ -42,8 +44,7 @@ public static void addOreByProductPrefix(OrePrefix orePrefix) { OrePrefix.crushedPurified, OrePrefix.dustImpure, OrePrefix.dustPure, - OrePrefix.crushedCentrifuged - ); + OrePrefix.crushedCentrifuged); private static ImmutableList ALWAYS_MACHINES; @@ -67,14 +68,13 @@ public OreByProduct(Material material) { MetaTileEntities.THERMAL_CENTRIFUGE[GTValues.LV].getStackForm(), MetaTileEntities.MACERATOR[GTValues.LV].getStackForm(), MetaTileEntities.MACERATOR[GTValues.LV].getStackForm(), - MetaTileEntities.CENTRIFUGE[GTValues.LV].getStackForm() - ); + MetaTileEntities.CENTRIFUGE[GTValues.LV].getStackForm()); } OreProperty property = material.getProperty(PropertyKey.ORE); int oreMultiplier = property.getOreMultiplier(); int byproductMultiplier = property.getByProductMultiplier(); currentSlot = 0; - Material[] byproducts = new Material[]{ + Material[] byproducts = new Material[] { property.getOreByProduct(0, material), property.getOreByProduct(1, material), property.getOreByProduct(2, material), @@ -148,7 +148,8 @@ public OreByProduct(Material material) { // direct smelt if (hasDirectSmelt) { ItemStack smeltingResult; - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { smeltingResult = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial); } else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) { @@ -236,9 +237,11 @@ public OreByProduct(Material material) { // electromagnetic separator if (hasSeparator) { - OrePrefix prefix = (separatedInto.get(separatedInto.size() - 1).getBlastTemperature() == 0 && separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) - ? OrePrefix.nugget : OrePrefix.dust; - ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedInto.get(separatedInto.size() - 1), prefix == OrePrefix.nugget ? 2 : 1); + OrePrefix prefix = (separatedInto.get(separatedInto.size() - 1).getBlastTemperature() == 0 && + separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) ? OrePrefix.nugget : + OrePrefix.dust; + ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedInto.get(separatedInto.size() - 1), + prefix == OrePrefix.nugget ? 2 : 1); addToOutputs(material, OrePrefix.dust, 1); addToOutputs(separatedInto.get(0), OrePrefix.dust, 1); diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java index eba115817cb..55daea56cbf 100644 --- a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.basic; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.unification.OreDictUnifier; @@ -8,6 +7,13 @@ import gregtech.api.unification.ore.OrePrefix; import gregtech.integration.jei.utils.render.FluidStackTextRenderer; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; @@ -16,16 +22,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class OreByProductCategory extends BasicRecipeCategory { protected final IDrawable slot; @@ -97,8 +100,7 @@ public class OreByProductCategory extends BasicRecipeCategory FLUID_LOCATIONS = ImmutableList.of( 42, 25, // washer in @@ -111,17 +113,22 @@ public OreByProductCategory(IGuiHelper guiHelper) { guiHelper.createBlankDrawable(176, 166), guiHelper); - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); - this.fluidSlot = guiHelper.drawableBuilder(GuiTextures.FLUID_SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18) + .build(); + this.fluidSlot = guiHelper.drawableBuilder(GuiTextures.FLUID_SLOT.imageLocation, 0, 0, 18, 18) + .setTextureSize(18, 18).build(); String baseloc = GTValues.MODID + ":textures/gui/arrows/"; this.arrowsBase = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-base.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsDirectSmelt = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-smelt.png"), 0, 0, 176, 166) + this.arrowsDirectSmelt = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-smelt.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsChemBath = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-chem.png"), 0, 0, 176, 166) + this.arrowsChemBath = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-chem.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); - this.arrowsSeparator = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-sep.png"), 0, 0, 176, 166) + this.arrowsSeparator = guiHelper + .drawableBuilder(new ResourceLocation(baseloc + "oreby-sep.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); this.arrowsSifter = guiHelper.drawableBuilder(new ResourceLocation(baseloc + "oreby-sift.png"), 0, 0, 176, 166) .setTextureSize(176, 166).build(); @@ -130,7 +137,8 @@ public OreByProductCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWrapper, + @Nonnull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); @@ -142,7 +150,8 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWr List> itemOutputs = ingredients.getOutputs(VanillaTypes.ITEM); itemOutputExists.clear(); for (int i = 0; i < ITEM_OUTPUT_LOCATIONS.size(); i += 2) { - itemStackGroup.init(i / 2 + itemInputs.size(), false, new ItemStackTextRenderer(recipeWrapper.getChance(i / 2 + itemInputs.size()), null), + itemStackGroup.init(i / 2 + itemInputs.size(), false, + new ItemStackTextRenderer(recipeWrapper.getChance(i / 2 + itemInputs.size()), null), ITEM_OUTPUT_LOCATIONS.get(i) + 1, ITEM_OUTPUT_LOCATIONS.get(i + 1) + 1, 16, 16, 0, 0); itemOutputExists.add(itemOutputs.get(i / 2).size() > 0); } @@ -189,7 +198,7 @@ public void drawExtras(@Nonnull Minecraft minecraft) { if (hasSeparator) { arrowsSeparator.draw(minecraft, 0, 0); } - if(hasSifter) { + if (hasSifter) { arrowsSifter.draw(minecraft, 0, 0); } @@ -209,5 +218,4 @@ public void drawExtras(@Nonnull Minecraft minecraft) { } } } - } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java index 0a9c78030b0..17b6a86bd73 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java @@ -3,6 +3,9 @@ import gregtech.api.GTValues; import gregtech.api.gui.GuiTextures; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; + +import net.minecraft.client.resources.I18n; + import mezz.jei.api.IGuiHelper; import mezz.jei.api.IJeiHelpers; import mezz.jei.api.IModRegistry; @@ -11,13 +14,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.gui.recipes.RecipeLayout; -import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; +import javax.annotation.Nonnull; + public class MultiblockInfoCategory implements IRecipeCategory { private final IDrawable background; @@ -27,7 +30,8 @@ public class MultiblockInfoCategory implements IRecipeCategory REGISTER = new LinkedList<>(); @@ -37,7 +41,8 @@ public static void registerMultiblock(MultiblockControllerBase controllerBase) { } public static void registerRecipes(IModRegistry registry) { - registry.addRecipes(REGISTER.stream().map(MultiblockInfoRecipeWrapper::new).collect(Collectors.toList()), "gregtech:multiblock_info"); + registry.addRecipes(REGISTER.stream().map(MultiblockInfoRecipeWrapper::new).collect(Collectors.toList()), + "gregtech:multiblock_info"); } @Nonnull @@ -70,7 +75,8 @@ public IDrawable getIcon() { } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, + @Nonnull IIngredients ingredients) { recipeWrapper.setRecipeLayout((RecipeLayout) recipeLayout, this.guiHelper); } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java index 5c4d692e4ef..ba9bcd92230 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java @@ -1,10 +1,5 @@ package gregtech.integration.jei.multiblock; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Translation; import gregtech.api.gui.GuiTextures; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -22,15 +17,7 @@ import gregtech.client.utils.RenderUtil; import gregtech.client.utils.TrackedDummyWorld; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.gui.recipes.RecipeLayout; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -56,15 +43,31 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + +import codechicken.lib.render.BlockRenderer; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.ColourMultiplier; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Translation; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; +import mezz.jei.gui.recipes.RecipeLayout; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; -import javax.vecmath.Vector3f; import java.util.*; import java.util.Map.Entry; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.vecmath.Vector3f; + public class MultiblockInfoRecipeWrapper implements IRecipeWrapper { private static final int MAX_PARTS = 18; @@ -75,11 +78,13 @@ public class MultiblockInfoRecipeWrapper implements IRecipeWrapper { private static final int RIGHT_PADDING = 5; private static class MBPattern { + final WorldSceneRenderer sceneRenderer; final List parts; final Map predicateMap; - public MBPattern(final WorldSceneRenderer sceneRenderer, final List parts, Map predicateMap) { + public MBPattern(final WorldSceneRenderer sceneRenderer, final List parts, + Map predicateMap) { this.sceneRenderer = sceneRenderer; this.parts = parts; this.predicateMap = predicateMap; @@ -125,7 +130,8 @@ public MultiblockInfoRecipeWrapper(@Nonnull MultiblockControllerBase controller) .toArray(MBPattern[]::new); allItemStackInputs.addAll(drops); this.nextLayerButton = new GuiButton(0, 176 - (ICON_SIZE + RIGHT_PADDING), 70, ICON_SIZE, ICON_SIZE, ""); - this.buttonPreviousPattern = new GuiButton(0, 176 - ((2 * ICON_SIZE) + RIGHT_PADDING + 1), 90, ICON_SIZE, ICON_SIZE, "<"); + this.buttonPreviousPattern = new GuiButton(0, 176 - ((2 * ICON_SIZE) + RIGHT_PADDING + 1), 90, ICON_SIZE, + ICON_SIZE, "<"); this.buttonNextPattern = new GuiButton(0, 176 - (ICON_SIZE + RIGHT_PADDING), 90, ICON_SIZE, ICON_SIZE, ">"); this.buttons.put(nextLayerButton, this::toggleNextLayer); this.buttons.put(buttonPreviousPattern, () -> switchRenderPage(-1)); @@ -147,8 +153,10 @@ public void getIngredients(IIngredients ingredients) { public void setRecipeLayout(RecipeLayout layout, IGuiHelper guiHelper) { this.recipeLayout = layout; - this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, SLOT_SIZE, SLOT_SIZE).setTextureSize(SLOT_SIZE, SLOT_SIZE).build(); - this.infoIcon = guiHelper.drawableBuilder(GuiTextures.INFO_ICON.imageLocation, 0, 0, ICON_SIZE, ICON_SIZE).setTextureSize(ICON_SIZE, ICON_SIZE).build(); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, SLOT_SIZE, SLOT_SIZE) + .setTextureSize(SLOT_SIZE, SLOT_SIZE).build(); + this.infoIcon = guiHelper.drawableBuilder(GuiTextures.INFO_ICON.imageLocation, 0, 0, ICON_SIZE, ICON_SIZE) + .setTextureSize(ICON_SIZE, ICON_SIZE).build(); IDrawable border = layout.getRecipeCategory().getBackground(); preparePlaceForParts(border.getHeight()); @@ -195,8 +203,8 @@ private void toggleNextLayer() { WorldSceneRenderer renderer = getCurrentRenderer(); int height = (int) ((TrackedDummyWorld) renderer.world).getSize().getY() - 1; if (++this.layerIndex > height) { - //if current layer index is more than max height, reset it - //to display all layers + // if current layer index is more than max height, reset it + // to display all layers this.layerIndex = -1; } setNextLayer(layerIndex); @@ -215,7 +223,8 @@ private void setNextLayer(int newLayer) { if (newLayer == -1) { renderBlocks = world.renderedBlocks; } else { - renderBlocks = world.renderedBlocks.stream().filter(pos -> pos.getY() - minY == newLayer).collect(Collectors.toSet()); + renderBlocks = world.renderedBlocks.stream().filter(pos -> pos.getY() - minY == newLayer) + .collect(Collectors.toSet()); } renderer.addRenderedBlocks(renderBlocks, null); } @@ -237,7 +246,8 @@ private void switchRenderPage(int amount) { this.buttonPreviousPattern.enabled = newIndex > 0; setNextLayer(-1); updateParts(); - getCurrentRenderer().setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); + getCurrentRenderer().setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), + Math.toRadians(rotationYaw)); if (this.selected != null) { this.selected = null; for (int i = 0; i < predicates.size(); i++) { @@ -252,7 +262,9 @@ private void switchRenderPage(int amount) { private void preparePlaceForParts(int recipeHeight) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); for (int i = 0; i < MAX_PARTS; ++i) - itemStackGroup.init(i, true, SLOT_SIZE * i - (SLOT_SIZE * SLOTS_PER_ROW) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, recipeHeight - PARTS_HEIGHT + SLOT_SIZE * (i / SLOTS_PER_ROW)); + itemStackGroup.init(i, true, + SLOT_SIZE * i - (SLOT_SIZE * SLOTS_PER_ROW) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, + recipeHeight - PARTS_HEIGHT + SLOT_SIZE * (i / SLOTS_PER_ROW)); } private void updateParts() { @@ -272,22 +284,25 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe WorldSceneRenderer renderer = getCurrentRenderer(); int sceneHeight = recipeHeight - PARTS_HEIGHT; - renderer.render(recipeLayout.getPosX(), recipeLayout.getPosY(), recipeWidth, sceneHeight, mouseX + recipeLayout.getPosX(), mouseY + recipeLayout.getPosY()); + renderer.render(recipeLayout.getPosX(), recipeLayout.getPosY(), recipeWidth, sceneHeight, + mouseX + recipeLayout.getPosX(), mouseY + recipeLayout.getPosY()); drawMultiblockName(recipeWidth); - //reset colors (so any elements render after this point are not dark) + // reset colors (so any elements render after this point are not dark) GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - int iconX = recipeWidth - (ICON_SIZE + RIGHT_PADDING); int iconY = 49; this.infoIcon.draw(minecraft, iconX, iconY); - this.drawInfoIcon = iconX <= mouseX && mouseX <= iconX + ICON_SIZE && iconY <= mouseY && mouseY <= iconY + ICON_SIZE; + this.drawInfoIcon = iconX <= mouseX && mouseX <= iconX + ICON_SIZE && iconY <= mouseY && + mouseY <= iconY + ICON_SIZE; // draw parts slots for (int i = 0; i < MAX_PARTS; ++i) { - this.slot.draw(minecraft, SLOT_SIZE * i - (SLOTS_PER_ROW * SLOT_SIZE) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, sceneHeight + SLOT_SIZE * (i / SLOTS_PER_ROW)); + this.slot.draw(minecraft, + SLOT_SIZE * i - (SLOTS_PER_ROW * SLOT_SIZE) * (i / SLOTS_PER_ROW) + (SLOT_SIZE / 2) - 2, + sceneHeight + SLOT_SIZE * (i / SLOTS_PER_ROW)); } // draw candidates slots @@ -329,13 +344,17 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe renderer.setCameraLookAt(center, zoom, Math.toRadians(rotationPitch), Math.toRadians(rotationYaw)); } - if (!(leftClickHeld || rightClickHeld) && rayTraceResult != null && !renderer.world.isAirBlock(rayTraceResult.getBlockPos())) { + if (!(leftClickHeld || rightClickHeld) && rayTraceResult != null && + !renderer.world.isAirBlock(rayTraceResult.getBlockPos())) { IBlockState blockState = renderer.world.getBlockState(rayTraceResult.getBlockPos()); - ItemStack itemStack = blockState.getBlock().getPickBlock(blockState, rayTraceResult, renderer.world, rayTraceResult.getBlockPos(), minecraft.player); - TraceabilityPredicate predicates = patterns[currentRendererPage].predicateMap.get(rayTraceResult.getBlockPos()); + ItemStack itemStack = blockState.getBlock().getPickBlock(blockState, rayTraceResult, renderer.world, + rayTraceResult.getBlockPos(), minecraft.player); + TraceabilityPredicate predicates = patterns[currentRendererPage].predicateMap + .get(rayTraceResult.getBlockPos()); if (predicates != null) { BlockWorldState worldState = new BlockWorldState(); - worldState.update(renderer.world, rayTraceResult.getBlockPos(), new PatternMatchContext(), new HashMap<>(), new HashMap<>(), predicates); + worldState.update(renderer.world, rayTraceResult.getBlockPos(), new PatternMatchContext(), + new HashMap<>(), new HashMap<>(), predicates); for (TraceabilityPredicate.SimplePredicate common : predicates.common) { if (common.test(worldState)) { predicateTips = common.getToolTips(predicates); @@ -370,7 +389,8 @@ private void drawMultiblockName(int recipeWidth) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; List lines = fontRenderer.listFormattedStringToWidth(localizedName, recipeWidth - 10); for (int i = 0; i < lines.size(); i++) { - fontRenderer.drawString(lines.get(i), (recipeWidth - fontRenderer.getStringWidth(lines.get(i))) / 2, fontRenderer.FONT_HEIGHT * i, ConfigHolder.client.multiblockPreviewFontColor); + fontRenderer.drawString(lines.get(i), (recipeWidth - fontRenderer.getStringWidth(lines.get(i))) / 2, + fontRenderer.FONT_HEIGHT * i, ConfigHolder.client.multiblockPreviewFontColor); } } @@ -418,7 +438,6 @@ public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, return false; } - private void setItemStackGroup() { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); for (int i = 0; i < predicates.size(); i++) { @@ -437,10 +456,13 @@ private void setItemStackGroup() { @Override public List getTooltipStrings(int mouseX, int mouseY) { if (drawInfoIcon) { - return Arrays.asList(I18n.format("gregtech.multiblock.preview.zoom"), I18n.format("gregtech.multiblock.preview.rotate"), I18n.format("gregtech.multiblock.preview.select")); + return Arrays.asList(I18n.format("gregtech.multiblock.preview.zoom"), + I18n.format("gregtech.multiblock.preview.rotate"), + I18n.format("gregtech.multiblock.preview.select")); } else if (tooltipBlockStack != null && !tooltipBlockStack.isEmpty() && !Mouse.isButtonDown(0)) { Minecraft minecraft = Minecraft.getMinecraft(); - ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL; + ITooltipFlag flag = minecraft.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : + TooltipFlags.NORMAL; List tooltip = tooltipBlockStack.getTooltip(minecraft.player, flag); EnumRarity rarity = tooltipBlockStack.getRarity(); for (int k = 0; k < tooltip.size(); ++k) { @@ -459,6 +481,7 @@ public List getTooltipStrings(int mouseX, int mouseY) { } private static class PartInfo { + final ItemStack itemStack; boolean isController = false; boolean isTile = false; @@ -487,8 +510,10 @@ ItemStack getItemStack() { } @Nonnull - private static Collection gatherStructureBlocks(World world, @Nonnull Map blocks, Set parts) { - Map partsMap = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + private static Collection gatherStructureBlocks(World world, @Nonnull Map blocks, + Set parts) { + Map partsMap = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (Entry entry : blocks.entrySet()) { BlockPos pos = entry.getKey(); IBlockState state = world.getBlockState(pos); @@ -518,7 +543,8 @@ private static Collection gatherStructureBlocks(World world, @Nonnull } if (stack.isEmpty()) { // if everything else doesn't work, try the not great getPickBlock() with some dummy values - stack = block.getPickBlock(state, new RayTraceResult(Vec3d.ZERO, EnumFacing.UP, pos), world, pos, new GregFakePlayer(world)); + stack = block.getPickBlock(state, new RayTraceResult(Vec3d.ZERO, EnumFacing.UP, pos), world, pos, + new GregFakePlayer(world)); } // if we got a stack, add it to the set and map @@ -547,8 +573,11 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non for (int y = 0; y < aisle.length; y++) { BlockInfo[] column = aisle[y]; for (int z = 0; z < column.length; z++) { - if (column[z].getTileEntity() instanceof IGregTechTileEntity && ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity() instanceof MultiblockControllerBase) { - controllerBase = (MultiblockControllerBase) ((IGregTechTileEntity) column[z].getTileEntity()).getMetaTileEntity(); + if (column[z].getTileEntity() instanceof IGregTechTileEntity && + ((IGregTechTileEntity) column[z].getTileEntity()) + .getMetaTileEntity() instanceof MultiblockControllerBase) { + controllerBase = (MultiblockControllerBase) ((IGregTechTileEntity) column[z].getTileEntity()) + .getMetaTileEntity(); } blockMap.put(new BlockPos(x, y, z), column[z]); } @@ -568,7 +597,8 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non worldSceneRenderer.setOnLookingAt(ray -> {}); worldSceneRenderer.setAfterWorldRender(renderer -> { - BlockPos look = worldSceneRenderer.getLastTraceResult() == null ? null : worldSceneRenderer.getLastTraceResult().getBlockPos(); + BlockPos look = worldSceneRenderer.getLastTraceResult() == null ? null : + worldSceneRenderer.getLastTraceResult().getBlockPos(); if (look != null && look.equals(selected)) { renderBlockOverLay(selected, 200, 75, 75); return; @@ -577,7 +607,8 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non renderBlockOverLay(selected, 255, 0, 0); }); world.updateEntities(); - world.setRenderFilter(pos -> worldSceneRenderer.renderedBlocksMap.keySet().stream().anyMatch(c -> c.contains(pos))); + world.setRenderFilter( + pos -> worldSceneRenderer.renderedBlocksMap.keySet().stream().anyMatch(c -> c.contains(pos))); Map predicateMap = new HashMap<>(); if (controllerBase != null) { @@ -585,18 +616,20 @@ private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Non controllerBase.reinitializeStructurePattern(); } if (controllerBase.structurePattern != null) { - controllerBase.structurePattern.cache.forEach((pos, blockInfo) -> predicateMap.put(BlockPos.fromLong(pos), (TraceabilityPredicate) blockInfo.getInfo())); + controllerBase.structurePattern.cache.forEach((pos, blockInfo) -> predicateMap + .put(BlockPos.fromLong(pos), (TraceabilityPredicate) blockInfo.getInfo())); } } - List sortedParts = gatherStructureBlocks(worldSceneRenderer.world, blockMap, parts).stream().sorted((one, two) -> { - if (one.isController) return -1; - if (two.isController) return +1; - if (one.isTile && !two.isTile) return -1; - if (two.isTile && !one.isTile) return +1; - if (one.blockId != two.blockId) return two.blockId - one.blockId; - return two.amount - one.amount; - }).map(PartInfo::getItemStack).collect(Collectors.toList()); + List sortedParts = gatherStructureBlocks(worldSceneRenderer.world, blockMap, parts).stream() + .sorted((one, two) -> { + if (one.isController) return -1; + if (two.isController) return +1; + if (one.isTile && !two.isTile) return -1; + if (two.isTile && !one.isTile) return +1; + if (one.blockId != two.blockId) return two.blockId - one.blockId; + return two.amount - one.amount; + }).map(PartInfo::getItemStack).collect(Collectors.toList()); return new MBPattern(worldSceneRenderer, sortedParts, predicateMap); } diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java index e8fb73c5ff6..5f7ddbf7525 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java @@ -1,12 +1,14 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.Lists; import gregtech.common.items.behaviors.FacadeItem; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import com.google.common.collect.Lists; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import javax.annotation.Nullable; diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java index 52766ac5f74..93b160a1db0 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.Lists; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; @@ -9,14 +8,18 @@ import gregtech.common.covers.facade.FacadeHelper; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.FacadeItem; + +import net.minecraft.item.ItemStack; + +import com.google.common.collect.Lists; import mezz.jei.api.recipe.*; import mezz.jei.api.recipe.IFocus.Mode; -import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + public class FacadeRegistryPlugin implements IRecipeRegistryPlugin { @Nonnull @@ -26,12 +29,12 @@ public List getRecipeCategoryUids(IFocus focus) { ItemStack itemStack = (ItemStack) focus.getValue(); if (focus.getMode() == Mode.OUTPUT) { if (MetaItems.COVER_FACADE.isItemEqual(itemStack)) { - //looking up recipes of facade cover + // looking up recipes of facade cover return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING); } } else if (focus.getMode() == Mode.INPUT) { if (FacadeHelper.isValidFacade(itemStack)) { - //looking up usage of block to make a facade cover + // looking up usage of block to make a facade cover return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING); } } @@ -41,7 +44,8 @@ public List getRecipeCategoryUids(IFocus focus) { @Nonnull @Override - public List getRecipeWrappers(IRecipeCategory recipeCategory, @Nonnull IFocus focus) { + public List getRecipeWrappers(IRecipeCategory recipeCategory, + @Nonnull IFocus focus) { if (!VanillaRecipeCategoryUid.CRAFTING.equals(recipeCategory.getUid())) { return Collections.emptyList(); } @@ -49,12 +53,12 @@ public List getRecipeWrappers(IRecipeCategory) createFacadeRecipes(itemStack); } } else if (focus.getMode() == Mode.INPUT) { if (FacadeHelper.isValidFacade(itemStack)) { - //looking up usage of block to make a facade cover + // looking up usage of block to make a facade cover ItemStack coverStack = MetaItems.COVER_FACADE.getStackForm(); FacadeItem.setFacadeStack(coverStack, itemStack); return (List) createFacadeRecipes(coverStack); diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 130d4e76176..01334a9651f 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -28,20 +28,23 @@ import gregtech.integration.RecipeCompatUtil; import gregtech.integration.jei.utils.AdvancedRecipeWrapper; import gregtech.integration.jei.utils.JeiButton; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; + import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; + import java.util.*; import java.util.function.BooleanSupplier; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class GTRecipeWrapper extends AdvancedRecipeWrapper { private static final int LINE_HEIGHT = 10; @@ -68,7 +71,6 @@ public Recipe getRecipe() { @Override public void getIngredients(@Nonnull IIngredients ingredients) { - // Inputs if (!sortedInputs.isEmpty()) { List> list = new ArrayList<>(); @@ -107,7 +109,8 @@ public void getIngredients(@Nonnull IIngredients ingredients) { if (researchId != null) break; } if (researchId != null) { - Collection possibleRecipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES).getDataStickEntry(researchId); + Collection possibleRecipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) + .getDataStickEntry(researchId); if (possibleRecipes != null) { for (Recipe r : possibleRecipes) { ItemStack researchItem = r.getOutputs().get(0); @@ -145,7 +148,8 @@ public void getIngredients(@Nonnull IIngredients ingredients) { .map(FluidStack::copy) .collect(Collectors.toList()); - List chancedOutputs = new ArrayList<>(recipe.getChancedFluidOutputs().getChancedEntries()); + List chancedOutputs = new ArrayList<>( + recipe.getChancedFluidOutputs().getChancedEntries()); for (ChancedFluidOutput chancedEntry : chancedOutputs) { recipeOutputs.add(chancedEntry.getIngredient()); } @@ -162,7 +166,8 @@ public void addItemTooltip(int slotIndex, boolean input, Object ingredient, List if (!recipe.getChancedOutputs().getChancedEntries().isEmpty()) { int outputIndex = slotIndex - recipeMap.getMaxInputs(); if (outputIndex >= recipe.getOutputs().size()) { - entry = recipe.getChancedOutputs().getChancedEntries().get(outputIndex - recipe.getOutputs().size()); + entry = recipe.getChancedOutputs().getChancedEntries() + .get(outputIndex - recipe.getOutputs().size()); } } } @@ -181,17 +186,20 @@ public void addFluidTooltip(int slotIndex, boolean input, Object ingredient, Lis if (!recipe.getChancedFluidOutputs().getChancedEntries().isEmpty()) { int outputIndex = slotIndex - recipeMap.getMaxFluidInputs(); if (outputIndex >= recipe.getFluidOutputs().size()) { - entry = recipe.getChancedFluidOutputs().getChancedEntries().get(outputIndex - recipe.getFluidOutputs().size()); + entry = recipe.getChancedFluidOutputs().getChancedEntries() + .get(outputIndex - recipe.getFluidOutputs().size()); } } - addIngredientTooltips(tooltip, notConsumed, input, entry, recipe.getChancedFluidOutputs().getChancedOutputLogic()); + addIngredientTooltips(tooltip, notConsumed, input, entry, + recipe.getChancedFluidOutputs().getChancedOutputLogic()); addIngredientTooltips(tooltip, notConsumed, input, ingredient, null); } - public void addIngredientTooltips(@Nonnull Collection tooltip, boolean notConsumed, boolean input, @Nullable Object ingredient, @Nullable Object ingredient2) { + public void addIngredientTooltips(@Nonnull Collection tooltip, boolean notConsumed, boolean input, + @Nullable Object ingredient, @Nullable Object ingredient2) { if (ingredient2 instanceof ChancedOutputLogic logic) { - if (ingredient instanceof BoostableChanceEntry entry) { + if (ingredient instanceof BoostableChanceEntryentry) { double chance = entry.getChance() / 100.0; double boost = entry.getChanceBoost() / 100.0; if (logic != ChancedOutputLogic.NONE && logic != ChancedOutputLogic.OR) { @@ -206,11 +214,12 @@ public void addIngredientTooltips(@Nonnull Collection tooltip, boolean n tooltip.add(TooltipHelper.BLINKING_CYAN + I18n.format("gregtech.recipe.not_consumed")); } - if (!input && this.recipeMap instanceof IScannerRecipeMap && ingredient instanceof ItemStack stack && !stack.isEmpty()) { + if (!input && this.recipeMap instanceof IScannerRecipeMap && ingredient instanceof ItemStack stack && + !stack.isEmpty()) { // check for "normal" data items if (stack.getItem() instanceof IDataItem) return; // check for metaitem data items - if (stack.getItem() instanceof MetaItem metaItem) { + if (stack.getItem() instanceof MetaItemmetaItem) { for (IItemBehaviour behaviour : metaItem.getBehaviours(stack)) { if (behaviour instanceof IDataItem) { return; @@ -243,18 +252,26 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe if (drawTotalEU) { long eu = Math.abs((long) recipe.getEUt()) * recipe.getDuration(); // sadly we still need a custom override here, since computation uses duration and EU/t very differently - if (recipe.hasProperty(TotalComputationProperty.getInstance()) && recipe.hasProperty(ComputationProperty.getInstance())) { + if (recipe.hasProperty(TotalComputationProperty.getInstance()) && + recipe.hasProperty(ComputationProperty.getInstance())) { int minimumCWUt = recipe.getProperty(ComputationProperty.getInstance(), 1); - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.max_eu", eu / minimumCWUt), 0, yPosition, 0x111111); + minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.max_eu", eu / minimumCWUt), 0, yPosition, + 0x111111); } else { minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.total", eu), 0, yPosition, 0x111111); } } if (drawEUt) { - minecraft.fontRenderer.drawString(I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", Math.abs(recipe.getEUt()), GTValues.VN[GTUtility.getTierByVoltage(recipe.getEUt())]), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString( + I18n.format(recipe.getEUt() >= 0 ? "gregtech.recipe.eu" : "gregtech.recipe.eu_inverted", + Math.abs(recipe.getEUt()), GTValues.VN[GTUtility.getTierByVoltage(recipe.getEUt())]), + 0, yPosition += LINE_HEIGHT, 0x111111); } if (drawDuration) { - minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", TextFormattingUtil.formatNumbers(recipe.getDuration() / 20d)), 0, yPosition += LINE_HEIGHT, 0x111111); + minecraft.fontRenderer.drawString( + I18n.format("gregtech.recipe.duration", + TextFormattingUtil.formatNumbers(recipe.getDuration() / 20d)), + 0, yPosition += LINE_HEIGHT, 0x111111); } // Property custom entries @@ -262,7 +279,8 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe if (!propertyEntry.getKey().isHidden()) { RecipeProperty property = propertyEntry.getKey(); Object value = propertyEntry.getValue(); - property.drawInfo(minecraft, 0, yPosition += property.getInfoHeight(value), 0x111111, value, mouseX, mouseY); + property.drawInfo(minecraft, 0, yPosition += property.getInfoHeight(value), 0x111111, value, mouseX, + mouseY); } } } @@ -286,10 +304,12 @@ public void initExtras() { // do not add the X button if no tweaker mod is present if (!RecipeCompatUtil.isTweakerLoaded()) return; - BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.isCreative(); + BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null && + Minecraft.getMinecraft().player.isCreative(); buttons.add(new JeiButton(166, 2, 10, 10) .setTextures(GuiTextures.BUTTON_CLEAR_GRID) - .setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() + " script, to remove this recipe, to the clipboard")) + .setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() + + " script, to remove this recipe, to the clipboard")) .setClickAction((minecraft, mouseX, mouseY, mouseButton) -> { String recipeLine = RecipeCompatUtil.getRecipeRemoveLine(recipeMap, recipe); String output = RecipeCompatUtil.getFirstOutputString(recipe); @@ -298,7 +318,8 @@ public void initExtras() { } String copyString = output + recipeLine + "\n"; ClipboardUtil.copyToClipboard(copyString); - Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard")); + Minecraft.getMinecraft().player.sendMessage( + new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard")); return true; }) .setActiveSupplier(creativePlayerCtPredicate)); diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java index a27546c7cb2..db33a9801ec 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java @@ -1,7 +1,5 @@ package gregtech.integration.jei.recipe; -import com.google.common.base.Suppliers; -import com.google.common.collect.Iterators; import gregtech.api.GTValues; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; @@ -9,15 +7,7 @@ import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.utils.render.CompositeDrawable; import gregtech.integration.jei.utils.render.CompositeRenderer; -import mcp.MethodsReturnNonnullByDefault; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredientRenderer; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.ingredients.VanillaTypes; -import mezz.jei.api.recipe.IRecipeCategory; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.BufferBuilder; @@ -27,16 +17,29 @@ import net.minecraft.client.resources.I18n; import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; + +import com.google.common.base.Suppliers; +import com.google.common.collect.Iterators; +import mcp.MethodsReturnNonnullByDefault; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredientRenderer; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeCategory; import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Iterator; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class IntCircuitCategory implements IRecipeCategory { @@ -51,18 +54,18 @@ public class IntCircuitCategory implements IRecipeCategory> otherItemRenderer = - Suppliers.memoize(() -> { - IIngredientRenderer defaultRenderer = JustEnoughItemsModule.ingredientRegistry.getIngredientRenderer(VanillaTypes.ITEM); - return CompositeRenderer.startBuilder(defaultRenderer) - .then(IntCircuitCategory::slice) - .then(defaultRenderer::render) - .then(() -> GL11.glDisable(GL11.GL_STENCIL_TEST)) - .build(); - }); - - private final Supplier> firstItemRenderer = - Suppliers.memoize(() -> CompositeRenderer.startBuilder(otherItemRenderer.get()) + private final Supplier> otherItemRenderer = Suppliers.memoize(() -> { + IIngredientRenderer defaultRenderer = JustEnoughItemsModule.ingredientRegistry + .getIngredientRenderer(VanillaTypes.ITEM); + return CompositeRenderer.startBuilder(defaultRenderer) + .then(IntCircuitCategory::slice) + .then(defaultRenderer::render) + .then(() -> GL11.glDisable(GL11.GL_STENCIL_TEST)) + .build(); + }); + + private final Supplier> firstItemRenderer = Suppliers + .memoize(() -> CompositeRenderer.startBuilder(otherItemRenderer.get()) .then(GlStateManager::pushMatrix) .then((minecraft, xPosition, yPosition, ingredient) -> { if (xPosition * yPosition != 0) @@ -84,11 +87,12 @@ public IntCircuitCategory(IGuiHelper guiHelper) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; slotBase = CompositeDrawable.startBuilder(SLOT_SIZE, SLOT_SIZE) - .then(guiHelper.drawableBuilder(GTUtility.gregtechId("textures/gui/base/slot.png"), 0, 0, SLOT_SIZE, SLOT_SIZE) + .then(guiHelper + .drawableBuilder(GTUtility.gregtechId("textures/gui/base/slot.png"), 0, 0, SLOT_SIZE, SLOT_SIZE) .setTextureSize(SLOT_SIZE, SLOT_SIZE) .build()::draw) - .then((minecraft, xOffset, yOffset) -> - fontRenderer.drawString(counter.next().toString(), xOffset + 1, yOffset + 1, 0x555555)) + .then((minecraft, xOffset, yOffset) -> fontRenderer.drawString(counter.next().toString(), xOffset + 1, + yOffset + 1, 0x555555)) .build(); scaledSlot = CompositeDrawable.startBuilder(SLOT_SIZE * FIRST_SLOT_SCALE, SLOT_SIZE * FIRST_SLOT_SCALE) @@ -130,25 +134,24 @@ public IDrawable getIcon() { } private static final int shortenedRowLength = ROW_LENGTH - FIRST_SLOT_SCALE; - private static final int[][] positions = - Stream.concat( - IntStream.range(0, shortenedRowLength * FIRST_SLOT_SCALE) - .mapToObj(i -> new int[]{ - SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i % shortenedRowLength), - SLOT_SIZE * (i / shortenedRowLength) - }), - IntStream.range(0, IntCircuitIngredient.CIRCUIT_MAX - (shortenedRowLength * FIRST_SLOT_SCALE)) - .mapToObj(i -> new int[]{ - SLOT_SIZE * (i % ROW_LENGTH), - SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i / ROW_LENGTH) - }) - ) - .toArray(int[][]::new); + private static final int[][] positions = Stream.concat( + IntStream.range(0, shortenedRowLength * FIRST_SLOT_SCALE) + .mapToObj(i -> new int[] { + SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i % shortenedRowLength), + SLOT_SIZE * (i / shortenedRowLength) + }), + IntStream.range(0, IntCircuitIngredient.CIRCUIT_MAX - (shortenedRowLength * FIRST_SLOT_SCALE)) + .mapToObj(i -> new int[] { + SLOT_SIZE * (i % ROW_LENGTH), + SLOT_SIZE * FIRST_SLOT_SCALE + SLOT_SIZE * (i / ROW_LENGTH) + })) + .toArray(int[][]::new); @Override public void setRecipe(IRecipeLayout recipeLayout, IntCircuitRecipeWrapper recipeWrapper, IIngredients ingredients) { IGuiItemStackGroup stacks = recipeLayout.getItemStacks(); - stacks.init(0, recipeWrapper.input, firstItemRenderer.get(), 0, 0, SLOT_SIZE * FIRST_SLOT_SCALE, SLOT_SIZE * FIRST_SLOT_SCALE, FIRST_SLOT_SCALE, FIRST_SLOT_SCALE); + stacks.init(0, recipeWrapper.input, firstItemRenderer.get(), 0, 0, SLOT_SIZE * FIRST_SLOT_SCALE, + SLOT_SIZE * FIRST_SLOT_SCALE, FIRST_SLOT_SCALE, FIRST_SLOT_SCALE); stacks.setBackground(0, scaledSlot); for (int i = 0; i < positions.length; i++) { stacks.init(i + 1, @@ -159,8 +162,7 @@ public void setRecipe(IRecipeLayout recipeLayout, IntCircuitRecipeWrapper recipe SLOT_SIZE, SLOT_SIZE, 1, - 1 - ); + 1); stacks.setBackground(i + 1, slotBase); } stacks.set(ingredients); @@ -205,5 +207,4 @@ private static void slice(Minecraft minecraft, int xPosition, int yPosition, @Nu GL11.glStencilFunc(GL11.GL_EQUAL, val, mask); } - } diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java index 7a5cb39df3d..ef2a02685ea 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java @@ -1,18 +1,21 @@ package gregtech.integration.jei.recipe; -import com.google.common.collect.ImmutableList; import gregtech.api.recipes.ingredients.IntCircuitIngredient; + +import net.minecraft.item.ItemStack; + +import com.google.common.collect.ImmutableList; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class IntCircuitRecipeWrapper implements IRecipeWrapper { @@ -25,8 +28,7 @@ private IntCircuitRecipeWrapper(boolean input) { public static Collection create() { return ImmutableList.of( new IntCircuitRecipeWrapper(true), - new IntCircuitRecipeWrapper(false) - ); + new IntCircuitRecipeWrapper(false)); } @Override diff --git a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java index 11657044667..2104bf474aa 100644 --- a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java @@ -21,6 +21,14 @@ import gregtech.integration.jei.JustEnoughItemsModule; import gregtech.integration.jei.utils.render.FluidStackTextRenderer; import gregtech.integration.jei.utils.render.ItemStackTextRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.items.ItemStackHandler; +import net.minecraftforge.items.SlotItemHandler; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; @@ -30,20 +38,15 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategory; -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.items.ItemStackHandler; -import net.minecraftforge.items.SlotItemHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class RecipeMapCategory implements IRecipeCategory { private final RecipeMap recipeMap; @@ -58,7 +61,8 @@ public class RecipeMapCategory implements IRecipeCategory { private static final Map gtCategories = new Object2ObjectOpenHashMap<>(); private static final Map, List> recipeMapCategories = new Object2ObjectOpenHashMap<>(); - public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCategory category, IGuiHelper guiHelper) { + public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCategory category, + IGuiHelper guiHelper) { this.recipeMap = recipeMap; this.category = category; FluidTank[] importFluidTanks = new FluidTank[recipeMap.getMaxFluidInputs()]; @@ -68,13 +72,15 @@ public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCateg for (int i = 0; i < exportFluidTanks.length; i++) exportFluidTanks[i] = new FluidTank(16000); this.modularUI = recipeMap.createJeiUITemplate( - (importItems = new ItemStackHandler(recipeMap.getMaxInputs() + (recipeMap == RecipeMaps.ASSEMBLY_LINE_RECIPES ? 1 : 0))), + (importItems = new ItemStackHandler( + recipeMap.getMaxInputs() + (recipeMap == RecipeMaps.ASSEMBLY_LINE_RECIPES ? 1 : 0))), (exportItems = new ItemStackHandler(recipeMap.getMaxOutputs())), (importFluids = new FluidTankList(false, importFluidTanks)), - (exportFluids = new FluidTankList(false, exportFluidTanks)), 0 - ).build(new BlankUIHolder(), Minecraft.getMinecraft().player); + (exportFluids = new FluidTankList(false, exportFluidTanks)), 0) + .build(new BlankUIHolder(), Minecraft.getMinecraft().player); this.modularUI.initWidgets(); - this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), modularUI.getHeight() * 2 / 3 + recipeMap.getPropertyHeightShift()); + this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), + modularUI.getHeight() * 2 / 3 + recipeMap.getPropertyHeightShift()); gtCategories.put(category, this); recipeMapCategories.compute(recipeMap, (k, v) -> { if (v == null) v = new ArrayList<>(); @@ -129,7 +135,8 @@ public IDrawable getBackground() { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recipeWrapper, + @Nonnull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); for (Widget uiWidget : modularUI.guiWidgets.values()) { @@ -141,7 +148,7 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip } SlotItemHandler handle = (SlotItemHandler) slotWidget.getHandle(); if (handle.getItemHandler() == importItems) { - //this is input item stack slot widget, so add it to item group + // this is input item stack slot widget, so add it to item group itemStackGroup.init(handle.getSlotIndex(), true, new ItemStackTextRenderer(recipeWrapper.isNotConsumedItem(handle.getSlotIndex())), slotWidget.getPosition().x + 1, @@ -149,9 +156,11 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip slotWidget.getSize().width - 2, slotWidget.getSize().height - 2, 0, 0); } else if (handle.getItemHandler() == exportItems) { - //this is output item stack slot widget, so add it to item group + // this is output item stack slot widget, so add it to item group itemStackGroup.init(importItems.getSlots() + handle.getSlotIndex(), false, - new ItemStackTextRenderer(recipeWrapper.getOutputChance(handle.getSlotIndex() - recipeWrapper.getRecipe().getOutputs().size()), + new ItemStackTextRenderer( + recipeWrapper.getOutputChance( + handle.getSlotIndex() - recipeWrapper.getRecipe().getOutputs().size()), recipeWrapper.getChancedOutputLogic()), slotWidget.getPosition().x + 1, slotWidget.getPosition().y + 1, @@ -166,12 +175,12 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip int fluidAmount = 0; if (inputsList.size() > importIndex && !inputsList.get(importIndex).isEmpty()) fluidAmount = inputsList.get(importIndex).get(0).amount; - //this is input tank widget, so add it to fluid group + // this is input tank widget, so add it to fluid group fluidStackGroup.init(importIndex, true, new FluidStackTextRenderer(fluidAmount, false, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), null) - .setNotConsumed(recipeWrapper.isNotConsumedFluid(importIndex)), + .setNotConsumed(recipeWrapper.isNotConsumedFluid(importIndex)), tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), @@ -183,12 +192,13 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip int fluidAmount = 0; if (inputsList.size() > exportIndex && !inputsList.get(exportIndex).isEmpty()) fluidAmount = inputsList.get(exportIndex).get(0).amount; - //this is output tank widget, so add it to fluid group + // this is output tank widget, so add it to fluid group fluidStackGroup.init(importFluids.getFluidTanks().size() + exportIndex, false, new FluidStackTextRenderer(fluidAmount, false, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), null, - recipeWrapper.getFluidOutputChance(exportIndex - recipeWrapper.getRecipe().getFluidOutputs().size()), + recipeWrapper.getFluidOutputChance( + exportIndex - recipeWrapper.getRecipe().getFluidOutputs().size()), recipeWrapper.getChancedFluidOutputLogic()), tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, @@ -205,7 +215,8 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip List dataItems = new ArrayList<>(); for (ResearchPropertyData.ResearchEntry entry : data) { ItemStack dataStick = entry.getDataItem().copy(); - AssemblyLineManager.writeResearchToNBT(GTUtility.getOrCreateNbtCompound(dataStick), entry.getResearchId()); + AssemblyLineManager.writeResearchToNBT(GTUtility.getOrCreateNbtCompound(dataStick), + entry.getResearchId()); dataItems.add(dataStick); } itemStackGroup.set(16, dataItems); @@ -222,8 +233,7 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip public void drawExtras(@Nonnull Minecraft minecraft) { for (Widget widget : modularUI.guiWidgets.values()) { if (widget instanceof ProgressWidget) widget.detectAndSendChanges(); - widget.drawInBackground(0, 0, minecraft.getRenderPartialTicks(), new IRenderContext() { - }); + widget.drawInBackground(0, 0, minecraft.getRenderPartialTicks(), new IRenderContext() {}); widget.drawInForeground(0, 0); } } diff --git a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java index b0252407f05..9b8b15b3068 100644 --- a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java @@ -1,6 +1,5 @@ package gregtech.integration.jei.utils; -import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.renderer.GlStateManager; @@ -8,10 +7,13 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; -import javax.annotation.Nonnull; +import mezz.jei.api.recipe.IRecipeWrapper; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public abstract class AdvancedRecipeWrapper implements IRecipeWrapper { protected final List buttons = new ArrayList<>(); @@ -45,8 +47,10 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe @Override public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { for (JeiButton button : buttons) { - if (button.isHovering(mouseX, mouseY) && button.getClickAction().click(minecraft, mouseX, mouseY, mouseButton)) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + if (button.isHovering(mouseX, mouseY) && + button.getClickAction().click(minecraft, mouseX, mouseY, mouseButton)) { + Minecraft.getMinecraft().getSoundHandler() + .playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); return true; } } diff --git a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java index 986ff5bc6b5..7778af062bb 100644 --- a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java +++ b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java @@ -2,12 +2,7 @@ import gregtech.api.util.GTLog; import gregtech.api.worldgen.config.OreDepositDefinition; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.ints.IntSortedSet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -17,7 +12,13 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.Loader; -import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.IntSortedSet; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -25,6 +26,8 @@ import java.util.function.Function; import java.util.function.Predicate; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.MODID_AR; /** @@ -34,7 +37,8 @@ public class JEIResourceDepositCategoryUtils { /** - * Creates a list of biomes whose weight, as described by the passed Function, differs from the passed original weight + * Creates a list of biomes whose weight, as described by the passed Function, differs from the passed original + * weight * For use in the JEI Ore Spawn Page and JEI Fluid Spawn Page * * @param biomeFunction A Function describing the modified weights of biomes @@ -117,7 +121,7 @@ public static void drawMultiLineCommaSeparatedDimensionList(Int2ObjectMap lines) { } public boolean isHovering(int mouseX, int mouseY) { - return mouseX >= x && mouseY >= y && mouseX <= x + width && mouseY <= y + height && activeSupplier.getAsBoolean(); + return mouseX >= x && mouseY >= y && mouseX <= x + width && mouseY <= y + height && + activeSupplier.getAsBoolean(); } public void render(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { @@ -69,6 +71,7 @@ public ClickAction getClickAction() { @FunctionalInterface public interface ClickAction { + boolean click(Minecraft minecraft, int mouseX, int mouseY, int mouseButton); } } diff --git a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java index 65ddc845d22..1ed37c488d0 100644 --- a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java @@ -2,12 +2,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GTUtility; -import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import net.minecraft.item.ItemStack; +import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import javax.annotation.Nonnull; public class MachineSubtypeHandler implements ISubtypeInterpreter { + @Nonnull @Override public String apply(@Nonnull ItemStack itemStack) { diff --git a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java index c683566ffd1..4d453ed6c48 100644 --- a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java @@ -2,12 +2,15 @@ import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; -import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import net.minecraft.item.ItemStack; +import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; + import javax.annotation.Nonnull; public class MetaItemSubtypeHandler implements ISubtypeInterpreter { + @Nonnull @Override public String apply(ItemStack itemStack) { diff --git a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java index 92529b57052..cd6af9d2d17 100644 --- a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java @@ -6,6 +6,9 @@ import gregtech.api.gui.ingredient.IGhostIngredientTarget; import gregtech.api.gui.ingredient.IIngredientSlot; import gregtech.api.gui.ingredient.IRecipeTransferHandlerWidget; + +import net.minecraft.entity.player.EntityPlayer; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import mezz.jei.api.gui.IAdvancedGuiHandler; import mezz.jei.api.gui.IGhostIngredientHandler; @@ -13,16 +16,17 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper; -import net.minecraft.entity.player.EntityPlayer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; import java.util.function.Predicate; -public class ModularUIGuiHandler implements IAdvancedGuiHandler, IGhostIngredientHandler, IRecipeTransferHandler { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class ModularUIGuiHandler implements IAdvancedGuiHandler, IGhostIngredientHandler, + IRecipeTransferHandler { private final IRecipeTransferHandlerHelper transferHelper; private Predicate validHandlers = widget -> true; @@ -50,7 +54,9 @@ public Class getContainerClass() { @Nullable @Override - public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container, @Nonnull IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container, + @Nonnull IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, + boolean maxTransfer, boolean doTransfer) { if (this.recipeTransferCategoryBlacklist.contains(recipeLayout.getRecipeCategory().getUid())) { return this.transferHelper.createInternalError(); } @@ -63,7 +69,8 @@ public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container if (!transferHandler.isPresent()) { return transferHelper.createInternalError(); } - String errorTooltip = transferHandler.get().transferRecipe(container, recipeLayout, player, maxTransfer, doTransfer); + String errorTooltip = transferHandler.get().transferRecipe(container, recipeLayout, player, maxTransfer, + doTransfer); if (errorTooltip == null) { return null; } @@ -97,7 +104,7 @@ public List> getTargets(ModularUIGui gui, @Nonnull I ingredient, b for (Widget widget : widgets) { if (widget instanceof IGhostIngredientTarget ghostTarget) { List> widgetTargets = ghostTarget.getPhantomTargets(ingredient); - //noinspection unchecked + // noinspection unchecked targets.addAll((List>) (Object) widgetTargets); } } @@ -111,6 +118,5 @@ public List getGuiExtraAreas(@Nonnull ModularUIGui guiContainer) { } @Override - public void onComplete() { - } + public void onComplete() {} } diff --git a/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java b/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java index c0915cc5685..6918306eee9 100644 --- a/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java +++ b/src/main/java/gregtech/integration/jei/utils/MultiblockInfoRecipeFocusShower.java @@ -1,12 +1,13 @@ package gregtech.integration.jei.utils; import gregtech.integration.jei.multiblock.MultiblockInfoRecipeWrapper; -import mezz.jei.input.ClickedIngredient; +import mezz.jei.input.ClickedIngredient; import mezz.jei.input.IClickedIngredient; import mezz.jei.input.IShowsRecipeFocuses; public class MultiblockInfoRecipeFocusShower implements IShowsRecipeFocuses { + @Override public IClickedIngredient getIngredientUnderMouse(int mouseX, int mouseY) { if (MultiblockInfoRecipeWrapper.getHoveredItemStack() != null) diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java index 9d7e136efa0..65aa59fb0fe 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java @@ -1,13 +1,16 @@ package gregtech.integration.jei.utils.render; -import mezz.jei.api.gui.IDrawable; import net.minecraft.client.Minecraft; -import javax.annotation.Nonnull; +import mezz.jei.api.gui.IDrawable; + import java.util.LinkedList; import java.util.List; +import javax.annotation.Nonnull; + public class CompositeDrawable implements IDrawable { + private final int width; private final int height; private final List steps; @@ -40,6 +43,7 @@ public static Builder startBuilder(int height, int width) { } public static class Builder { + private final int height; private final int width; private final List steps = new LinkedList<>(); @@ -65,6 +69,7 @@ public CompositeDrawable build() { @FunctionalInterface public interface RenderNode { + void draw(@Nonnull Minecraft minecraft, int xOffset, int yOffset); } } diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java index 1b927a1d2b2..daac90efc7c 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java @@ -1,19 +1,22 @@ package gregtech.integration.jei.utils.render; -import mcp.MethodsReturnNonnullByDefault; -import mezz.jei.api.ingredients.IIngredientRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.util.ITooltipFlag; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; +import mezz.jei.api.ingredients.IIngredientRenderer; + import java.util.LinkedList; import java.util.List; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CompositeRenderer implements IIngredientRenderer { + private final TooltipSupplier tooltipSupplier; private final FontRendererSupplier fontRendererSupplier; private final List> steps; @@ -54,6 +57,7 @@ public FontRenderer getFontRenderer(Minecraft minecraft, T ingredient) { } public static class Builder { + private final TooltipSupplier tooltipSupplier; private final FontRendererSupplier fontRendererSupplier; private final List> steps = new LinkedList<>(); @@ -80,16 +84,19 @@ public CompositeRenderer build() { @FunctionalInterface public interface RenderNode { + void render(Minecraft minecraft, int xPosition, int yPosition, @Nullable T ingredient); } @FunctionalInterface public interface TooltipSupplier { + List getTooltip(Minecraft minecraft, T ingredient, ITooltipFlag tooltipFlag); } @FunctionalInterface public interface FontRendererSupplier { + FontRenderer getFontRenderer(Minecraft minecraft, T ingredient); } } diff --git a/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java index 8d5cf5d12c2..d2e093dd13c 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java +++ b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java @@ -1,21 +1,24 @@ package gregtech.integration.jei.utils.render; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import java.util.Map; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; + import java.util.HashMap; +import java.util.Map; /** * HashMap of IDrawables for JEI rendering */ public class DrawableRegistry { + private static final Map drawableMap = new HashMap<>(); public static void initDrawable(IGuiHelper guiHelper, String textureLocation, int width, int height, String key) { - drawableMap.put(key, guiHelper.drawableBuilder(new ResourceLocation(textureLocation), 0, 0, width, height).setTextureSize(width, height).build()); + drawableMap.put(key, guiHelper.drawableBuilder(new ResourceLocation(textureLocation), 0, 0, width, height) + .setTextureSize(width, height).build()); } public static void drawDrawable(Minecraft minecraft, String key, int x, int y) { diff --git a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java index 5a0aaec0be9..0260601a9f3 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java @@ -4,23 +4,27 @@ import gregtech.api.recipes.chance.output.ChancedOutputLogic; import gregtech.api.util.TextFormattingUtil; import gregtech.client.utils.RenderUtil; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.plugins.vanilla.ingredients.fluid.FluidStackRenderer; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fluids.FluidStack; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.plugins.vanilla.ingredients.fluid.FluidStackRenderer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; public class FluidStackTextRenderer extends FluidStackRenderer { + private boolean notConsumed; private int chanceBase = -1; private int chanceBoost = -1; private ChancedOutputLogic chanceLogic; - public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, @Nullable IDrawable overlay) { + public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, + @Nullable IDrawable overlay) { super(capacityMb, showCapacity, width, height, overlay); this.notConsumed = false; } @@ -30,7 +34,8 @@ public FluidStackTextRenderer setNotConsumed(boolean notConsumed) { return this; } - public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, @Nullable IDrawable overlay, + public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, int height, + @Nullable IDrawable overlay, BoostableChanceEntry chance, ChancedOutputLogic chanceLogic) { if (chance != null) { this.chanceBase = chance.getChance(); @@ -41,7 +46,8 @@ public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, i } @Override - public void render(@Nonnull Minecraft minecraft, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) { + public void render(@Nonnull Minecraft minecraft, final int xPosition, final int yPosition, + @Nullable FluidStack fluidStack) { if (fluidStack == null) return; @@ -55,7 +61,8 @@ public void render(@Nonnull Minecraft minecraft, final int xPosition, final int String s = TextFormattingUtil.formatLongToCompactString(fluidStack.amount, 4) + "L"; FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, (yPosition + 11) * 2, 0xFFFFFF); + fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, + (yPosition + 11) * 2, 0xFFFFFF); GlStateManager.popMatrix(); @@ -66,20 +73,23 @@ public void render(@Nonnull Minecraft minecraft, final int xPosition, final int GlStateManager.translate(0, 0, 160); String s2 = (this.chanceBase / 100) + "%"; - if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && this.chanceLogic != ChancedOutputLogic.OR) { + if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && + this.chanceLogic != ChancedOutputLogic.OR) { s2 += "*"; } else if (this.chanceBoost > 0) { s2 += "+"; } - fontRenderer.drawStringWithShadow(s2, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s2) + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow(s2, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s2) + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); } else if (notConsumed) { GlStateManager.pushMatrix(); GlStateManager.scale(0.5, 0.5, 1); - fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); } diff --git a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java index e0d1c2fa0df..e2c642df694 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java @@ -2,16 +2,19 @@ import gregtech.api.recipes.chance.boost.BoostableChanceEntry; import gregtech.api.recipes.chance.output.ChancedOutputLogic; -import mezz.jei.plugins.vanilla.ingredients.item.ItemStackRenderer; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; +import mezz.jei.plugins.vanilla.ingredients.item.ItemStackRenderer; + import javax.annotation.Nonnull; import javax.annotation.Nullable; public class ItemStackTextRenderer extends ItemStackRenderer { + private final int chanceBase; private final int chanceBoost; private final ChancedOutputLogic chanceLogic; @@ -56,14 +59,16 @@ public void render(@Nonnull Minecraft minecraft, int xPosition, int yPosition, @ GlStateManager.translate(0, 0, 160); String s = (this.chanceBase / 100) + "%"; - if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && this.chanceLogic != ChancedOutputLogic.OR) { + if (this.chanceLogic != null && this.chanceLogic != ChancedOutputLogic.NONE && + this.chanceLogic != ChancedOutputLogic.OR) { s += "*"; } else if (this.chanceBoost > 0) { s += "+"; } FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow(s, (xPosition + 6) * 2 - fontRenderer.getStringWidth(s) + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); GlStateManager.enableBlend(); @@ -75,7 +80,8 @@ public void render(@Nonnull Minecraft minecraft, int xPosition, int yPosition, @ GlStateManager.translate(0, 0, 160); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, (yPosition + 1) * 2, 0xFFFF00); + fontRenderer.drawStringWithShadow("NC", (xPosition + 6) * 2 - fontRenderer.getStringWidth("NC") + 19, + (yPosition + 1) * 2, 0xFFFF00); GlStateManager.popMatrix(); GlStateManager.enableBlend(); diff --git a/src/main/java/gregtech/integration/opencomputers/InputValidator.java b/src/main/java/gregtech/integration/opencomputers/InputValidator.java index e60c766c697..799e4699a0c 100644 --- a/src/main/java/gregtech/integration/opencomputers/InputValidator.java +++ b/src/main/java/gregtech/integration/opencomputers/InputValidator.java @@ -52,12 +52,14 @@ public static String getColorString(Arguments args, int index) { colorString = colorString.substring(2); } if (colorString.length() != 8) { - throw new IllegalArgumentException("String " + colorString + " is not valid, must be 8 characters long beyond \"0x\"."); + throw new IllegalArgumentException( + "String " + colorString + " is not valid, must be 8 characters long beyond \"0x\"."); } try { Long.parseLong(colorString, 16); } catch (NumberFormatException e) { - throw new IllegalArgumentException("String " + colorString + " is not a valid code, must be only numbers (0-9) and letters (A-F)."); + throw new IllegalArgumentException( + "String " + colorString + " is not a valid code, must be only numbers (0-9) and letters (A-F)."); } return colorString; } diff --git a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java index 08a216991c7..344dee2667e 100644 --- a/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java +++ b/src/main/java/gregtech/integration/opencomputers/OpenComputersModule.java @@ -11,18 +11,19 @@ import gregtech.integration.opencomputers.drivers.specific.DriverPowerSubstation; import gregtech.integration.opencomputers.drivers.specific.DriverWorldAccelerator; import gregtech.modules.GregTechModules; -import li.cil.oc.api.Driver; -import li.cil.oc.api.driver.DriverBlock; + import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import li.cil.oc.api.Driver; +import li.cil.oc.api.driver.DriverBlock; + @GregTechModule( - moduleID = GregTechModules.MODULE_OC, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_OC, - name = "GregTech OpenComputers Integration", - description = "OpenComputers Integration Module" -) + moduleID = GregTechModules.MODULE_OC, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_OC, + name = "GregTech OpenComputers Integration", + description = "OpenComputers Integration Module") public class OpenComputersModule extends IntegrationSubmodule { private static final String MODID_GTCE2OC = "gtce2oc"; diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java index a1a3e2aded5..6f6eeed9f97 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverAbstractRecipeLogic.java @@ -8,12 +8,7 @@ import gregtech.api.recipes.chance.output.impl.ChancedFluidOutput; import gregtech.api.recipes.chance.output.impl.ChancedItemOutput; import gregtech.api.recipes.ingredients.GTRecipeInput; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.prefab.DriverSidedTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -21,6 +16,13 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.prefab.DriverSidedTileEntity; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -132,7 +134,8 @@ public Object[] getCurrentRecipe(final Context context, final Arguments args) { } List> chancedFluidOutput = new ArrayList<>(); - List chancedFluidOutputs = previousRecipe.getChancedFluidOutputs().getChancedEntries(); + List chancedFluidOutputs = previousRecipe.getChancedFluidOutputs() + .getChancedEntries(); chancedFluidOutputs.forEach(iR -> { Map output = new Object2ObjectOpenHashMap<>(); output.put("chance", iR.getChance()); @@ -144,9 +147,9 @@ public Object[] getCurrentRecipe(final Context context, final Arguments args) { if (!chancedFluidOutput.isEmpty()) { recipe.put("chancedFluidOutput", chancedFluidOutput); } - return new Object[]{recipe}; + return new Object[] { recipe }; } - return new Object[]{null}; + return new Object[] { null }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java index 25ed615d1f4..be85082485c 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverCoverHolder.java @@ -7,15 +7,17 @@ import gregtech.common.covers.*; import gregtech.integration.opencomputers.InputValidator; import gregtech.integration.opencomputers.values.*; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverCoverHolder extends DriverSidedTileEntity { @@ -55,22 +57,22 @@ public Object[] getCover(final Context context, final Arguments args) { EnumFacing side = EnumFacing.VALUES[index]; Cover cover = tileEntity.getCoverAtSide(side); if (cover instanceof CoverRoboticArm robotArm) - return new Object[]{new ValueCoverRoboticArm(robotArm, side)}; + return new Object[] { new ValueCoverRoboticArm(robotArm, side) }; if (cover instanceof CoverConveyor conveyor) - return new Object[]{new ValueCoverConveyor(conveyor, side)}; + return new Object[] { new ValueCoverConveyor(conveyor, side) }; if (cover instanceof CoverFluidRegulator regulator) - return new Object[]{new ValueCoverFluidRegulator(regulator, side)}; + return new Object[] { new ValueCoverFluidRegulator(regulator, side) }; if (cover instanceof CoverPump pump) - return new Object[]{new ValueCoverPump(pump, side)}; + return new Object[] { new ValueCoverPump(pump, side) }; if (cover instanceof CoverFluidFilter filter) - return new Object[]{new ValueCoverFluidFilter(filter, side)}; + return new Object[] { new ValueCoverFluidFilter(filter, side) }; if (cover instanceof CoverItemFilter filter) - return new Object[]{new ValueCoverItemFilter(filter, side)}; + return new Object[] { new ValueCoverItemFilter(filter, side) }; if (cover instanceof CoverEnderFluidLink efl) - return new Object[]{new ValueCoverEnderFluidLink(efl, side)}; + return new Object[] { new ValueCoverEnderFluidLink(efl, side) }; if (cover != null) - return new Object[]{new ValueCoverBehavior(cover, side)}; - return new Object[]{null}; + return new Object[] { new ValueCoverBehavior(cover, side) }; + return new Object[] { null }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java index e4a73c28d7b..c8ecbaf4dba 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverEnergyContainer.java @@ -3,15 +3,17 @@ import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverEnergyContainer extends DriverSidedTileEntity { @@ -34,8 +36,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentIEnergyContainer((IGregTechTileEntity) tileEntity, - tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side) - ); + tileEntity.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side)); } return null; } @@ -48,43 +49,43 @@ public EnvironmentIEnergyContainer(IGregTechTileEntity holder, IEnergyContainer @Callback(doc = "function():number -- Returns the amount of electricity contained in this Block, in EU units!") public Object[] getEnergyStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyStored()}; + return new Object[] { tileEntity.getEnergyStored() }; } - @Callback(doc = "function():number -- " - + "Returns the amount of electricity containable in this Block, in EU units!") + @Callback(doc = "function():number -- " + + "Returns the amount of electricity containable in this Block, in EU units!") public Object[] getEnergyCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyCapacity()}; + return new Object[] { tileEntity.getEnergyCapacity() }; } @Callback(doc = "function():number -- Gets the Output in EU/p.") public Object[] getOutputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputVoltage()}; + return new Object[] { tileEntity.getOutputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getOutputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputAmperage()}; + return new Object[] { tileEntity.getOutputAmperage() }; } @Callback(doc = "function():number -- Gets the maximum Input in EU/p.") public Object[] getInputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputVoltage()}; + return new Object[] { tileEntity.getInputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getInputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputAmperage()}; + return new Object[] { tileEntity.getInputAmperage() }; } @Callback(doc = "function():number -- Gets the energy input per second.") public Object[] getInputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getInputPerSec()}; + return new Object[] { tileEntity.getInputPerSec() }; } @Callback(doc = "function():number -- Gets the energy output per second.") public Object[] getOutputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputPerSec()}; + return new Object[] { tileEntity.getOutputPerSec() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java index 086245b3b6f..ee6941cfd48 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java @@ -5,12 +5,7 @@ import gregtech.api.capability.impl.MultiblockRecipeLogic; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.prefab.DriverSidedTileEntity; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -19,11 +14,19 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.prefab.DriverSidedTileEntity; + import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + public class DriverRecipeMapMultiblockController extends DriverSidedTileEntity { @Override @@ -51,7 +54,8 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin return null; } - public final static class EnvironmentMultiblockRecipeLogic extends EnvironmentMetaTileEntity { + public final static class EnvironmentMultiblockRecipeLogic extends + EnvironmentMetaTileEntity { public EnvironmentMultiblockRecipeLogic(IGregTechTileEntity holder, RecipeMapMultiblockController capability) { super(holder, capability, "gt_multiblockRecipeLogic"); @@ -59,43 +63,43 @@ public EnvironmentMultiblockRecipeLogic(IGregTechTileEntity holder, RecipeMapMul @Callback(doc = "function():number -- Returns the amount of electricity contained in this Block, in EU units!") public Object[] getEnergyStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getEnergyStored()}; + return new Object[] { tileEntity.getEnergyContainer().getEnergyStored() }; } - @Callback(doc = "function():number -- " - + "Returns the amount of electricity containable in this Block, in EU units!") + @Callback(doc = "function():number -- " + + "Returns the amount of electricity containable in this Block, in EU units!") public Object[] getEnergyCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getEnergyCapacity()}; + return new Object[] { tileEntity.getEnergyContainer().getEnergyCapacity() }; } @Callback(doc = "function():number -- Gets the Output in EU/p.") public Object[] getOutputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputVoltage()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getOutputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputAmperage()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputAmperage() }; } @Callback(doc = "function():number -- Gets the maximum Input in EU/p.") public Object[] getInputVoltage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputVoltage()}; + return new Object[] { tileEntity.getEnergyContainer().getInputVoltage() }; } @Callback(doc = "function():number -- Gets the amount of Energy Packets per tick.") public Object[] getInputAmperage(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputAmperage()}; + return new Object[] { tileEntity.getEnergyContainer().getInputAmperage() }; } @Callback(doc = "function():number -- Gets the energy input per second.") public Object[] getInputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getInputPerSec()}; + return new Object[] { tileEntity.getEnergyContainer().getInputPerSec() }; } @Callback(doc = "function():number -- Gets the energy output per second.") public Object[] getOutputPerSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getEnergyContainer().getOutputPerSec()}; + return new Object[] { tileEntity.getEnergyContainer().getOutputPerSec() }; } @Nonnull @@ -109,7 +113,7 @@ private Object[] getInventory(IItemHandlerModifiable handler) { map.put("name", itemStack.getDisplayName()); result.add(map); } - return new Object[]{result}; + return new Object[] { result }; } @Callback(doc = "function():table -- Gets the Input Inventory.") @@ -137,7 +141,7 @@ private Object[] getTank(IMultipleTankHandler handler) { } result.add(map); }); - return new Object[]{result}; + return new Object[] { result }; } @Callback(doc = "function():table -- Gets the Input Tank.") diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java index a4dd4fb6fd6..e9047958c6e 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverSimpleMachine.java @@ -2,15 +2,17 @@ import gregtech.api.metatileentity.SimpleMachineMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverSimpleMachine extends DriverSidedTileEntity { @@ -33,8 +35,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentSimpleMachine((IGregTechTileEntity) tileEntity, - (SimpleMachineMetaTileEntity) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (SimpleMachineMetaTileEntity) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } @@ -47,74 +48,77 @@ public EnvironmentSimpleMachine(IGregTechTileEntity holder, SimpleMachineMetaTil @Callback(doc = "function():number -- Returns the tier of machine.") public Object[] getTier(final Context context, final Arguments args) { - return new Object[]{tileEntity.getTier()}; + return new Object[] { tileEntity.getTier() }; } @Callback(doc = "function():boolean -- Returns is autoOutputItems enabled.") public Object[] isAutoOutputItems(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAutoOutputItems()}; + return new Object[] { tileEntity.isAutoOutputItems() }; } @Callback(doc = "function(autoOutputItems:boolean):boolean -- Sets autoOutputItems enabled.") public Object[] setAutoOutputItems(final Context context, final Arguments args) { tileEntity.setAutoOutputItems(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is autoOutputFluids enabled.") public Object[] isAutoOutputFluids(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAutoOutputFluids()}; + return new Object[] { tileEntity.isAutoOutputFluids() }; } @Callback(doc = "function(autoOutputFluids:boolean):boolean -- Sets autoOutputFluids enabled.") public Object[] setAutoOutputFluids(final Context context, final Arguments args) { tileEntity.setAutoOutputFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for BOTH items and fluids.") public Object[] isAllowInputFromOutputSide(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for items.") public Object[] isAllowInputFromOutputSideItems(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function():boolean -- Returns is allowInputFromOutputSide enabled for fluids.") public Object[] isAllowInputFromOutputSideFluids(final Context context, final Arguments args) { - return new Object[]{tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids()}; + return new Object[] { + tileEntity.isAllowInputFromOutputSideItems() && tileEntity.isAllowInputFromOutputSideFluids() }; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for BOTH items and fluids.") public Object[] setAllowInputFromOutputSide(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideItems(args.checkBoolean(0)); tileEntity.setAllowInputFromOutputSideFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for items.") public Object[] setAllowInputFromOutputSideItems(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideItems(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(allowInputFromOutputSide:boolean):boolean -- Sets allowInputFromOutputSide enabled for fluids.") public Object[] setAllowInputFromOutputSideFluids(final Context context, final Arguments args) { tileEntity.setAllowInputFromOutputSideFluids(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Returns is outputFacing.") public Object[] getOutputFacing(final Context context, final Arguments args) { - return new Object[]{tileEntity.getOutputFacing().ordinal()}; + return new Object[] { tileEntity.getOutputFacing().ordinal() }; } @Callback(doc = "function(side:number) -- Sets outputFacing.") public Object[] setOutputFacing(final Context context, final Arguments args) { tileEntity.setOutputFacing(EnumFacing.values()[args.checkInteger(0)]); - return new Object[]{}; + return new Object[] {}; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java index 43508abda61..e5c5b075bef 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverWorkable.java @@ -3,15 +3,17 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverWorkable extends DriverSidedTileEntity { @@ -34,8 +36,7 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentIWorkable((IGregTechTileEntity) tileEntity, - tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, side) - ); + tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, side)); } return null; } @@ -48,30 +49,30 @@ public EnvironmentIWorkable(IGregTechTileEntity holder, IWorkable capability) { @Callback(doc = "function():number -- Returns the MaxProgress!") public Object[] getMaxProgress(final Context context, final Arguments args) { - return new Object[]{tileEntity.getMaxProgress()}; + return new Object[] { tileEntity.getMaxProgress() }; } @Callback(doc = "function():number -- Returns the Progress!") public Object[] getProgress(final Context context, final Arguments args) { - return new Object[]{tileEntity.getProgress()}; + return new Object[] { tileEntity.getProgress() }; } @Callback(doc = "function():boolean -- Returns is active or not.") public Object[] isActive(final Context context, final Arguments args) { - return new Object[]{tileEntity.isActive()}; + return new Object[] { tileEntity.isActive() }; } @Callback(doc = "function():boolean -- Returns is working enabled.") public Object[] isWorkingEnabled(final Context context, final Arguments args) { - return new Object[]{tileEntity.isWorkingEnabled()}; + return new Object[] { tileEntity.isWorkingEnabled() }; } - @Callback(doc = "function(workingEnabled:boolean):boolean -- " - + "Sets working enabled, return last working enabled.") + @Callback(doc = "function(workingEnabled:boolean):boolean -- " + + "Sets working enabled, return last working enabled.") public Object[] setWorkingEnabled(final Context context, final Arguments args) { boolean lsatState = tileEntity.isWorkingEnabled(); tileEntity.setWorkingEnabled(args.checkBoolean(0)); - return new Object[]{lsatState}; + return new Object[] { lsatState }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java b/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java index f5427805067..20d67a34fd3 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/EnvironmentMetaTileEntity.java @@ -1,6 +1,7 @@ package gregtech.integration.opencomputers.drivers; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + import li.cil.oc.api.driver.NamedBlock; import li.cil.oc.integration.ManagedTileEntityEnvironment; diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java index 69a68aaab81..5d53ad3742e 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverConverter.java @@ -4,15 +4,17 @@ import gregtech.common.metatileentities.converter.MetaTileEntityConverter; import gregtech.integration.opencomputers.InputValidator; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverConverter extends DriverSidedTileEntity { @@ -40,7 +42,8 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin return null; } - public final static class EnvironmentTileEntityConverter extends EnvironmentMetaTileEntity { + public final static class EnvironmentTileEntityConverter extends + EnvironmentMetaTileEntity { public EnvironmentTileEntityConverter(IGregTechTileEntity holder, MetaTileEntityConverter tileEntity) { super(holder, tileEntity, "gt_converter"); @@ -48,14 +51,14 @@ public EnvironmentTileEntityConverter(IGregTechTileEntity holder, MetaTileEntity @Callback(doc = "function():number -- Gets the Converter Mode. (0:FE->EU, 1:EU->FE)") public Object[] getConverterMode(final Context context, final Arguments args) { - return new Object[]{tileEntity.isFeToEu() ? 0 : 1}; + return new Object[] { tileEntity.isFeToEu() ? 0 : 1 }; } @Callback(doc = "function(mode:number) -- Sets the Converter Mode. (0:FE->EU, 1:EU->FE)") public Object[] setConverterMode(final Context context, final Arguments args) { boolean mode = InputValidator.getInteger(args, 0, 0, 1) == 0; tileEntity.setFeToEu(mode); - return new Object[]{}; + return new Object[] {}; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java index f29e9b993a2..91ab2537635 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverFusionReactor.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.multi.electric.MetaTileEntityFusionReactor; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverFusionReactor extends DriverSidedTileEntity { @@ -34,14 +36,13 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentFusionReactor((IGregTechTileEntity) tileEntity, - (MetaTileEntityFusionReactor) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (MetaTileEntityFusionReactor) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } public final static class EnvironmentFusionReactor extends - EnvironmentMetaTileEntity { + EnvironmentMetaTileEntity { public EnvironmentFusionReactor(IGregTechTileEntity holder, MetaTileEntityFusionReactor tileEntity) { super(holder, tileEntity, "gt_fusionReactor"); @@ -49,7 +50,7 @@ public EnvironmentFusionReactor(IGregTechTileEntity holder, MetaTileEntityFusion @Callback(doc = "function():number -- Returns the heat of machine.") public Object[] getHeat(final Context context, final Arguments args) { - return new Object[]{tileEntity.getHeat()}; + return new Object[] { tileEntity.getHeat() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java index 9058ffded46..509de932b1b 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverPowerSubstation.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverPowerSubstation extends DriverSidedTileEntity { @@ -32,13 +34,15 @@ public boolean worksWith(World world, BlockPos pos, EnumFacing side) { @Override public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacing side) { TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IGregTechTileEntity gtte && gtte.getMetaTileEntity() instanceof MetaTileEntityPowerSubstation pss) { + if (tileEntity instanceof IGregTechTileEntity gtte && + gtte.getMetaTileEntity() instanceof MetaTileEntityPowerSubstation pss) { return new EnvironmentPowerSubstation(gtte, pss); } return null; } - public final static class EnvironmentPowerSubstation extends EnvironmentMetaTileEntity { + public final static class EnvironmentPowerSubstation extends + EnvironmentMetaTileEntity { public EnvironmentPowerSubstation(IGregTechTileEntity holder, MetaTileEntityPowerSubstation mte) { super(holder, mte, "gt_powerSubstation"); @@ -46,22 +50,22 @@ public EnvironmentPowerSubstation(IGregTechTileEntity holder, MetaTileEntityPowe @Callback(doc = "function():string -- Returns the stored energy of the machine.") public Object[] getStored(final Context context, final Arguments args) { - return new Object[]{tileEntity.getStored()}; + return new Object[] { tileEntity.getStored() }; } @Callback(doc = "function():string -- Returns the total energy capacity of the machine.") public Object[] getCapacity(final Context context, final Arguments args) { - return new Object[]{tileEntity.getCapacity()}; + return new Object[] { tileEntity.getCapacity() }; } @Callback(doc = "function():number -- Returns the passive drain of the machine, in EU/t.") public Object[] getPassiveDrain(final Context context, final Arguments args) { - return new Object[]{tileEntity.getPassiveDrain()}; + return new Object[] { tileEntity.getPassiveDrain() }; } @Callback(doc = "function():number -- Returns the average net EU/t in or out over the last second.") public Object[] getAverageIOLastSec(final Context context, final Arguments args) { - return new Object[]{tileEntity.getAverageIOLastSec()}; + return new Object[] { tileEntity.getAverageIOLastSec() }; } } } diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java index e8f56345cd7..6d1c9b9844f 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/specific/DriverWorldAccelerator.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityWorldAccelerator; import gregtech.integration.opencomputers.drivers.EnvironmentMetaTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class DriverWorldAccelerator extends DriverSidedTileEntity { @@ -34,42 +36,41 @@ public ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacin TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IGregTechTileEntity) { return new EnvironmentTileEntityWorldAccelerator((IGregTechTileEntity) tileEntity, - (MetaTileEntityWorldAccelerator) ((IGregTechTileEntity) tileEntity).getMetaTileEntity() - ); + (MetaTileEntityWorldAccelerator) ((IGregTechTileEntity) tileEntity).getMetaTileEntity()); } return null; } public final static class EnvironmentTileEntityWorldAccelerator extends - EnvironmentMetaTileEntity { + EnvironmentMetaTileEntity { - public EnvironmentTileEntityWorldAccelerator(IGregTechTileEntity holder, MetaTileEntityWorldAccelerator tileEntity) { + public EnvironmentTileEntityWorldAccelerator(IGregTechTileEntity holder, + MetaTileEntityWorldAccelerator tileEntity) { super(holder, tileEntity, "gt_worldAccelerator"); } @Callback(doc = "function():boolean -- Returns the mode of machine.") public Object[] isTileMode(final Context context, final Arguments args) { - return new Object[]{tileEntity.isTEMode()}; + return new Object[] { tileEntity.isTEMode() }; } @Callback(doc = "function(isTile:boolean) -- Sets the mode of machine.") public Object[] setTileMode(final Context context, final Arguments args) { tileEntity.setTEMode(args.checkBoolean(0)); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():boolean -- Returns is working enabled.") public Object[] isWorkingEnabled(final Context context, final Arguments args) { - return new Object[]{tileEntity.isWorkingEnabled()}; + return new Object[] { tileEntity.isWorkingEnabled() }; } - @Callback(doc = "function(workingEnabled:boolean):boolean -- " - + "Sets working enabled, return last working enabled.") + @Callback(doc = "function(workingEnabled:boolean):boolean -- " + + "Sets working enabled, return last working enabled.") public Object[] setWorkingEnabled(final Context context, final Arguments args) { boolean lsatState = tileEntity.isWorkingEnabled(); tileEntity.setWorkingEnabled(args.checkBoolean(0)); - return new Object[]{lsatState}; + return new Object[] { lsatState }; } - } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java index 53ee3974d00..110fbdf9d5b 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverBehavior.java @@ -4,10 +4,7 @@ import gregtech.api.cover.Cover; import gregtech.api.cover.CoverableView; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.prefab.AbstractValue; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.TileEntity; @@ -16,6 +13,11 @@ import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; +import li.cil.oc.api.machine.Arguments; +import li.cil.oc.api.machine.Callback; +import li.cil.oc.api.machine.Context; +import li.cil.oc.api.prefab.AbstractValue; + import java.util.Objects; public class ValueCoverBehavior extends AbstractValue { @@ -25,7 +27,7 @@ public class ValueCoverBehavior extends AbstractValue { private int dim; private String coverName; - public final Object[] NULL_COVER = new Object[]{null, "Found no cover, this is an invalid object."}; + public final Object[] NULL_COVER = new Object[] { null, "Found no cover, this is an invalid object." }; protected ValueCoverBehavior(Cover cover, EnumFacing side, String coverName) { this.pos = cover.getPos(); @@ -52,12 +54,12 @@ protected Cover getCover() { @Callback(doc = "function():number -- Returns the side of the cover.") public Object[] getSide(final Context context, final Arguments args) { - return new Object[]{side.ordinal()}; + return new Object[] { side.ordinal() }; } @Callback(doc = "function():string -- Returns the type name of the cover.") public Object[] getTypeName(final Context context, final Arguments args) { - return new Object[]{coverName}; + return new Object[] { coverName }; } @Callback(doc = "function():number -- Gets redstone signal output.") @@ -67,7 +69,7 @@ public final Object[] getRedstoneSignalOutput(final Context context, final Argum return NULL_COVER; } - return new Object[]{cover.getRedstoneSignalOutput()}; + return new Object[] { cover.getRedstoneSignalOutput() }; } @Callback(doc = "function():number -- Gets redstone signal input.") @@ -77,7 +79,7 @@ public final Object[] getRedstoneSignalInput(final Context context, final Argume return NULL_COVER; } - return new Object[]{cover.getCoverableView().getInputRedstoneSignal(cover.getAttachedSide(), true)}; + return new Object[] { cover.getCoverableView().getInputRedstoneSignal(cover.getAttachedSide(), true) }; } @Override diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java index 2a93f1ef8d9..1694dcff6fc 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverConveyor.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverConveyor; import gregtech.common.covers.CoverConveyor.ConveyorMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverConveyor extends ValueCoverBehavior { @@ -32,7 +34,7 @@ public Object[] getTier(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.tier}; + return new Object[] { cover.tier }; } @Callback(doc = "function():number -- Returns transfer rate.") @@ -42,7 +44,7 @@ public Object[] getTransferRate(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferRate()}; + return new Object[] { cover.getTransferRate() }; } @Callback(doc = "function(number) -- Sets transfer rate.") @@ -54,7 +56,7 @@ public Object[] setTransferRate(final Context context, final Arguments args) { int transferRate = InputValidator.getInteger(args, 0, 0, cover.maxItemTransferRate); cover.setTransferRate(transferRate); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(mode:number) -- Sets conveyor mode. (0:IMPORT, 1:EXPORT)") @@ -66,7 +68,7 @@ public Object[] setConveyorMode(final Context context, final Arguments args) { ConveyorMode mode = InputValidator.getEnumArrayIndex(args, 0, ConveyorMode.values()); cover.setConveyorMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets conveyor mode. (0:IMPORT, 1:EXPORT)") @@ -76,6 +78,6 @@ public Object[] getConveyorMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getConveyorMode().ordinal()}; + return new Object[] { cover.getConveyorMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java index 1a87f4d6ea4..8f919385959 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverEnderFluidLink.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverEnderFluidLink; import gregtech.common.covers.CoverPump.PumpMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverEnderFluidLink extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setColorChannel(final Context context, final Arguments args) { String colorString = InputValidator.getColorString(args, 0); cover.updateColor(colorString); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():string -- Gets the color channel.") @@ -40,7 +42,7 @@ public Object[] getColorChannel(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getColorStr()}; + return new Object[] { cover.getColorStr() }; } @Callback(doc = "function(mode:number) -- Sets pump mode. (0:IMPORT, 1:EXPORT)") @@ -52,7 +54,7 @@ public Object[] setPumpMode(final Context context, final Arguments args) { PumpMode mode = InputValidator.getEnumArrayIndex(args, 0, PumpMode.values()); cover.setPumpMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets pump mode. (0:IMPORT, 1:EXPORT)") @@ -62,6 +64,6 @@ public Object[] getPumpMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getPumpMode().ordinal()}; + return new Object[] { cover.getPumpMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java index e5434f63ae3..c5d30e10fc2 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidFilter.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverFluidFilter; import gregtech.common.covers.FluidFilterMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverFluidFilter extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setFilterMode(final Context context, final Arguments args) { FluidFilterMode mode = InputValidator.getEnumArrayIndex(args, 0, FluidFilterMode.values()); cover.setFilterMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets filter mode. (0:FILTER_FILL, 1:FILTER_DRAIN, 2:FILTER_BOTH)") @@ -40,6 +42,6 @@ public Object[] getFilterMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getFilterMode().ordinal()}; + return new Object[] { cover.getFilterMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java index dba40e29624..d4da4ca7e10 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverFluidRegulator.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverFluidRegulator; import gregtech.common.covers.TransferMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverFluidRegulator extends ValueCoverPump { @@ -30,7 +32,7 @@ public Object[] setTransferMode(final Context context, final Arguments args) { TransferMode mode = InputValidator.getEnumArrayIndex(args, 0, TransferMode.values()); cover.setTransferMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets transfer mode. (0:TRANSFER_ANY, 1:TRANSFER_EXACT, 2:KEEP_EXACT)") @@ -40,6 +42,6 @@ public Object[] getTransferMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferMode().ordinal()}; + return new Object[] { cover.getTransferMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java index 6a3c316e6de..dc0a9255641 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverItemFilter.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverItemFilter; import gregtech.common.covers.ItemFilterMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverItemFilter extends ValueCoverBehavior { @@ -30,7 +32,7 @@ public Object[] setFilterMode(final Context context, final Arguments args) { ItemFilterMode mode = InputValidator.getEnumArrayIndex(args, 0, ItemFilterMode.values()); cover.setFilterMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets filter mode. (0:FILTER_INSERT, 1:FILTER_EXTRACT, 2:FILTER_BOTH)") @@ -40,6 +42,6 @@ public Object[] getFilterMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getFilterMode().ordinal()}; + return new Object[] { cover.getFilterMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java index bb828702466..87c9d6457fa 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverPump.java @@ -4,10 +4,12 @@ import gregtech.common.covers.CoverPump; import gregtech.common.covers.CoverPump.PumpMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverPump extends ValueCoverBehavior { @@ -32,7 +34,7 @@ public Object[] getTier(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.tier}; + return new Object[] { cover.tier }; } @Callback(doc = "function():number -- Returns transfer rate.") @@ -42,7 +44,7 @@ public Object[] getTransferRate(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferRate()}; + return new Object[] { cover.getTransferRate() }; } @Callback(doc = "function(number) -- Sets transfer rate.") @@ -54,7 +56,7 @@ public Object[] setTransferRate(final Context context, final Arguments args) { int transferRate = InputValidator.getInteger(args, 0, 0, cover.maxFluidTransferRate); cover.setTransferRate(transferRate); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function(mode:number) -- Sets pump mode. (0:IMPORT, 1:EXPORT)") @@ -66,7 +68,7 @@ public Object[] setPumpMode(final Context context, final Arguments args) { PumpMode mode = InputValidator.getEnumArrayIndex(args, 0, PumpMode.values()); cover.setPumpMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets pump mode. (0:IMPORT, 1:EXPORT)") @@ -76,6 +78,6 @@ public Object[] getPumpMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getPumpMode().ordinal()}; + return new Object[] { cover.getPumpMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java index 9099f7535ca..a77408d05ca 100644 --- a/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java +++ b/src/main/java/gregtech/integration/opencomputers/values/ValueCoverRoboticArm.java @@ -3,10 +3,12 @@ import gregtech.common.covers.CoverRoboticArm; import gregtech.common.covers.TransferMode; import gregtech.integration.opencomputers.InputValidator; + +import net.minecraft.util.EnumFacing; + import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; -import net.minecraft.util.EnumFacing; public class ValueCoverRoboticArm extends ValueCoverConveyor { @@ -28,7 +30,7 @@ public Object[] setTransferMode(final Context context, final Arguments args) { TransferMode mode = InputValidator.getEnumArrayIndex(args, 0, TransferMode.values()); cover.setTransferMode(mode); - return new Object[]{}; + return new Object[] {}; } @Callback(doc = "function():number -- Gets transfer mode. (0:TRANSFER_ANY, 1:TRANSFER_EXACT, 2:KEEP_EXACT)") @@ -38,6 +40,6 @@ public Object[] getTransferMode(final Context context, final Arguments args) { return NULL_COVER; } - return new Object[]{cover.getTransferMode().ordinal()}; + return new Object[] { cover.getTransferMode().ordinal() }; } } diff --git a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java index 9afdb46c5d5..943448ce2ce 100644 --- a/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java +++ b/src/main/java/gregtech/integration/theoneprobe/TheOneProbeModule.java @@ -7,17 +7,18 @@ import gregtech.integration.theoneprobe.provider.debug.DebugPipeNetInfoProvider; import gregtech.integration.theoneprobe.provider.debug.DebugTickTimeProvider; import gregtech.modules.GregTechModules; + +import net.minecraftforge.fml.common.event.FMLInitializationEvent; + import mcjty.theoneprobe.TheOneProbe; import mcjty.theoneprobe.api.ITheOneProbe; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; @GregTechModule( - moduleID = GregTechModules.MODULE_TOP, - containerID = GTValues.MODID, - modDependencies = GTValues.MODID_TOP, - name = "GregTech TheOneProbe Integration", - description = "TheOneProbe Integration Module" -) + moduleID = GregTechModules.MODULE_TOP, + containerID = GTValues.MODID, + modDependencies = GTValues.MODID_TOP, + name = "GregTech TheOneProbe Integration", + description = "TheOneProbe Integration Module") public class TheOneProbeModule extends IntegrationSubmodule { @Override diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java index d6a4e7ef8fb..e4a0747660a 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/BlockOreInfoProvider.java @@ -3,12 +3,14 @@ import gregtech.api.GTValues; import gregtech.api.unification.ore.StoneType; import gregtech.common.blocks.BlockOre; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + public class BlockOreInfoProvider implements IProbeInfoProvider { @Override @@ -17,13 +19,15 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, World world, IBlockState blockState, IProbeHitData probeHitData) { + public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, World world, + IBlockState blockState, IProbeHitData probeHitData) { if (blockState.getBlock() instanceof BlockOre) { StoneType stoneType = blockState.getValue(((BlockOre) blockState.getBlock()).STONE_TYPE); if (entityPlayer.isSneaking() && !stoneType.shouldBeDroppedAsItem) { probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.block_drops*}:"); ItemStack itemDropped = blockState.getBlock().getItem(world, probeHitData.getPos(), blockState); - IProbeInfo horizontalInfo = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); + IProbeInfo horizontalInfo = probeInfo + .horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); horizontalInfo.item(itemDropped); horizontalInfo.itemLabel(itemDropped); } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java index 76448c16368..511f5187dfa 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java @@ -1,15 +1,16 @@ package gregtech.integration.theoneprobe.provider; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + import javax.annotation.Nonnull; public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @@ -17,14 +18,16 @@ public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @Nonnull protected abstract Capability getCapability(); - protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data); + protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, + IProbeHitData data); protected boolean allowDisplaying(T capability) { return true; } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity == null) return; diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java index f9456324654..58bcc90d46c 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java @@ -3,13 +3,15 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class ControllableInfoProvider extends CapabilityInfoProvider { @@ -26,7 +28,9 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IControllable capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { - if (!capability.isWorkingEnabled()) probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.working_disabled*}"); + protected void addProbeInfo(@Nonnull IControllable capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, + @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + if (!capability.isWorkingEnabled()) + probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.working_disabled*}"); } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java index 4f83cf4ec4a..fb205454caf 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java @@ -6,15 +6,17 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.converter.ConverterTrait; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class ConverterInfoProvider extends CapabilityInfoProvider { @@ -31,9 +33,11 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, + @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { // Info on current converter mode - probeInfo.text(TextStyleClass.INFO + ((capability.isFeToEu()) ? "{*gregtech.top.convert_fe*}" : "{*gregtech.top.convert_eu*}")); + probeInfo.text(TextStyleClass.INFO + + ((capability.isFeToEu()) ? "{*gregtech.top.convert_fe*}" : "{*gregtech.top.convert_eu*}")); // Info on the current side of the converter EnumFacing facing = ((IGregTechTileEntity) tileEntity).getMetaTileEntity().getFrontFacing(); @@ -41,15 +45,19 @@ protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeI long amperage = capability.getBaseAmps(); if (capability.isFeToEu()) { if (data.getSideHit() == facing) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + voltageN + TextFormatting.GREEN + " (" + amperage + "A)"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + voltageN + + TextFormatting.GREEN + " (" + amperage + "A)"); } else { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + TextFormatting.RED + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(true)) + " FE"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + TextFormatting.RED + + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(true)) + " FE"); } } else { if (data.getSideHit() == facing) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + TextFormatting.RED + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(false)) + " FE"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_output*} " + TextFormatting.RED + + FeCompat.toFe(capability.getVoltage() * amperage, FeCompat.ratio(false)) + " FE"); } else { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + voltageN + TextFormatting.GREEN + " (" + amperage + "A)"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.transform_input*} " + voltageN + + TextFormatting.GREEN + " (" + amperage + "A)"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java index 72080f1e00d..e1f9bc47594 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java @@ -7,14 +7,16 @@ import gregtech.api.util.TextFormattingUtil; import gregtech.common.covers.*; import gregtech.common.covers.filter.*; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -32,7 +34,9 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { Cover cover = capability.getCoverAtSide(data.getSideHit()); if (cover instanceof CoverConveyor conveyor) { conveyorInfo(probeInfo, conveyor); @@ -58,14 +62,16 @@ private static void conveyorInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverCo if (conveyor instanceof CoverItemVoiding) { itemVoidingInfo(probeInfo, (CoverItemVoiding) conveyor); - } else if (!(conveyor instanceof CoverRoboticArm) || ((CoverRoboticArm) conveyor).getTransferMode() == TransferMode.TRANSFER_ANY) { - // only display the regular rate if the cover does not have a specialized rate - transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); - } + } else if (!(conveyor instanceof CoverRoboticArm) || + ((CoverRoboticArm) conveyor).getTransferMode() == TransferMode.TRANSFER_ANY) { + // only display the regular rate if the cover does not have a specialized rate + transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); + } ItemFilterContainer filter = conveyor.getItemFilterContainer(); if (conveyor instanceof CoverRoboticArm roboticArm) { - transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), filter.getFilterWrapper().getItemFilter() != null); + transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), + filter.getFilterWrapper().getItemFilter() != null); } itemFilterText(probeInfo, filter.getFilterWrapper().getItemFilter()); } @@ -82,7 +88,8 @@ private static void itemVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove ItemFilterContainer container = voiding.getItemFilterContainer(); if (voiding instanceof CoverItemVoidingAdvanced advanced) { VoidingMode mode = advanced.getVoidingMode(); - voidingText(probeInfo, mode, unit, container.getTransferStackSize(), container.getFilterWrapper().getItemFilter() != null); + voidingText(probeInfo, mode, unit, container.getTransferStackSize(), + container.getFilterWrapper().getItemFilter() != null); } } @@ -97,14 +104,18 @@ private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump p if (pump instanceof CoverFluidVoiding) { fluidVoidingInfo(probeInfo, (CoverFluidVoiding) pump); - } else if (!(pump instanceof CoverFluidRegulator) || ((CoverFluidRegulator) pump).getTransferMode() == TransferMode.TRANSFER_ANY) { - // do not display the regular rate if the cover has a specialized rate - transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, pump.getBucketMode() == CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : pump.getTransferRate()); - } + } else if (!(pump instanceof CoverFluidRegulator) || + ((CoverFluidRegulator) pump).getTransferMode() == TransferMode.TRANSFER_ANY) { + // do not display the regular rate if the cover has a specialized rate + transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, + pump.getBucketMode() == CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : + pump.getTransferRate()); + } FluidFilterContainer filter = pump.getFluidFilterContainer(); if (pump instanceof CoverFluidRegulator regulator) { - transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), filter.getFilterWrapper().getFluidFilter() != null); + transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), + filter.getFilterWrapper().getFluidFilter() != null); } fluidFilterText(probeInfo, filter.getFilterWrapper().getFluidFilter()); } @@ -116,12 +127,16 @@ private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump p * @param voiding the voiding cover to get data from */ private static void fluidVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverFluidVoiding voiding) { - String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gregtech.top.unit.fluid_buckets*}" : " {*gregtech.top.unit.fluid_milibuckets*}"; + String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gregtech.top.unit.fluid_buckets*}" : + " {*gregtech.top.unit.fluid_milibuckets*}"; if (voiding instanceof CoverFluidVoidingAdvanced advanced) { VoidingMode mode = advanced.getVoidingMode(); // do not display amount in overflow when a filter is present - voidingText(probeInfo, mode, unit, voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? advanced.getTransferAmount() / 1000 : advanced.getTransferAmount(), voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); + voidingText(probeInfo, mode, unit, + voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? advanced.getTransferAmount() / 1000 : + advanced.getTransferAmount(), + voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); } } @@ -154,7 +169,8 @@ private static void fluidFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove * @param enderFluidLink the ender fluid link cover to get data from */ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverEnderFluidLink enderFluidLink) { - transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); + transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", + enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); fluidFilterText(probeInfo, enderFluidLink.getFluidFilterContainer().getFilterWrapper().getFluidFilter()); if (!enderFluidLink.getColorStr().isEmpty()) { @@ -162,7 +178,6 @@ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull C } } - /** * Displays text for {@link IIOMode} covers * @@ -171,9 +186,11 @@ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull C * @param rateUnit the unit of what is transferred * @param rate the transfer rate of the mode */ - private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIOMode mode, @Nonnull String rateUnit, int rate) { + private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIOMode mode, @Nonnull String rateUnit, + int rate) { String modeText = mode.isImport() ? "{*gregtech.top.mode.import*} " : "{*gregtech.top.mode.export*} "; - probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + TextFormattingUtil.formatNumbers(rate) + rateUnit); + probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + TextFormattingUtil.formatNumbers(rate) + + rateUnit); } /** @@ -185,7 +202,8 @@ private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIO * @param rate the transfer rate of the mode * @param hasFilter whether the cover has a filter installed */ - private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull TransferMode mode, @Nonnull String rateUnit, int rate, boolean hasFilter) { + private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull TransferMode mode, + @Nonnull String rateUnit, int rate, boolean hasFilter) { String text = TextStyleClass.OK + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (!hasFilter && mode != TransferMode.TRANSFER_ANY) text += TextStyleClass.LABEL + " " + rate + rateUnit; probeInfo.text(text); @@ -200,7 +218,8 @@ private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull Tra * @param amount the transfer rate of the mode * @param hasFilter whether the cover has a filter in it or not */ - private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingMode mode, @Nonnull String unit, int amount, boolean hasFilter) { + private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingMode mode, @Nonnull String unit, + int amount, boolean hasFilter) { String text = TextFormatting.RED + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (mode != VoidingMode.VOID_ANY && !hasFilter) text += " " + amount + unit; probeInfo.text(text); @@ -228,7 +247,8 @@ private static void itemFilterText(@Nonnull IProbeInfo probeInfo, @Nullable Item String expression = ((OreDictionaryItemFilter) filter).getExpression(); if (!expression.isEmpty()) probeInfo.text(label + expression); } else if (filter instanceof SmartItemFilter) { - probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + IProbeInfo.ENDLOC); + probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + + IProbeInfo.ENDLOC); } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java index a5a09fb7a9b..3896aff8dc5 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.common.metatileentities.electric.MetaTileEntityDiode; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class DiodeInfoProvider extends ElectricContainerInfoProvider { @@ -21,16 +23,19 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityDiode) { if (capability.inputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO + TextFormatting.GOLD.toString() - + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + capability.getInputAmperage() + " A"); + probeInfo.text( + TextStyleClass.INFO + TextFormatting.GOLD.toString() + "{*gregtech.top.transform_input*} " + + TextFormatting.RESET + capability.getInputAmperage() + " A"); } else if (capability.outputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() - + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + capability.getOutputAmperage() + " A"); + probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() + + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + + capability.getOutputAmperage() + " A"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java index 0367553191e..40e4e96cab9 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java @@ -3,12 +3,14 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IEnergyContainer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; + import javax.annotation.Nonnull; public class ElectricContainerInfoProvider extends CapabilityInfoProvider { @@ -30,7 +32,8 @@ protected boolean allowDisplaying(@Nonnull IEnergyContainer capability) { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() @@ -39,5 +42,4 @@ protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProb .alternateFilledColor(0xFFEEE600) .borderColor(0xFF555555)); } - } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java index d6340587d22..d6170974374 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java @@ -5,13 +5,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.pipenet.longdist.ILDEndpoint; import gregtech.api.pipenet.longdist.LongDistanceNetwork; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + import javax.annotation.Nonnull; public class LDPipeProvider implements IProbeInfoProvider { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java index 4bf6dc3a01a..5c6e9571ca7 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LampInfoProvider.java @@ -2,13 +2,15 @@ import gregtech.api.GTValues; import gregtech.common.blocks.BlockLamp; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.IProbeInfoProvider; import mcjty.theoneprobe.api.ProbeMode; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; public class LampInfoProvider implements IProbeInfoProvider { @@ -18,7 +20,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo info, EntityPlayer player, World world, IBlockState state, IProbeHitData hitData) { + public void addProbeInfo(ProbeMode mode, IProbeInfo info, EntityPlayer player, World world, IBlockState state, + IProbeHitData hitData) { if (state.getBlock() instanceof BlockLamp) { BlockLamp lamp = (BlockLamp) state.getBlock(); boolean inverted = lamp.isInverted(state); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java index 4125fafec59..922bee89460 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java @@ -3,16 +3,19 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.ILaserContainer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; + +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; public class LaserContainerInfoProvider extends CapabilityInfoProvider { + @NotNull @Override protected Capability getCapability() { @@ -25,7 +28,8 @@ protected boolean allowDisplaying(@Nonnull ILaserContainer capability) { } @Override - protected void addProbeInfo(ILaserContainer capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data) { + protected void addProbeInfo(ILaserContainer capability, IProbeInfo probeInfo, EntityPlayer player, + TileEntity tileEntity, IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java index c6bc9ed0ddb..09a95a16bc1 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java @@ -7,16 +7,18 @@ import gregtech.api.unification.material.Materials; import gregtech.common.ConfigHolder; import gregtech.common.items.ToolItems; -import mcjty.theoneprobe.api.ElementAlignment; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.ElementAlignment; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MaintenanceInfoProvider extends CapabilityInfoProvider { @@ -40,17 +42,20 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, IProbeHitData data) { + protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, EntityPlayer player, + TileEntity tileEntity, IProbeHitData data) { if (ConfigHolder.machines.enableMaintenance && capability.hasMaintenanceMechanics()) { if (tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null)) { - //noinspection ConstantConditions - if (tileEntity.getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null).isStructureFormed()) { + // noinspection ConstantConditions + if (tileEntity.getCapability(GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER, null) + .isStructureFormed()) { if (capability.hasMaintenanceProblems()) { if (player.isSneaking()) { int problems = capability.getMaintenanceProblems(); for (byte i = 0; i < 6; i++) { if (((problems >> i) & 1) == 0) { - IProbeInfo horizontal = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); + IProbeInfo horizontal = probeInfo.horizontal( + probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); ItemStack stack = ItemStack.EMPTY; String text = ""; switch (i) { @@ -85,7 +90,8 @@ protected void addProbeInfo(IMaintenance capability, IProbeInfo probeInfo, Entit break; } } - horizontal.item(stack).text(TextFormatting.RED + IProbeInfo.STARTLOC + text + IProbeInfo.ENDLOC); + horizontal.item(stack) + .text(TextFormatting.RED + IProbeInfo.STARTLOC + text + IProbeInfo.ENDLOC); } } } else { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java index 081a395039e..a26817af470 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IMultipleRecipeMaps; import gregtech.api.recipes.RecipeMap; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MultiRecipeMapInfoProvider extends CapabilityInfoProvider { @@ -27,10 +29,13 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IMultipleRecipeMaps iMultipleRecipeMaps, @Nonnull IProbeInfo iProbeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IMultipleRecipeMaps iMultipleRecipeMaps, @Nonnull IProbeInfo iProbeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (iMultipleRecipeMaps.getAvailableRecipeMaps().length == 1) return; - iProbeInfo.text(TextStyleClass.INFO + IProbeInfo.STARTLOC + "gregtech.multiblock.multiple_recipemaps.header" + IProbeInfo.ENDLOC); + iProbeInfo.text(TextStyleClass.INFO + IProbeInfo.STARTLOC + "gregtech.multiblock.multiple_recipemaps.header" + + IProbeInfo.ENDLOC); for (RecipeMap recipeMap : iMultipleRecipeMaps.getAvailableRecipeMaps()) { if (recipeMap.equals(iMultipleRecipeMaps.getCurrentRecipeMap())) { iProbeInfo.text(" " + TextStyleClass.INFOIMP + "{*" + recipeMap.getTranslationKey() + "*} {*<*}"); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java index 5c44a447411..82e36f8ce2a 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java @@ -3,14 +3,16 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IMultiblockController; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class MultiblockInfoProvider extends CapabilityInfoProvider { @@ -27,7 +29,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IMultiblockController capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IMultiblockController capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (capability.isStructureFormed()) { probeInfo.text(TextStyleClass.OK + "{*gregtech.top.valid_structure*}"); if (capability.isStructureObstructed()) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java index 8201544092c..94d253c514b 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java @@ -4,13 +4,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IPrimitivePump; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + import javax.annotation.Nonnull; public class PrimitivePumpInfoProvider implements IProbeInfoProvider { @@ -21,14 +23,17 @@ public String getID() { } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (!(tileEntity instanceof IGregTechTileEntity)) return; MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof IPrimitivePump) { - probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.primitive_pump_production*} " + TextFormatting.AQUA + ((IPrimitivePump) metaTileEntity).getFluidProduction() + TextFormatting.RESET + " L/s"); + probeInfo.text( + TextStyleClass.INFO + "{*gregtech.top.primitive_pump_production*} " + TextFormatting.AQUA + + ((IPrimitivePump) metaTileEntity).getFluidProduction() + TextFormatting.RESET + " L/s"); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java index b999a84cbeb..7bee7e657bc 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java @@ -11,14 +11,16 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class RecipeLogicInfoProvider extends CapabilityInfoProvider { @@ -35,7 +37,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { // do not show energy usage on machines that do not use energy if (capability.isWorking()) { if (capability instanceof PrimitiveRecipeLogic) { @@ -48,13 +52,17 @@ protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IP if (tileEntity instanceof IGregTechTileEntity) { IGregTechTileEntity gtTileEntity = (IGregTechTileEntity) tileEntity; MetaTileEntity mte = gtTileEntity.getMetaTileEntity(); - if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || mte instanceof RecipeMapSteamMultiblockController) { - text = TextFormatting.AQUA.toString() + absEUt + TextStyleClass.INFO + " L/t {*" + Materials.Steam.getUnlocalizedName() + "*}"; + if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler || + mte instanceof RecipeMapSteamMultiblockController) { + text = TextFormatting.AQUA.toString() + absEUt + TextStyleClass.INFO + " L/t {*" + + Materials.Steam.getUnlocalizedName() + "*}"; } } if (text == null) { - // Default behavior, if this TE is not a steam machine (or somehow not instanceof IGregTechTileEntity...) - text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + TextFormatting.GREEN + " (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.GREEN + ")"; + // Default behavior, if this TE is not a steam machine (or somehow not instanceof + // IGregTechTileEntity...) + text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + TextFormatting.GREEN + + " (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.GREEN + ")"; } if (EUt == 0) return; // idk what to do for 0 eut diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java index 2ee863d7d82..4ccdc7125d0 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/SteamBoilerInfoProvider.java @@ -5,13 +5,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; import gregtech.common.metatileentities.steam.boiler.SteamBoiler; -import mcjty.theoneprobe.api.*; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import mcjty.theoneprobe.api.*; + public class SteamBoilerInfoProvider implements IProbeInfoProvider { @Override @@ -20,7 +22,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state, IProbeHitData data) { + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state, + IProbeHitData data) { if (state.getBlock().hasTileEntity(state)) { TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof IGregTechTileEntity igtte) { @@ -32,16 +35,15 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play // Creating steam if (steamOutput > 0 && boiler.hasWater()) { - probeInfo.text(TextStyleClass.INFO - + "{*gregtech.top.energy_production*} " - + TextFormatting.AQUA + (steamOutput / 10) - + TextStyleClass.INFO + " L/t" - + " {*" + Materials.Steam.getUnlocalizedName() + "*}"); + probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_production*} " + + TextFormatting.AQUA + (steamOutput / 10) + TextStyleClass.INFO + " L/t" + " {*" + + Materials.Steam.getUnlocalizedName() + "*}"); } // Initial heat-up if (steamOutput <= 0) { - probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED + "{*gregtech.top.steam_heating_up*}"); + probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED + + "{*gregtech.top.steam_heating_up*}"); } // No water diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java index 55881670f62..774de2cb1d0 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java @@ -6,13 +6,15 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.util.GTUtility; import gregtech.common.metatileentities.electric.MetaTileEntityTransformer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextFormatting; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; + import javax.annotation.Nonnull; public class TransformerInfoProvider extends ElectricContainerInfoProvider { @@ -23,7 +25,8 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, + EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityTransformer) { @@ -42,18 +45,19 @@ protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProb .append("A)"); // Step Up/Step Down line - probeInfo.text(TextStyleClass.INFO + (((MetaTileEntityTransformer) metaTileEntity).isInverted() - ? TextFormatting.RED + "{*gregtech.top.transform_up*} " + TextFormatting.RESET - : TextFormatting.GREEN + "{*gregtech.top.transform_down*} " + TextFormatting.RESET) - + input + " -> " + output); + probeInfo.text(TextStyleClass.INFO + + (((MetaTileEntityTransformer) metaTileEntity).isInverted() ? + TextFormatting.RED + "{*gregtech.top.transform_up*} " + TextFormatting.RESET : + TextFormatting.GREEN + "{*gregtech.top.transform_down*} " + TextFormatting.RESET) + + input + " -> " + output); // Input/Output side line if (capability.inputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO - + TextFormatting.GOLD.toString() + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + input); + probeInfo.text(TextStyleClass.INFO + TextFormatting.GOLD.toString() + + "{*gregtech.top.transform_input*} " + TextFormatting.RESET + input); } else if (capability.outputsEnergy(data.getSideHit())) { - probeInfo.text(TextStyleClass.INFO - + TextFormatting.BLUE.toString() + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + output); + probeInfo.text(TextStyleClass.INFO + TextFormatting.BLUE.toString() + + "{*gregtech.top.transform_output*} " + TextFormatting.RESET + output); } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java index c7bd37ca686..966498a355d 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java @@ -4,12 +4,14 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IWorkable; import gregtech.api.capability.impl.ComputationRecipeLogic; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.capabilities.Capability; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; + import javax.annotation.Nonnull; public class WorkableInfoProvider extends CapabilityInfoProvider { @@ -26,7 +28,9 @@ protected Capability getCapability() { } @Override - protected void addProbeInfo(@Nonnull IWorkable capability, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@Nonnull IWorkable capability, @Nonnull IProbeInfo probeInfo, + @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, + @Nonnull IProbeHitData data) { if (!capability.isActive()) return; int currentProgress = capability.getProgress(); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java index 2817069299c..79146b737db 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java @@ -8,27 +8,32 @@ import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.pipenet.tile.TileEntityPipeBase; import gregtech.common.ConfigHolder; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + public class DebugPipeNetInfoProvider implements IProbeInfoProvider { + @Override public String getID() { return "gregtech:debug_pipe_net_provider"; } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, + @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { if (ConfigHolder.misc.debug) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity instanceof IGregTechTileEntity) { @@ -57,11 +62,11 @@ public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, probeInfo.text(builder.toString()); } probeInfo.text("tile open: " + pipeTile.getConnections()); -// if (blockPipe instanceof BlockFluidPipe) { -// if (pipeTile instanceof TileEntityFluidPipeTickable) { -// probeInfo.text("tile active: " + ((TileEntityFluidPipeTickable) pipeTile).isActive()); -// } -// } + // if (blockPipe instanceof BlockFluidPipe) { + // if (pipeTile instanceof TileEntityFluidPipeTickable) { + // probeInfo.text("tile active: " + ((TileEntityFluidPipeTickable) pipeTile).isActive()); + // } + // } } } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java index b9bcf38846b..2cab557888c 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugTickTimeProvider.java @@ -3,15 +3,17 @@ import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.TextFormattingUtil; import gregtech.common.ConfigHolder; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; + import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; + public class DebugTickTimeProvider implements IProbeInfoProvider { @Override @@ -20,7 +22,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, + IBlockState blockState, IProbeHitData data) { if (ConfigHolder.misc.debug) { TileEntity tile = world.getTileEntity(data.getPos()); if (tile instanceof MetaTileEntityHolder holder) { @@ -30,7 +33,9 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play double worstTickTime = timeStatistics[1]; // this is for dev environment debug, so don't worry about translating - probeInfo.text("Average: " + TextFormattingUtil.formatNumbers(averageTickTime / MetaTileEntityHolder.TRACKED_TICKS) + "ns"); + probeInfo.text("Average: " + + TextFormattingUtil.formatNumbers(averageTickTime / MetaTileEntityHolder.TRACKED_TICKS) + + "ns"); probeInfo.text("Worst: " + TextFormattingUtil.formatNumbers(worstTickTime) + "ns"); } } diff --git a/src/main/java/gregtech/integration/xaero/ColorUtility.java b/src/main/java/gregtech/integration/xaero/ColorUtility.java index 043ffc1423f..5b365c20b6b 100644 --- a/src/main/java/gregtech/integration/xaero/ColorUtility.java +++ b/src/main/java/gregtech/integration/xaero/ColorUtility.java @@ -2,17 +2,20 @@ import java.awt.*; -// **************************************************************************************** -/** Utilities for converting between various colour spaces. Note that the default scaling - * for RGB is 0-1 and hue is expressed as degrees (0-360). For other values, see - * documentation for each conversion routine. - * @author Jo Wood,giCentre, City University London. Includes modified code from Duane - * Schwartzwald and Harry Parker. - * @version 3.4, 5th February, 2016. +// **************************************************************************************** +/** + * Utilities for converting between various colour spaces. Note that the default scaling + * for RGB is 0-1 and hue is expressed as degrees (0-360). For other values, see + * documentation for each conversion routine. + * + * @author Jo Wood,giCentre, City University London. Includes modified code from Duane + * Schwartzwald and Harry Parker. + * @version 3.4, 5th February, 2016. */ // ***************************************************************************************** -/* This file is part of giCentre utilities library. gicentre.utils is free software: you can +/* + * This file is part of giCentre utilities library. gicentre.utils is free software: you can * redistribute it and/or modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. @@ -27,6 +30,7 @@ */ public class ColorUtility { + public enum WhitePoint { // Tristimulus values taken from Schanda, J. (19xx) Colorimetry, p.74 @@ -54,7 +58,7 @@ public enum WhitePoint { private double[] params; private WhitePoint(double X, double Y, double Z) { - params = new double[]{X, Y, Z}; + params = new double[] { X, Y, Z }; } /** @@ -67,13 +71,12 @@ private WhitePoint(double X, double Y, double Z) { } } - /** * sRGB to XYZ conversion matrix (3x3) */ - static final double[][] M = {{0.4124, 0.3576, 0.1805}, // RX, GX, BX - {0.2126, 0.7152, 0.0722}, // RY, GY, BY - {0.0193, 0.1192, 0.9505}}; // RZ, GZ, BZ + static final double[][] M = { { 0.4124, 0.3576, 0.1805 }, // RX, GX, BX + { 0.2126, 0.7152, 0.0722 }, // RY, GY, BY + { 0.0193, 0.1192, 0.9505 } }; // RZ, GZ, BZ /** * Finds the CIELab triplet representing the given colour. CIELab L value scaled between 0-100, @@ -98,7 +101,7 @@ static double[] RGBtoXYZ(Color colour) { double r = colour.getRed() / 255.0; double g = colour.getGreen() / 255.0; double b = colour.getBlue() / 255.0; - return RGBtoXYZ(new double[]{r, g, b}); + return RGBtoXYZ(new double[] { r, g, b }); } /** @@ -163,7 +166,6 @@ static double[] XYZtoLAB(double[] XYZ, WhitePoint wp) { z = (7.787 * z) + (16.0 / 116.0); } - return new double[]{116 * y - 16, 500 * (x - y), 200 * (y - z)}; + return new double[] { 116 * y - 16, 500 * (x - y), 200 * (y - z) }; } - } diff --git a/src/main/java/gregtech/loaders/MaterialInfoLoader.java b/src/main/java/gregtech/loaders/MaterialInfoLoader.java index b890c2e731e..7808074a400 100644 --- a/src/main/java/gregtech/loaders/MaterialInfoLoader.java +++ b/src/main/java/gregtech/loaders/MaterialInfoLoader.java @@ -9,6 +9,7 @@ import gregtech.common.blocks.BlockWireCoil.CoilType; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.loaders.recipe.WoodRecipeLoader; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -113,7 +114,6 @@ public static void init() { new MaterialStack(Materials.Europium, M), // single cable new MaterialStack(Materials.Rubber, M * 2))); // plate - OreDictUnifier.registerOre(MetaTileEntities.ENERGY_INPUT_HATCH[3].getStackForm(), new ItemMaterialInfo( new MaterialStack(Materials.StainlessSteel, M * 8), // plate new MaterialStack(Materials.Gold, M * 2), // single cable @@ -162,32 +162,60 @@ public static void init() { new MaterialStack(Materials.NeodymiumMagnetic, M / 2) // rod )); - OreDictUnifier.registerOre(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config - new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config - new MaterialStack(Materials.Concrete, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config - )); - - OreDictUnifier.registerOre(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / config - new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 sheets / config - new MaterialStack(Materials.Glass, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config - )); - - OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), new ItemMaterialInfo( - new MaterialStack(Materials.Steel, (M * 8) / ConfigHolder.recipes.casingsPerCraft), // casing / config - new MaterialStack(Materials.Polytetrafluoroethylene, M * 3 / 2) // 1.5 ingots PTFE (fluid in recipe) - )); - - OreDictUnifier.registerOre(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS), new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M * 4))); + OreDictUnifier.registerOre( + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / + // config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 + // sheets + // / + // config + new MaterialStack(Materials.Concrete, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / + // config + )); + + OreDictUnifier.registerOre( + MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 2) / ConfigHolder.recipes.casingsPerCraft), // frame / + // config + new MaterialStack(Materials.Polyethylene, (M * 6) / ConfigHolder.recipes.casingsPerCraft), // 6 + // sheets + // / + // config + new MaterialStack(Materials.Glass, M / ConfigHolder.recipes.casingsPerCraft) // 1 block / config + )); + + OreDictUnifier.registerOre( + MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PTFE_INERT_CASING), + new ItemMaterialInfo( + new MaterialStack(Materials.Steel, (M * 8) / ConfigHolder.recipes.casingsPerCraft), // casing / + // config + new MaterialStack(Materials.Polytetrafluoroethylene, M * 3 / 2) // 1.5 ingots PTFE (fluid in + // recipe) + )); + + OreDictUnifier.registerOre( + MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.PRIMITIVE_BRICKS), + new ItemMaterialInfo(new MaterialStack(Materials.Fireclay, M * 4))); + + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_I), + new ItemMaterialInfo( + new MaterialStack(Materials.Ultimet, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 + // screws + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_II), + new ItemMaterialInfo( + new MaterialStack(Materials.Ruridit, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 + // screws + OreDictUnifier.registerOre( + MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_III), + new ItemMaterialInfo( + new MaterialStack(Materials.Neutronium, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + + // 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_I), new ItemMaterialInfo( - new MaterialStack(Materials.Ultimet, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_II), new ItemMaterialInfo( - new MaterialStack(Materials.Ruridit, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(MetaBlocks.BATTERY_BLOCK.getItemVariant(BlockBatteryPart.BatteryPartType.EMPTY_TIER_III), new ItemMaterialInfo( - new MaterialStack(Materials.Neutronium, M * 2 + M * 6 + (M / 9 * 24)))); // frame + 6 plates + 24 screws - OreDictUnifier.registerOre(LONG_DIST_ITEM_ENDPOINT.getStackForm(), new ItemMaterialInfo(new MaterialStack(Tin, M * 6), // large pipe new MaterialStack(Steel, M * 8))); // 4 plates + 1 gear @@ -209,94 +237,160 @@ public static void init() { new MaterialStack(Materials.Iron, M * 4 + (M * 3 / 16)), // 4 iron plates + 1 iron bars new MaterialStack(Materials.Steel, M / 9))); // tiny steel dust } else { - OreDictUnifier.registerOre(new ItemStack(Items.IRON_DOOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_DOOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.SANDSTONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.RED_SANDSTONE_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small - OreDictUnifier.registerOre(new ItemStack(Blocks.QUARTZ_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 6))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 6))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 6))); // dust - - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 2), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 3), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 4), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 5), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 6), new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 7), new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 2))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.LEVER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9), new MaterialStack(Materials.Wood, 1814400L))); - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_BUTTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 9))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BUTTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9))); - OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_TORCH, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 2), new MaterialStack(Materials.Redstone, M))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); - OreDictUnifier.registerOre(new ItemStack(Blocks.GOLDEN_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DETECTOR_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ACTIVATOR_RAIL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.SANDSTONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.RED_SANDSTONE_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, (3 * M) / 2))); // dust small + OreDictUnifier.registerOre(new ItemStack(Blocks.QUARTZ_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 6))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 6))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 6))); // dust + + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 2), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 3), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 4), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 5), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 6), + new ItemMaterialInfo(new MaterialStack(Materials.Netherrack, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_SLAB, 1, 7), + new ItemMaterialInfo(new MaterialStack(Materials.NetherQuartz, M * 2))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.LEVER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M / 9), new MaterialStack(Materials.Wood, 1814400L))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_BUTTON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 9))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_BUTTON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M / 9))); + OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_TORCH, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M / 2), new MaterialStack(Materials.Redstone, M))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); + OreDictUnifier.registerOre(new ItemStack(Blocks.GOLDEN_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DETECTOR_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ACTIVATOR_RAIL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M / 2))); if (ConfigHolder.recipes.hardRedstoneRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M), new MaterialStack(Materials.Iron, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Iron, M * 6 / 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Steel, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Steel, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M), new MaterialStack(Materials.Iron, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Iron, M * 6 / 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Steel, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Steel, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONE_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); } - OreDictUnifier.registerOre(new ItemStack(Items.WHEAT, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HAY_BLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M * 9))); - - OreDictUnifier.registerOre(new ItemStack(Items.SNOWBALL, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Water, M / 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.SNOW, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Water, M))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.PACKED_ICE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Ice, M * 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.BOOKSHELF, 1), new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 9), new MaterialStack(Materials.Wood, M * 6))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 72))); // block - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); // ingot - - OreDictUnifier.registerOre(new ItemStack(Items.MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.CHEST_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.FURNACE_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Stone, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.TNT_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.HOPPER_MINECART, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 10), new MaterialStack(Materials.Wood, M * 8))); - - OreDictUnifier.registerOre(new ItemStack(Items.CAULDRON, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_BARS, 8, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); - OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_TRAPDOOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.BUCKET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3))); - - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 0), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 31))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 22))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 2), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 13))); - OreDictUnifier.registerOre(new ItemStack(Blocks.HOPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); - - OreDictUnifier.registerOre(new ItemStack(Items.GLASS_BOTTLE), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny - OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS_PANE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny - - OreDictUnifier.registerOre(new ItemStack(Items.FLOWER_POT, 1), new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Items.PAINTING, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Items.ITEM_FRAME, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE_WALL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Items.END_CRYSTAL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Glass, M * 7), new MaterialStack(Materials.EnderEye, M))); + OreDictUnifier.registerOre(new ItemStack(Items.WHEAT, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HAY_BLOCK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wheat, M * 9))); + + OreDictUnifier.registerOre(new ItemStack(Items.SNOWBALL, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Water, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.SNOW, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Water, M))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.PACKED_ICE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Ice, M * 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.BOOKSHELF, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Paper, M * 9), new MaterialStack(Materials.Wood, M * 6))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 72))); // block + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_APPLE, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); // ingot + + OreDictUnifier.registerOre(new ItemStack(Items.MINECART, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.CHEST_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.FURNACE_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Stone, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.TNT_MINECART, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.HOPPER_MINECART, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 10), new MaterialStack(Materials.Wood, M * 8))); + + OreDictUnifier.registerOre(new ItemStack(Items.CAULDRON, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_BARS, 8, W), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3 / 16))); + OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_TRAPDOOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.BUCKET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3))); + + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 0), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 31))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 22))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1, 2), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 13))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HOPPER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 5), new MaterialStack(Materials.Wood, M * 8))); + + OreDictUnifier.registerOre(new ItemStack(Items.GLASS_BOTTLE), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny + OreDictUnifier.registerOre(new ItemStack(Blocks.GLASS_PANE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Glass, M / 3))); // dust tiny + + OreDictUnifier.registerOre(new ItemStack(Items.FLOWER_POT, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Brick, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Items.PAINTING, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.ITEM_FRAME, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE_WALL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.END_CRYSTAL, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Glass, M * 7), new MaterialStack(Materials.EnderEye, M))); if (ConfigHolder.recipes.hardToolArmorRecipes) { - OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo - (new MaterialStack(Materials.Gold, (13 * M) / 8), // M + ring + 3 * bolt + OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, (13 * M) / 8), // M + ring + 3 * bolt new MaterialStack(Materials.Redstone, M))); OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo( @@ -304,8 +398,10 @@ public static void init() { new MaterialStack(Materials.RedAlloy, M / 8), // bolt new MaterialStack(Materials.Zinc, M / 4))); // ring } else { - OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.CLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 4), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Items.COMPASS, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 4), new MaterialStack(Materials.Redstone, M))); } if (ConfigHolder.recipes.hardMiscRecipes) { @@ -324,93 +420,166 @@ public static void init() { new MaterialStack(Materials.Obsidian, M * 9 * 6), // 6 dense plates new MaterialStack(Materials.EnderEye, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.BEACON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.NetherStar, M), new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Obsidian, M * 4), new MaterialStack(Materials.Paper, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.BEACON, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.NetherStar, M), + new MaterialStack(Materials.Obsidian, M * 3), new MaterialStack(Materials.Glass, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENCHANTING_TABLE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), + new MaterialStack(Materials.Obsidian, M * 4), new MaterialStack(Materials.Paper, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.ENDER_CHEST, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.EnderEye, M), new MaterialStack(Materials.Obsidian, M * 8))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.LADDER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M))); - - OreDictUnifier.registerOre(new ItemStack(Items.BOWL, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.SIGN, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Blocks.TRAPPED_CHEST, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Iron, M / 2))); // ring + OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.LADDER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M))); + + OreDictUnifier.registerOre(new ItemStack(Items.BOWL, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.SIGN, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.CHEST, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Blocks.TRAPPED_CHEST, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Iron, M / 2))); // ring if (ConfigHolder.recipes.hardMiscRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.RedAlloy, M / 2))); // rod + OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.RedAlloy, M / 2))); // rod OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo( new MaterialStack(Materials.Diamond, M / 8), // bolt new MaterialStack(Materials.Iron, (17 * M) / 4), // gear + ring new MaterialStack(Materials.RedAlloy, M))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Diamond, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.NOTEBLOCK, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.JUKEBOX, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Wood, M * 8), new MaterialStack(Materials.Diamond, M))); } - OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_LAMP, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Glowstone, M * 4), new MaterialStack(Materials.Redstone, M * 4))); // dust - OreDictUnifier.registerOre(new ItemStack(Blocks.CRAFTING_TABLE, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Blocks.PISTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STICKY_PISTON, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_LAMP, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Glowstone, M * 4), new MaterialStack(Materials.Redstone, M * 4))); // dust + OreDictUnifier.registerOre(new ItemStack(Blocks.CRAFTING_TABLE, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Blocks.PISTON, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STICKY_PISTON, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 4), new MaterialStack(Materials.Wood, M * 3))); if (ConfigHolder.recipes.hardRedstoneRecipes) { - OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.RedAlloy, M / 2), new MaterialStack(Materials.Iron, M * 4 + M / 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.RedAlloy, M / 2), new MaterialStack(Materials.Iron, M * 2 + M * 3 / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), + new MaterialStack(Materials.RedAlloy, M / 2), + new MaterialStack(Materials.Iron, M * 4 + M / 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), + new MaterialStack(Materials.RedAlloy, M / 2), + new MaterialStack(Materials.Iron, M * 2 + M * 3 / 4))); } else { - OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); - OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DISPENSER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); + OreDictUnifier.registerOre(new ItemStack(Blocks.DROPPER, 1, W), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Redstone, M))); } - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.IRON_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 5))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 7))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); - - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_HELMET, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5 / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_CHESTPLATE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_LEGGINGS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7 / 4))); - OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_BOOTS, 1), new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); - - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 4))); - - OreDictUnifier.registerOre(new ItemStack(Items.STONE_SHOVEL, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_PICKAXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_AXE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_HOE, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 2))); - OreDictUnifier.registerOre(new ItemStack(Items.STONE_SWORD, 1), new ItemMaterialInfo(new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.IRON_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Iron, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Gold, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.GOLDEN_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Gold, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 5))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 7))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Diamond, M * 8))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SHOVEL, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Diamond, M * 2), new MaterialStack(Materials.Wood, M / 2))); + + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_HELMET, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 5 / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_CHESTPLATE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 2))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_LEGGINGS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M * 7 / 4))); + OreDictUnifier.registerOre(new ItemStack(Items.CHAINMAIL_BOOTS, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Iron, M))); + + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_PICKAXE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_AXE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 3 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_HOE, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.WOODEN_SWORD, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Wood, M * 2 + M / 4))); + + OreDictUnifier.registerOre(new ItemStack(Items.STONE_SHOVEL, 1), + new ItemMaterialInfo(new MaterialStack(Materials.Stone, M), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_PICKAXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_AXE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 3), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_HOE, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 2))); + OreDictUnifier.registerOre(new ItemStack(Items.STONE_SWORD, 1), new ItemMaterialInfo( + new MaterialStack(Materials.Stone, M * 2), new MaterialStack(Materials.Wood, M / 4))); WoodRecipeLoader.registerUnificationInfo(); } diff --git a/src/main/java/gregtech/loaders/OreDictionaryLoader.java b/src/main/java/gregtech/loaders/OreDictionaryLoader.java index 2ae31b7f12c..b05fba4609b 100644 --- a/src/main/java/gregtech/loaders/OreDictionaryLoader.java +++ b/src/main/java/gregtech/loaders/OreDictionaryLoader.java @@ -12,6 +12,7 @@ import gregtech.api.util.GTLog; import gregtech.common.blocks.MetaBlocks; import gregtech.common.blocks.StoneVariantBlock; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -36,23 +37,27 @@ public static void init() { OreDictUnifier.registerOre(new ItemStack(Blocks.BRICK_BLOCK), OrePrefix.block, Materials.Brick); OreDictUnifier.registerOre(new ItemStack(Items.CLAY_BALL), OrePrefix.ingot, Materials.Clay); OreDictUnifier.registerOre(new ItemStack(Items.FLINT), OrePrefix.gem, Materials.Flint); - OreDictUnifier.registerOre(new ItemStack(Blocks.HARDENED_CLAY, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); - OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, W), new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.HARDENED_CLAY, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); + OreDictUnifier.registerOre(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, W), + new ItemMaterialInfo(new MaterialStack(Materials.Clay, M * 4))); - for (Material material : new Material[]{Materials.Wood, Materials.TreatedWood}) { + for (Material material : new Material[] { Materials.Wood, Materials.TreatedWood }) { for (ItemStack woodPlateStack : OreDictUnifier.getAll(new UnificationEntry(OrePrefix.plate, material))) { OreDictUnifier.registerOre(woodPlateStack, OrePrefix.plank, material); } } - for (Material material : new Material[]{Materials.Lapis, Materials.Lazurite, Materials.Sodalite}) { + for (Material material : new Material[] { Materials.Lapis, Materials.Lazurite, Materials.Sodalite }) { OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.gem, material), OrePrefix.dye, Color.Blue); OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, material), OrePrefix.dye, Color.Blue); } - OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, Materials.MetalMixture), OrePrefix.dye, Color.Brown); + OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.dust, Materials.MetalMixture), OrePrefix.dye, + Color.Brown); - OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.lens, Materials.Glass), OrePrefix.craftingLens, MarkerMaterials.Color.White); + OreDictUnifier.registerOre(OreDictUnifier.get(OrePrefix.lens, Materials.Glass), OrePrefix.craftingLens, + MarkerMaterials.Color.White); OreDictUnifier.registerOre(new ItemStack(Blocks.COAL_ORE), OrePrefix.ore, Materials.Coal); OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_ORE), OrePrefix.ore, Materials.Iron); diff --git a/src/main/java/gregtech/loaders/WoodTypeEntry.java b/src/main/java/gregtech/loaders/WoodTypeEntry.java index 03a293da5ec..5ff9f964344 100644 --- a/src/main/java/gregtech/loaders/WoodTypeEntry.java +++ b/src/main/java/gregtech/loaders/WoodTypeEntry.java @@ -1,12 +1,14 @@ package gregtech.loaders; -import com.google.common.base.Preconditions; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; +import com.google.common.base.Preconditions; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -408,7 +410,8 @@ public Builder registerUnificationInfo(boolean planks, boolean door, boolean sla public WoodTypeEntry build() { Preconditions.checkArgument(!planks.isEmpty(), "Planks cannot be empty."); return new WoodTypeEntry(modid, woodName, log, removeCharcoalRecipe, addCharcoalRecipe, planks, - planksRecipeName, door, doorRecipeName, slab, slabRecipeName, addSlabsCraftingRecipe, fence, fenceRecipeName, + planksRecipeName, door, doorRecipeName, slab, slabRecipeName, addSlabsCraftingRecipe, fence, + fenceRecipeName, fenceGate, fenceGateRecipeName, stairs, addStairsCraftingRecipe, boat, boatRecipeName, material, addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, addDoorsUnificationInfo, diff --git a/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java b/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java index 197cfc54710..a4355e70973 100644 --- a/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java +++ b/src/main/java/gregtech/loaders/dungeon/ChestGenHooks.java @@ -1,12 +1,10 @@ package gregtech.loaders.dungeon; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; import gregtech.api.util.GTLog; import gregtech.api.util.GTStringUtils; import gregtech.api.util.ItemStackHashStrategy; import gregtech.common.ConfigHolder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; @@ -19,6 +17,10 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -42,7 +44,7 @@ public static void init() { @SubscribeEvent public static void onWorldLoad(@NotNull LootTableLoadEvent event) { LootPool mainPool = event.getTable().getPool("main"); - //noinspection ConstantValue + // noinspection ConstantValue if (mainPool == null) return; ResourceLocation name = event.getName(); @@ -64,11 +66,13 @@ public static void onWorldLoad(@NotNull LootTableLoadEvent event) { if (rollValues.containsKey(event.getName())) { RandomValueRange rangeAdd = rollValues.get(event.getName()); RandomValueRange range = mainPool.getRolls(); - mainPool.setRolls(new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); + mainPool.setRolls( + new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); } } - public static void addItem(@NotNull ResourceLocation lootTable, @NotNull ItemStack stack, int minAmount, int maxAmount, int weight) { + public static void addItem(@NotNull ResourceLocation lootTable, @NotNull ItemStack stack, int minAmount, + int maxAmount, int weight) { RandomWeightLootFunction lootFunction = new RandomWeightLootFunction(stack, minAmount, maxAmount); String modid = Objects.requireNonNull(stack.getItem().getRegistryName()).getNamespace(); String entryName = createEntryName(stack, modid, weight, lootFunction); @@ -88,7 +92,8 @@ public static void addRolls(ResourceLocation tableLocation, int minAdd, int maxA private static @NotNull String createEntryName(@NotNull ItemStack stack, @NotNull String modid, int weight, @NotNull RandomWeightLootFunction function) { - int hashCode = Objects.hash(HASH_STRATEGY.hashCode(stack), modid, weight, function.getMinAmount(), function.getMaxAmount()); + int hashCode = Objects.hash(HASH_STRATEGY.hashCode(stack), modid, weight, function.getMinAmount(), + function.getMaxAmount()); return String.format("#%s:loot_%s", modid, hashCode); } @@ -96,8 +101,9 @@ private static class GTLootEntryItem extends LootEntryItem { private final ItemStack stack; - public GTLootEntryItem(@NotNull ItemStack stack, int weight, LootFunction lootFunction, @NotNull String entryName) { - super(stack.getItem(), weight, 1, new LootFunction[]{lootFunction}, NO_CONDITIONS, entryName); + public GTLootEntryItem(@NotNull ItemStack stack, int weight, LootFunction lootFunction, + @NotNull String entryName) { + super(stack.getItem(), weight, 1, new LootFunction[] { lootFunction }, NO_CONDITIONS, entryName); this.stack = stack; } @@ -130,7 +136,8 @@ public int getMaxAmount() { } @Override - public @NotNull ItemStack apply(@NotNull ItemStack itemStack, @NotNull Random rand, @NotNull LootContext context) { + public @NotNull ItemStack apply(@NotNull ItemStack itemStack, @NotNull Random rand, + @NotNull LootContext context) { itemStack.setItemDamage(stack.getItemDamage()); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null) { diff --git a/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java b/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java index c54fe2ba4bb..5d41b705fb0 100644 --- a/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java +++ b/src/main/java/gregtech/loaders/dungeon/DungeonLootLoader.java @@ -6,6 +6,7 @@ import gregtech.api.util.GTLog; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.storage.loot.LootTableList; @@ -18,77 +19,140 @@ public static void init() { ChestGenHooks.init(); } if (ConfigHolder.worldgen.addLoot) { - ChestGenHooks.addItem(LootTableList.CHESTS_SPAWN_BONUS_CHEST, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 8, 16, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_SPAWN_BONUS_CHEST, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), + 8, 16, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 4, 8, 80); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 6, 120); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 6, 30); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 1, 6, 60); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 6, 10); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 6, 20); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 1, 6, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 3, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, MetaItems.BOTTLE_PURPLE_DRINK.getStackForm(), 4, + 8, 80); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 6, 120); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 6, 30); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 1, 6, 60); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 6, 10); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 6, 20); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 1, 6, 40); + ChestGenHooks.addItem(LootTableList.CHESTS_SIMPLE_DUNGEON, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 3, 40); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 4, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.ingot, Materials.Platinum), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 4, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.ingot, Materials.Platinum), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_DESERT_PYRAMID, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.COIN_GOLD_ANCIENT.getStackForm(), 16, 64, 10); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.ZERO_POINT_MODULE.getChargedStack(Long.MAX_VALUE), 1, 1, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, MetaItems.COIN_GOLD_ANCIENT.getStackForm(), 16, + 64, 10); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + MetaItems.ZERO_POINT_MODULE.getChargedStack(Long.MAX_VALUE), 1, 1, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), + 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 2, 8, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, 8, 30); + ChestGenHooks.addItem(LootTableList.CHESTS_JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, + 8, 30); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 4, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 4, 3); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 4, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 4, 4); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 4, 2); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 4, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Silver), 1, 4, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Lead), 1, 4, 3); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Sapphire), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GreenSapphire), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Olivine), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetRed), 1, 4, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.GarnetYellow), 1, 4, 4); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Ruby), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.gem, Materials.Emerald), 1, 4, 2); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_ABANDONED_MINESHAFT, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 1, 4, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 2, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 2, 8, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.Brass), 4, 12, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 12, 1); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 1, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 2, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 2, 8, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.Brass), 4, 12, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_VILLAGE_BLACKSMITH, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 12, 1); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 8, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 8, 16, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 4, 8, 12); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 4, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 2, 4, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 4, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Steel), 8, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Bronze), 8, 16, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.ingot, Materials.Manganese), 4, 8, 12); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.dust, Materials.Neodymium), 4, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CROSSING, + OreDictUnifier.get(OrePrefix.dust, Materials.Chrome), 2, 4, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 2, 8, 6); - ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 2, 8, 6); + ChestGenHooks.addItem(LootTableList.CHESTS_STRONGHOLD_CORRIDOR, + OreDictUnifier.get(OrePrefix.ingot, Materials.DamascusSteel), 3, 12, 6); } if (ConfigHolder.worldgen.increaseDungeonLoot) { ChestGenHooks.addRolls(LootTableList.CHESTS_SPAWN_BONUS_CHEST, 2, 4); @@ -103,5 +167,4 @@ public static void init() { ChestGenHooks.addRolls(LootTableList.CHESTS_STRONGHOLD_LIBRARY, 4, 8); } } - } diff --git a/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java b/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java index f4dc7dd182b..29252f0d561 100644 --- a/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java +++ b/src/main/java/gregtech/loaders/recipe/AssemblyLineLoader.java @@ -16,7 +16,6 @@ public class AssemblyLineLoader { public static void init() { - ASSEMBLY_LINE_RECIPES.recipeBuilder() .inputs(FUSION_CASING.getItemVariant(SUPERCONDUCTOR_COIL)) .input(circuit, Tier.ZPM, 4) diff --git a/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java b/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java index 61a806c141f..c23ec372712 100644 --- a/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/BatteryRecipes.java @@ -25,7 +25,6 @@ public static void init() { } private static void standardBatteries() { - // Tantalum Battery (since it doesn't fit elsewhere) ASSEMBLER_RECIPES.recipeBuilder() .input(dust, Tantalum) @@ -218,30 +217,42 @@ private static void standardBatteries() { .output(BATTERY_UV_NAQUADRIA) .buildAndRegister(); - // Battery Recycling Recipes - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_HV).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_EV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_SMALL_VANADIUM).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_IV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MEDIUM_VANADIUM).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LUV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LARGE_VANADIUM).buildAndRegister(); - - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_ZPM_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_MEDIUM_NAQUADRIA).buildAndRegister(); - EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_UV_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY).output(BATTERY_HULL_LARGE_NAQUADRIA).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_MV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_CADMIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_LITHIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_HV_SODIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_HV).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_EV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_SMALL_VANADIUM).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_IV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MEDIUM_VANADIUM).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_LUV_VANADIUM, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LARGE_VANADIUM).buildAndRegister(); + + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_ZPM_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_MEDIUM_NAQUADRIA).buildAndRegister(); + EXTRACTOR_RECIPES.recipeBuilder().inputNBT(BATTERY_UV_NAQUADRIA, NBTMatcher.ANY, NBTCondition.ANY) + .output(BATTERY_HULL_LARGE_NAQUADRIA).buildAndRegister(); } private static void gemBatteries() { - // Energy Crystal MIXER_RECIPES.recipeBuilder().duration(600).EUt(VA[MV]) .input(dust, Redstone, 5) @@ -425,7 +436,6 @@ private static void gemBatteries() { } private static void batteryBlocks() { - // Empty Tier I ASSEMBLER_RECIPES.recipeBuilder() .input(frameGt, Ultimet) diff --git a/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java b/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java index f8e3a9bd1a6..0d62958b37c 100644 --- a/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/CircuitRecipes.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -27,7 +28,6 @@ public static void init() { } private static void waferRecipes() { - // Boules BLAST_RECIPES.recipeBuilder() .input(dust, Silicon, 32) @@ -90,57 +90,131 @@ private static void waferRecipes() { .duration(2400).EUt(VA[IV]).buildAndRegister(); // Wafer engraving - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(NAQUADAH_WAFER).notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Red).output(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Green).output(RANDOM_ACCESS_MEMORY_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.LightBlue).output(CENTRAL_PROCESSING_UNIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Blue).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Orange).output(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(SILICON_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(50).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Cyan).output(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Gray).output(NAND_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Pink).output(NOR_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Brown).output(POWER_INTEGRATED_CIRCUIT_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(PHOSPHORUS_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(200).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Yellow).output(SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(NAQUADAH_WAFER) + .notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(500).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Purple).output(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); // Can replace this with a Quantum Star/Eye Lens if desired - LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(NEUTRONIUM_WAFER).notConsumable(craftingLens, Color.Black).output(HIGHLY_ADVANCED_SOC_WAFER).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + LASER_ENGRAVER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(NEUTRONIUM_WAFER) + .notConsumable(craftingLens, Color.Black).output(HIGHLY_ADVANCED_SOC_WAFER) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); // Wafer chemical refining recipes CHEMICAL_RECIPES.recipeBuilder() @@ -184,26 +258,41 @@ private static void waferRecipes() { .duration(1200).EUt(VA[EV]).buildAndRegister(); // Wafer cutting - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGHLY_ADVANCED_SOC_WAFER).output(HIGHLY_ADVANCED_SOC, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(ADVANCED_SYSTEM_ON_CHIP_WAFER).output(ADVANCED_SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(SYSTEM_ON_CHIP_WAFER).output(SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(SIMPLE_SYSTEM_ON_CHIP_WAFER).output(SIMPLE_SYSTEM_ON_CHIP, 6).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(96).input(RANDOM_ACCESS_MEMORY_WAFER).output(RANDOM_ACCESS_MEMORY, 32).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER).output(QUBIT_CENTRAL_PROCESSING_UNIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).output(LOW_POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(POWER_INTEGRATED_CIRCUIT_WAFER).output(POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).output(HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[LuV]).input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).output(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NOR_MEMORY_CHIP_WAFER).output(NOR_MEMORY_CHIP, 16).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NAND_MEMORY_CHIP_WAFER).output(NAND_MEMORY_CHIP, 32).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(CENTRAL_PROCESSING_UNIT_WAFER).output(CENTRAL_PROCESSING_UNIT, 8).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(INTEGRATED_LOGIC_CIRCUIT_WAFER).output(INTEGRATED_LOGIC_CIRCUIT, 8).buildAndRegister(); - CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(NANO_CENTRAL_PROCESSING_UNIT_WAFER).output(NANO_CENTRAL_PROCESSING_UNIT, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGHLY_ADVANCED_SOC_WAFER) + .output(HIGHLY_ADVANCED_SOC, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .output(ADVANCED_SYSTEM_ON_CHIP, 6).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(SYSTEM_ON_CHIP_WAFER).output(SYSTEM_ON_CHIP, 6) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(SIMPLE_SYSTEM_ON_CHIP_WAFER) + .output(SIMPLE_SYSTEM_ON_CHIP, 6).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(96).input(RANDOM_ACCESS_MEMORY_WAFER) + .output(RANDOM_ACCESS_MEMORY, 32).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER) + .output(QUBIT_CENTRAL_PROCESSING_UNIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(LOW_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(LOW_POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[EV]).input(POWER_INTEGRATED_CIRCUIT_WAFER) + .output(POWER_INTEGRATED_CIRCUIT, 4).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[IV]).input(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[LuV]).input(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER) + .output(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NOR_MEMORY_CHIP_WAFER).output(NOR_MEMORY_CHIP, 16) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(192).input(NAND_MEMORY_CHIP_WAFER).output(NAND_MEMORY_CHIP, 32) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[MV]).input(CENTRAL_PROCESSING_UNIT_WAFER) + .output(CENTRAL_PROCESSING_UNIT, 8).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(64).input(INTEGRATED_LOGIC_CIRCUIT_WAFER) + .output(INTEGRATED_LOGIC_CIRCUIT, 8).buildAndRegister(); + CUTTER_RECIPES.recipeBuilder().duration(900).EUt(VA[HV]).input(NANO_CENTRAL_PROCESSING_UNIT_WAFER) + .output(NANO_CENTRAL_PROCESSING_UNIT, 8).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); } private static void componentRecipes() { - // Vacuum Tube ModHandler.addShapedRecipe("vacuum_tube", VACUUM_TUBE.getStackForm(), "PTP", "WWW", @@ -665,7 +754,6 @@ private static void componentRecipes() { } private static void boardRecipes() { - // Coated Board ModHandler.addShapedRecipe("coated_board", COATED_BOARD.getStackForm(3), "RRR", "PPP", "RRR", @@ -899,7 +987,6 @@ private static void boardRecipes() { } private static void circuitRecipes() { - int outputAmount = ConfigHolder.recipes.harderCircuitRecipes ? 1 : 2; // T1: Electronic ============================================================================================== @@ -964,7 +1051,8 @@ private static void circuitRecipes() { // HV CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).duration(800) - .input(INTEGRATED_CIRCUIT_MV, outputAmount) // a little generous for this first HV if harder recipes enabled + .input(INTEGRATED_CIRCUIT_MV, outputAmount) // a little generous for this first HV if harder recipes + // enabled .input(INTEGRATED_LOGIC_CIRCUIT, 2) .input(RANDOM_ACCESS_MEMORY, 2) .input(component, Component.Transistor, 4) diff --git a/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java b/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java index 005026c3d18..cb0828ab239 100644 --- a/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/ComponentRecipes.java @@ -4,9 +4,11 @@ import gregtech.api.unification.material.MarkerMaterials.Tier; import gregtech.api.unification.material.Material; import gregtech.api.unification.stack.UnificationEntry; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.init.Items; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import static gregtech.api.GTValues.*; @@ -19,14 +21,26 @@ public class ComponentRecipes { public static void register() { - - //Motors Start-------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe("electric_motor_lv_steel", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(stick, Steel), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(stick, Iron), 'M', new UnificationEntry(stick, IronMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_mv", ELECTRIC_MOTOR_MV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Copper), 'W', new UnificationEntry(wireGtDouble, Cupronickel), 'R', new UnificationEntry(stick, Aluminium), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_hv", ELECTRIC_MOTOR_HV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Silver), 'W', new UnificationEntry(wireGtDouble, Electrum), 'R', new UnificationEntry(stick, StainlessSteel), 'M', new UnificationEntry(stick, SteelMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_ev", ELECTRIC_MOTOR_EV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', new UnificationEntry(wireGtDouble, Kanthal), 'R', new UnificationEntry(stick, Titanium), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); - ModHandler.addShapedRecipe(true, "electric_motor_iv", ELECTRIC_MOTOR_IV.getStackForm(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', new UnificationEntry(wireGtDouble, Graphene), 'R', new UnificationEntry(stick, TungstenSteel), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); + // Motors + // Start-------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe("electric_motor_lv_steel", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', + new UnificationEntry(stick, Steel), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.getStackForm(), "CWR", "WMW", + "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), + 'R', new UnificationEntry(stick, Iron), 'M', new UnificationEntry(stick, IronMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_mv", ELECTRIC_MOTOR_MV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtSingle, Copper), 'W', new UnificationEntry(wireGtDouble, Cupronickel), + 'R', new UnificationEntry(stick, Aluminium), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_hv", ELECTRIC_MOTOR_HV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Silver), 'W', new UnificationEntry(wireGtDouble, Electrum), + 'R', new UnificationEntry(stick, StainlessSteel), 'M', new UnificationEntry(stick, SteelMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_ev", ELECTRIC_MOTOR_EV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', new UnificationEntry(wireGtDouble, Kanthal), + 'R', new UnificationEntry(stick, Titanium), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); + ModHandler.addShapedRecipe(true, "electric_motor_iv", ELECTRIC_MOTOR_IV.getStackForm(), "CWR", "WMW", "RWC", + 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', new UnificationEntry(wireGtDouble, Graphene), + 'R', new UnificationEntry(stick, TungstenSteel), 'M', new UnificationEntry(stick, NeodymiumMagnetic)); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin, 2) @@ -124,9 +138,8 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Conveyors Start----------------------------------------------------------------------------------------------- + // Conveyors + // Start----------------------------------------------------------------------------------------------- final Map rubberMaterials = new Object2ObjectOpenHashMap<>(); rubberMaterials.put("rubber", Rubber); rubberMaterials.put("silicone_rubber", SiliconeRubber); @@ -136,12 +149,24 @@ public static void register() { Material material = materialEntry.getValue(); String name = materialEntry.getKey(); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_lv_%s", name), CONVEYOR_MODULE_LV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_mv_%s", name), CONVEYOR_MODULE_MV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_hv_%s", name), CONVEYOR_MODULE_HV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_ev_%s", name), CONVEYOR_MODULE_EV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_lv_%s", name), + CONVEYOR_MODULE_LV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_mv_%s", name), + CONVEYOR_MODULE_MV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_hv_%s", name), + CONVEYOR_MODULE_HV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("conveyor_module_ev_%s", name), + CONVEYOR_MODULE_EV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), + 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); if (!materialEntry.getValue().equals(Rubber)) - ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("conveyor_module_iv_%s", materialEntry.getKey()), CONVEYOR_MODULE_IV.getStackForm(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(SiliconeRubber), + String.format("conveyor_module_iv_%s", materialEntry.getKey()), + CONVEYOR_MODULE_IV.getStackForm(), "RRR", "MCM", "RRR", 'R', + new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', + ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin) @@ -184,14 +209,35 @@ public static void register() { .outputs(CONVEYOR_MODULE_IV.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - - //Pumps Start--------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_lv_%s", name), ELECTRIC_PUMP_LV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Tin), 'X', new UnificationEntry(rotor, Tin), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_mv_%s", name), ELECTRIC_PUMP_MV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Bronze), 'X', new UnificationEntry(rotor, Bronze), 'P', new UnificationEntry(pipeNormalFluid, Steel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_hv_%s", name), ELECTRIC_PUMP_HV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Steel), 'X', new UnificationEntry(rotor, Steel), 'P', new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_ev_%s", name), ELECTRIC_PUMP_EV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); + // Pumps + // Start--------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_lv_%s", name), + ELECTRIC_PUMP_LV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Tin), 'X', + new UnificationEntry(rotor, Tin), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', + ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_mv_%s", name), + ELECTRIC_PUMP_MV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Bronze), 'X', + new UnificationEntry(rotor, Bronze), 'P', new UnificationEntry(pipeNormalFluid, Steel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', + ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_hv_%s", name), + ELECTRIC_PUMP_HV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Steel), 'X', + new UnificationEntry(rotor, Steel), 'P', new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', + ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(Rubber), String.format("electric_pump_ev_%s", name), + ELECTRIC_PUMP_EV.getStackForm(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', + new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); if (!material.equals(Rubber)) - ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("electric_pump_iv_%s", name), ELECTRIC_PUMP_IV.getStackForm(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, TungstenSteel), 'X', new UnificationEntry(rotor, TungstenSteel), 'P', new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + ModHandler.addShapedRecipe(material.equals(SiliconeRubber), String.format("electric_pump_iv_%s", name), + ELECTRIC_PUMP_IV.getStackForm(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, TungstenSteel), 'X', new UnificationEntry(rotor, TungstenSteel), + 'P', new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', + new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', + ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin) @@ -343,7 +389,8 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - //Fluid Regulators---------------------------------------------------------------------------------------------- + // Fluid + // Regulators---------------------------------------------------------------------------------------------- ASSEMBLER_RECIPES.recipeBuilder() .inputs(ELECTRIC_PUMP_LV.getStackForm()) @@ -422,9 +469,11 @@ public static void register() { .duration(50) .buildAndRegister(); - //Voiding Covers Start----------------------------------------------------------------------------------------- + // Voiding Covers Start----------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "cover_item_voiding", COVER_ITEM_VOIDING.getStackForm(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.getStackForm(), 'P', new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); + ModHandler.addShapedRecipe(true, "cover_item_voiding", COVER_ITEM_VOIDING.getStackForm(), "SDS", "dPw", " E ", + 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.getStackForm(), 'P', + new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder() .input(screw, Steel, 2) @@ -440,7 +489,9 @@ public static void register() { .outputs(COVER_ITEM_VOIDING_ADVANCED.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - ModHandler.addShapedRecipe(true, "cover_fluid_voiding", COVER_FLUID_VOIDING.getStackForm(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.getStackForm(), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); + ModHandler.addShapedRecipe(true, "cover_fluid_voiding", COVER_FLUID_VOIDING.getStackForm(), "SDS", "dPw", " E ", + 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.getStackForm(), 'P', + new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder() .input(screw, Steel, 2) @@ -456,12 +507,28 @@ public static void register() { .outputs(COVER_FLUID_VOIDING_ADVANCED.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - //Pistons Start------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "electric_piston_lv", ELECTRIC_PISTON_LV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', ELECTRIC_MOTOR_LV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_mv", ELECTRIC_PISTON_MV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Aluminium), 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'G', new UnificationEntry(gearSmall, Aluminium), 'M', ELECTRIC_MOTOR_MV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_hv", ELECTRIC_PISTON_HV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, StainlessSteel), 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'G', new UnificationEntry(gearSmall, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_ev", ELECTRIC_PISTON_EV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Titanium), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'G', new UnificationEntry(gearSmall, Titanium), 'M', ELECTRIC_MOTOR_EV.getStackForm()); - ModHandler.addShapedRecipe(true, "electric_piston_iv", ELECTRIC_PISTON_IV.getStackForm(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, TungstenSteel), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'G', new UnificationEntry(gearSmall, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.getStackForm()); + // Pistons + // Start------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "electric_piston_lv", ELECTRIC_PISTON_LV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), 'R', + new UnificationEntry(stick, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', + ELECTRIC_MOTOR_LV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_mv", ELECTRIC_PISTON_MV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Aluminium), 'C', new UnificationEntry(cableGtSingle, Copper), 'R', + new UnificationEntry(stick, Aluminium), 'G', new UnificationEntry(gearSmall, Aluminium), 'M', + ELECTRIC_MOTOR_MV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_hv", ELECTRIC_PISTON_HV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, StainlessSteel), 'C', new UnificationEntry(cableGtSingle, Gold), 'R', + new UnificationEntry(stick, StainlessSteel), 'G', new UnificationEntry(gearSmall, StainlessSteel), 'M', + ELECTRIC_MOTOR_HV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_ev", ELECTRIC_PISTON_EV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, Titanium), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', + new UnificationEntry(stick, Titanium), 'G', new UnificationEntry(gearSmall, Titanium), 'M', + ELECTRIC_MOTOR_EV.getStackForm()); + ModHandler.addShapedRecipe(true, "electric_piston_iv", ELECTRIC_PISTON_IV.getStackForm(), "PPP", "CRR", "CMG", + 'P', new UnificationEntry(plate, TungstenSteel), 'C', new UnificationEntry(cableGtSingle, Tungsten), + 'R', new UnificationEntry(stick, TungstenSteel), 'G', new UnificationEntry(gearSmall, TungstenSteel), + 'M', ELECTRIC_MOTOR_IV.getStackForm()); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Steel, 2) @@ -508,7 +575,6 @@ public static void register() { .outputs(ELECTRIC_PISTON_IV.getStackForm()) .duration(100).EUt(VA[LV]).buildAndRegister(); - ASSEMBLY_LINE_RECIPES.recipeBuilder() .input(ELECTRIC_MOTOR_LuV) .input(plate, HSSS, 4) @@ -561,14 +627,28 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Robot Arms Start --------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "robot_arm_lv", ROBOT_ARM_LV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'M', ELECTRIC_MOTOR_LV.getStackForm(), 'P', ELECTRIC_PISTON_LV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "robot_arm_mv", ROBOT_ARM_MV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'P', ELECTRIC_PISTON_MV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "robot_arm_hv", ROBOT_ARM_HV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.getStackForm(), 'P', ELECTRIC_PISTON_HV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "robot_arm_ev", ROBOT_ARM_EV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'M', ELECTRIC_MOTOR_EV.getStackForm(), 'P', ELECTRIC_PISTON_EV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "robot_arm_iv", ROBOT_ARM_IV.getStackForm(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.getStackForm(), 'P', ELECTRIC_PISTON_IV.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Robot Arms Start + // --------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "robot_arm_lv", ROBOT_ARM_LV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(stick, Steel), 'M', + ELECTRIC_MOTOR_LV.getStackForm(), 'P', ELECTRIC_PISTON_LV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "robot_arm_mv", ROBOT_ARM_MV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(stick, Aluminium), 'M', + ELECTRIC_MOTOR_MV.getStackForm(), 'P', ELECTRIC_PISTON_MV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "robot_arm_hv", ROBOT_ARM_HV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(stick, StainlessSteel), 'M', + ELECTRIC_MOTOR_HV.getStackForm(), 'P', ELECTRIC_PISTON_HV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "robot_arm_ev", ROBOT_ARM_EV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(stick, Titanium), 'M', + ELECTRIC_MOTOR_EV.getStackForm(), 'P', ELECTRIC_PISTON_EV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "robot_arm_iv", ROBOT_ARM_IV.getStackForm(), "CCC", "MRM", "PXR", 'C', + new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(stick, TungstenSteel), 'M', + ELECTRIC_MOTOR_IV.getStackForm(), 'P', ELECTRIC_PISTON_IV.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(cableGtSingle, Tin, 3) @@ -670,14 +750,27 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Field Generators Start --------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "field_generator_lv", FIELD_GENERATOR_LV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', new UnificationEntry(plate, Steel), 'G', new UnificationEntry(gem, EnderPearl), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "field_generator_mv", FIELD_GENERATOR_MV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "field_generator_hv", FIELD_GENERATOR_HV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "field_generator_ev", FIELD_GENERATOR_EV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "field_generator_iv", FIELD_GENERATOR_IV.getStackForm(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Field Generators Start + // --------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "field_generator_lv", FIELD_GENERATOR_LV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', new UnificationEntry(plate, Steel), + 'G', new UnificationEntry(gem, EnderPearl), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "field_generator_mv", FIELD_GENERATOR_MV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', + new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', + new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "field_generator_hv", FIELD_GENERATOR_HV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', + new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "field_generator_ev", FIELD_GENERATOR_EV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', + new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', + new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "field_generator_iv", FIELD_GENERATOR_IV.getStackForm(), "WPW", "XGX", "WPW", + 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', + new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.getStackForm(), 'X', + new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(gem, EnderPearl) @@ -769,14 +862,23 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - - //Sensors Start------------------------------------------------------------------------------------------------- - ModHandler.addShapedRecipe(true, "sensor_lv", SENSOR_LV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Steel), 'R', new UnificationEntry(stick, Brass), 'G', new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "sensor_mv", SENSOR_MV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(stick, Electrum), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "sensor_hv", SENSOR_HV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(stick, Chrome), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "sensor_ev", SENSOR_EV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(stick, Platinum), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "sensor_iv", SENSOR_IV.getStackForm(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(stick, Iridium), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Sensors + // Start------------------------------------------------------------------------------------------------- + ModHandler.addShapedRecipe(true, "sensor_lv", SENSOR_LV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Steel), 'R', new UnificationEntry(stick, Brass), 'G', + new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "sensor_mv", SENSOR_MV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(stick, Electrum), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "sensor_hv", SENSOR_HV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(stick, Chrome), 'G', + new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "sensor_ev", SENSOR_EV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(stick, Platinum), 'G', + QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "sensor_iv", SENSOR_IV.getStackForm(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(stick, Iridium), 'G', + QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Brass) @@ -868,13 +970,23 @@ public static void register() { .EUt(VA[ZPM])) .duration(600).EUt(100000).buildAndRegister(); - - //Emitters Start------------------------------------------------------------------------------------------------ - ModHandler.addShapedRecipe(true, "emitter_lv", EMITTER_LV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); - ModHandler.addShapedRecipe(true, "emitter_mv", EMITTER_MV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); - ModHandler.addShapedRecipe(true, "emitter_hv", EMITTER_HV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Chrome), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); - ModHandler.addShapedRecipe(true, "emitter_ev", EMITTER_EV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); - ModHandler.addShapedRecipe(true, "emitter_iv", EMITTER_IV.getStackForm(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(stick, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); + // Emitters + // Start------------------------------------------------------------------------------------------------ + ModHandler.addShapedRecipe(true, "emitter_lv", EMITTER_LV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', + new UnificationEntry(gem, Quartzite), 'X', new UnificationEntry(circuit, Tier.LV)); + ModHandler.addShapedRecipe(true, "emitter_mv", EMITTER_MV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', new UnificationEntry(circuit, Tier.MV)); + ModHandler.addShapedRecipe(true, "emitter_hv", EMITTER_HV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Chrome), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', + new UnificationEntry(gem, EnderEye), 'X', new UnificationEntry(circuit, Tier.HV)); + ModHandler.addShapedRecipe(true, "emitter_ev", EMITTER_EV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', + QUANTUM_EYE.getStackForm(), 'X', new UnificationEntry(circuit, Tier.EV)); + ModHandler.addShapedRecipe(true, "emitter_iv", EMITTER_IV.getStackForm(), "CRX", "RGR", "XRC", 'R', + new UnificationEntry(stick, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', + QUANTUM_STAR.getStackForm(), 'X', new UnificationEntry(circuit, Tier.IV)); ASSEMBLER_RECIPES.recipeBuilder() .input(stick, Brass, 4) diff --git a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java index 00d33bc11d4..9b2fbca568d 100644 --- a/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/ComputerRecipes.java @@ -7,6 +7,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockComputerCasing; import gregtech.common.blocks.BlockGlassCasing; + import net.minecraft.item.ItemStack; import static gregtech.api.GTValues.*; @@ -21,7 +22,6 @@ public class ComputerRecipes { public static void init() { - ASSEMBLER_RECIPES.recipeBuilder() .input(ITEM_IMPORT_BUS[EV]) .inputNBT(TOOL_DATA_STICK, 4, NBTMatcher.ANY, NBTCondition.ANY) @@ -48,7 +48,8 @@ public static void init() { .input(wireFine, Cobalt, 16) .input(wireFine, Copper, 16) .input(wireGtSingle, NiobiumTitanium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.HIGH_POWER_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[IV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -58,7 +59,8 @@ public static void init() { .input(wireFine, Cobalt, 32) .input(wireFine, Copper, 32) .input(wireGtSingle, VanadiumGallium, 2) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(200).EUt(VA[LuV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -77,7 +79,8 @@ public static void init() { .input(pipeTinyFluid, StainlessSteel, 16) .input(plate, Copper, 16) .input(wireGtSingle, SamariumIronArsenicOxide) - .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, ConfigHolder.recipes.casingsPerCraft)) + .outputs(COMPUTER_CASING.getItemVariant(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT, + ConfigHolder.recipes.casingsPerCraft)) .duration(100).EUt(VA[EV]).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() @@ -281,24 +284,26 @@ public static void init() { .output(ACTIVE_TRANSFORMER) .duration(300).EUt(VA[LuV]).buildAndRegister(); -/* TODO UPSATUPDATE - ASSEMBLER_RECIPES.recipeBuilder() - .input(HULL[LuV]) - .input(lens, Diamond) - .input(EMITTER_LuV) - .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) - .output(LASER_OUTPUT_HATCH) - .circuitMeta(1) - .duration(300).EUt(VA[IV]).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder() - .input(HULL[LuV]) - .input(lens, Diamond) - .input(SENSOR_LuV) - .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) - .output(LASER_INPUT_HATCH) - .circuitMeta(2) - .duration(300).EUt(VA[IV]).buildAndRegister();*/ + /* + * TODO UPSATUPDATE + * ASSEMBLER_RECIPES.recipeBuilder() + * .input(HULL[LuV]) + * .input(lens, Diamond) + * .input(EMITTER_LuV) + * .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) + * .output(LASER_OUTPUT_HATCH) + * .circuitMeta(1) + * .duration(300).EUt(VA[IV]).buildAndRegister(); + * + * ASSEMBLER_RECIPES.recipeBuilder() + * .input(HULL[LuV]) + * .input(lens, Diamond) + * .input(SENSOR_LuV) + * .input(wireGtSingle, IndiumTinBariumTitaniumCuprate, 2) + * .output(LASER_INPUT_HATCH) + * .circuitMeta(2) + * .duration(300).EUt(VA[IV]).buildAndRegister(); + */ ASSEMBLER_RECIPES.recipeBuilder() .inputs(TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)) diff --git a/src/main/java/gregtech/loaders/recipe/CraftingComponent.java b/src/main/java/gregtech/loaders/recipe/CraftingComponent.java index c7679d64fc7..f6c8898f9d9 100644 --- a/src/main/java/gregtech/loaders/recipe/CraftingComponent.java +++ b/src/main/java/gregtech/loaders/recipe/CraftingComponent.java @@ -12,6 +12,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -81,757 +82,753 @@ public class CraftingComponent { } public static void initializeComponents() { - /* * GTCEu must supply values for at least tiers 1 through 8 (through UV) */ - CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.circuit, Tier.ULV)}, - {1, new UnificationEntry(OrePrefix.circuit, Tier.LV)}, - {2, new UnificationEntry(OrePrefix.circuit, Tier.MV)}, - {3, new UnificationEntry(OrePrefix.circuit, Tier.HV)}, - {4, new UnificationEntry(OrePrefix.circuit, Tier.EV)}, - {5, new UnificationEntry(OrePrefix.circuit, Tier.IV)}, - {6, new UnificationEntry(OrePrefix.circuit, Tier.LuV)}, - {7, new UnificationEntry(OrePrefix.circuit, Tier.ZPM)}, - {8, new UnificationEntry(OrePrefix.circuit, Tier.UV)}, - {9, new UnificationEntry(OrePrefix.circuit, Tier.UHV)}, - {10, new UnificationEntry(OrePrefix.circuit, Tier.UEV)}, - {11, new UnificationEntry(OrePrefix.circuit, Tier.UIV)}, - {12, new UnificationEntry(OrePrefix.circuit, Tier.UXV)}, - {13, new UnificationEntry(OrePrefix.circuit, Tier.OpV)}, - {14, new UnificationEntry(OrePrefix.circuit, Tier.MAX)} - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - BETTER_CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.circuit, Tier.LV)}, - {1, new UnificationEntry(OrePrefix.circuit, Tier.MV)}, - {2, new UnificationEntry(OrePrefix.circuit, Tier.HV)}, - {3, new UnificationEntry(OrePrefix.circuit, Tier.EV)}, - {4, new UnificationEntry(OrePrefix.circuit, Tier.IV)}, - {5, new UnificationEntry(OrePrefix.circuit, Tier.LuV)}, - {6, new UnificationEntry(OrePrefix.circuit, Tier.ZPM)}, - {7, new UnificationEntry(OrePrefix.circuit, Tier.UV)}, - {8, new UnificationEntry(OrePrefix.circuit, Tier.UHV)}, - {9, new UnificationEntry(OrePrefix.circuit, Tier.UEV)}, - {10, new UnificationEntry(OrePrefix.circuit, Tier.UIV)}, - {11, new UnificationEntry(OrePrefix.circuit, Tier.UXV)}, - {12, new UnificationEntry(OrePrefix.circuit, Tier.OpV)}, - {13, new UnificationEntry(OrePrefix.circuit, Tier.MAX)} - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - PUMP = new Component(Stream.of(new Object[][]{ - - {1, MetaItems.ELECTRIC_PUMP_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_PUMP_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_PUMP_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_PUMP_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_PUMP_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_PUMP_LuV.getStackForm()}, - {7, MetaItems.ELECTRIC_PUMP_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_PUMP_UV.getStackForm()}, + CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, new UnificationEntry(OrePrefix.circuit, Tier.ULV) }, + { 1, new UnificationEntry(OrePrefix.circuit, Tier.LV) }, + { 2, new UnificationEntry(OrePrefix.circuit, Tier.MV) }, + { 3, new UnificationEntry(OrePrefix.circuit, Tier.HV) }, + { 4, new UnificationEntry(OrePrefix.circuit, Tier.EV) }, + { 5, new UnificationEntry(OrePrefix.circuit, Tier.IV) }, + { 6, new UnificationEntry(OrePrefix.circuit, Tier.LuV) }, + { 7, new UnificationEntry(OrePrefix.circuit, Tier.ZPM) }, + { 8, new UnificationEntry(OrePrefix.circuit, Tier.UV) }, + { 9, new UnificationEntry(OrePrefix.circuit, Tier.UHV) }, + { 10, new UnificationEntry(OrePrefix.circuit, Tier.UEV) }, + { 11, new UnificationEntry(OrePrefix.circuit, Tier.UIV) }, + { 12, new UnificationEntry(OrePrefix.circuit, Tier.UXV) }, + { 13, new UnificationEntry(OrePrefix.circuit, Tier.OpV) }, + { 14, new UnificationEntry(OrePrefix.circuit, Tier.MAX) } + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + BETTER_CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, new UnificationEntry(OrePrefix.circuit, Tier.LV) }, + { 1, new UnificationEntry(OrePrefix.circuit, Tier.MV) }, + { 2, new UnificationEntry(OrePrefix.circuit, Tier.HV) }, + { 3, new UnificationEntry(OrePrefix.circuit, Tier.EV) }, + { 4, new UnificationEntry(OrePrefix.circuit, Tier.IV) }, + { 5, new UnificationEntry(OrePrefix.circuit, Tier.LuV) }, + { 6, new UnificationEntry(OrePrefix.circuit, Tier.ZPM) }, + { 7, new UnificationEntry(OrePrefix.circuit, Tier.UV) }, + { 8, new UnificationEntry(OrePrefix.circuit, Tier.UHV) }, + { 9, new UnificationEntry(OrePrefix.circuit, Tier.UEV) }, + { 10, new UnificationEntry(OrePrefix.circuit, Tier.UIV) }, + { 11, new UnificationEntry(OrePrefix.circuit, Tier.UXV) }, + { 12, new UnificationEntry(OrePrefix.circuit, Tier.OpV) }, + { 13, new UnificationEntry(OrePrefix.circuit, Tier.MAX) } + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + PUMP = new Component(Stream.of(new Object[][] { + + { 1, MetaItems.ELECTRIC_PUMP_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_PUMP_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_PUMP_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_PUMP_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_PUMP_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_PUMP_LuV.getStackForm() }, + { 7, MetaItems.ELECTRIC_PUMP_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_PUMP_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - PUMP.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_PUMP_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_PUMP_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_PUMP_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_PUMP_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_PUMP_OpV.getStackForm()}, + PUMP.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_PUMP_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_PUMP_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_PUMP_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_PUMP_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_PUMP_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - WIRE_ELECTRIC = new Component(Stream.of(new Object[][]{ + WIRE_ELECTRIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold)}, - {1, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold)}, - {2, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Silver)}, - {3, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Electrum)}, - {4, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {6, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {7, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, - {8, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium)}, + { 0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold) }, + { 1, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Gold) }, + { 2, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Silver) }, + { 3, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Electrum) }, + { 4, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 6, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 7, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, + { 8, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Osmium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_QUAD = new Component(Stream.of(new Object[][]{ + WIRE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_OCT = new Component(Stream.of(new Object[][]{ + WIRE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtOctal, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtOctal, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtOctal, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_HEX = new Component(Stream.of(new Object[][]{ + WIRE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtHex, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtHex, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtHex, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.wireGtHex, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.wireGtHex, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.wireGtHex, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtHex, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtHex, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtHex, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtHex, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.wireGtHex, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.wireGtHex, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.wireGtHex, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.wireGtHex, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtHex, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE = new Component(Stream.of(new Object[][]{ + CABLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_QUAD = new Component(Stream.of(new Object[][]{ + CABLE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_OCT = new Component(Stream.of(new Object[][]{ + CABLE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtOctal, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtOctal, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtOctal, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtOctal, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtOctal, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtOctal, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtOctal, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_HEX = new Component(Stream.of(new Object[][]{ + CABLE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtHex, Materials.RedAlloy)}, - {1, new UnificationEntry(OrePrefix.cableGtHex, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.cableGtHex, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.cableGtHex, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.cableGtHex, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.cableGtHex, Materials.Platinum)}, - {6, new UnificationEntry(OrePrefix.cableGtHex, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.cableGtHex, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.cableGtHex, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.cableGtHex, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtHex, Materials.RedAlloy) }, + { 1, new UnificationEntry(OrePrefix.cableGtHex, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.cableGtHex, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.cableGtHex, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.cableGtHex, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.cableGtHex, Materials.Platinum) }, + { 6, new UnificationEntry(OrePrefix.cableGtHex, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.cableGtHex, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.cableGtHex, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.cableGtHex, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold)}, - {3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium)}, - {4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium)}, - {6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium)}, - {7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate)}, - {8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Gold) }, + { 3, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Aluminium) }, + { 4, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.cableGtSingle, Materials.NiobiumTitanium) }, + { 6, new UnificationEntry(OrePrefix.cableGtSingle, Materials.VanadiumGallium) }, + { 7, new UnificationEntry(OrePrefix.cableGtSingle, Materials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtSingle, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_QUAD_TIER_UP = new Component(Stream.of(new Object[][]{ + CABLE_QUAD_TIER_UP = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold)}, - {3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium)}, - {4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum)}, - {5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium)}, - {6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium)}, - {7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate)}, - {8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Gold) }, + { 3, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Aluminium) }, + { 4, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Platinum) }, + { 5, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.NiobiumTitanium) }, + { 6, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.VanadiumGallium) }, + { 7, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.cableGtQuadruple, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL = new Component(Stream.of(new Object[][]{ + HULL = new Component(Stream.of(new Object[][] { - {0, MetaTileEntities.HULL[0].getStackForm()}, - {1, MetaTileEntities.HULL[1].getStackForm()}, - {2, MetaTileEntities.HULL[2].getStackForm()}, - {3, MetaTileEntities.HULL[3].getStackForm()}, - {4, MetaTileEntities.HULL[4].getStackForm()}, - {5, MetaTileEntities.HULL[5].getStackForm()}, - {6, MetaTileEntities.HULL[6].getStackForm()}, - {7, MetaTileEntities.HULL[7].getStackForm()}, - {8, MetaTileEntities.HULL[8].getStackForm()}, - {9, MetaTileEntities.HULL[9].getStackForm()}, + { 0, MetaTileEntities.HULL[0].getStackForm() }, + { 1, MetaTileEntities.HULL[1].getStackForm() }, + { 2, MetaTileEntities.HULL[2].getStackForm() }, + { 3, MetaTileEntities.HULL[3].getStackForm() }, + { 4, MetaTileEntities.HULL[4].getStackForm() }, + { 5, MetaTileEntities.HULL[5].getStackForm() }, + { 6, MetaTileEntities.HULL[6].getStackForm() }, + { 7, MetaTileEntities.HULL[7].getStackForm() }, + { 8, MetaTileEntities.HULL[8].getStackForm() }, + { 9, MetaTileEntities.HULL[9].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - HULL.appendIngredients(Stream.of(new Object[][]{ - {10, MetaTileEntities.HULL[10].getStackForm()}, - {11, MetaTileEntities.HULL[11].getStackForm()}, - {12, MetaTileEntities.HULL[12].getStackForm()}, - {13, MetaTileEntities.HULL[13].getStackForm()}, - {14, MetaTileEntities.HULL[14].getStackForm()}, + HULL.appendIngredients(Stream.of(new Object[][] { + { 10, MetaTileEntities.HULL[10].getStackForm() }, + { 11, MetaTileEntities.HULL[11].getStackForm() }, + { 12, MetaTileEntities.HULL[12].getStackForm() }, + { 13, MetaTileEntities.HULL[13].getStackForm() }, + { 14, MetaTileEntities.HULL[14].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - TRANSFORMER = new Component(Stream.of(new Object[][]{ + TRANSFORMER = new Component(Stream.of(new Object[][] { - {0, MetaTileEntities.TRANSFORMER[0].getStackForm()}, - {1, MetaTileEntities.TRANSFORMER[1].getStackForm()}, - {2, MetaTileEntities.TRANSFORMER[2].getStackForm()}, - {3, MetaTileEntities.TRANSFORMER[3].getStackForm()}, - {4, MetaTileEntities.TRANSFORMER[4].getStackForm()}, - {5, MetaTileEntities.TRANSFORMER[5].getStackForm()}, - {6, MetaTileEntities.TRANSFORMER[6].getStackForm()}, - {7, MetaTileEntities.TRANSFORMER[7].getStackForm()}, - {8, MetaTileEntities.TRANSFORMER[8].getStackForm()}, + { 0, MetaTileEntities.TRANSFORMER[0].getStackForm() }, + { 1, MetaTileEntities.TRANSFORMER[1].getStackForm() }, + { 2, MetaTileEntities.TRANSFORMER[2].getStackForm() }, + { 3, MetaTileEntities.TRANSFORMER[3].getStackForm() }, + { 4, MetaTileEntities.TRANSFORMER[4].getStackForm() }, + { 5, MetaTileEntities.TRANSFORMER[5].getStackForm() }, + { 6, MetaTileEntities.TRANSFORMER[6].getStackForm() }, + { 7, MetaTileEntities.TRANSFORMER[7].getStackForm() }, + { 8, MetaTileEntities.TRANSFORMER[8].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - TRANSFORMER.appendIngredients(Stream.of(new Object[][]{ - {9, MetaTileEntities.TRANSFORMER[9].getStackForm()}, - {10, MetaTileEntities.TRANSFORMER[10].getStackForm()}, - {11, MetaTileEntities.TRANSFORMER[11].getStackForm()}, - {12, MetaTileEntities.TRANSFORMER[12].getStackForm()}, - {13, MetaTileEntities.TRANSFORMER[13].getStackForm()}, + TRANSFORMER.appendIngredients(Stream.of(new Object[][] { + { 9, MetaTileEntities.TRANSFORMER[9].getStackForm() }, + { 10, MetaTileEntities.TRANSFORMER[10].getStackForm() }, + { 11, MetaTileEntities.TRANSFORMER[11].getStackForm() }, + { 12, MetaTileEntities.TRANSFORMER[12].getStackForm() }, + { 13, MetaTileEntities.TRANSFORMER[13].getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - CASING = new Component(Stream.of(new Object[][]{ + CASING = new Component(Stream.of(new Object[][] { - {0, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ULV)}, - {1, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LV)}, - {2, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MV)}, - {3, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.HV)}, - {4, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.EV)}, - {5, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.IV)}, - {6, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LuV)}, - {7, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ZPM)}, - {8, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UV)}, - {9, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UHV)}, + { 0, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ULV) }, + { 1, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LV) }, + { 2, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MV) }, + { 3, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.HV) }, + { 4, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.EV) }, + { 5, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.IV) }, + { 6, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.LuV) }, + { 7, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.ZPM) }, + { 8, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UV) }, + { 9, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UHV) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - CASING.appendIngredients(Stream.of(new Object[][]{ - {10, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UEV)}, - {11, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UIV)}, - {12, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UXV)}, - {13, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.OpV)}, - {14, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MAX)}, + CASING.appendIngredients(Stream.of(new Object[][] { + { 10, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UEV) }, + { 11, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UIV) }, + { 12, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.UXV) }, + { 13, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.OpV) }, + { 14, MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.MAX) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - PIPE_NORMAL = new Component(Stream.of(new Object[][]{ + PIPE_NORMAL = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze)}, - {2, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Iridium)}, - {8, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Naquadah)}, + { 0, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Bronze) }, + { 2, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Iridium) }, + { 8, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_LARGE = new Component(Stream.of(new Object[][]{ + PIPE_LARGE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze)}, - {2, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Ultimet)}, - {8, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Naquadah)}, + { 0, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Bronze) }, + { 2, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Ultimet) }, + { 8, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - //TODO, Glass Tiers: + // TODO, Glass Tiers: /* - Glass: Steam-MV - Tempered: HV, EV - Laminated Glass: IV, LuV - Fusion: ZPM, UV - Some gregicality thing: UHV+ + * Glass: Steam-MV + * Tempered: HV, EV + * Laminated Glass: IV, LuV + * Fusion: ZPM, UV + * Some gregicality thing: UHV+ */ - GLASS = new Component(Stream.of(new Object[][]{ + GLASS = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {ULV, Blocks.GLASS}, - {LV, Blocks.GLASS}, - {MV, Blocks.GLASS}, - {HV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS)}, - {EV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS)}, - {IV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.LAMINATED_GLASS)}, - {LuV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.LAMINATED_GLASS)}, - {ZPM, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.FUSION_GLASS)}, - {UV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.FUSION_GLASS)} + { GTValues.FALLBACK, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { ULV, Blocks.GLASS }, + { LV, Blocks.GLASS }, + { MV, Blocks.GLASS }, + { HV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS) }, + { EV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS) }, + { IV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.LAMINATED_GLASS) }, + { LuV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.LAMINATED_GLASS) }, + { ZPM, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.FUSION_GLASS) }, + { UV, MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.FUSION_GLASS) } }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PLATE = new Component(Stream.of(new Object[][]{ + PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {1, new UnificationEntry(OrePrefix.plate, Materials.Steel)}, - {2, new UnificationEntry(OrePrefix.plate, Materials.Aluminium)}, - {3, new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.plate, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.plate, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.plate, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.plate, Materials.Darmstadtium)}, - {9, new UnificationEntry(OrePrefix.plate, Materials.Neutronium)}, + { 0, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 1, new UnificationEntry(OrePrefix.plate, Materials.Steel) }, + { 2, new UnificationEntry(OrePrefix.plate, Materials.Aluminium) }, + { 3, new UnificationEntry(OrePrefix.plate, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.plate, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.plate, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.plate, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.plate, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.plate, Materials.Darmstadtium) }, + { 9, new UnificationEntry(OrePrefix.plate, Materials.Neutronium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - DOUBLE_PLATE = new Component(Stream.of(new Object[][]{ + DOUBLE_PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plateDouble, Materials.WroughtIron)}, - {1, new UnificationEntry(OrePrefix.plateDouble, Materials.Steel)}, - {2, new UnificationEntry(OrePrefix.plateDouble, Materials.Aluminium)}, - {3, new UnificationEntry(OrePrefix.plateDouble, Materials.StainlessSteel)}, - {4, new UnificationEntry(OrePrefix.plateDouble, Materials.Titanium)}, - {5, new UnificationEntry(OrePrefix.plateDouble, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.plateDouble, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.plateDouble, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.plateDouble, Materials.Darmstadtium)}, - {9, new UnificationEntry(OrePrefix.plateDouble, Materials.Neutronium)}, + { 0, new UnificationEntry(OrePrefix.plateDouble, Materials.WroughtIron) }, + { 1, new UnificationEntry(OrePrefix.plateDouble, Materials.Steel) }, + { 2, new UnificationEntry(OrePrefix.plateDouble, Materials.Aluminium) }, + { 3, new UnificationEntry(OrePrefix.plateDouble, Materials.StainlessSteel) }, + { 4, new UnificationEntry(OrePrefix.plateDouble, Materials.Titanium) }, + { 5, new UnificationEntry(OrePrefix.plateDouble, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.plateDouble, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.plateDouble, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.plateDouble, Materials.Darmstadtium) }, + { 9, new UnificationEntry(OrePrefix.plateDouble, Materials.Neutronium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL_PLATE = new Component(Stream.of(new Object[][]{ + HULL_PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.plate, Materials.Wood)}, - {1, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {2, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron)}, - {3, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene)}, - {4, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene)}, - {5, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene)}, - {6, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, - {8, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole)}, + { 0, new UnificationEntry(OrePrefix.plate, Materials.Wood) }, + { 1, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 2, new UnificationEntry(OrePrefix.plate, Materials.WroughtIron) }, + { 3, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene) }, + { 4, new UnificationEntry(OrePrefix.plate, Materials.Polyethylene) }, + { 5, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene) }, + { 6, new UnificationEntry(OrePrefix.plate, Materials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, + { 8, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.plate, Materials.Polybenzimidazole) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - MOTOR = new Component(Stream.of(new Object[][]{ + MOTOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.ELECTRIC_MOTOR_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_MOTOR_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_MOTOR_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_MOTOR_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_MOTOR_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_MOTOR_LuV.getStackForm()}, - {7, MetaItems.ELECTRIC_MOTOR_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_MOTOR_UV.getStackForm()}, + { 1, MetaItems.ELECTRIC_MOTOR_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_MOTOR_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_MOTOR_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_MOTOR_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_MOTOR_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_MOTOR_LuV.getStackForm() }, + { 7, MetaItems.ELECTRIC_MOTOR_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_MOTOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - MOTOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_MOTOR_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_MOTOR_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_MOTOR_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_MOTOR_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_MOTOR_OpV.getStackForm()}, + MOTOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_MOTOR_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_MOTOR_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_MOTOR_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_MOTOR_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_MOTOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROTOR = new Component(Stream.of(new Object[][]{ + ROTOR = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.rotor, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.rotor, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.rotor, Materials.Bronze)}, - {3, new UnificationEntry(OrePrefix.rotor, Materials.Steel)}, - {4, new UnificationEntry(OrePrefix.rotor, Materials.StainlessSteel)}, - {5, new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel)}, - {6, new UnificationEntry(OrePrefix.rotor, Materials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(OrePrefix.rotor, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.rotor, Materials.Darmstadtium)}, + { 0, new UnificationEntry(OrePrefix.rotor, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.rotor, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.rotor, Materials.Bronze) }, + { 3, new UnificationEntry(OrePrefix.rotor, Materials.Steel) }, + { 4, new UnificationEntry(OrePrefix.rotor, Materials.StainlessSteel) }, + { 5, new UnificationEntry(OrePrefix.rotor, Materials.TungstenSteel) }, + { 6, new UnificationEntry(OrePrefix.rotor, Materials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(OrePrefix.rotor, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.rotor, Materials.Darmstadtium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SENSOR = new Component(Stream.of(new Object[][]{ + SENSOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.SENSOR_LV.getStackForm()}, - {2, MetaItems.SENSOR_MV.getStackForm()}, - {3, MetaItems.SENSOR_HV.getStackForm()}, - {4, MetaItems.SENSOR_EV.getStackForm()}, - {5, MetaItems.SENSOR_IV.getStackForm()}, - {6, MetaItems.SENSOR_LuV.getStackForm()}, - {7, MetaItems.SENSOR_ZPM.getStackForm()}, - {8, MetaItems.SENSOR_UV.getStackForm()}, + { 1, MetaItems.SENSOR_LV.getStackForm() }, + { 2, MetaItems.SENSOR_MV.getStackForm() }, + { 3, MetaItems.SENSOR_HV.getStackForm() }, + { 4, MetaItems.SENSOR_EV.getStackForm() }, + { 5, MetaItems.SENSOR_IV.getStackForm() }, + { 6, MetaItems.SENSOR_LuV.getStackForm() }, + { 7, MetaItems.SENSOR_ZPM.getStackForm() }, + { 8, MetaItems.SENSOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - SENSOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.SENSOR_UHV.getStackForm()}, - {10, MetaItems.SENSOR_UEV.getStackForm()}, - {11, MetaItems.SENSOR_UIV.getStackForm()}, - {12, MetaItems.SENSOR_UXV.getStackForm()}, - {13, MetaItems.SENSOR_OpV.getStackForm()}, + SENSOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.SENSOR_UHV.getStackForm() }, + { 10, MetaItems.SENSOR_UEV.getStackForm() }, + { 11, MetaItems.SENSOR_UIV.getStackForm() }, + { 12, MetaItems.SENSOR_UXV.getStackForm() }, + { 13, MetaItems.SENSOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - GRINDER = new Component(Stream.of(new Object[][]{ + GRINDER = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {1, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {2, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, - {3, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm()}, - {4, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm()}, - {5, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm()}, - {GTValues.FALLBACK, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm()}, + { 0, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 1, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 2, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, + { 3, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm() }, + { 4, MetaItems.COMPONENT_GRINDER_DIAMOND.getStackForm() }, + { 5, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm() }, + { GTValues.FALLBACK, MetaItems.COMPONENT_GRINDER_TUNGSTEN.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SAWBLADE = new Component(Stream.of(new Object[][]{ + SAWBLADE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Bronze)}, - {1, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.CobaltBrass)}, - {2, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.VanadiumSteel)}, - {3, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.BlueSteel)}, - {4, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Ultimet)}, - {5, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.TungstenCarbide)}, - {6, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.HSSE)}, - {7, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.NaquadahAlloy)}, - {8, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium)}, + { 0, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Bronze) }, + { 1, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.CobaltBrass) }, + { 2, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.VanadiumSteel) }, + { 3, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.BlueSteel) }, + { 4, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Ultimet) }, + { 5, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.TungstenCarbide) }, + { 6, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.HSSE) }, + { 7, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.NaquadahAlloy) }, + { 8, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.toolHeadBuzzSaw, Materials.Duranium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - DIAMOND = new Component(Stream.of(new Object[][]{ + DIAMOND = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.gem, Materials.Diamond)}, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.gem, Materials.Diamond) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PISTON = new Component(Stream.of(new Object[][]{ + PISTON = new Component(Stream.of(new Object[][] { - {1, MetaItems.ELECTRIC_PISTON_LV.getStackForm()}, - {2, MetaItems.ELECTRIC_PISTON_MV.getStackForm()}, - {3, MetaItems.ELECTRIC_PISTON_HV.getStackForm()}, - {4, MetaItems.ELECTRIC_PISTON_EV.getStackForm()}, - {5, MetaItems.ELECTRIC_PISTON_IV.getStackForm()}, - {6, MetaItems.ELECTRIC_PISTON_LUV.getStackForm()}, - {7, MetaItems.ELECTRIC_PISTON_ZPM.getStackForm()}, - {8, MetaItems.ELECTRIC_PISTON_UV.getStackForm()}, + { 1, MetaItems.ELECTRIC_PISTON_LV.getStackForm() }, + { 2, MetaItems.ELECTRIC_PISTON_MV.getStackForm() }, + { 3, MetaItems.ELECTRIC_PISTON_HV.getStackForm() }, + { 4, MetaItems.ELECTRIC_PISTON_EV.getStackForm() }, + { 5, MetaItems.ELECTRIC_PISTON_IV.getStackForm() }, + { 6, MetaItems.ELECTRIC_PISTON_LUV.getStackForm() }, + { 7, MetaItems.ELECTRIC_PISTON_ZPM.getStackForm() }, + { 8, MetaItems.ELECTRIC_PISTON_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - PISTON.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ELECTRIC_PISTON_UHV.getStackForm()}, - {10, MetaItems.ELECTRIC_PISTON_UEV.getStackForm()}, - {11, MetaItems.ELECTRIC_PISTON_UIV.getStackForm()}, - {12, MetaItems.ELECTRIC_PISTON_UXV.getStackForm()}, - {13, MetaItems.ELECTRIC_PISTON_OpV.getStackForm()}, + PISTON.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ELECTRIC_PISTON_UHV.getStackForm() }, + { 10, MetaItems.ELECTRIC_PISTON_UEV.getStackForm() }, + { 11, MetaItems.ELECTRIC_PISTON_UIV.getStackForm() }, + { 12, MetaItems.ELECTRIC_PISTON_UXV.getStackForm() }, + { 13, MetaItems.ELECTRIC_PISTON_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - EMITTER = new Component(Stream.of(new Object[][]{ + EMITTER = new Component(Stream.of(new Object[][] { - {1, MetaItems.EMITTER_LV.getStackForm()}, - {2, MetaItems.EMITTER_MV.getStackForm()}, - {3, MetaItems.EMITTER_HV.getStackForm()}, - {4, MetaItems.EMITTER_EV.getStackForm()}, - {5, MetaItems.EMITTER_IV.getStackForm()}, - {6, MetaItems.EMITTER_LuV.getStackForm()}, - {7, MetaItems.EMITTER_ZPM.getStackForm()}, - {8, MetaItems.EMITTER_UV.getStackForm()}, + { 1, MetaItems.EMITTER_LV.getStackForm() }, + { 2, MetaItems.EMITTER_MV.getStackForm() }, + { 3, MetaItems.EMITTER_HV.getStackForm() }, + { 4, MetaItems.EMITTER_EV.getStackForm() }, + { 5, MetaItems.EMITTER_IV.getStackForm() }, + { 6, MetaItems.EMITTER_LuV.getStackForm() }, + { 7, MetaItems.EMITTER_ZPM.getStackForm() }, + { 8, MetaItems.EMITTER_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - EMITTER.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.EMITTER_UHV.getStackForm()}, - {10, MetaItems.EMITTER_UEV.getStackForm()}, - {11, MetaItems.EMITTER_UIV.getStackForm()}, - {12, MetaItems.EMITTER_UXV.getStackForm()}, - {13, MetaItems.EMITTER_OpV.getStackForm()}, + EMITTER.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.EMITTER_UHV.getStackForm() }, + { 10, MetaItems.EMITTER_UEV.getStackForm() }, + { 11, MetaItems.EMITTER_UIV.getStackForm() }, + { 12, MetaItems.EMITTER_UXV.getStackForm() }, + { 13, MetaItems.EMITTER_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - CONVEYOR = new Component(Stream.of(new Object[][]{ + CONVEYOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.CONVEYOR_MODULE_LV.getStackForm()}, - {2, MetaItems.CONVEYOR_MODULE_MV.getStackForm()}, - {3, MetaItems.CONVEYOR_MODULE_HV.getStackForm()}, - {4, MetaItems.CONVEYOR_MODULE_EV.getStackForm()}, - {5, MetaItems.CONVEYOR_MODULE_IV.getStackForm()}, - {6, MetaItems.CONVEYOR_MODULE_LuV.getStackForm()}, - {7, MetaItems.CONVEYOR_MODULE_ZPM.getStackForm()}, - {8, MetaItems.CONVEYOR_MODULE_UV.getStackForm()}, + { 1, MetaItems.CONVEYOR_MODULE_LV.getStackForm() }, + { 2, MetaItems.CONVEYOR_MODULE_MV.getStackForm() }, + { 3, MetaItems.CONVEYOR_MODULE_HV.getStackForm() }, + { 4, MetaItems.CONVEYOR_MODULE_EV.getStackForm() }, + { 5, MetaItems.CONVEYOR_MODULE_IV.getStackForm() }, + { 6, MetaItems.CONVEYOR_MODULE_LuV.getStackForm() }, + { 7, MetaItems.CONVEYOR_MODULE_ZPM.getStackForm() }, + { 8, MetaItems.CONVEYOR_MODULE_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - CONVEYOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.CONVEYOR_MODULE_UHV.getStackForm()}, - {10, MetaItems.CONVEYOR_MODULE_UEV.getStackForm()}, - {11, MetaItems.CONVEYOR_MODULE_UIV.getStackForm()}, - {12, MetaItems.CONVEYOR_MODULE_UXV.getStackForm()}, - {13, MetaItems.CONVEYOR_MODULE_OpV.getStackForm()}, + CONVEYOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.CONVEYOR_MODULE_UHV.getStackForm() }, + { 10, MetaItems.CONVEYOR_MODULE_UEV.getStackForm() }, + { 11, MetaItems.CONVEYOR_MODULE_UIV.getStackForm() }, + { 12, MetaItems.CONVEYOR_MODULE_UXV.getStackForm() }, + { 13, MetaItems.CONVEYOR_MODULE_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROBOT_ARM = new Component(Stream.of(new Object[][]{ + ROBOT_ARM = new Component(Stream.of(new Object[][] { - {1, MetaItems.ROBOT_ARM_LV.getStackForm()}, - {2, MetaItems.ROBOT_ARM_MV.getStackForm()}, - {3, MetaItems.ROBOT_ARM_HV.getStackForm()}, - {4, MetaItems.ROBOT_ARM_EV.getStackForm()}, - {5, MetaItems.ROBOT_ARM_IV.getStackForm()}, - {6, MetaItems.ROBOT_ARM_LuV.getStackForm()}, - {7, MetaItems.ROBOT_ARM_ZPM.getStackForm()}, - {8, MetaItems.ROBOT_ARM_UV.getStackForm()}, + { 1, MetaItems.ROBOT_ARM_LV.getStackForm() }, + { 2, MetaItems.ROBOT_ARM_MV.getStackForm() }, + { 3, MetaItems.ROBOT_ARM_HV.getStackForm() }, + { 4, MetaItems.ROBOT_ARM_EV.getStackForm() }, + { 5, MetaItems.ROBOT_ARM_IV.getStackForm() }, + { 6, MetaItems.ROBOT_ARM_LuV.getStackForm() }, + { 7, MetaItems.ROBOT_ARM_ZPM.getStackForm() }, + { 8, MetaItems.ROBOT_ARM_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - ROBOT_ARM.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.ROBOT_ARM_UHV.getStackForm()}, - {10, MetaItems.ROBOT_ARM_UEV.getStackForm()}, - {11, MetaItems.ROBOT_ARM_UIV.getStackForm()}, - {12, MetaItems.ROBOT_ARM_UXV.getStackForm()}, - {13, MetaItems.ROBOT_ARM_OpV.getStackForm()}, + ROBOT_ARM.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.ROBOT_ARM_UHV.getStackForm() }, + { 10, MetaItems.ROBOT_ARM_UEV.getStackForm() }, + { 11, MetaItems.ROBOT_ARM_UIV.getStackForm() }, + { 12, MetaItems.ROBOT_ARM_UXV.getStackForm() }, + { 13, MetaItems.ROBOT_ARM_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - COIL_HEATING = new Component(Stream.of(new Object[][]{ + COIL_HEATING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.wireGtDouble, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.wireGtDouble, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.wireGtDouble, Materials.NaquadahAlloy)}, + { 0, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.wireGtDouble, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.wireGtDouble, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.wireGtDouble, Materials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][]{ + COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NaquadahAlloy)}, + { 0, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 1, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + COIL_ELECTRIC = new Component(Stream.of(new Object[][] { - COIL_ELECTRIC = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Tin)}, - {1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Silver)}, - {4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Steel)}, - {5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Graphene)}, - {6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumNitride)}, - {7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(OrePrefix.wireGtSingle, Materials.Tin) }, + { 1, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.wireGtDouble, Materials.Silver) }, + { 4, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Steel) }, + { 5, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.Graphene) }, + { 6, new UnificationEntry(OrePrefix.wireGtQuadruple, Materials.NiobiumNitride) }, + { 7, new UnificationEntry(OrePrefix.wireGtOctal, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.wireGtOctal, Materials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_MAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_MAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic)}, - {1, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic)}, - {2, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic)}, - {3, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic)}, - {4, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic)}, - {5, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic)}, - {6, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic)}, - {7, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic)}, - {8, new UnificationEntry(OrePrefix.block, Materials.NeodymiumMagnetic)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic) }, + { 1, new UnificationEntry(OrePrefix.stick, Materials.IronMagnetic) }, + { 2, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic) }, + { 3, new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic) }, + { 4, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic) }, + { 5, new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic) }, + { 6, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic) }, + { 7, new UnificationEntry(OrePrefix.stickLong, Materials.NeodymiumMagnetic) }, + { 8, new UnificationEntry(OrePrefix.block, Materials.NeodymiumMagnetic) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_DISTILLATION = new Component(Stream.of(new Object[][]{ + STICK_DISTILLATION = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.Blaze)}, - {1, new UnificationEntry(OrePrefix.spring, Materials.Copper)}, - {2, new UnificationEntry(OrePrefix.spring, Materials.Cupronickel)}, - {3, new UnificationEntry(OrePrefix.spring, Materials.Kanthal)}, - {4, new UnificationEntry(OrePrefix.spring, Materials.Nichrome)}, - {5, new UnificationEntry(OrePrefix.spring, Materials.RTMAlloy)}, - {6, new UnificationEntry(OrePrefix.spring, Materials.HSSG)}, - {7, new UnificationEntry(OrePrefix.spring, Materials.Naquadah)}, - {8, new UnificationEntry(OrePrefix.spring, Materials.NaquadahAlloy)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Blaze)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.Blaze) }, + { 1, new UnificationEntry(OrePrefix.spring, Materials.Copper) }, + { 2, new UnificationEntry(OrePrefix.spring, Materials.Cupronickel) }, + { 3, new UnificationEntry(OrePrefix.spring, Materials.Kanthal) }, + { 4, new UnificationEntry(OrePrefix.spring, Materials.Nichrome) }, + { 5, new UnificationEntry(OrePrefix.spring, Materials.RTMAlloy) }, + { 6, new UnificationEntry(OrePrefix.spring, Materials.HSSG) }, + { 7, new UnificationEntry(OrePrefix.spring, Materials.Naquadah) }, + { 8, new UnificationEntry(OrePrefix.spring, Materials.NaquadahAlloy) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Blaze) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - FIELD_GENERATOR = new Component(Stream.of(new Object[][]{ + FIELD_GENERATOR = new Component(Stream.of(new Object[][] { - {1, MetaItems.FIELD_GENERATOR_LV.getStackForm()}, - {2, MetaItems.FIELD_GENERATOR_MV.getStackForm()}, - {3, MetaItems.FIELD_GENERATOR_HV.getStackForm()}, - {4, MetaItems.FIELD_GENERATOR_EV.getStackForm()}, - {5, MetaItems.FIELD_GENERATOR_IV.getStackForm()}, - {6, MetaItems.FIELD_GENERATOR_LuV.getStackForm()}, - {7, MetaItems.FIELD_GENERATOR_ZPM.getStackForm()}, - {8, MetaItems.FIELD_GENERATOR_UV.getStackForm()}, + { 1, MetaItems.FIELD_GENERATOR_LV.getStackForm() }, + { 2, MetaItems.FIELD_GENERATOR_MV.getStackForm() }, + { 3, MetaItems.FIELD_GENERATOR_HV.getStackForm() }, + { 4, MetaItems.FIELD_GENERATOR_EV.getStackForm() }, + { 5, MetaItems.FIELD_GENERATOR_IV.getStackForm() }, + { 6, MetaItems.FIELD_GENERATOR_LuV.getStackForm() }, + { 7, MetaItems.FIELD_GENERATOR_ZPM.getStackForm() }, + { 8, MetaItems.FIELD_GENERATOR_UV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GregTechAPI.isHighTier()) { - FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][]{ - {9, MetaItems.FIELD_GENERATOR_UHV.getStackForm()}, - {10, MetaItems.FIELD_GENERATOR_UEV.getStackForm()}, - {11, MetaItems.FIELD_GENERATOR_UIV.getStackForm()}, - {12, MetaItems.FIELD_GENERATOR_UXV.getStackForm()}, - {13, MetaItems.FIELD_GENERATOR_OpV.getStackForm()}, + FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][] { + { 9, MetaItems.FIELD_GENERATOR_UHV.getStackForm() }, + { 10, MetaItems.FIELD_GENERATOR_UEV.getStackForm() }, + { 11, MetaItems.FIELD_GENERATOR_UIV.getStackForm() }, + { 12, MetaItems.FIELD_GENERATOR_UXV.getStackForm() }, + { 13, MetaItems.FIELD_GENERATOR_OpV.getStackForm() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.stick, Materials.Iron)}, - {1, new UnificationEntry(OrePrefix.stick, Materials.Iron)}, - {2, new UnificationEntry(OrePrefix.stick, Materials.Steel)}, - {3, new UnificationEntry(OrePrefix.stick, Materials.Steel)}, - {4, new UnificationEntry(OrePrefix.stick, Materials.Neodymium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.VanadiumGallium)}, + { 0, new UnificationEntry(OrePrefix.stick, Materials.Iron) }, + { 1, new UnificationEntry(OrePrefix.stick, Materials.Iron) }, + { 2, new UnificationEntry(OrePrefix.stick, Materials.Steel) }, + { 3, new UnificationEntry(OrePrefix.stick, Materials.Steel) }, + { 4, new UnificationEntry(OrePrefix.stick, Materials.Neodymium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.VanadiumGallium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_RADIOACTIVE = new Component(Stream.of(new Object[][]{ + STICK_RADIOACTIVE = new Component(Stream.of(new Object[][] { - {4, new UnificationEntry(OrePrefix.stick, Materials.Uranium235)}, - {5, new UnificationEntry(OrePrefix.stick, Materials.Plutonium241)}, - {6, new UnificationEntry(OrePrefix.stick, Materials.NaquadahEnriched)}, - {7, new UnificationEntry(OrePrefix.stick, Materials.Americium)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Tritanium)}, + { 4, new UnificationEntry(OrePrefix.stick, Materials.Uranium235) }, + { 5, new UnificationEntry(OrePrefix.stick, Materials.Plutonium241) }, + { 6, new UnificationEntry(OrePrefix.stick, Materials.NaquadahEnriched) }, + { 7, new UnificationEntry(OrePrefix.stick, Materials.Americium) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.stick, Materials.Tritanium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_REACTOR = new Component(Stream.of(new Object[][]{ + PIPE_REACTOR = new Component(Stream.of(new Object[][] { - {0, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {1, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {2, new ItemStack(Blocks.GLASS, 1, GTValues.W)}, - {3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene)}, - {4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polyethylene)}, - {5, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polyethylene)}, - {6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polytetrafluoroethylene)}, - {8, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polytetrafluoroethylene)}, - {GTValues.FALLBACK, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene)}, + { 0, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 1, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 2, new ItemStack(Blocks.GLASS, 1, GTValues.W) }, + { 3, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene) }, + { 4, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polyethylene) }, + { 5, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polyethylene) }, + { 6, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(OrePrefix.pipeLargeFluid, Materials.Polytetrafluoroethylene) }, + { 8, new UnificationEntry(OrePrefix.pipeHugeFluid, Materials.Polytetrafluoroethylene) }, + { GTValues.FALLBACK, new UnificationEntry(OrePrefix.pipeNormalFluid, Materials.Polyethylene) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - POWER_COMPONENT = new Component(Stream.of(new Object[][]{ + POWER_COMPONENT = new Component(Stream.of(new Object[][] { - {2, MetaItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {3, MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {4, MetaItems.POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {5, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {6, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {7, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {8, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {9, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm()}, - {GTValues.FALLBACK, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT}, + { 2, MetaItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 3, MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 4, MetaItems.POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 5, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 6, MetaItems.HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 7, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 8, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { 9, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm() }, + { GTValues.FALLBACK, MetaItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - VOLTAGE_COIL = new Component(Stream.of(new Object[][]{ + VOLTAGE_COIL = new Component(Stream.of(new Object[][] { - {0, MetaItems.VOLTAGE_COIL_ULV.getStackForm()}, - {1, MetaItems.VOLTAGE_COIL_LV.getStackForm()}, - {2, MetaItems.VOLTAGE_COIL_MV.getStackForm()}, - {3, MetaItems.VOLTAGE_COIL_HV.getStackForm()}, - {4, MetaItems.VOLTAGE_COIL_EV.getStackForm()}, - {5, MetaItems.VOLTAGE_COIL_IV.getStackForm()}, - {6, MetaItems.VOLTAGE_COIL_LuV.getStackForm()}, - {7, MetaItems.VOLTAGE_COIL_ZPM.getStackForm()}, - {8, MetaItems.VOLTAGE_COIL_UV.getStackForm()}, - {GTValues.FALLBACK, MetaItems.VOLTAGE_COIL_UV}, + { 0, MetaItems.VOLTAGE_COIL_ULV.getStackForm() }, + { 1, MetaItems.VOLTAGE_COIL_LV.getStackForm() }, + { 2, MetaItems.VOLTAGE_COIL_MV.getStackForm() }, + { 3, MetaItems.VOLTAGE_COIL_HV.getStackForm() }, + { 4, MetaItems.VOLTAGE_COIL_EV.getStackForm() }, + { 5, MetaItems.VOLTAGE_COIL_IV.getStackForm() }, + { 6, MetaItems.VOLTAGE_COIL_LuV.getStackForm() }, + { 7, MetaItems.VOLTAGE_COIL_ZPM.getStackForm() }, + { 8, MetaItems.VOLTAGE_COIL_UV.getStackForm() }, + { GTValues.FALLBACK, MetaItems.VOLTAGE_COIL_UV }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SPRING = new Component(Stream.of(new Object[][]{ + SPRING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(OrePrefix.spring, Materials.Lead)}, - {1, new UnificationEntry(OrePrefix.spring, Materials.Tin)}, - {2, new UnificationEntry(OrePrefix.spring, Materials.Copper)}, - {3, new UnificationEntry(OrePrefix.spring, Materials.Gold)}, - {4, new UnificationEntry(OrePrefix.spring, Materials.Aluminium)}, - {5, new UnificationEntry(OrePrefix.spring, Materials.Tungsten)}, - {6, new UnificationEntry(OrePrefix.spring, Materials.NiobiumTitanium)}, - {7, new UnificationEntry(OrePrefix.spring, Materials.VanadiumGallium)}, - {8, new UnificationEntry(OrePrefix.spring, Materials.YttriumBariumCuprate)}, - {9, new UnificationEntry(OrePrefix.spring, Materials.Europium)}, + { 0, new UnificationEntry(OrePrefix.spring, Materials.Lead) }, + { 1, new UnificationEntry(OrePrefix.spring, Materials.Tin) }, + { 2, new UnificationEntry(OrePrefix.spring, Materials.Copper) }, + { 3, new UnificationEntry(OrePrefix.spring, Materials.Gold) }, + { 4, new UnificationEntry(OrePrefix.spring, Materials.Aluminium) }, + { 5, new UnificationEntry(OrePrefix.spring, Materials.Tungsten) }, + { 6, new UnificationEntry(OrePrefix.spring, Materials.NiobiumTitanium) }, + { 7, new UnificationEntry(OrePrefix.spring, Materials.VanadiumGallium) }, + { 8, new UnificationEntry(OrePrefix.spring, Materials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(OrePrefix.spring, Materials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - public static class Component { private final Map ingredients; @@ -859,10 +856,7 @@ public Object getIngredient(int tier) { @SuppressWarnings("unused") public void appendIngredients(Map newIngredients) { ingredients.remove(GTValues.FALLBACK); - newIngredients.forEach((key, value) -> - ingredients.merge(key, value, (v1, v2) -> v2) - ); + newIngredients.forEach((key, value) -> ingredients.merge(key, value, (v1, v2) -> v2)); } } } - diff --git a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java index 3d835d9bd39..0b0d513a7f7 100644 --- a/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/CraftingRecipeLoader.java @@ -16,6 +16,7 @@ import gregtech.common.crafting.FacadeRecipe; import gregtech.common.items.MetaItems; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -29,7 +30,8 @@ public class CraftingRecipeLoader { public static void init() { loadCraftingRecipes(); - GTLog.logger.info("Modifying vanilla recipes according to config. DON'T BE SCARED OF FML's WARNING ABOUT DANGEROUS ALTERNATIVE PREFIX."); + GTLog.logger.info( + "Modifying vanilla recipes according to config. DON'T BE SCARED OF FML's WARNING ABOUT DANGEROUS ALTERNATIVE PREFIX."); VanillaOverrideRecipes.init(); VanillaStandardRecipes.init(); } @@ -40,139 +42,305 @@ private static void loadCraftingRecipes() { ToolRecipeHandler.registerPowerUnitRecipes(); ToolRecipeHandler.registerCustomToolRecipes(); - ModHandler.addShapelessRecipe("integrated_circuit", IntCircuitIngredient.getIntegratedCircuit(0), new UnificationEntry(OrePrefix.circuit, Tier.LV)); + ModHandler.addShapelessRecipe("integrated_circuit", IntCircuitIngredient.getIntegratedCircuit(0), + new UnificationEntry(OrePrefix.circuit, Tier.LV)); - ModHandler.addShapedRecipe("item_filter", ITEM_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Steel)); - ModHandler.addShapedRecipe("fluid_filter_lapis", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Lapis)); - ModHandler.addShapedRecipe("fluid_filter_lazurite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Lazurite)); - ModHandler.addShapedRecipe("fluid_filter_sodalite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Sodalite)); + ModHandler.addShapedRecipe("item_filter", ITEM_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Steel)); + ModHandler.addShapedRecipe("fluid_filter_lapis", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Lapis)); + ModHandler.addShapedRecipe("fluid_filter_lazurite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Lazurite)); + ModHandler.addShapedRecipe("fluid_filter_sodalite", FLUID_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Sodalite)); - ModHandler.addShapedRecipe("ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Olivine)); - ModHandler.addShapedRecipe("ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', new UnificationEntry(OrePrefix.plate, Materials.Emerald)); + ModHandler.addShapedRecipe("ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Olivine)); + ModHandler.addShapedRecipe("ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.getStackForm(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'Y', + new UnificationEntry(OrePrefix.plate, Materials.Emerald)); - ModHandler.addShapedRecipe("smart_item_filter_olivine", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', new UnificationEntry(OrePrefix.plate, Materials.Olivine)); - ModHandler.addShapedRecipe("smart_item_filter_emerald", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', new UnificationEntry(OrePrefix.plate, Materials.Emerald)); + ModHandler.addShapedRecipe("smart_item_filter_olivine", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', + new UnificationEntry(OrePrefix.plate, Materials.Olivine)); + ModHandler.addShapedRecipe("smart_item_filter_emerald", SMART_FILTER.getStackForm(), "XEX", "XCX", "XEX", 'X', + new UnificationEntry(OrePrefix.foil, Materials.Zinc), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.LV), 'E', + new UnificationEntry(OrePrefix.plate, Materials.Emerald)); - ModHandler.addShapedRecipe("plank_to_wooden_shape", WOODEN_FORM_EMPTY.getStackForm(), " ", " X ", "s ", 'X', new UnificationEntry(OrePrefix.plank, Materials.Wood)); - ModHandler.addShapedRecipe("wooden_shape_brick", WOODEN_FORM_BRICK.getStackForm(), "k ", " X", 'X', WOODEN_FORM_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("plank_to_wooden_shape", WOODEN_FORM_EMPTY.getStackForm(), " ", " X ", "s ", 'X', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("wooden_shape_brick", WOODEN_FORM_BRICK.getStackForm(), "k ", " X", 'X', + WOODEN_FORM_EMPTY.getStackForm()); if (ConfigHolder.recipes.harderBrickRecipes) { - ModHandler.addShapelessRecipe("compressed_clay", COMPRESSED_CLAY.getStackForm(), WOODEN_FORM_BRICK.getStackForm(), new ItemStack(Items.CLAY_BALL)); + ModHandler.addShapelessRecipe("compressed_clay", COMPRESSED_CLAY.getStackForm(), + WOODEN_FORM_BRICK.getStackForm(), new ItemStack(Items.CLAY_BALL)); ModHandler.addSmeltingRecipe(COMPRESSED_CLAY.getStackForm(), new ItemStack(Items.BRICK), 0.3f); } - ModHandler.addShapedRecipe("compressed_coke_clay", COMPRESSED_COKE_CLAY.getStackForm(3), "XXX", "SYS", "SSS", 'Y', WOODEN_FORM_BRICK.getStackForm(), 'X', new ItemStack(Items.CLAY_BALL), 'S', "sand"); - ModHandler.addShapelessRecipe("fireclay_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Fireclay, 2), new UnificationEntry(OrePrefix.dust, Materials.Brick), new UnificationEntry(OrePrefix.dust, Materials.Clay)); + ModHandler.addShapedRecipe("compressed_coke_clay", COMPRESSED_COKE_CLAY.getStackForm(3), "XXX", "SYS", "SSS", + 'Y', WOODEN_FORM_BRICK.getStackForm(), 'X', new ItemStack(Items.CLAY_BALL), 'S', "sand"); + ModHandler.addShapelessRecipe("fireclay_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Fireclay, 2), + new UnificationEntry(OrePrefix.dust, Materials.Brick), + new UnificationEntry(OrePrefix.dust, Materials.Clay)); ModHandler.addSmeltingRecipe(COMPRESSED_COKE_CLAY.getStackForm(), COKE_OVEN_BRICK.getStackForm(), 0.3f); ModHandler.addSmeltingRecipe(COMPRESSED_FIRECLAY.getStackForm(), FIRECLAY_BRICK.getStackForm(), 0.3f); - ModHandler.addSmeltingRecipe(new UnificationEntry(OrePrefix.nugget, Materials.Iron), OreDictUnifier.get(OrePrefix.nugget, Materials.WroughtIron)); - - ModHandler.addShapedRecipe("clipboard", CLIPBOARD.getStackForm(), " Sd", "BWR", "PPP", 'P', Items.PAPER, 'R', new UnificationEntry(OrePrefix.springSmall, Iron), 'B', new UnificationEntry(OrePrefix.bolt, Iron), 'S', new UnificationEntry(OrePrefix.screw, Iron), 'W', new UnificationEntry(OrePrefix.plate, Wood)); + ModHandler.addSmeltingRecipe(new UnificationEntry(OrePrefix.nugget, Materials.Iron), + OreDictUnifier.get(OrePrefix.nugget, Materials.WroughtIron)); + ModHandler.addShapedRecipe("clipboard", CLIPBOARD.getStackForm(), " Sd", "BWR", "PPP", 'P', Items.PAPER, 'R', + new UnificationEntry(OrePrefix.springSmall, Iron), 'B', new UnificationEntry(OrePrefix.bolt, Iron), 'S', + new UnificationEntry(OrePrefix.screw, Iron), 'W', new UnificationEntry(OrePrefix.plate, Wood)); - ModHandler.addShapedRecipe("rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.Rubber), "k", "X", 'X', new UnificationEntry(OrePrefix.plate, Materials.Rubber)); - ModHandler.addShapedRecipe("silicone_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.SiliconeRubber), "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.SiliconeRubber)); - ModHandler.addShapedRecipe("styrene_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.StyreneButadieneRubber), "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.StyreneButadieneRubber)); + ModHandler.addShapedRecipe("rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.Rubber), "k", "X", 'X', + new UnificationEntry(OrePrefix.plate, Materials.Rubber)); + ModHandler.addShapedRecipe("silicone_rubber_ring", OreDictUnifier.get(OrePrefix.ring, Materials.SiliconeRubber), + "k", "P", 'P', OreDictUnifier.get(OrePrefix.plate, Materials.SiliconeRubber)); + ModHandler.addShapedRecipe("styrene_rubber_ring", + OreDictUnifier.get(OrePrefix.ring, Materials.StyreneButadieneRubber), "k", "P", 'P', + OreDictUnifier.get(OrePrefix.plate, Materials.StyreneButadieneRubber)); - ModHandler.addShapelessRecipe("iron_magnetic_stick", OreDictUnifier.get(OrePrefix.stick, Materials.IronMagnetic), new UnificationEntry(OrePrefix.stick, Materials.Iron), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone), new UnificationEntry(OrePrefix.dust, Materials.Redstone)); + ModHandler.addShapelessRecipe("iron_magnetic_stick", + OreDictUnifier.get(OrePrefix.stick, Materials.IronMagnetic), + new UnificationEntry(OrePrefix.stick, Materials.Iron), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone), + new UnificationEntry(OrePrefix.dust, Materials.Redstone)); - ModHandler.addShapedRecipe("component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.getStackForm(), "XSX", "SDS", "XSX", 'X', new UnificationEntry(OrePrefix.dust, Materials.Diamond), 'S', new UnificationEntry(OrePrefix.plateDouble, Materials.Steel), 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond)); - ModHandler.addShapedRecipe("component_grinder_tungsten", COMPONENT_GRINDER_TUNGSTEN.getStackForm(), "WSW", "SDS", "WSW", 'W', new UnificationEntry(OrePrefix.plate, Materials.Tungsten), 'S', new UnificationEntry(OrePrefix.plateDouble, Materials.VanadiumSteel), 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond)); + ModHandler.addShapedRecipe("component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.getStackForm(), "XSX", "SDS", + "XSX", 'X', new UnificationEntry(OrePrefix.dust, Materials.Diamond), 'S', + new UnificationEntry(OrePrefix.plateDouble, Materials.Steel), 'D', + new UnificationEntry(OrePrefix.gem, Materials.Diamond)); + ModHandler.addShapedRecipe("component_grinder_tungsten", COMPONENT_GRINDER_TUNGSTEN.getStackForm(), "WSW", + "SDS", "WSW", 'W', new UnificationEntry(OrePrefix.plate, Materials.Tungsten), 'S', + new UnificationEntry(OrePrefix.plateDouble, Materials.VanadiumSteel), 'D', + new UnificationEntry(OrePrefix.gem, Materials.Diamond)); - ModHandler.addShapedRecipe("minecart_wheels_iron", IRON_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'S', new UnificationEntry(OrePrefix.stick, Materials.Iron)); - ModHandler.addShapedRecipe("minecart_wheels_steel", STEEL_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), 'S', new UnificationEntry(OrePrefix.stick, Materials.Steel)); + ModHandler.addShapedRecipe("minecart_wheels_iron", IRON_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", + 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Iron)); + ModHandler.addShapedRecipe("minecart_wheels_steel", STEEL_MINECART_WHEELS.getStackForm(), " h ", "RSR", " w ", + 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Steel)); - ModHandler.addShapedRecipe("nano_saber", NANO_SABER.getStackForm(), "PIC", "PIC", "XEX", 'P', new UnificationEntry(OrePrefix.plate, Materials.Platinum), 'I', new UnificationEntry(OrePrefix.plate, Ruridit), 'C', CARBON_FIBER_PLATE.getStackForm(), 'X', new UnificationEntry(OrePrefix.circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_saber", NANO_SABER.getStackForm(), "PIC", "PIC", "XEX", 'P', + new UnificationEntry(OrePrefix.plate, Materials.Platinum), 'I', + new UnificationEntry(OrePrefix.plate, Ruridit), 'C', CARBON_FIBER_PLATE.getStackForm(), 'X', + new UnificationEntry(OrePrefix.circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("solar_panel_basic", COVER_SOLAR_PANEL.getStackForm(), "WGW", "CPC", 'W', SILICON_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'P', CARBON_FIBER_PLATE.getStackForm()); - ModHandler.addShapedRecipe("solar_panel_ulv", COVER_SOLAR_PANEL_ULV.getStackForm(), "WGW", "CAC", "P P", 'W', PHOSPHORUS_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.HV), 'P', OreDictUnifier.get(OrePrefix.plate, GalliumArsenide), 'A', OreDictUnifier.get(OrePrefix.wireGtQuadruple, Graphene)); - ModHandler.addShapedRecipe("solar_panel_lv", COVER_SOLAR_PANEL_LV.getStackForm(), "WGW", "CAC", "P P", 'W', NAQUADAH_WAFER.getStackForm(), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant( - BlockGlassCasing.CasingType.TEMPERED_GLASS), 'C', new UnificationEntry(OrePrefix.circuit, Tier.LuV), 'P', OreDictUnifier.get(OrePrefix.plate, IndiumGalliumPhosphide), 'A', OreDictUnifier.get(OrePrefix.wireGtHex, Graphene)); + ModHandler.addShapedRecipe("solar_panel_basic", COVER_SOLAR_PANEL.getStackForm(), "WGW", "CPC", 'W', + SILICON_WAFER.getStackForm(), 'G', "paneGlass", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), + 'P', CARBON_FIBER_PLATE.getStackForm()); + ModHandler.addShapedRecipe("solar_panel_ulv", COVER_SOLAR_PANEL_ULV.getStackForm(), "WGW", "CAC", "P P", 'W', + PHOSPHORUS_WAFER.getStackForm(), 'G', "paneGlass", 'C', + new UnificationEntry(OrePrefix.circuit, Tier.HV), 'P', + OreDictUnifier.get(OrePrefix.plate, GalliumArsenide), 'A', + OreDictUnifier.get(OrePrefix.wireGtQuadruple, Graphene)); + ModHandler.addShapedRecipe("solar_panel_lv", COVER_SOLAR_PANEL_LV.getStackForm(), "WGW", "CAC", "P P", 'W', + NAQUADAH_WAFER.getStackForm(), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant( + BlockGlassCasing.CasingType.TEMPERED_GLASS), + 'C', new UnificationEntry(OrePrefix.circuit, Tier.LuV), 'P', + OreDictUnifier.get(OrePrefix.plate, IndiumGalliumPhosphide), 'A', + OreDictUnifier.get(OrePrefix.wireGtHex, Graphene)); - ModHandler.addShapedRecipe("universal_fluid_cell", FLUID_CELL_UNIVERSAL.getStackForm(), "C ", " ", 'C', FLUID_CELL); - ModHandler.addShapedRecipe("universal_fluid_cell_revert", FLUID_CELL.getStackForm(), "C ", " ", 'C', FLUID_CELL_UNIVERSAL); + ModHandler.addShapedRecipe("universal_fluid_cell", FLUID_CELL_UNIVERSAL.getStackForm(), "C ", " ", 'C', + FLUID_CELL); + ModHandler.addShapedRecipe("universal_fluid_cell_revert", FLUID_CELL.getStackForm(), "C ", " ", 'C', + FLUID_CELL_UNIVERSAL); - ModHandler.addShapedRecipe("blacklight", BLACKLIGHT.getStackForm(), "SPS", "GRG", "CPK", 'S', new UnificationEntry(OrePrefix.screw, TungstenCarbide), 'P', new UnificationEntry(OrePrefix.plate, TungstenCarbide), 'G', MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS), 'R', new UnificationEntry(OrePrefix.spring, Europium), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), 'K', new UnificationEntry(OrePrefix.cableGtSingle, Platinum)); + ModHandler.addShapedRecipe("blacklight", BLACKLIGHT.getStackForm(), "SPS", "GRG", "CPK", 'S', + new UnificationEntry(OrePrefix.screw, TungstenCarbide), 'P', + new UnificationEntry(OrePrefix.plate, TungstenCarbide), 'G', + MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS), 'R', + new UnificationEntry(OrePrefix.spring, Europium), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV), + 'K', new UnificationEntry(OrePrefix.cableGtSingle, Platinum)); - ModHandler.addShapedRecipe(true, "filter_casing", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, ConfigHolder.recipes.casingsPerCraft), "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', new UnificationEntry(OrePrefix.rotor, Steel)); - ModHandler.addShapedRecipe(true, "filter_casing_sterile", MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, ConfigHolder.recipes.casingsPerCraft), "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); + ModHandler.addShapedRecipe(true, "filter_casing", + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING, + ConfigHolder.recipes.casingsPerCraft), + "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.getStackForm(), 'M', + ELECTRIC_MOTOR_MV.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Steel), 'R', + new UnificationEntry(OrePrefix.rotor, Steel)); + ModHandler.addShapedRecipe(true, "filter_casing_sterile", + MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.FILTER_CASING_STERILE, + ConfigHolder.recipes.casingsPerCraft), + "BEB", "ISI", "MFR", 'B', new UnificationEntry(OrePrefix.pipeLargeFluid, Polybenzimidazole), 'E', + EMITTER_ZPM.getStackForm(), 'I', ITEM_FILTER.getStackForm(), 'S', BLACKLIGHT.getStackForm(), 'M', + ELECTRIC_MOTOR_ZPM.getStackForm(), 'F', new UnificationEntry(OrePrefix.frameGt, Tritanium), 'R', + new UnificationEntry(OrePrefix.rotor, NaquadahAlloy)); /////////////////////////////////////////////////// - // Shapes and Molds // + // Shapes and Molds // /////////////////////////////////////////////////// - ModHandler.addShapedRecipe("shape_empty", SHAPE_EMPTY.getStackForm(), "hf", "PP", "PP", 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel)); - - ModHandler.addShapedRecipe("shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_gear", SHAPE_EXTRUDER_GEAR.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_block", SHAPE_EXTRUDER_BLOCK.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_INGOT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_huge", SHAPE_EXTRUDER_PIPE_HUGE.getStackForm(), " ", " S ", " x", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_large", SHAPE_EXTRUDER_PIPE_LARGE.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_normal", SHAPE_EXTRUDER_PIPE_NORMAL.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_small", SHAPE_EXTRUDER_PIPE_SMALL.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_pipe_tiny", SHAPE_EXTRUDER_PIPE_TINY.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_wire", SHAPE_EXTRUDER_WIRE.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_cell", SHAPE_EXTRUDER_CELL.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_ring", SHAPE_EXTRUDER_RING.getStackForm(), " ", " S ", " x ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rod", SHAPE_EXTRUDER_ROD.getStackForm(), " ", " Sx", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rod_long", SHAPE_EXTRUDER_ROD_LONG.getStackForm(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_plate", SHAPE_EXTRUDER_PLATE.getStackForm(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_FOIL.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_gear_small", SHAPE_EXTRUDER_GEAR_SMALL.getStackForm(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_foil", SHAPE_EXTRUDER_FOIL.getStackForm(), " ", " S ", " x", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.getStackForm(), " ", " S ", "x ", 'S', SHAPE_EMPTY.getStackForm()); - - ModHandler.addShapedRecipe("shape_mold_rotor", SHAPE_MOLD_ROTOR.getStackForm(), " h", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.getStackForm(), " ", " ", "h S", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_name", SHAPE_MOLD_NAME.getStackForm(), " S", " ", "h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_anvil", SHAPE_MOLD_ANVIL.getStackForm(), " S", " ", " h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_cylinder", SHAPE_MOLD_CYLINDER.getStackForm(), " S", " ", " h", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_nugget", SHAPE_MOLD_NUGGET.getStackForm(), "S h", " ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_block", SHAPE_MOLD_BLOCK.getStackForm(), " ", "hS ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_ball", SHAPE_MOLD_BALL.getStackForm(), " ", " S ", "h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_ingot", SHAPE_MOLD_INGOT.getStackForm(), " ", " S ", " h ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_bottle", SHAPE_MOLD_BOTTLE.getStackForm(), " ", " S ", " h", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_credit", SHAPE_MOLD_CREDIT.getStackForm(), "h ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_gear", SHAPE_MOLD_GEAR.getStackForm(), " ", " Sh", " ", 'S', SHAPE_EMPTY.getStackForm()); - ModHandler.addShapedRecipe("shape_mold_plate", SHAPE_MOLD_PLATE.getStackForm(), " h ", " S ", " ", 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_empty", SHAPE_EMPTY.getStackForm(), "hf", "PP", "PP", 'P', + new UnificationEntry(OrePrefix.plate, Materials.Steel)); + + ModHandler.addShapedRecipe("shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.getStackForm(), " x", " S ", " ", + 'S', SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_gear", SHAPE_EXTRUDER_GEAR.getStackForm(), "x ", " S ", " ", 'S', + SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_block", SHAPE_EXTRUDER_BLOCK.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EXTRUDER_INGOT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_huge", SHAPE_EXTRUDER_PIPE_HUGE.getStackForm(), " ", " S ", + " x", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_large", SHAPE_EXTRUDER_PIPE_LARGE.getStackForm(), " ", " Sx", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_normal", SHAPE_EXTRUDER_PIPE_NORMAL.getStackForm(), " x", + " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_small", SHAPE_EXTRUDER_PIPE_SMALL.getStackForm(), " x ", " S ", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_pipe_tiny", SHAPE_EXTRUDER_PIPE_TINY.getStackForm(), "x ", " S ", + " ", 'S', SHAPE_EXTRUDER_BOLT.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_wire", SHAPE_EXTRUDER_WIRE.getStackForm(), " x ", " S ", " ", 'S', + SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_cell", SHAPE_EXTRUDER_CELL.getStackForm(), " ", " Sx", " ", 'S', + SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_ring", SHAPE_EXTRUDER_RING.getStackForm(), " ", " S ", " x ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.getStackForm(), "x ", " S ", " ", 'S', + SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rod", SHAPE_EXTRUDER_ROD.getStackForm(), " ", " Sx", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rod_long", SHAPE_EXTRUDER_ROD_LONG.getStackForm(), " x", " S ", + " ", 'S', SHAPE_EXTRUDER_ROD.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_plate", SHAPE_EXTRUDER_PLATE.getStackForm(), "x ", " S ", " ", + 'S', SHAPE_EXTRUDER_FOIL.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_gear_small", SHAPE_EXTRUDER_GEAR_SMALL.getStackForm(), " x ", " S ", + " ", 'S', SHAPE_EXTRUDER_RING.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_foil", SHAPE_EXTRUDER_FOIL.getStackForm(), " ", " S ", " x", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.getStackForm(), " ", " S ", "x ", + 'S', SHAPE_EMPTY.getStackForm()); + + ModHandler.addShapedRecipe("shape_mold_rotor", SHAPE_MOLD_ROTOR.getStackForm(), " h", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.getStackForm(), " ", " ", "h S", + 'S', SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_name", SHAPE_MOLD_NAME.getStackForm(), " S", " ", "h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_anvil", SHAPE_MOLD_ANVIL.getStackForm(), " S", " ", " h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_cylinder", SHAPE_MOLD_CYLINDER.getStackForm(), " S", " ", " h", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_nugget", SHAPE_MOLD_NUGGET.getStackForm(), "S h", " ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_block", SHAPE_MOLD_BLOCK.getStackForm(), " ", "hS ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_ball", SHAPE_MOLD_BALL.getStackForm(), " ", " S ", "h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_ingot", SHAPE_MOLD_INGOT.getStackForm(), " ", " S ", " h ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_bottle", SHAPE_MOLD_BOTTLE.getStackForm(), " ", " S ", " h", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_credit", SHAPE_MOLD_CREDIT.getStackForm(), "h ", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_gear", SHAPE_MOLD_GEAR.getStackForm(), " ", " Sh", " ", 'S', + SHAPE_EMPTY.getStackForm()); + ModHandler.addShapedRecipe("shape_mold_plate", SHAPE_MOLD_PLATE.getStackForm(), " h ", " S ", " ", 'S', + SHAPE_EMPTY.getStackForm()); /////////////////////////////////////////////////// - // Credits // + // Credits // /////////////////////////////////////////////////// - ModHandler.addShapelessRecipe("coin_chocolate", COIN_CHOCOLATE.getStackForm(), new UnificationEntry(OrePrefix.dust, Materials.Cocoa), new UnificationEntry(OrePrefix.foil, Materials.Gold), new ItemStack(Items.MILK_BUCKET), new UnificationEntry(OrePrefix.dust, Materials.Sugar)); + ModHandler.addShapelessRecipe("coin_chocolate", COIN_CHOCOLATE.getStackForm(), + new UnificationEntry(OrePrefix.dust, Materials.Cocoa), + new UnificationEntry(OrePrefix.foil, Materials.Gold), new ItemStack(Items.MILK_BUCKET), + new UnificationEntry(OrePrefix.dust, Materials.Sugar)); - ModHandler.addShapelessRecipe("credit_copper", CREDIT_COPPER.getStackForm(8), CREDIT_CUPRONICKEL.getStackForm()); - ModHandler.addShapelessRecipe("credit_cupronickel_alt", CREDIT_CUPRONICKEL.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm()); - ModHandler.addShapelessRecipe("credit_cupronickel", CREDIT_CUPRONICKEL.getStackForm(8), CREDIT_SILVER.getStackForm()); - ModHandler.addShapelessRecipe("credit_silver_alt", CREDIT_SILVER.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm()); + ModHandler.addShapelessRecipe("credit_copper", CREDIT_COPPER.getStackForm(8), + CREDIT_CUPRONICKEL.getStackForm()); + ModHandler.addShapelessRecipe("credit_cupronickel_alt", CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm(), + CREDIT_COPPER.getStackForm(), CREDIT_COPPER.getStackForm()); + ModHandler.addShapelessRecipe("credit_cupronickel", CREDIT_CUPRONICKEL.getStackForm(8), + CREDIT_SILVER.getStackForm()); + ModHandler.addShapelessRecipe("credit_silver_alt", CREDIT_SILVER.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm(), + CREDIT_CUPRONICKEL.getStackForm(), CREDIT_CUPRONICKEL.getStackForm()); ModHandler.addShapelessRecipe("credit_silver", CREDIT_SILVER.getStackForm(8), CREDIT_GOLD.getStackForm()); - ModHandler.addShapelessRecipe("credit_gold_alt", CREDIT_GOLD.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm()); + ModHandler.addShapelessRecipe("credit_gold_alt", CREDIT_GOLD.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), CREDIT_SILVER.getStackForm(), + CREDIT_SILVER.getStackForm()); ModHandler.addShapelessRecipe("credit_gold", CREDIT_GOLD.getStackForm(8), CREDIT_PLATINUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_platinum_alt", CREDIT_PLATINUM.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm()); + ModHandler.addShapelessRecipe("credit_platinum_alt", CREDIT_PLATINUM.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), CREDIT_GOLD.getStackForm(), + CREDIT_GOLD.getStackForm()); ModHandler.addShapelessRecipe("credit_platinum", CREDIT_PLATINUM.getStackForm(8), CREDIT_OSMIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_osmium_alt", CREDIT_OSMIUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_osmium_alt", CREDIT_OSMIUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), CREDIT_PLATINUM.getStackForm(), + CREDIT_PLATINUM.getStackForm()); ModHandler.addShapelessRecipe("credit_osmium", CREDIT_OSMIUM.getStackForm(8), CREDIT_NAQUADAH.getStackForm()); - ModHandler.addShapelessRecipe("credit_naquadah_alt", CREDIT_NAQUADAH.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_naquadah", CREDIT_NAQUADAH.getStackForm(8), CREDIT_NEUTRONIUM.getStackForm()); - ModHandler.addShapelessRecipe("credit_darmstadtium", CREDIT_NEUTRONIUM.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm()); + ModHandler.addShapelessRecipe("credit_naquadah_alt", CREDIT_NAQUADAH.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm(), + CREDIT_OSMIUM.getStackForm(), CREDIT_OSMIUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_naquadah", CREDIT_NAQUADAH.getStackForm(8), + CREDIT_NEUTRONIUM.getStackForm()); + ModHandler.addShapelessRecipe("credit_darmstadtium", CREDIT_NEUTRONIUM.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm(), + CREDIT_NAQUADAH.getStackForm(), CREDIT_NAQUADAH.getStackForm()); /////////////////////////////////////////////////// - // Armors // + // Armors // /////////////////////////////////////////////////// - ModHandler.addShapedRecipe("nightvision_goggles", MetaItems.NIGHTVISION_GOGGLES.getStackForm(), "CSC", "RBR", "LdL", 'C', new UnificationEntry(OrePrefix.circuit, Tier.ULV), 'S', new UnificationEntry(OrePrefix.screw, Steel), 'R', new UnificationEntry(OrePrefix.ring, Rubber), 'B', MetaItems.BATTERY_LV_SODIUM, 'L', new UnificationEntry(OrePrefix.lens, Glass)); - ModHandler.addShapedRecipe("fluid_jetpack", MetaItems.SEMIFLUID_JETPACK.getStackForm(), "xCw", "SUS", "RIR", 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'S', MetaItems.FLUID_CELL_LARGE_STEEL.getStackForm(), 'U', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'R', new UnificationEntry(OrePrefix.rotor, Lead), 'I', new UnificationEntry(OrePrefix.pipeSmallFluid, Potin)); - ModHandler.addShapedRecipe("electric_jetpack", MetaItems.ELECTRIC_JETPACK.getStackForm(), "xCd", "TBT", "I I", 'C', new UnificationEntry(OrePrefix.circuit, Tier.MV), 'T', MetaItems.POWER_THRUSTER.getStackForm(), 'B', MetaItems.BATTERY_MV_LITHIUM.getStackForm(), 'I', new UnificationEntry(OrePrefix.wireGtDouble, AnnealedCopper)); - ModHandler.addShapedRecipe("electric_jetpack_advanced", MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), "xJd", "TBT", "WCW", 'J', MetaItems.ELECTRIC_JETPACK.getStackForm(), 'T', MetaItems.POWER_THRUSTER_ADVANCED.getStackForm(), 'B', ENERGIUM_CRYSTAL.getStackForm(), 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Gold), 'C', new UnificationEntry(OrePrefix.circuit, Tier.HV)); - ModHandler.addShapedRecipe("nano_helmet", MetaItems.NANO_HELMET.getStackForm(), "PPP", "PNP", "xEd", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'N', MetaItems.NIGHTVISION_GOGGLES.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_chestplate", MetaItems.NANO_CHESTPLATE.getStackForm(), "PEP", "PPP", "PPP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_leggings", MetaItems.NANO_LEGGINGS.getStackForm(), "PPP", "PEP", "PxP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_boots", MetaItems.NANO_BOOTS.getStackForm(), "PxP", "PEP", 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); - ModHandler.addShapedRecipe("nano_chestplate_advanced", MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(), "xJd", "PNP", "WCW", 'J', MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), 'P', MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm(), 'N', MetaItems.NANO_CHESTPLATE.getStackForm(), 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Platinum), 'C', new UnificationEntry(OrePrefix.circuit, Tier.IV)); - ModHandler.addShapedRecipe("gravitation_engine", MetaItems.GRAVITATION_ENGINE.getStackForm(), "ESE", "POP", "ESE", 'E', MetaItems.EMITTER_LuV.getStackForm(), 'S', new UnificationEntry(OrePrefix.wireGtQuadruple, Osmium), 'P', new UnificationEntry(OrePrefix.plateDouble, Iridium), 'O', MetaItems.ENERGY_LAPOTRONIC_ORB.getStackForm()); + ModHandler.addShapedRecipe("nightvision_goggles", MetaItems.NIGHTVISION_GOGGLES.getStackForm(), "CSC", "RBR", + "LdL", 'C', new UnificationEntry(OrePrefix.circuit, Tier.ULV), 'S', + new UnificationEntry(OrePrefix.screw, Steel), 'R', new UnificationEntry(OrePrefix.ring, Rubber), 'B', + MetaItems.BATTERY_LV_SODIUM, 'L', new UnificationEntry(OrePrefix.lens, Glass)); + ModHandler.addShapedRecipe("fluid_jetpack", MetaItems.SEMIFLUID_JETPACK.getStackForm(), "xCw", "SUS", "RIR", + 'C', new UnificationEntry(OrePrefix.circuit, Tier.LV), 'S', + MetaItems.FLUID_CELL_LARGE_STEEL.getStackForm(), 'U', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'R', + new UnificationEntry(OrePrefix.rotor, Lead), 'I', + new UnificationEntry(OrePrefix.pipeSmallFluid, Potin)); + ModHandler.addShapedRecipe("electric_jetpack", MetaItems.ELECTRIC_JETPACK.getStackForm(), "xCd", "TBT", "I I", + 'C', new UnificationEntry(OrePrefix.circuit, Tier.MV), 'T', MetaItems.POWER_THRUSTER.getStackForm(), + 'B', MetaItems.BATTERY_MV_LITHIUM.getStackForm(), 'I', + new UnificationEntry(OrePrefix.wireGtDouble, AnnealedCopper)); + ModHandler.addShapedRecipe("electric_jetpack_advanced", MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), + "xJd", "TBT", "WCW", 'J', MetaItems.ELECTRIC_JETPACK.getStackForm(), 'T', + MetaItems.POWER_THRUSTER_ADVANCED.getStackForm(), 'B', ENERGIUM_CRYSTAL.getStackForm(), 'W', + new UnificationEntry(OrePrefix.wireGtQuadruple, Gold), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.HV)); + ModHandler.addShapedRecipe("nano_helmet", MetaItems.NANO_HELMET.getStackForm(), "PPP", "PNP", "xEd", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'N', MetaItems.NIGHTVISION_GOGGLES.getStackForm(), 'E', + MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_chestplate", MetaItems.NANO_CHESTPLATE.getStackForm(), "PEP", "PPP", "PPP", + 'P', MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_leggings", MetaItems.NANO_LEGGINGS.getStackForm(), "PPP", "PEP", "PxP", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_boots", MetaItems.NANO_BOOTS.getStackForm(), "PxP", "PEP", 'P', + MetaItems.CARBON_FIBER_PLATE.getStackForm(), 'E', MetaItems.ENERGIUM_CRYSTAL.getStackForm()); + ModHandler.addShapedRecipe("nano_chestplate_advanced", MetaItems.NANO_CHESTPLATE_ADVANCED.getStackForm(), "xJd", + "PNP", "WCW", 'J', MetaItems.ELECTRIC_JETPACK_ADVANCED.getStackForm(), 'P', + MetaItems.LOW_POWER_INTEGRATED_CIRCUIT.getStackForm(), 'N', MetaItems.NANO_CHESTPLATE.getStackForm(), + 'W', new UnificationEntry(OrePrefix.wireGtQuadruple, Platinum), 'C', + new UnificationEntry(OrePrefix.circuit, Tier.IV)); + ModHandler.addShapedRecipe("gravitation_engine", MetaItems.GRAVITATION_ENGINE.getStackForm(), "ESE", "POP", + "ESE", 'E', MetaItems.EMITTER_LuV.getStackForm(), 'S', + new UnificationEntry(OrePrefix.wireGtQuadruple, Osmium), 'P', + new UnificationEntry(OrePrefix.plateDouble, Iridium), 'O', + MetaItems.ENERGY_LAPOTRONIC_ORB.getStackForm()); } private static void registerFacadeRecipe(Material material, int facadeAmount) { OreIngredient ingredient = new OreIngredient(new UnificationEntry(OrePrefix.plate, material).toString()); - ForgeRegistries.RECIPES.register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material)); + ForgeRegistries.RECIPES + .register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material)); } } diff --git a/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java b/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java index a685699f7ea..75c0e216964 100644 --- a/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/DecorationRecipes.java @@ -2,21 +2,22 @@ import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; -import gregtech.common.blocks.BlockColored; import gregtech.common.blocks.MetaBlocks; + import net.minecraft.item.EnumDyeColor; import static gregtech.api.recipes.RecipeMaps.*; + public class DecorationRecipes { - private DecorationRecipes(){} + private DecorationRecipes() {} + public static void init() { assemblerRecipes(); dyeRecipes(); } private static void assemblerRecipes() { - ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.block, Materials.Concrete, 5) .input(OrePrefix.plate, Materials.Iron, 2) @@ -40,11 +41,9 @@ private static void assemblerRecipes() { .outputs(MetaBlocks.STUDS.getItemVariant(EnumDyeColor.BLACK, 32)) .EUt(4).duration(20) .buildAndRegister(); - } private static void dyeRecipes() { - for (int i = 0; i < Materials.CHEMICAL_DYES.length; i++) { CHEMICAL_BATH_RECIPES.recipeBuilder() .inputs(MetaBlocks.METAL_SHEET.getItemVariant(EnumDyeColor.WHITE)) @@ -67,7 +66,5 @@ private static void dyeRecipes() { .EUt(2).duration(10) .buildAndRegister(); } - } - } diff --git a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java index e1181f737e0..94da5ecb799 100644 --- a/src/main/java/gregtech/loaders/recipe/FuelRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/FuelRecipes.java @@ -8,7 +8,7 @@ public class FuelRecipes { public static void registerFuels() { - //diesel generator fuels + // diesel generator fuels RecipeMaps.COMBUSTION_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Naphtha.getFluid(1)) .duration(10) @@ -99,7 +99,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //steam generator fuels + // steam generator fuels RecipeMaps.STEAM_TURBINE_FUELS.recipeBuilder() .fluidInputs(Steam.getFluid(640)) .fluidOutputs(DistilledWater.getFluid(4)) @@ -107,7 +107,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //gas turbine fuels + // gas turbine fuels RecipeMaps.GAS_TURBINE_FUELS.recipeBuilder() .fluidInputs(NaturalGas.getFluid(8)) .duration(5) @@ -216,7 +216,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //semi-fluid fuels, like creosote + // semi-fluid fuels, like creosote RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Creosote.getFluid(16)) .duration(1) @@ -259,7 +259,7 @@ public static void registerFuels() { .EUt((int) V[LV]) .buildAndRegister(); - //plasma turbine + // plasma turbine RecipeMaps.PLASMA_GENERATOR_FUELS.recipeBuilder() .fluidInputs(Helium.getPlasma(1)) .fluidOutputs(Helium.getFluid(1)) diff --git a/src/main/java/gregtech/loaders/recipe/FusionLoader.java b/src/main/java/gregtech/loaders/recipe/FusionLoader.java index 5803da01fb2..f5ec3a7b861 100644 --- a/src/main/java/gregtech/loaders/recipe/FusionLoader.java +++ b/src/main/java/gregtech/loaders/recipe/FusionLoader.java @@ -8,7 +8,6 @@ public class FusionLoader { public static void init() { - RecipeMaps.FUSION_RECIPES.recipeBuilder() .fluidInputs(Materials.Deuterium.getFluid(125)) .fluidInputs(Materials.Tritium.getFluid(125)) @@ -206,6 +205,5 @@ public static void init() { .EUt(VA[LuV]) .EUToStart(200_000_000) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java b/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java index 07989f7b188..e91a9bd2c7a 100644 --- a/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java +++ b/src/main/java/gregtech/loaders/recipe/GTRecipeManager.java @@ -4,6 +4,7 @@ import gregtech.loaders.recipe.handlers.DecompositionRecipeHandler; import gregtech.loaders.recipe.handlers.RecipeHandlerList; import gregtech.loaders.recipe.handlers.ToolRecipeHandler; + import net.minecraftforge.common.MinecraftForge; public final class GTRecipeManager { diff --git a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java index 3669cf026e9..eb820fbe624 100644 --- a/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MachineRecipeLoader.java @@ -28,6 +28,7 @@ import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; import gregtech.loaders.recipe.chemistry.AssemblerRecipeLoader; import gregtech.loaders.recipe.chemistry.ChemistryRecipes; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -86,7 +87,6 @@ public static void init() { } private static void registerBendingCompressingRecipes() { - COMPRESSOR_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.Fireclay) .outputs(MetaItems.COMPRESSED_FIRECLAY.getStackForm()) @@ -218,33 +218,54 @@ private static void registerBendingCompressingRecipes() { } private static void registerPrimitiveBlastFurnaceRecipes() { - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(OREDICT_FUEL_COKE).output(ingot, Steel).output(dustTiny, Ash).duration(1500).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coke).output(ingot, Steel).output(dustTiny, Ash).duration(1500).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Coal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Charcoal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(OREDICT_BLOCK_FUEL_COKE).output(block, Steel).output(dust, Ash).duration(13500).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Charcoal, 2).output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(OREDICT_FUEL_COKE).output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coke).output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Coal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Charcoal, 2).output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(OREDICT_BLOCK_FUEL_COKE).output(block, Steel).output(dust, Ash).duration(5400).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Coal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(gem, Charcoal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Charcoal, 2).output(ingot, Steel) + .output(dustTiny, DarkAsh, 2).duration(1800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(OREDICT_FUEL_COKE).output(ingot, Steel) + .output(dustTiny, Ash).duration(1500).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, Iron).input(dust, Coke).output(ingot, Steel) + .output(dustTiny, Ash).duration(1500).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Coal, 2).output(block, Steel) + .output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(block, Charcoal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(16200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, Iron).input(OREDICT_BLOCK_FUEL_COKE) + .output(block, Steel).output(dust, Ash).duration(13500).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Coal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(gem, Charcoal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Charcoal, 2) + .output(ingot, Steel).output(dustTiny, DarkAsh, 2).duration(800).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(OREDICT_FUEL_COKE) + .output(ingot, Steel).output(dustTiny, Ash).duration(600).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(ingot, WroughtIron).input(dust, Coke).output(ingot, Steel) + .output(dustTiny, Ash).duration(600).buildAndRegister(); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Coal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(block, Charcoal, 2) + .output(block, Steel).output(dust, DarkAsh, 2).duration(7200).buildAndRegister(); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder().input(block, WroughtIron).input(OREDICT_BLOCK_FUEL_COKE) + .output(block, Steel).output(dust, Ash).duration(5400).buildAndRegister(); } private static void registerCokeOvenRecipes() { - COKE_OVEN_RECIPES.recipeBuilder().input(log, Wood).output(gem, Charcoal).fluidOutputs(Creosote.getFluid(250)).duration(900).buildAndRegister(); - COKE_OVEN_RECIPES.recipeBuilder().input(gem, Coal).output(gem, Coke).fluidOutputs(Creosote.getFluid(500)).duration(900).buildAndRegister(); - COKE_OVEN_RECIPES.recipeBuilder().input(block, Coal).output(block, Coke).fluidOutputs(Creosote.getFluid(4500)).duration(8100).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(log, Wood).output(gem, Charcoal).fluidOutputs(Creosote.getFluid(250)) + .duration(900).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(gem, Coal).output(gem, Coke).fluidOutputs(Creosote.getFluid(500)) + .duration(900).buildAndRegister(); + COKE_OVEN_RECIPES.recipeBuilder().input(block, Coal).output(block, Coke).fluidOutputs(Creosote.getFluid(4500)) + .duration(8100).buildAndRegister(); } private static void registerStoneBricksRecipes() { @@ -297,19 +318,18 @@ private static void registerStoneBricksRecipes() { } private static void registerMixingCrystallizationRecipes() { - RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() .input(OrePrefix.dust, Materials.SiliconDioxide) .fluidInputs(Materials.DistilledWater.getFluid(250)) .chancedOutput(OreDictUnifier.get(OrePrefix.gem, Materials.Quartzite), 1000, 1000) .duration(1200).EUt(24).buildAndRegister(); - //todo find UU-Matter replacement -// RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() -// .input(OrePrefix.dust, Materials.NetherStar) -// .fluidInputs(Materials.UUMatter.getFluid(576)) -// .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) -// .duration(72000).EUt(VA[HV]).buildAndRegister(); + // todo find UU-Matter replacement + // RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder() + // .input(OrePrefix.dust, Materials.NetherStar) + // .fluidInputs(Materials.UUMatter.getFluid(576)) + // .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) + // .duration(72000).EUt(VA[HV]).buildAndRegister(); RecipeMaps.MIXER_RECIPES.recipeBuilder() .input(OrePrefix.crushedPurified, Materials.Sphalerite) @@ -335,26 +355,41 @@ private static void registerMixingCrystallizationRecipes() { .fluidInputs(Concrete.getFluid(L)) .outputs(MetaBlocks.ASPHALT.getItemVariant(BlockAsphalt.BlockType.ASPHALT)) .duration(60).EUt(16).buildAndRegister(); - } private static final MaterialStack[][] alloySmelterList = { - {new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.Bronze, 4L)}, - {new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Zinc, 1), new MaterialStack(Materials.Brass, 4L)}, - {new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Cupronickel, 2L)}, - {new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Redstone, 4L), new MaterialStack(Materials.RedAlloy, 1)}, - {new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.Bronze, 4L)}, - {new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Zinc, 1), new MaterialStack(Materials.Brass, 4L)}, - {new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Cupronickel, 2L)}, - {new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Redstone, 4L), new MaterialStack(Materials.RedAlloy, 1)}, - {new MaterialStack(Materials.Iron, 1), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.TinAlloy, 2L)}, - {new MaterialStack(Materials.WroughtIron, 1), new MaterialStack(Materials.Tin, 1), new MaterialStack(Materials.TinAlloy, 2L)}, - {new MaterialStack(Materials.Iron, 2L), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Invar, 3L)}, - {new MaterialStack(Materials.WroughtIron, 2L), new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Invar, 3L)}, - {new MaterialStack(Materials.Lead, 4L), new MaterialStack(Materials.Antimony, 1), new MaterialStack(Materials.BatteryAlloy, 5L)}, - {new MaterialStack(Materials.Gold, 1), new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrum, 2L)}, - {new MaterialStack(Materials.Magnesium, 1), new MaterialStack(Materials.Aluminium, 2L), new MaterialStack(Materials.Magnalium, 3L)}, - {new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrotine, 4), new MaterialStack(Materials.BlueAlloy, 1)}}; + { new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.Bronze, 4L) }, + { new MaterialStack(Materials.Copper, 3L), new MaterialStack(Materials.Zinc, 1), + new MaterialStack(Materials.Brass, 4L) }, + { new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Cupronickel, 2L) }, + { new MaterialStack(Materials.Copper, 1), new MaterialStack(Materials.Redstone, 4L), + new MaterialStack(Materials.RedAlloy, 1) }, + { new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.Bronze, 4L) }, + { new MaterialStack(Materials.AnnealedCopper, 3L), new MaterialStack(Materials.Zinc, 1), + new MaterialStack(Materials.Brass, 4L) }, + { new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Cupronickel, 2L) }, + { new MaterialStack(Materials.AnnealedCopper, 1), new MaterialStack(Materials.Redstone, 4L), + new MaterialStack(Materials.RedAlloy, 1) }, + { new MaterialStack(Materials.Iron, 1), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.TinAlloy, 2L) }, + { new MaterialStack(Materials.WroughtIron, 1), new MaterialStack(Materials.Tin, 1), + new MaterialStack(Materials.TinAlloy, 2L) }, + { new MaterialStack(Materials.Iron, 2L), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Invar, 3L) }, + { new MaterialStack(Materials.WroughtIron, 2L), new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Invar, 3L) }, + { new MaterialStack(Materials.Lead, 4L), new MaterialStack(Materials.Antimony, 1), + new MaterialStack(Materials.BatteryAlloy, 5L) }, + { new MaterialStack(Materials.Gold, 1), new MaterialStack(Materials.Silver, 1), + new MaterialStack(Materials.Electrum, 2L) }, + { new MaterialStack(Materials.Magnesium, 1), new MaterialStack(Materials.Aluminium, 2L), + new MaterialStack(Materials.Magnalium, 3L) }, + { new MaterialStack(Materials.Silver, 1), new MaterialStack(Materials.Electrotine, 4), + new MaterialStack(Materials.BlueAlloy, 1) } }; private static void registerAlloyRecipes() { for (MaterialStack[] stack : alloySmelterList) { @@ -374,8 +409,7 @@ private static void registerAlloyRecipes() { .outputs(OreDictUnifier.get(OrePrefix.ingot, stack[2].material, (int) stack[2].amount)) .buildAndRegister(); } - if (stack[0].material.hasProperty(PropertyKey.INGOT) - && stack[1].material.hasProperty(PropertyKey.INGOT)) { + if (stack[0].material.hasProperty(PropertyKey.INGOT) && stack[1].material.hasProperty(PropertyKey.INGOT)) { RecipeMaps.ALLOY_SMELTER_RECIPES.recipeBuilder() .duration((int) stack[2].amount * 50).EUt(16) .input(OrePrefix.ingot, stack[0].material, (int) stack[0].amount) @@ -391,13 +425,19 @@ private static void registerAlloyRecipes() { .buildAndRegister(); } - COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_FIBERS.getStackForm(2)).outputs(MetaItems.CARBON_MESH.getStackForm()).duration(100).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_MESH.getStackForm()).outputs(MetaItems.CARBON_FIBER_PLATE.getStackForm()).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_FIBERS.getStackForm(2)) + .outputs(MetaItems.CARBON_MESH.getStackForm()).duration(100).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(MetaItems.CARBON_MESH.getStackForm()) + .outputs(MetaItems.CARBON_FIBER_PLATE.getStackForm()).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(10).EUt(VA[ULV]).input(OrePrefix.ingot, Materials.Rubber, 2).notConsumable(MetaItems.SHAPE_MOLD_PLATE).output(OrePrefix.plate, Materials.Rubber).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input(OrePrefix.dust, Materials.Sulfur).input(OrePrefix.dust, Materials.RawRubber, 3).output(OrePrefix.ingot, Materials.Rubber).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(10).EUt(VA[ULV]).input(OrePrefix.ingot, Materials.Rubber, 2) + .notConsumable(MetaItems.SHAPE_MOLD_PLATE).output(OrePrefix.plate, Materials.Rubber).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input(OrePrefix.dust, Materials.Sulfur) + .input(OrePrefix.dust, Materials.RawRubber, 3).output(OrePrefix.ingot, Materials.Rubber) + .buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().duration(150).EUt(VA[ULV]).inputs(OreDictUnifier.get("sand")).inputs(new ItemStack(Items.CLAY_BALL)).outputs(COKE_OVEN_BRICK.getStackForm(2)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().duration(150).EUt(VA[ULV]).inputs(OreDictUnifier.get("sand")) + .inputs(new ItemStack(Items.CLAY_BALL)).outputs(COKE_OVEN_BRICK.getStackForm(2)).buildAndRegister(); } private static void registerAssemblerRecipes() { @@ -583,99 +623,314 @@ private static void registerAssemblerRecipes() { .duration(100) .buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, WroughtIron, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).circuitMeta(8).duration(25).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Steel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Aluminium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, StainlessSteel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Titanium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, TungstenSteel, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, RhodiumPlatedPalladium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, NaquadahAlloy, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Darmstadtium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).circuitMeta(8).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Neutronium, 8).outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).circuitMeta(8).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(OrePrefix.wireGtDouble, Materials.Cupronickel, 8).input(OrePrefix.foil, Materials.Bronze, 8).fluidInputs(Materials.TinAlloy.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.CUPRONICKEL)).duration(200).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[MV]).input(OrePrefix.wireGtDouble, Materials.Kanthal, 8).input(OrePrefix.foil, Materials.Aluminium, 8).fluidInputs(Materials.Copper.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.KANTHAL)).duration(300).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[HV]).input(OrePrefix.wireGtDouble, Materials.Nichrome, 8).input(OrePrefix.foil, Materials.StainlessSteel, 8).fluidInputs(Materials.Aluminium.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NICHROME)).duration(400).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[EV]).input(OrePrefix.wireGtDouble, Materials.RTMAlloy, 8).input(OrePrefix.foil, Materials.VanadiumSteel, 8).fluidInputs(Materials.Nichrome.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.RTM_ALLOY)).duration(500).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[IV]).input(OrePrefix.wireGtDouble, Materials.HSSG, 8).input(OrePrefix.foil, Materials.TungstenCarbide, 8).fluidInputs(Materials.Tungsten.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.HSS_G)).duration(600).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.Naquadah, 8).input(OrePrefix.foil, Materials.Osmium, 8).fluidInputs(Materials.TungstenSteel.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NAQUADAH)).duration(700).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.Trinium, 8).input(OrePrefix.foil, Materials.NaquadahEnriched, 8).fluidInputs(Materials.Naquadah.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRINIUM)).duration(800).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.Tritanium, 8).input(OrePrefix.foil, Materials.Naquadria, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L)).outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRITANIUM)).duration(900).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6).inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6).outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6).input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6).input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6).input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6).input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6).input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6).input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6).outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID)).fluidInputs(Materials.Polytetrafluoroethylene.getFluid(216)).circuitMeta(6).outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.PTFE_INERT_CASING)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.IndiumTinBariumTitaniumCuprate, 32).input(OrePrefix.foil, Materials.NiobiumTitanium, 32).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 24)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.UraniumRhodiumDinaquadide, 16).input(OrePrefix.foil, Materials.NiobiumTitanium, 16).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 16)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.EnrichedNaquadahTriniumEuropiumDuranide, 8).input(OrePrefix.foil, Materials.NiobiumTitanium, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 8)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(100).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.RutheniumTriniumAmericiumNeutronate, 4).input(OrePrefix.foil, Materials.NiobiumTitanium, 4).fluidInputs(Materials.Trinium.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).duration(200).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.FIELD_GENERATOR_IV.getStackForm(2)).inputs(MetaItems.ELECTRIC_PUMP_IV.getStackForm()).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(2)).input(OrePrefix.circuit, MarkerMaterials.Tier.LuV, 4).input(OrePrefix.pipeSmallFluid, Materials.Naquadah, 4).input(OrePrefix.plate, Materials.Europium, 4).fluidInputs(Materials.VanadiumGallium.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)).input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, ConfigHolder.recipes.casingsPerCraft)).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()).input(OrePrefix.plate, Materials.TungstenSteel, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()).input(OrePrefix.plate, Materials.Europium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)).inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()).input(OrePrefix.plate, Materials.Americium, 6).fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)).outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, ConfigHolder.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6).input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)).input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)).duration(50).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)).outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel).input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)).outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, ConfigHolder.recipes.casingsPerCraft)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, WroughtIron, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).circuitMeta(8).duration(25) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Steel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Aluminium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, StainlessSteel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Titanium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, TungstenSteel, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, RhodiumPlatedPalladium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, NaquadahAlloy, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Darmstadtium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).circuitMeta(8).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Neutronium, 8) + .outputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).circuitMeta(8).duration(50) + .buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(OrePrefix.wireGtDouble, Materials.Cupronickel, 8) + .input(OrePrefix.foil, Materials.Bronze, 8).fluidInputs(Materials.TinAlloy.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.CUPRONICKEL)).duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[MV]).input(OrePrefix.wireGtDouble, Materials.Kanthal, 8) + .input(OrePrefix.foil, Materials.Aluminium, 8).fluidInputs(Materials.Copper.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.KANTHAL)).duration(300).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[HV]).input(OrePrefix.wireGtDouble, Materials.Nichrome, 8) + .input(OrePrefix.foil, Materials.StainlessSteel, 8) + .fluidInputs(Materials.Aluminium.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NICHROME)).duration(400).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[EV]).input(OrePrefix.wireGtDouble, Materials.RTMAlloy, 8) + .input(OrePrefix.foil, Materials.VanadiumSteel, 8).fluidInputs(Materials.Nichrome.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.RTM_ALLOY)).duration(500).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[IV]).input(OrePrefix.wireGtDouble, Materials.HSSG, 8) + .input(OrePrefix.foil, Materials.TungstenCarbide, 8) + .fluidInputs(Materials.Tungsten.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.HSS_G)).duration(600).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]).input(OrePrefix.wireGtDouble, Materials.Naquadah, 8) + .input(OrePrefix.foil, Materials.Osmium, 8).fluidInputs(Materials.TungstenSteel.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.NAQUADAH)).duration(700).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]).input(OrePrefix.wireGtDouble, Materials.Trinium, 8) + .input(OrePrefix.foil, Materials.NaquadahEnriched, 8) + .fluidInputs(Materials.Naquadah.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRINIUM)).duration(800).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]).input(OrePrefix.wireGtDouble, Materials.Tritanium, 8) + .input(OrePrefix.foil, Materials.Naquadria, 8).fluidInputs(Materials.Trinium.getFluid(GTValues.L)) + .outputs(MetaBlocks.WIRE_COIL.getItemVariant(CoilType.TRITANIUM)).duration(900).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Bronze, 6) + .inputs(new ItemStack(Blocks.BRICK_BLOCK, 1)).circuitMeta(6) + .outputs(METAL_CASING.getItemVariant(BRONZE_BRICKS, ConfigHolder.recipes.casingsPerCraft)).duration(50) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Invar, 6) + .input(OrePrefix.frameGt, Materials.Invar, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.INVAR_HEATPROOF, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Steel, 6) + .input(OrePrefix.frameGt, Materials.Steel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.STEEL_SOLID, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Aluminium, 6) + .input(OrePrefix.frameGt, Materials.Aluminium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.TungstenSteel, 6) + .input(OrePrefix.frameGt, Materials.TungstenSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.TUNGSTENSTEEL_ROBUST, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.StainlessSteel, 6) + .input(OrePrefix.frameGt, Materials.StainlessSteel, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.STAINLESS_CLEAN, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Titanium, 6) + .input(OrePrefix.frameGt, Materials.Titanium, 1).circuitMeta(6).outputs(MetaBlocks.METAL_CASING + .getItemVariant(MetalCasingType.TITANIUM_STABLE, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, HSSE, 6).input(frameGt, Europium).circuitMeta(6) + .outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.HSSE_STURDY, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(plate, Palladium, 6).input(frameGt, Iridium).circuitMeta(6) + .outputs(METAL_CASING.getItemVariant(MetalCasingType.PALLADIUM_SUBSTATION, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.STEEL_SOLID)) + .fluidInputs(Materials.Polytetrafluoroethylene.getFluid(216)).circuitMeta(6) + .outputs(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.PTFE_INERT_CASING)).duration(50) + .buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .input(OrePrefix.wireGtDouble, Materials.IndiumTinBariumTitaniumCuprate, 32) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 32) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 24)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .input(OrePrefix.wireGtDouble, Materials.UraniumRhodiumDinaquadide, 16) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 16) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 16)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .input(OrePrefix.wireGtDouble, Materials.EnrichedNaquadahTriniumEuropiumDuranide, 8) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 8) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 8)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .input(OrePrefix.wireGtDouble, Materials.RutheniumTriniumAmericiumNeutronate, 4) + .input(OrePrefix.foil, Materials.NiobiumTitanium, 4) + .fluidInputs(Materials.Trinium.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .duration(200).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .inputs(MetaItems.FIELD_GENERATOR_IV.getStackForm(2)).inputs(MetaItems.ELECTRIC_PUMP_IV.getStackForm()) + .inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(2)) + .input(OrePrefix.circuit, MarkerMaterials.Tier.LuV, 4) + .input(OrePrefix.pipeSmallFluid, Materials.Naquadah, 4).input(OrePrefix.plate, Materials.Europium, 4) + .fluidInputs(Materials.VanadiumGallium.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .inputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.LAMINATED_GLASS)) + .input(OrePrefix.plate, Materials.Naquadah, 4).inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm(4)) + .outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.FUSION_GLASS, + ConfigHolder.recipes.casingsPerCraft)) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)).duration(50) + .cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LuV]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.SUPERCONDUCTOR_COIL)) + .inputs(MetaItems.NEUTRON_REFLECTOR.getStackForm()).inputs(MetaItems.ELECTRIC_PUMP_LuV.getStackForm()) + .input(OrePrefix.plate, Materials.TungstenSteel, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ZPM]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .inputs(MetaItems.VOLTAGE_COIL_ZPM.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_LuV.getStackForm()) + .input(OrePrefix.plate, Materials.Europium, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 2)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK2, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[UV]) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)) + .inputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_COIL)) + .inputs(MetaItems.VOLTAGE_COIL_UV.getStackForm(2)).inputs(MetaItems.FIELD_GENERATOR_ZPM.getStackForm()) + .input(OrePrefix.plate, Materials.Americium, 6) + .fluidInputs(Materials.Polybenzimidazole.getFluid(GTValues.L * 4)) + .outputs(MetaBlocks.FUSION_CASING.getItemVariant(BlockFusionCasing.CasingType.FUSION_CASING_MK3, + ConfigHolder.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plate, Materials.Magnalium, 6) + .input(OrePrefix.frameGt, Materials.BlueSteel, 1).circuitMeta(6).outputs(MetaBlocks.TURBINE_CASING + .getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING, ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.StainlessSteel, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STAINLESS_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.Titanium, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TITANIUM_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(16) + .inputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.STEEL_TURBINE_CASING)) + .input(OrePrefix.plate, Materials.TungstenSteel, 6).circuitMeta(6) + .outputs(MetaBlocks.TURBINE_CASING.getItemVariant(TurbineCasingType.TUNGSTENSTEEL_TURBINE_CASING, + ConfigHolder.recipes.casingsPerCraft)) + .duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel) + .input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Concrete.getFluid(L)) + .outputs(MetaBlocks.CLEANROOM_CASING.getItemVariant(BlockCleanroomCasing.CasingType.PLASCRETE, + ConfigHolder.recipes.casingsPerCraft)) + .duration(200).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(48).input(OrePrefix.frameGt, Materials.Steel) + .input(OrePrefix.plate, Materials.Polyethylene, 6).fluidInputs(Glass.getFluid(L)) + .outputs(MetaBlocks.TRANSPARENT_CASING.getItemVariant(BlockGlassCasing.CasingType.CLEANROOM_GLASS, + ConfigHolder.recipes.casingsPerCraft)) + .duration(200).buildAndRegister(); // If these recipes are changed, change the values in MaterialInfoLoader.java - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(25).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)).input(OrePrefix.cableGtSingle, Materials.RedAlloy, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[0].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)).input(OrePrefix.cableGtSingle, Materials.Tin, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[1].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).input(OrePrefix.cableGtSingle, Materials.Copper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)).input(OrePrefix.cableGtSingle, Materials.AnnealedCopper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)).input(OrePrefix.cableGtSingle, Materials.Gold, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[3].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)).input(OrePrefix.cableGtSingle, Materials.Aluminium, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[4].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)).input(OrePrefix.cableGtSingle, Materials.Platinum, 2).fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[5].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)).input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2).fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[6].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)).input(OrePrefix.cableGtSingle, Materials.VanadiumGallium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[7].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)).input(cableGtSingle, Materials.YttriumBariumCuprate, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[8].getStackForm()).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16).inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)).input(cableGtSingle, Materials.Europium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[9].getStackForm()).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, Iron, 5).outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, WroughtIron, 5).outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plank, Wood, 4).input(screw, Iron, 4).outputs(WOODEN_CRATE.getStackForm()).duration(100).circuitMeta(5).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 4).input(plate, Bronze, 4).outputs(BRONZE_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 4).input(plate, Steel, 4).outputs(STEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 4).input(plate, Aluminium, 4).outputs(ALUMINIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 4).input(plate, StainlessSteel, 4).outputs(STAINLESS_STEEL_CRATE.getStackForm()).circuitMeta(1).duration(200).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 4).input(plate, Titanium, 4).outputs(TITANIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 4).input(plate, TungstenSteel, 4).outputs(TUNGSTENSTEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 2).input(plate, Bronze, 4).outputs(BRONZE_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 2).input(plate, Steel, 4).outputs(STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 2).input(plate, Aluminium, 4).outputs(ALUMINIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 2).input(plate, StainlessSteel, 4).outputs(STAINLESS_STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 2).input(plate, Titanium, 4).outputs(TITANIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 2).input(plate, TungstenSteel, 4).outputs(TUNGSTENSTEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Gold, 2).input(plate, Gold, 4).outputs(GOLD_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polyethylene, 4).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, SiliconeRubber, 2).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE, 2).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polycaprolactam, 2).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(144)).output(DUCT_TAPE, 4).duration(100).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polybenzimidazole).input(CARBON_MESH).fluidInputs(Polyethylene.getFluid(72)).output(DUCT_TAPE, 8).duration(100).buildAndRegister(); - - ModHandler.addShapedRecipe("basic_tape", BASIC_TAPE.getStackForm(), " P ", "PSP", " P ", 'P', new UnificationEntry(plate, Paper), 'S', STICKY_RESIN.getStackForm()); - ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ULV]).input(plate, Paper, 2).input(STICKY_RESIN).output(BASIC_TAPE, 2).duration(100).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(25).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ULV)) + .input(OrePrefix.cableGtSingle, Materials.RedAlloy, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[0].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LV)) + .input(OrePrefix.cableGtSingle, Materials.Tin, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[1].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)) + .input(OrePrefix.cableGtSingle, Materials.Copper, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[2].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.MV)) + .input(OrePrefix.cableGtSingle, Materials.AnnealedCopper, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[2].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.HV)) + .input(OrePrefix.cableGtSingle, Materials.Gold, 2).fluidInputs(Materials.Polyethylene.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[3].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.EV)) + .input(OrePrefix.cableGtSingle, Materials.Aluminium, 2) + .fluidInputs(Materials.Polyethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[4].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.IV)) + .input(OrePrefix.cableGtSingle, Materials.Platinum, 2) + .fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[5].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.LuV)) + .input(OrePrefix.cableGtSingle, Materials.NiobiumTitanium, 2) + .fluidInputs(Polytetrafluoroethylene.getFluid(L * 2)).outputs(MetaTileEntities.HULL[6].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.ZPM)) + .input(OrePrefix.cableGtSingle, Materials.VanadiumGallium, 2) + .fluidInputs(Polybenzimidazole.getFluid(L * 2)).outputs(MetaTileEntities.HULL[7].getStackForm()) + .buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UV)) + .input(cableGtSingle, Materials.YttriumBariumCuprate, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[8].getStackForm()).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(50).EUt(16) + .inputs(MetaBlocks.MACHINE_CASING.getItemVariant(MachineCasingType.UHV)) + .input(cableGtSingle, Materials.Europium, 2).fluidInputs(Polybenzimidazole.getFluid(L * 2)) + .outputs(MetaTileEntities.HULL[9].getStackForm()).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, Iron, 5) + .outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(2).input(OreDictNames.chestWood.toString()).input(plate, WroughtIron, 5) + .outputs(new ItemStack(Blocks.HOPPER)).duration(800).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(OrePrefix.plank, Wood, 4).input(screw, Iron, 4) + .outputs(WOODEN_CRATE.getStackForm()).duration(100).circuitMeta(5).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 4).input(plate, Bronze, 4) + .outputs(BRONZE_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 4).input(plate, Steel, 4) + .outputs(STEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 4).input(plate, Aluminium, 4) + .outputs(ALUMINIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 4).input(plate, StainlessSteel, 4) + .outputs(STAINLESS_STEEL_CRATE.getStackForm()).circuitMeta(1).duration(200).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 4).input(plate, Titanium, 4) + .outputs(TITANIUM_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 4).input(plate, TungstenSteel, 4) + .outputs(TUNGSTENSTEEL_CRATE.getStackForm()).duration(200).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Bronze, 2).input(plate, Bronze, 4) + .outputs(BRONZE_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Steel, 2).input(plate, Steel, 4) + .outputs(STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Aluminium, 2).input(plate, Aluminium, 4) + .outputs(ALUMINIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, StainlessSteel, 2).input(plate, StainlessSteel, 4) + .outputs(STAINLESS_STEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Titanium, 2).input(plate, Titanium, 4) + .outputs(TITANIUM_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, TungstenSteel, 2).input(plate, TungstenSteel, 4) + .outputs(TUNGSTENSTEEL_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(16).input(stickLong, Gold, 2).input(plate, Gold, 4) + .outputs(GOLD_DRUM.getStackForm()).duration(200).circuitMeta(2).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polyethylene, 4).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, SiliconeRubber, 2).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(288)).output(DUCT_TAPE, 2).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polycaprolactam, 2).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(144)).output(DUCT_TAPE, 4).duration(100).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[LV]).input(foil, Polybenzimidazole).input(CARBON_MESH) + .fluidInputs(Polyethylene.getFluid(72)).output(DUCT_TAPE, 8).duration(100).buildAndRegister(); + + ModHandler.addShapedRecipe("basic_tape", BASIC_TAPE.getStackForm(), " P ", "PSP", " P ", 'P', + new UnificationEntry(plate, Paper), 'S', STICKY_RESIN.getStackForm()); + ASSEMBLER_RECIPES.recipeBuilder().EUt(VA[ULV]).input(plate, Paper, 2).input(STICKY_RESIN).output(BASIC_TAPE, 2) + .duration(100).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(plateDouble, Steel, 2) @@ -761,12 +1016,18 @@ private static void registerBlastFurnaceRecipes() { .buildAndRegister(); // Aluminium from aluminium oxide gems - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Ruby).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Ruby).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, GreenSapphire).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, GreenSapphire).output(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); - BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Sapphire).output(nugget, Aluminium, 3).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Ruby).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Ruby).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, GreenSapphire).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, GreenSapphire).output(nugget, Aluminium, 3) + .chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(400).EUt(100).input(dust, Sapphire).output(nugget, Aluminium, 3) + .blastFurnaceTemp(1200).buildAndRegister(); + BLAST_RECIPES.recipeBuilder().duration(320).EUt(100).input(gem, Sapphire).output(nugget, Aluminium, 3) + .blastFurnaceTemp(1200).buildAndRegister(); // Titanium tetrachloride BLAST_RECIPES.recipeBuilder().duration(800).EUt(VA[HV]) @@ -787,7 +1048,7 @@ private static void registerBlastFurnaceRecipes() { .blastFurnaceTemp(1700) .duration(1600).EUt(VA[HV]).buildAndRegister(); - //Tempered Glass + // Tempered Glass BLAST_RECIPES.recipeBuilder() .input(block, Glass) .fluidInputs(Oxygen.getFluid(100)) @@ -847,7 +1108,8 @@ private static void registerBlastFurnaceMetallurgyRecipes() { .buildAndRegister(); } - private static void createSulfurDioxideRecipe(Material inputMaterial, Material outputMaterial, int sulfurDioxideAmount) { + private static void createSulfurDioxideRecipe(Material inputMaterial, Material outputMaterial, + int sulfurDioxideAmount) { BLAST_RECIPES.recipeBuilder().duration(120).EUt(VA[MV]).blastFurnaceTemp(1200) .input(dust, inputMaterial) .fluidInputs(Oxygen.getFluid(3000)) @@ -858,8 +1120,6 @@ private static void createSulfurDioxideRecipe(Material inputMaterial, Material o } private static void registerDecompositionRecipes() { - - EXTRACTOR_RECIPES.recipeBuilder() .inputs(STICKY_RESIN.getStackForm()) .output(dust, RawRubber, 3) @@ -886,20 +1146,27 @@ private static void registerDecompositionRecipes() { .output(dust, RawRubber, 2) .buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).input("treeSapling", 8).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.WHEAT, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.POTATO, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.CARROT, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.CACTUS, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.REEDS, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.BROWN_MUSHROOM, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.RED_MUSHROOM, 8)).output(PLANT_BALL).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.BEETROOT, 8)).output(PLANT_BALL).buildAndRegister(); - + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).input("treeSapling", 8).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.WHEAT, 8)).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.POTATO, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.CARROT, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.CACTUS, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.REEDS, 8)).output(PLANT_BALL) + .buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.BROWN_MUSHROOM, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Blocks.RED_MUSHROOM, 8)) + .output(PLANT_BALL).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2).inputs(new ItemStack(Items.BEETROOT, 8)) + .output(PLANT_BALL).buildAndRegister(); } private static void registerRecyclingRecipes() { - MACERATOR_RECIPES.recipeBuilder() .input(stone, Endstone) .output(dust, Endstone) @@ -1010,7 +1277,6 @@ private static void registerRecyclingRecipes() { } private static void registerFluidRecipes() { - FLUID_HEATER_RECIPES.recipeBuilder().duration(32).EUt(4) .fluidInputs(Ice.getFluid(L)) .circuitMeta(1) @@ -1030,8 +1296,10 @@ private static void registerFluidRecipes() { .duration(100).EUt(16).buildAndRegister(); } - FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(Water.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); - FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(DistilledWater.getFluid(6)).circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); + FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(Water.getFluid(6)).circuitMeta(1) + .fluidOutputs(Steam.getFluid(960)).buildAndRegister(); + FLUID_HEATER_RECIPES.recipeBuilder().duration(30).EUt(VA[LV]).fluidInputs(DistilledWater.getFluid(6)) + .circuitMeta(1).fluidOutputs(Steam.getFluid(960)).buildAndRegister(); } private static void registerSmoothRecipe(List roughStack, List smoothStack) { @@ -1055,7 +1323,8 @@ private static void registerCobbleRecipe(List smoothStack, List polishedStack, List brickStack, MarkerMaterial color) { + private static void registerBricksRecipe(List polishedStack, List brickStack, + MarkerMaterial color) { for (int i = 0; i < polishedStack.size(); i++) { LASER_ENGRAVER_RECIPES.recipeBuilder() .inputs(polishedStack.get(i)) @@ -1078,97 +1347,138 @@ private static void registerMossRecipe(List regularStack, List void registerMachineRecipe(boolean withUnificationData, T[] metaTileEntities, Object... recipe) { + public static < + T extends MetaTileEntity & ITieredMetaTileEntity> void registerMachineRecipe(boolean withUnificationData, + T[] metaTileEntities, + Object... recipe) { for (T metaTileEntity : metaTileEntities) { // Needed to skip certain tiers if not enabled. @@ -442,12 +1162,14 @@ public static void registerMa if (prepRecipe == null) { return; } - ModHandler.addShapedRecipe(withUnificationData, metaTileEntity.getMetaName(), metaTileEntity.getStackForm(), prepRecipe); + ModHandler.addShapedRecipe(withUnificationData, metaTileEntity.getMetaName(), + metaTileEntity.getStackForm(), prepRecipe); } } } - public static void registerMachineRecipe(T[] metaTileEntities, Object... recipe) { + public static void registerMachineRecipe(T[] metaTileEntities, + Object... recipe) { registerMachineRecipe(true, metaTileEntities, recipe); } @@ -463,5 +1185,4 @@ private static Object[] prepareRecipe(int tier, Object... recipe) { } return recipe; } - } diff --git a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java index 838e6ecc757..cc01014c03a 100644 --- a/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MetaTileEntityMachineRecipeLoader.java @@ -4,6 +4,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; @@ -15,8 +16,8 @@ import static gregtech.api.unification.material.MarkerMaterials.Tier; import static gregtech.api.unification.material.Materials.*; import static gregtech.api.unification.ore.OrePrefix.*; -import static gregtech.common.blocks.MetaBlocks.LD_ITEM_PIPE; import static gregtech.common.blocks.MetaBlocks.LD_FLUID_PIPE; +import static gregtech.common.blocks.MetaBlocks.LD_ITEM_PIPE; import static gregtech.common.items.MetaItems.*; import static gregtech.common.items.MetaItems.SENSOR_UV; import static gregtech.common.metatileentities.MetaTileEntities.*; @@ -24,7 +25,6 @@ public class MetaTileEntityMachineRecipeLoader { public static void init() { - // Fluid Hatches registerHatchBusRecipe(ULV, FLUID_IMPORT_HATCH[ULV], FLUID_EXPORT_HATCH[ULV], new ItemStack(Blocks.GLASS)); registerHatchBusRecipe(LV, FLUID_IMPORT_HATCH[LV], FLUID_EXPORT_HATCH[LV], new ItemStack(Blocks.GLASS)); @@ -33,7 +33,8 @@ public static void init() { registerHatchBusRecipe(EV, FLUID_IMPORT_HATCH[EV], FLUID_EXPORT_HATCH[EV], ALUMINIUM_DRUM.getStackForm()); registerHatchBusRecipe(IV, FLUID_IMPORT_HATCH[IV], FLUID_EXPORT_HATCH[IV], STAINLESS_STEEL_DRUM.getStackForm()); registerHatchBusRecipe(LuV, FLUID_IMPORT_HATCH[LuV], FLUID_EXPORT_HATCH[LuV], TITANIUM_DRUM.getStackForm()); - registerHatchBusRecipe(ZPM, FLUID_IMPORT_HATCH[ZPM], FLUID_EXPORT_HATCH[ZPM], TUNGSTENSTEEL_DRUM.getStackForm()); + registerHatchBusRecipe(ZPM, FLUID_IMPORT_HATCH[ZPM], FLUID_EXPORT_HATCH[ZPM], + TUNGSTENSTEEL_DRUM.getStackForm()); registerHatchBusRecipe(UV, FLUID_IMPORT_HATCH[UV], FLUID_EXPORT_HATCH[UV], QUANTUM_TANK[0].getStackForm()); registerHatchBusRecipe(UHV, FLUID_IMPORT_HATCH[UHV], FLUID_EXPORT_HATCH[UHV], QUANTUM_TANK[1].getStackForm()); @@ -512,7 +513,6 @@ public static void init() { .EUt(VA[UV])) .duration(1000).EUt(VA[UHV]).buildAndRegister(); - // Power Transformers ASSEMBLER_RECIPES.recipeBuilder() @@ -1025,7 +1025,8 @@ public static void init() { } } - private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, MetaTileEntity outputBus, ItemStack extra) { + private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, MetaTileEntity outputBus, + ItemStack extra) { // Glue recipe for ULV and LV // 250L for ULV, 500L for LV if (tier <= GTValues.LV) { @@ -1115,23 +1116,32 @@ private static void registerHatchBusRecipe(int tier, MetaTileEntity inputBus, Me private static int getFluidAmount(int offsetTier) { switch (offsetTier) { - case 0: return 4; - case 1: return 9; - case 2: return 18; - case 3: return 36; - case 4: return 72; - case 5: return 144; - case 6: return 288; - case 7: return 432; - case 8: return 576; + case 0: + return 4; + case 1: + return 9; + case 2: + return 18; + case 3: + return 36; + case 4: + return 72; + case 5: + return 144; + case 6: + return 288; + case 7: + return 432; + case 8: + return 576; case 9: - default: return 720; + default: + return 720; } } // TODO clean this up with a CraftingComponent rework private static void registerLaserRecipes() { - // 256A Laser Source Hatches ASSEMBLER_RECIPES.recipeBuilder() .input(HULL[IV]) diff --git a/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java index 795b880849c..fb3b3173dc4 100644 --- a/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/MiscRecipeLoader.java @@ -20,6 +20,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -33,11 +34,11 @@ public class MiscRecipeLoader { public static void init() { - // Basic Terminal Recipe ModHandler.addShapedRecipe(true, "basic_terminal", TERMINAL.getStackForm(), - "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', OreDictUnifier.get("paneGlass"), 'B', new ItemStack(Items.BOOK), - 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); + "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', + OreDictUnifier.get("paneGlass"), 'B', new ItemStack(Items.BOOK), + 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); // Multiblock Builder ModHandler.addShapedRecipe(true, "multiblock_builder", MULTIBLOCK_BUILDER.getStackForm(), @@ -238,7 +239,8 @@ public static void init() { .buildAndRegister(); ASSEMBLY_LINE_RECIPES.recipeBuilder().duration(1000).EUt(GTValues.VA[GTValues.LuV]) - .inputNBT(((ArmorMetaItem) QUANTUM_CHESTPLATE.getStackForm().getItem()).getItem(QUANTUM_CHESTPLATE.getStackForm()), NBTMatcher.ANY, NBTCondition.ANY) + .inputNBT(((ArmorMetaItem) QUANTUM_CHESTPLATE.getStackForm().getItem()) + .getItem(QUANTUM_CHESTPLATE.getStackForm()), NBTMatcher.ANY, NBTCondition.ANY) .inputs(HIGH_POWER_INTEGRATED_CIRCUIT.getStackForm(2)) .input(wireFine, NiobiumTitanium, 64) .input(wireGtQuadruple, Osmium, 6) @@ -254,7 +256,6 @@ public static void init() { .scannerResearch(GRAVITATION_ENGINE.getStackForm()) .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(VA[HV]) .inputs(MetaItems.COVER_SCREEN.getStackForm()) .inputs((ItemStack) CraftingComponent.HULL.getIngredient(1)) @@ -375,25 +376,35 @@ public static void init() { .duration(40).EUt(6).buildAndRegister(); // Dyed Lens Recipes - RecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder().EUt(VA[HV]).duration(200).input(craftingLens, Glass); + RecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder().EUt(VA[HV]).duration(200).input(craftingLens, + Glass); final int dyeAmount = 288; - builder.copy().fluidInputs(DyeWhite.getFluid(dyeAmount)) .output(lens, Glass) .buildAndRegister(); - builder.copy().fluidInputs(DyeOrange.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Orange)) .buildAndRegister(); - builder.copy().fluidInputs(DyeMagenta.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Magenta)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLightBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightBlue)).buildAndRegister(); - builder.copy().fluidInputs(DyeYellow.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Yellow)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLime.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Lime)) .buildAndRegister(); - builder.copy().fluidInputs(DyePink.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Pink)) .buildAndRegister(); - builder.copy().fluidInputs(DyeGray.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Gray)) .buildAndRegister(); - builder.copy().fluidInputs(DyeLightGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightGray)).buildAndRegister(); - builder.copy().fluidInputs(DyeCyan.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Cyan)) .buildAndRegister(); - builder.copy().fluidInputs(DyePurple.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Purple)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBlue.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Blue)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBrown.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Brown)) .buildAndRegister(); - builder.copy().fluidInputs(DyeGreen.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Green)) .buildAndRegister(); - builder.copy().fluidInputs(DyeRed.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Red)) .buildAndRegister(); - builder.copy().fluidInputs(DyeBlack.getFluid(dyeAmount)) .output(GLASS_LENSES.get(Color.Black)) .buildAndRegister(); + builder.copy().fluidInputs(DyeWhite.getFluid(dyeAmount)).output(lens, Glass).buildAndRegister(); + builder.copy().fluidInputs(DyeOrange.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Orange)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeMagenta.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Magenta)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeLightBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightBlue)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeYellow.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Yellow)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeLime.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Lime)).buildAndRegister(); + builder.copy().fluidInputs(DyePink.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Pink)).buildAndRegister(); + builder.copy().fluidInputs(DyeGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Gray)).buildAndRegister(); + builder.copy().fluidInputs(DyeLightGray.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.LightGray)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeCyan.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Cyan)).buildAndRegister(); + builder.copy().fluidInputs(DyePurple.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Purple)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeBlue.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Blue)).buildAndRegister(); + builder.copy().fluidInputs(DyeBrown.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Brown)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeGreen.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Green)) + .buildAndRegister(); + builder.copy().fluidInputs(DyeRed.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Red)).buildAndRegister(); + builder.copy().fluidInputs(DyeBlack.getFluid(dyeAmount)).output(GLASS_LENSES.get(Color.Black)) + .buildAndRegister(); // NAN Certificate EXTRUDER_RECIPES.recipeBuilder() @@ -411,26 +422,46 @@ public static void init() { .output(FERTILIZER, 4) .duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite) .input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Sulfur) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, TricalciumPhosphate).fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Phosphate) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Ash, 3) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); - CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, DarkAsh) .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcite).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 1).duration(100).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Calcium).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Sulfur).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Phosphate).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, Ash, 3).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, Apatite).input(dust, DarkAsh).fluidInputs(Water.getFluid(1000)) + .output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Sulfur) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, TricalciumPhosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 4).duration(400).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Phosphate) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 3).duration(300).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, Ash, 3) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); + CHEMICAL_RECIPES.recipeBuilder().input(dust, GlauconiteSand).input(dust, DarkAsh) + .fluidInputs(Water.getFluid(1000)).output(FERTILIZER, 2).duration(200).EUt(VA[LV]).buildAndRegister(); ELECTROLYZER_RECIPES.recipeBuilder() .input(FERTILIZER) diff --git a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java index b657766e6ee..81955f6b6fb 100644 --- a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.RecipeBuilder; @@ -20,17 +19,21 @@ import gregtech.api.unification.stack.MaterialStack; import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Tuple; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.collect.ImmutableList; + import java.util.*; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.L; import static gregtech.api.GTValues.M; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -54,8 +57,8 @@ public static void init() { } } - public static void registerRecyclingRecipes(ItemStack input, List components, boolean ignoreArcSmelting, @Nullable OrePrefix prefix) { - + public static void registerRecyclingRecipes(ItemStack input, List components, + boolean ignoreArcSmelting, @Nullable OrePrefix prefix) { // Gather the valid Materials for use in recycling recipes. // - Filter out Materials that cannot create a Dust // - Filter out Materials that do not equate to at least 1 Nugget worth of Material. @@ -89,13 +92,14 @@ public static void registerRecyclingRecipes(ItemStack input, List } // Skip Ingot -> Ingot Arc Recipes - if (OreDictUnifier.getPrefix(input) == OrePrefix.ingot && m.getProperty(PropertyKey.INGOT).getArcSmeltInto() == m) { + if (OreDictUnifier.getPrefix(input) == OrePrefix.ingot && + m.getProperty(PropertyKey.INGOT).getArcSmeltInto() == m) { return; } // Prevent Magnetic dust -> Regular Ingot Arc Furnacing, avoiding the EBF recipe // "I will rework magnetic materials soon" - DStrand1 - if(prefix == OrePrefix.dust && m.hasFlag(IS_MAGNETIC)) { + if (prefix == OrePrefix.dust && m.hasFlag(IS_MAGNETIC)) { return; } } @@ -103,13 +107,11 @@ public static void registerRecyclingRecipes(ItemStack input, List } private static void registerMaceratorRecycling(ItemStack input, List materials, int multiplier) { - // Finalize the output list. List outputs = finalizeOutputs( materials, RecipeMaps.MACERATOR_RECIPES.getMaxOutputs(), - OreDictUnifier::getDust - ); + OreDictUnifier::getDust); // Exit if no valid Materials exist for this recycling Recipe. if (outputs.size() == 0) return; @@ -125,10 +127,10 @@ private static void registerMaceratorRecycling(ItemStack input, List materials, int multiplier, @Nullable OrePrefix prefix) { + private static void registerExtractorRecycling(ItemStack input, List materials, int multiplier, + @Nullable OrePrefix prefix) { // Handle simple materials separately if (prefix != null && prefix.secondaryMaterials.isEmpty()) { MaterialStack ms = OreDictUnifier.getMaterial(input); @@ -155,13 +157,15 @@ private static void registerExtractorRecycling(ItemStack input, List ms.material.hasProperty(PropertyKey.FLUID)).findFirst().orElse(null); + MaterialStack fluidMs = materials.stream().filter(ms -> ms.material.hasProperty(PropertyKey.FLUID)).findFirst() + .orElse(null); if (fluidMs == null) return; // Find the next MaterialStack, which will be the Item output. // This can sometimes be before the Fluid output in the list, so we have to // assume it can be anywhere in the list. - MaterialStack itemMs = materials.stream().filter(ms -> !ms.material.equals(fluidMs.material)).findFirst().orElse(null); + MaterialStack itemMs = materials.stream().filter(ms -> !ms.material.equals(fluidMs.material)).findFirst() + .orElse(null); // Calculate the duration based off of those two possible outputs. // - Sum the two Material amounts together (if both exist) @@ -188,7 +192,8 @@ private static void registerExtractorRecycling(ItemStack input, List materials, @Nullable OrePrefix prefix) { + private static void registerArcRecycling(ItemStack input, List materials, + @Nullable OrePrefix prefix) { // Block dusts from being arc'd instead of EBF'd MaterialStack ms = OreDictUnifier.getMaterial(input); if (prefix == OrePrefix.dust && ms != null && ms.material.hasProperty(PropertyKey.BLAST)) { @@ -214,14 +219,12 @@ private static void registerArcRecycling(ItemStack input, List ma .outputs(output) .duration(calculateDuration(Collections.singletonList(output))) .EUt(GTValues.VA[GTValues.LV]); - } - else { + } else { // Finalize the output List List outputs = finalizeOutputs( Collections.singletonList(materialOutput), RecipeMaps.ARC_FURNACE_RECIPES.getMaxOutputs(), - RecyclingRecipes::getArcIngotOrDust - ); + RecyclingRecipes::getArcIngotOrDust); builder = RecipeMaps.ARC_FURNACE_RECIPES.recipeBuilder() .inputs(input.copy()) @@ -252,8 +255,7 @@ private static void registerArcRecycling(ItemStack input, List ma List outputs = finalizeOutputs( materials, RecipeMaps.ARC_FURNACE_RECIPES.getMaxOutputs(), - RecyclingRecipes::getArcIngotOrDust - ); + RecyclingRecipes::getArcIngotOrDust); // Exit if no valid outputs exist for this recycling Recipe. if (outputs.size() == 0) return; @@ -316,7 +318,7 @@ private static MaterialStack getArcSmeltingResult(MaterialStack materialStack) { return null; } - // Else if the Material is an Ingot, return the Arc Smelting + // Else if the Material is an Ingot, return the Arc Smelting // result if it exists, otherwise return the Material itself. if (material.hasProperty(PropertyKey.INGOT)) { Material arcSmelt = material.getProperty(PropertyKey.INGOT).getArcSmeltInto(); @@ -355,7 +357,6 @@ private static MaterialStack getGemArcSmeltResult(MaterialStack materialStack) { } private static int calculateVoltageMultiplier(List materials) { - // Gather the highest blast temperature of any material in the list int highestTemp = 0; for (MaterialStack ms : materials) { @@ -365,13 +366,14 @@ private static int calculateVoltageMultiplier(List materials) { if (prop.getBlastTemperature() > highestTemp) { highestTemp = prop.getBlastTemperature(); } - } - else if(m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { - BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto().getProperty(PropertyKey.BLAST); - if (prop.getBlastTemperature() > highestTemp) { - highestTemp = prop.getBlastTemperature(); - } - } + } else if (m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && + m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { + BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto() + .getProperty(PropertyKey.BLAST); + if (prop.getBlastTemperature() > highestTemp) { + highestTemp = prop.getBlastTemperature(); + } + } } // No blast temperature in the list means no multiplier @@ -402,7 +404,6 @@ private static int calculateDuration(List materials) { * Combines any matching Materials in the List into one MaterialStack */ private static List combineStacks(List rawList) { - // Combine any stacks in the List that have the same Item. Map materialStacksExploded = new HashMap<>(); for (MaterialStack ms : rawList) { @@ -414,8 +415,8 @@ private static List combineStacks(List rawList) { .collect(Collectors.toList()); } - private static List finalizeOutputs(List materials, int maxOutputs, Function toItemStackMapper) { - + private static List finalizeOutputs(List materials, int maxOutputs, + Function toItemStackMapper) { // Map of ItemStack, Long to properly sort by the true material amount for outputs List> outputs = new ArrayList<>(); @@ -491,23 +492,29 @@ private static List finalizeOutputs(List materials, in return returnValues; } - private static void splitStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void splitStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { int amount = originalStack.getCount(); while (amount > 64) { - list.add(new Tuple<>(GTUtility.copy(64, originalStack), new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * 64))); + list.add(new Tuple<>(GTUtility.copy(64, originalStack), + new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * 64))); amount -= 64; } - list.add(new Tuple<>(GTUtility.copy(amount, originalStack), new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * amount))); + list.add(new Tuple<>(GTUtility.copy(amount, originalStack), + new MaterialStack(entry.material, entry.orePrefix.getMaterialAmount(entry.material) * amount))); } - private static final List DUST_ORDER = ImmutableList.of(OrePrefix.dust, OrePrefix.dustSmall, OrePrefix.dustTiny); - private static final List INGOT_ORDER = ImmutableList.of(OrePrefix.block, OrePrefix.ingot, OrePrefix.nugget); + private static final List DUST_ORDER = ImmutableList.of(OrePrefix.dust, OrePrefix.dustSmall, + OrePrefix.dustTiny); + private static final List INGOT_ORDER = ImmutableList.of(OrePrefix.block, OrePrefix.ingot, + OrePrefix.nugget); - private static void shrinkStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void shrinkStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { Material material = entry.material; long materialAmount = originalStack.getCount() * entry.orePrefix.getMaterialAmount(material); - //noinspection ConstantConditions + // noinspection ConstantConditions final List chosenList = material.hasProperty(PropertyKey.INGOT) ? INGOT_ORDER : DUST_ORDER; // Break materialAmount into a maximal stack @@ -527,7 +534,10 @@ private static void shrinkStacks(List> list, Ite if (tempList.containsKey(chosenList.get(0))) { OrePrefix prefix = chosenList.get(0); MaterialStack ms = tempList.get(prefix); - splitStacks(list, OreDictUnifier.get(chosenList.get(0), ms.material, (int) (ms.amount / prefix.getMaterialAmount(material))), new UnificationEntry(prefix, material)); + splitStacks(list, + OreDictUnifier.get(chosenList.get(0), ms.material, + (int) (ms.amount / prefix.getMaterialAmount(material))), + new UnificationEntry(prefix, material)); } OrePrefix mediumPrefix = chosenList.get(1); // dustSmall or ingot @@ -539,21 +549,24 @@ private static void shrinkStacks(List> list, Ite if (mediumMS != null && smallestMS != null) { long singleStackAmount = mediumMS.amount + smallestMS.amount; if (singleStackAmount / smallestPrefix.getMaterialAmount(material) <= 64) { - list.add(new Tuple<>(OreDictUnifier.get(smallestPrefix, material, (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), new MaterialStack(material, singleStackAmount))); + list.add(new Tuple<>( + OreDictUnifier.get(smallestPrefix, material, + (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, singleStackAmount))); return; } } // Otherwise simply add the stacks to the List if they exist if (mediumMS != null) list.add(new Tuple<>( - OreDictUnifier.get(mediumPrefix, material, (int) (mediumMS.amount / mediumPrefix.getMaterialAmount(material))), - new MaterialStack(material, mediumMS.amount) - )); + OreDictUnifier.get(mediumPrefix, material, + (int) (mediumMS.amount / mediumPrefix.getMaterialAmount(material))), + new MaterialStack(material, mediumMS.amount))); if (smallestMS != null) list.add(new Tuple<>( - OreDictUnifier.get(smallestPrefix, material, (int) (smallestMS.amount / smallestPrefix.getMaterialAmount(material))), - new MaterialStack(material, smallestMS.amount) - )); + OreDictUnifier.get(smallestPrefix, material, + (int) (smallestMS.amount / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, smallestMS.amount))); } private static boolean isAshMaterial(MaterialStack ms) { @@ -563,11 +576,10 @@ private static boolean isAshMaterial(MaterialStack ms) { /** * Performs various NBT matching on the provided input and adds the result to the provided RecipeBuilder * - * @param input The input itemStack + * @param input The input itemStack * @param builder The RecipeBuilder to add the NBT condition to */ private static void cleanInputNBT(ItemStack input, RecipeBuilder builder) { - // Ignore String tag from naming machines MetaTileEntity mte = GTUtility.getMetaTileEntity(input); if (mte != null) { diff --git a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java index 970ed03ff81..b057a3e3b0d 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java @@ -13,6 +13,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -56,15 +57,19 @@ public static void init() { private static void woodRecipes() { if (ConfigHolder.recipes.nerfWoodCrafting) { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:stick")); - ModHandler.addShapedRecipe("stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood)); - ModHandler.addShapedRecipe("stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", 'P', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); } if (ConfigHolder.recipes.nerfPaperCrafting) { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:paper")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:sugar")); - ModHandler.addShapedRecipe("paper_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Paper, 2), "SSS", " m ", 'S', new ItemStack(Items.REEDS)); - ModHandler.addShapedRecipe("sugar", OreDictUnifier.get(OrePrefix.dust, Materials.Sugar, 1), "Sm ", 'S', new ItemStack(Items.REEDS)); + ModHandler.addShapedRecipe("paper_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Paper, 2), "SSS", + " m ", 'S', new ItemStack(Items.REEDS)); + ModHandler.addShapedRecipe("sugar", OreDictUnifier.get(OrePrefix.dust, Materials.Sugar, 1), "Sm ", 'S', + new ItemStack(Items.REEDS)); ModHandler.addShapedRecipe("paper", new ItemStack(Items.PAPER, 2), " r ", "SSS", " B ", 'S', OreDictUnifier.get(OrePrefix.dust, Materials.Paper), @@ -74,15 +79,17 @@ private static void woodRecipes() { if (!ConfigHolder.recipes.hardWoodRecipes) return; ModHandler.removeRecipeByName(new ResourceLocation("minecraft:ladder")); - ModHandler.addShapedRecipe("ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood), 'R', new UnificationEntry(OrePrefix.bolt, Materials.Wood)); + ModHandler.addShapedRecipe("ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood), 'R', + new UnificationEntry(OrePrefix.bolt, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:trapdoor")); ModHandler.addShapedRecipe("trapdoor", new ItemStack(Blocks.TRAPDOOR), "SRS", "RRR", "SRS", 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("bowl", new ItemStack(Items.BOWL), "k", "X", 'X', new UnificationEntry(OrePrefix.plank, Materials.Wood)); + ModHandler.addShapedRecipe("bowl", new ItemStack(Items.BOWL), "k", "X", 'X', + new UnificationEntry(OrePrefix.plank, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bowl")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:chest")); @@ -129,8 +136,7 @@ private static void redstoneRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:sticky_piston")); ModHandler.addShapedRecipe("sticky_piston", new ItemStack(Blocks.STICKY_PISTON, 1), "h", "R", "P", 'R', "slimeball", - 'P', new ItemStack(Blocks.PISTON) - ); + 'P', new ItemStack(Blocks.PISTON)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:piston")); @@ -139,8 +145,7 @@ private static void redstoneRecipes() { 'C', OreDictNames.stoneCobble, 'R', new UnificationEntry(OrePrefix.plate, Materials.RedAlloy), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'F', OreDictNames.fenceWood - ); + 'F', OreDictNames.fenceWood); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.stick, Materials.Iron) @@ -187,35 +192,34 @@ private static void redstoneRecipes() { .outputs(new ItemStack(Blocks.PISTON, 16)) .duration(800).EUt(VA[LV]).buildAndRegister(); - ModHandler.removeRecipeByName(new ResourceLocation("minecraft:stone_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:wooden_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:heavy_weighted_pressure_plate")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:light_weighted_pressure_plate")); - ModHandler.addShapedRecipe("stone_pressure_plate", new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("stone_pressure_plate", new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", + "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'L', new ItemStack(Blocks.STONE_SLAB), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron)); - ModHandler.addShapedRecipe("wooden_pressure_plate", new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + ModHandler.addShapedRecipe("wooden_pressure_plate", new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 2), "SrS", + "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.bolt, Materials.Wood), 'L', new UnificationEntry(OrePrefix.plate, Materials.Wood), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Iron)); - ModHandler.addShapedRecipe("heavy_weighted_pressure_plate", new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("heavy_weighted_pressure_plate", new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), + "ShS", "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel), 'L', new UnificationEntry(OrePrefix.plate, Materials.Gold), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel)); - ModHandler.addShapedRecipe("light_weighted_pressure_plate", new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + ModHandler.addShapedRecipe("light_weighted_pressure_plate", new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), + "ShS", "LCL", "SdS", 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel), 'L', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel) - ); + 'C', new UnificationEntry(OrePrefix.spring, Materials.Steel)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.spring, Materials.Iron) @@ -262,8 +266,7 @@ private static void redstoneRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lever")); ModHandler.addShapedRecipe("lever", new ItemStack(Blocks.LEVER), "B", "S", 'B', new ItemStack(Blocks.STONE_BUTTON), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:daylight_detector")); ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_daylight_detector")); @@ -271,36 +274,33 @@ private static void redstoneRecipes() { 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); - ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", + "SRS", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); - ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", + "SRS", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'P', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), 'S', new UnificationEntry(OrePrefix.slab, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:redstone_lamp")); ModHandler.addShapedRecipe("redstone_lamp", new ItemStack(Blocks.REDSTONE_LAMP), "PPP", "PGP", "PRP", 'P', new ItemStack(Blocks.GLASS_PANE, 1, GTValues.W), 'G', new UnificationEntry(OrePrefix.block, Materials.Glowstone), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:tripwire_hook")); ModHandler.addShapedRecipe("tripwire_hook", new ItemStack(Blocks.TRIPWIRE_HOOK), "IRI", "SRS", " S ", 'I', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'R', new UnificationEntry(OrePrefix.stick, Materials.Wood), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:dropper")); ModHandler.addShapedRecipe("dropper", new ItemStack(Blocks.DROPPER), "CRC", "STS", "GAG", @@ -309,8 +309,7 @@ private static void redstoneRecipes() { 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Iron), 'T', new ItemStack(Items.STRING), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'A', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'A', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:observer")); ModHandler.addShapedRecipe("observer", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", @@ -318,32 +317,28 @@ private static void redstoneRecipes() { 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.addShapedRecipe("observer_certus", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.addShapedRecipe("observer_quartzite", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), 'C', OreDictNames.stoneCobble, 'Q', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron), - 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'S', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:repeater")); ModHandler.addShapedRecipe("repeater", new ItemStack(Items.REPEATER), "S S", "TdT", "PRP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:comparator")); ModHandler.removeRecipeByName(new ResourceLocation("appliedenergistics2:misc/vanilla_comparator")); @@ -351,22 +346,19 @@ private static void redstoneRecipes() { 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.NetherQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.addShapedRecipe("comparator_certus", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.CertusQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.addShapedRecipe("comparator_quartzite", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.plate, Materials.Quartzite), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:golden_rail")); ModHandler.addShapedRecipe("golden_rail", new ItemStack(Blocks.GOLDEN_RAIL, 6), "SPS", "IWI", "GdG", @@ -374,34 +366,31 @@ private static void redstoneRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.RedAlloy), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood), - 'G', new UnificationEntry(OrePrefix.stick, Materials.Gold) - ); + 'G', new UnificationEntry(OrePrefix.stick, Materials.Gold)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:detector_rail")); ModHandler.addShapedRecipe("detector_rail", new ItemStack(Blocks.DETECTOR_RAIL, 6), "SPS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:rail")); ModHandler.addShapedRecipe("rail", new ItemStack(Blocks.RAIL, 8), "ShS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:activator_rail")); ModHandler.addShapedRecipe("activator_rail", new ItemStack(Blocks.ACTIVATOR_RAIL, 6), "SPS", "IWI", "IdI", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new ItemStack(Blocks.REDSTONE_TORCH), 'I', new UnificationEntry(OrePrefix.stick, Materials.Iron), - 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood) - ); + 'W', new UnificationEntry(OrePrefix.stick, Materials.Wood)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:redstone_torch")); - ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new ItemStack(Blocks.TORCH)); + ModHandler.addShapedRecipe("redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", 'R', + new UnificationEntry(OrePrefix.dust, Materials.Redstone), 'T', new ItemStack(Blocks.TORCH)); } /** @@ -410,24 +399,21 @@ private static void redstoneRecipes() { private static void metalRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:cauldron")); ModHandler.addShapedRecipe("cauldron", new ItemStack(Items.CAULDRON), "X X", "XhX", "XXX", - 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:hopper")); ModHandler.addShapedRecipe("hopper", new ItemStack(Blocks.HOPPER), "XCX", "XGX", "wXh", 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'C', "chestWood", - 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron) - ); + 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:iron_bars")); ModHandler.addShapedRecipe("iron_bars", new ItemStack(Blocks.IRON_BARS, 8), " h ", "XXX", "XXX", - 'X', new UnificationEntry(OrePrefix.stick, Materials.Iron) - ); + 'X', new UnificationEntry(OrePrefix.stick, Materials.Iron)); - ModHandler.addShapedRecipe("iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', new UnificationEntry(OrePrefix.plate, Materials.Iron)); + ModHandler.addShapedRecipe("iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', + new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bucket")); - } /** @@ -439,8 +425,7 @@ private static void metalAdvancedRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'T', new ItemStack(Blocks.IRON_BARS), 'R', new UnificationEntry(OrePrefix.ring, Materials.Steel), - 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel) - ); + 'S', new UnificationEntry(OrePrefix.screw, Materials.Steel)); ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron, 4) .inputs(new ItemStack(Blocks.IRON_BARS)) @@ -452,16 +437,13 @@ private static void metalAdvancedRecipes() { ModHandler.addShapedRecipe("anvil", new ItemStack(Blocks.ANVIL), "BBB", "SBS", "PBP", 'B', new UnificationEntry(OrePrefix.block, Materials.Iron), 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:iron_trapdoor")); ModHandler.addShapedRecipe("iron_trapdoor", new ItemStack(Blocks.IRON_TRAPDOOR), "SPS", "PTP", "sPd", 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'T', new ItemStack(Blocks.TRAPDOOR) - ); - + 'T', new ItemStack(Blocks.TRAPDOOR)); } /** @@ -496,11 +478,11 @@ private static void miscRecipes() { 'G', new ItemStack(Blocks.GLASS), 'L', new UnificationEntry(OrePrefix.lens, Materials.NetherStar), 'S', new ItemStack(Items.NETHER_STAR), - 'O', new UnificationEntry(OrePrefix.plate, Materials.Obsidian) - ); + 'O', new UnificationEntry(OrePrefix.plate, Materials.Obsidian)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lit_pumpkin")); - ModHandler.addShapedRecipe("lit_pumpkin", new ItemStack(Blocks.LIT_PUMPKIN), "PT", "k ", 'P', new ItemStack(Blocks.PUMPKIN), 'T', new ItemStack(Blocks.TORCH)); + ModHandler.addShapedRecipe("lit_pumpkin", new ItemStack(Blocks.LIT_PUMPKIN), "PT", "k ", 'P', + new ItemStack(Blocks.PUMPKIN), 'T', new ItemStack(Blocks.TORCH)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:golden_apple")); @@ -509,8 +491,7 @@ private static void miscRecipes() { 'S', new ItemStack(Items.STRING), 'P', new ItemStack(Items.PAPER), 'L', new ItemStack(Items.LEATHER), - 'G', MetaItems.STICKY_RESIN.getStackForm().copy() - ); + 'G', MetaItems.STICKY_RESIN.getStackForm().copy()); ModHandler.removeRecipeByName(new ResourceLocation("brewing_stand")); ModHandler.addShapedRecipe("brewing_stand", new ItemStack(Items.BREWING_STAND), "RBR", "ABA", "SCS", @@ -533,8 +514,7 @@ private static void miscRecipes() { 'D', new UnificationEntry(OrePrefix.gem, Materials.Diamond), 'C', new ItemStack(Blocks.CARPET, 1, 14), 'P', new UnificationEntry(OrePrefix.plate, Materials.Obsidian), - 'B', new ItemStack(Blocks.BOOKSHELF) - ); + 'B', new ItemStack(Blocks.BOOKSHELF)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:jukebox")); ModHandler.addShapedRecipe("jukebox", new ItemStack(Blocks.JUKEBOX), "LBL", "NRN", "LGL", @@ -542,8 +522,7 @@ private static void miscRecipes() { 'B', new UnificationEntry(OrePrefix.bolt, Materials.Diamond), 'N', new ItemStack(Blocks.NOTEBLOCK), 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), - 'G', new UnificationEntry(OrePrefix.gear, Materials.Iron) - ); + 'G', new UnificationEntry(OrePrefix.gear, Materials.Iron)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.bolt, Materials.Diamond) @@ -559,8 +538,7 @@ private static void miscRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood), 'B', new ItemStack(Blocks.IRON_BARS), 'G', new UnificationEntry(OrePrefix.gear, Materials.Wood), - 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy) - ); + 'R', new UnificationEntry(OrePrefix.stick, Materials.RedAlloy)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Wood, 4) @@ -573,8 +551,7 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:furnace")); ModHandler.addShapedRecipe("furnace", new ItemStack(Blocks.FURNACE), "CCC", "FFF", "CCC", 'F', new ItemStack(Items.FLINT), - 'C', OreDictNames.stoneCobble - ); + 'C', OreDictNames.stoneCobble); ASSEMBLER_RECIPES.recipeBuilder() .circuitMeta(8) @@ -584,8 +561,10 @@ private static void miscRecipes() { .duration(100).EUt(VA[ULV]).buildAndRegister(); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:crafting_table")); - ModHandler.addShapedRecipe("crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", "WW", 'F', new ItemStack(Items.FLINT), 'W', new UnificationEntry(OrePrefix.log, Materials.Wood)); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).input("logWood", 1).inputs(new ItemStack(Items.FLINT)).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); + ModHandler.addShapedRecipe("crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", "WW", 'F', + new ItemStack(Items.FLINT), 'W', new UnificationEntry(OrePrefix.log, Materials.Wood)); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).input("logWood", 1) + .inputs(new ItemStack(Items.FLINT)).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.STONEBRICK)); @@ -594,7 +573,8 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:polished_andesite")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:lead")); - ModHandler.addShapedRecipe("lead", new ItemStack(Items.LEAD), "SSS", "SBS", "SSS", 'S', new ItemStack(Items.STRING), 'B', new ItemStack(Items.SLIME_BALL)); + ModHandler.addShapedRecipe("lead", new ItemStack(Items.LEAD), "SSS", "SBS", "SSS", 'S', + new ItemStack(Items.STRING), 'B', new ItemStack(Items.SLIME_BALL)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:bow")); ModHandler.addShapedRecipe("bow", new ItemStack(Items.BOW), "hLS", "LRS", "fLS", @@ -620,10 +600,14 @@ private static void miscRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:furnace_minecart")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:tnt_minecart")); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:hopper_minecart")); - ModHandler.addShapedRecipe("chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", " M ", " d ", 'I', "chestWood", 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); - ModHandler.addShapedRecipe("hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", " M ", " d ", 'I', + "chestWood", 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); + ModHandler.addShapedRecipe("hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', + new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:flower_pot")); ModHandler.addShapedRecipe("flower_pot", new ItemStack(Items.FLOWER_POT), "BfB", " B ", @@ -682,9 +666,12 @@ private static void addBedRecipe(int meta) { */ private static void dyeRecipes() { for (MarkerMaterial colorMaterial : MarkerMaterials.Color.VALUES) { - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial))); - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_hardened_clay", colorMaterial))); - ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_stained_hardened_clay", colorMaterial))); + ModHandler.removeRecipeByName( + new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial))); ModHandler.removeRecipeByName(new ResourceLocation(String.format("minecraft:%s_wool", colorMaterial))); } ModHandler.removeRecipeByName("minecraft:dark_prismarine"); @@ -756,23 +743,32 @@ private static void removeCompressionRecipes() { // Slab replacement ModHandler.removeRecipeByName("minecraft:stone_slab"); - ModHandler.addShapedRecipe("stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', new ItemStack(Blocks.STONE)); + ModHandler.addShapedRecipe("stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', + new ItemStack(Blocks.STONE)); ModHandler.removeRecipeByName("minecraft:sandstone_slab"); - ModHandler.addShapedRecipe("sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 1), "sS", 'S', new ItemStack(Blocks.SANDSTONE, 1, W)); + ModHandler.addShapedRecipe("sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 1), "sS", 'S', + new ItemStack(Blocks.SANDSTONE, 1, W)); ModHandler.removeRecipeByName("minecraft:cobblestone_slab"); - ModHandler.addShapedRecipe("cobblestone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 3), "sS", 'S', new ItemStack(Blocks.COBBLESTONE)); + ModHandler.addShapedRecipe("cobblestone_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 3), "sS", 'S', + new ItemStack(Blocks.COBBLESTONE)); ModHandler.removeRecipeByName("minecraft:brick_slab"); - ModHandler.addShapedRecipe("brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 4), "sS", 'S', new ItemStack(Blocks.BRICK_BLOCK)); + ModHandler.addShapedRecipe("brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 4), "sS", 'S', + new ItemStack(Blocks.BRICK_BLOCK)); ModHandler.removeRecipeByName("minecraft:stone_brick_slab"); - ModHandler.addShapedRecipe("stone_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 5), "sS", 'S', OreDictNames.stoneBricks); + ModHandler.addShapedRecipe("stone_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 5), "sS", 'S', + OreDictNames.stoneBricks); ModHandler.removeRecipeByName("minecraft:nether_brick_slab"); - ModHandler.addShapedRecipe("nether_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 6), "sS", 'S', new ItemStack(Blocks.NETHER_BRICK)); + ModHandler.addShapedRecipe("nether_brick_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 6), "sS", 'S', + new ItemStack(Blocks.NETHER_BRICK)); ModHandler.removeRecipeByName("minecraft:quartz_slab"); - ModHandler.addShapedRecipe("quartz_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 7), "sS", 'S', new ItemStack(Blocks.QUARTZ_BLOCK, 1, W)); + ModHandler.addShapedRecipe("quartz_slab_saw", new ItemStack(Blocks.STONE_SLAB, 1, 7), "sS", 'S', + new ItemStack(Blocks.QUARTZ_BLOCK, 1, W)); ModHandler.removeRecipeByName("minecraft:red_sandstone_slab"); - ModHandler.addShapedRecipe("red_sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB2), "sS", 'S', new ItemStack(Blocks.RED_SANDSTONE, 1, W)); + ModHandler.addShapedRecipe("red_sandstone_slab_saw", new ItemStack(Blocks.STONE_SLAB2), "sS", 'S', + new ItemStack(Blocks.RED_SANDSTONE, 1, W)); ModHandler.removeRecipeByName("minecraft:purpur_slab"); - ModHandler.addShapedRecipe("purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', new ItemStack(Blocks.PURPUR_BLOCK)); + ModHandler.addShapedRecipe("purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', + new ItemStack(Blocks.PURPUR_BLOCK)); } } @@ -785,8 +781,7 @@ private static void toolArmorRecipes() { ModHandler.addShapedRecipe("flint_and_steel", new ItemStack(Items.FLINT_AND_STEEL), "G", "F", "S", 'G', new UnificationEntry(OrePrefix.gearSmall, Materials.Steel), 'F', new ItemStack(Items.FLINT, 1), - 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Steel) - ); + 'S', new UnificationEntry(OrePrefix.springSmall, Materials.Steel)); } if (!ConfigHolder.recipes.hardToolArmorRecipes) @@ -829,8 +824,7 @@ private static void toolArmorRecipes() { 'B', new UnificationEntry(OrePrefix.bolt, Materials.IronMagnetic), 'R', new UnificationEntry(OrePrefix.ring, Materials.Zinc), 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), - 'A', new UnificationEntry(OrePrefix.bolt, Materials.RedAlloy) - ); + 'A', new UnificationEntry(OrePrefix.bolt, Materials.RedAlloy)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron) @@ -845,8 +839,7 @@ private static void toolArmorRecipes() { ModHandler.addShapedRecipe("fishing_rod", new ItemStack(Items.FISHING_ROD), " S", " SL", "SxR", 'S', new UnificationEntry(OrePrefix.stickLong, Materials.Wood), 'L', new ItemStack(Items.STRING), - 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:clock")); ModHandler.addShapedRecipe("clock", new ItemStack(Items.CLOCK), "RPR", "BCB", "dSw", @@ -854,8 +847,7 @@ private static void toolArmorRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Gold), 'B', new UnificationEntry(OrePrefix.bolt, Materials.Gold), 'C', new ItemStack(Items.COMPARATOR), - 'S', new UnificationEntry(OrePrefix.screw, Materials.Gold) - ); + 'S', new UnificationEntry(OrePrefix.screw, Materials.Gold)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Gold) @@ -871,16 +863,14 @@ private static void toolArmorRecipes() { 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron), 'S', new UnificationEntry(OrePrefix.screw, Materials.Iron), 'R', new UnificationEntry(OrePrefix.ring, Materials.Iron), - 'T', new ItemStack(Items.STICK) - ); + 'T', new ItemStack(Items.STICK)); ModHandler.removeRecipeByName(new ResourceLocation("minecraft:shield")); ModHandler.addShapedRecipe("shield", new ItemStack(Items.SHIELD), "BRB", "LPL", "BRB", 'B', new UnificationEntry(OrePrefix.bolt, Materials.Iron), 'R', new UnificationEntry(OrePrefix.stick, Materials.Iron), 'L', new UnificationEntry(OrePrefix.stickLong, Materials.Iron), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Wood)); // Remove a bunch of processing recipes for tools and armor, since we have significantly better options ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HELMET, 1, W)); @@ -910,71 +900,65 @@ private static void createShovelRecipe(String regName, ItemStack output, Materia ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "hPf", " S ", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); } private static void createPickaxeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PII", "hSf", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createAxeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PIf", "PS ", "hS ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createSwordRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, " P ", "hPf", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'S', new ItemStack(Items.STICK) - ); + 'S', new ItemStack(Items.STICK)); } private static void createHoeRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PIf", "hS ", " S ", 'P', new UnificationEntry(OrePrefix.plate, material), - 'I', new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), - 'S', new ItemStack(Items.STICK) - ); + 'I', + new UnificationEntry(material.equals(Materials.Diamond) ? OrePrefix.gem : OrePrefix.ingot, material), + 'S', new ItemStack(Items.STICK)); } private static void createHelmetRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PPP", "PhP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createChestplateRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PhP", "PPP", "PPP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createLeggingsRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "PPP", "PhP", "P P", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void createBootsRecipe(String regName, ItemStack output, Material material) { ModHandler.removeRecipeByName(new ResourceLocation(regName)); ModHandler.addShapedRecipe(regName, output, "P P", "PhP", - 'P', new UnificationEntry(OrePrefix.plate, material) - ); + 'P', new UnificationEntry(OrePrefix.plate, material)); } private static void alwaysRemovedRecipes() { diff --git a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java index bf8e90f11d5..ecfb4e8e739 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaStandardRecipes.java @@ -11,6 +11,7 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -53,7 +54,7 @@ private static void compressingRecipes() { .outputs(new ItemStack(Blocks.STONE)) .buildAndRegister(); - //todo autogenerate 2x2 recipes? + // todo autogenerate 2x2 recipes? COMPRESSOR_RECIPES.recipeBuilder().duration(300).EUt(2) .inputs(new ItemStack(Blocks.SAND, 4)) .outputs(new ItemStack(Blocks.SANDSTONE)) @@ -89,8 +90,10 @@ private static void compressingRecipes() { .outputs(new ItemStack(Blocks.GLOWSTONE)) .buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.ICE, 2, GTValues.W)).outputs(new ItemStack(Blocks.PACKED_ICE)).buildAndRegister(); - COMPRESSOR_RECIPES.recipeBuilder().input(OrePrefix.dust, Materials.Ice, 1).outputs(new ItemStack(Blocks.ICE)).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.ICE, 2, GTValues.W)) + .outputs(new ItemStack(Blocks.PACKED_ICE)).buildAndRegister(); + COMPRESSOR_RECIPES.recipeBuilder().input(OrePrefix.dust, Materials.Ice, 1).outputs(new ItemStack(Blocks.ICE)) + .buildAndRegister(); PACKER_RECIPES.recipeBuilder() .inputs(new ItemStack(Items.WHEAT, 9)) @@ -113,11 +116,14 @@ private static void compressingRecipes() { * - Removes some glass related recipes based on configs */ private static void glassRecipes() { - ModHandler.addShapedRecipe("glass_dust_hammer", OreDictUnifier.get(dust, Materials.Glass), "hG", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W)); + ModHandler.addShapedRecipe("glass_dust_hammer", OreDictUnifier.get(dust, Materials.Glass), "hG", 'G', + new ItemStack(Blocks.GLASS, 1, GTValues.W)); - ModHandler.addShapelessRecipe("glass_dust_handcrafting", OreDictUnifier.get(dust, Glass), "dustSand", "dustFlint"); + ModHandler.addShapelessRecipe("glass_dust_handcrafting", OreDictUnifier.get(dust, Glass), "dustSand", + "dustFlint"); - ModHandler.addShapedRecipe("quartz_sand", OreDictUnifier.get(OrePrefix.dust, Materials.QuartzSand), "S", "m", 'S', new ItemStack(Blocks.SAND)); + ModHandler.addShapedRecipe("quartz_sand", OreDictUnifier.get(OrePrefix.dust, Materials.QuartzSand), "S", "m", + 'S', new ItemStack(Blocks.SAND)); RecipeMaps.MACERATOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.SAND)) @@ -187,7 +193,8 @@ private static void glassRecipes() { ModHandler.removeRecipeByOutput(new ItemStack(Blocks.STAINED_GLASS_PANE, 16, i)); } - ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); + ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", + 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) .inputs(new ItemStack(Blocks.STAINED_GLASS, 3, i)) @@ -198,7 +205,8 @@ private static void glassRecipes() { if (ConfigHolder.recipes.hardGlassRecipes) ModHandler.removeRecipeByOutput(new ItemStack(Blocks.GLASS_PANE, 16)); - ModHandler.addShapedRecipe("glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', new ItemStack(Blocks.GLASS)); + ModHandler.addShapedRecipe("glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', + new ItemStack(Blocks.GLASS)); CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) .inputs(new ItemStack(Blocks.GLASS, 3)) @@ -210,7 +218,8 @@ private static void glassRecipes() { * Adds smashing related recipes for vanilla blocks and items */ private static void smashingRecipes() { - ModHandler.addShapedRecipe("cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", 'C', new UnificationEntry(OrePrefix.stone)); + ModHandler.addShapedRecipe("cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", 'C', + new UnificationEntry(OrePrefix.stone)); FORGE_HAMMER_RECIPES.recipeBuilder() .input(stone.name(), 1) @@ -253,16 +262,23 @@ private static void smashingRecipes() { .EUt(2).duration(400).buildAndRegister(); if (!ConfigHolder.recipes.disableManualCompression) { - ModHandler.addShapelessRecipe("nether_quartz_block_to_nether_quartz", new ItemStack(Items.QUARTZ, 4), Blocks.QUARTZ_BLOCK); + ModHandler.addShapelessRecipe("nether_quartz_block_to_nether_quartz", new ItemStack(Items.QUARTZ, 4), + Blocks.QUARTZ_BLOCK); } - ModHandler.addShapelessRecipe("clay_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Clay), 'm', Blocks.CLAY); - ModHandler.addShapelessRecipe("clay_ball_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Clay), 'm', Items.CLAY_BALL); - ModHandler.addShapelessRecipe("brick_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Brick), 'm', Blocks.BRICK_BLOCK); - ModHandler.addShapelessRecipe("brick_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Brick), 'm', Items.BRICK); - ModHandler.addShapelessRecipe("wheat_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Wheat), 'm', Items.WHEAT); + ModHandler.addShapelessRecipe("clay_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Clay), 'm', + Blocks.CLAY); + ModHandler.addShapelessRecipe("clay_ball_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Clay), 'm', + Items.CLAY_BALL); + ModHandler.addShapelessRecipe("brick_block_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Brick), 'm', + Blocks.BRICK_BLOCK); + ModHandler.addShapelessRecipe("brick_to_dust", OreDictUnifier.get(OrePrefix.dustSmall, Materials.Brick), 'm', + Items.BRICK); + ModHandler.addShapelessRecipe("wheat_to_dust", OreDictUnifier.get(OrePrefix.dust, Materials.Wheat), 'm', + Items.WHEAT); ModHandler.addShapelessRecipe("gravel_to_flint", new ItemStack(Items.FLINT), 'm', Blocks.GRAVEL); ModHandler.addShapelessRecipe("bone_to_bone_meal", new ItemStack(Items.DYE, 4, 15), 'm', Items.BONE); - ModHandler.addShapelessRecipe("blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), 'm', Items.BLAZE_ROD); + ModHandler.addShapelessRecipe("blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), 'm', + Items.BLAZE_ROD); RecipeMaps.MACERATOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage())) @@ -426,25 +442,50 @@ private static void woodRecipes() { .outputs(new ItemStack(Blocks.TORCH, 8)) .duration(100).EUt(1).buildAndRegister(); - ModHandler.addShapedRecipe("sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", 'X', MetaItems.STICKY_RESIN, 'Y', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Sulfur), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Phosphorus), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Coal), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Charcoal), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(OrePrefix.gem, Materials.Coke), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(OrePrefix.dust, Materials.Coke), 'S', new UnificationEntry(OrePrefix.stick, Materials.Wood)); - ModHandler.addShapedRecipe("torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", 'W', OreDictUnifier.get("wool"), 'S', new UnificationEntry(stick, Wood), 'B', FluidUtil.getFilledBucket(Creosote.getFluid(1000))); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(dust, Redstone).input(stick, Wood).outputs(new ItemStack(Blocks.REDSTONE_TORCH, 1)).duration(100).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Sulfur).outputs(new ItemStack(Blocks.TORCH, 2)).duration(100).circuitMeta(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Phosphorus).outputs(new ItemStack(Blocks.TORCH, 6)).duration(100).circuitMeta(1).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(40).circuitMeta(7).inputs(new ItemStack(Items.STICK, 7)).outputs(new ItemStack(Blocks.LADDER, ConfigHolder.recipes.hardWoodRecipes ? 2 : 3)).buildAndRegister(); - - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(OreDictUnifier.get("chestWood")).outputs(new ItemStack(Items.CHEST_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.FURNACE)).outputs(new ItemStack(Items.FURNACE_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.TNT)).outputs(new ItemStack(Items.TNT_MINECART)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)).inputs(new ItemStack(Blocks.HOPPER)).outputs(new ItemStack(Items.HOPPER_MINECART)).buildAndRegister(); + ModHandler.addShapedRecipe("sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", 'X', + MetaItems.STICKY_RESIN, 'Y', new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Sulfur), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Phosphorus), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Coal), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Charcoal), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(OrePrefix.gem, Materials.Coke), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(OrePrefix.dust, Materials.Coke), 'S', + new UnificationEntry(OrePrefix.stick, Materials.Wood)); + ModHandler.addShapedRecipe("torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", 'W', + OreDictUnifier.get("wool"), 'S', new UnificationEntry(stick, Wood), 'B', + FluidUtil.getFilledBucket(Creosote.getFluid(1000))); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(dust, Redstone).input(stick, Wood) + .outputs(new ItemStack(Blocks.REDSTONE_TORCH, 1)).duration(100).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Sulfur) + .outputs(new ItemStack(Blocks.TORCH, 2)).duration(100).circuitMeta(1).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).input(stick, Wood).input(dust, Phosphorus) + .outputs(new ItemStack(Blocks.TORCH, 6)).duration(100).circuitMeta(1).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(40).circuitMeta(7).inputs(new ItemStack(Items.STICK, 7)) + .outputs(new ItemStack(Blocks.LADDER, ConfigHolder.recipes.hardWoodRecipes ? 2 : 3)).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(OreDictUnifier.get("chestWood")).outputs(new ItemStack(Items.CHEST_MINECART)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.FURNACE)).outputs(new ItemStack(Items.FURNACE_MINECART)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.TNT)).outputs(new ItemStack(Items.TNT_MINECART)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Items.MINECART)) + .inputs(new ItemStack(Blocks.HOPPER)).outputs(new ItemStack(Items.HOPPER_MINECART)).buildAndRegister(); } /** @@ -709,11 +750,21 @@ private static void redstoneRecipes() { 'R', STICKY_RESIN.getStackForm(), 'P', new ItemStack(Blocks.PISTON)); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Iron).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Bronze).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Steel).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 2)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Aluminium).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Titanium).inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)).input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 8)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Iron) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Bronze) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Steel) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 2)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Aluminium) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(16).input(plate, Titanium) + .inputs(new ItemStack(Blocks.PLANKS, 3, GTValues.W)).inputs(new ItemStack(Blocks.COBBLESTONE, 4)) + .input(dust, Redstone).outputs(new ItemStack(Blocks.PISTON, 8)).buildAndRegister(); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Gold, 2) @@ -728,26 +779,24 @@ private static void redstoneRecipes() { ModHandler.addShapedRecipe("comparator_certus", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.gem, Materials.CertusQuartz), - 'S', new UnificationEntry(OrePrefix.stone) - ); + 'S', new UnificationEntry(OrePrefix.stone)); ModHandler.addShapedRecipe("comparator_quartzite", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(OrePrefix.gem, Materials.Quartzite), - 'S', new UnificationEntry(OrePrefix.stone) - ); + 'S', new UnificationEntry(OrePrefix.stone)); - ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + ModHandler.addShapedRecipe("daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", + "PPP", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'C', new UnificationEntry(gem, CertusQuartz), - 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood)); - ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + ModHandler.addShapedRecipe("daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", + "PPP", 'G', new ItemStack(Blocks.GLASS, 1, GTValues.W), 'C', new UnificationEntry(gem, Quartzite), - 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood) - ); + 'P', new UnificationEntry(OrePrefix.slab, Materials.Wood)); ASSEMBLER_RECIPES.recipeBuilder() .input(plank, Wood, 8) @@ -794,40 +843,34 @@ private static void metalRecipes() { 'P', new UnificationEntry(plate, Materials.Iron), 'C', new ItemStack(Items.IRON_CHESTPLATE), 'L', new ItemStack(Items.IRON_LEGGINGS), - 'S', new UnificationEntry(screw, Materials.Iron) - ); + 'S', new UnificationEntry(screw, Materials.Iron)); ModHandler.addShapedRecipe("golden_horse_armor", new ItemStack(Items.GOLDEN_HORSE_ARMOR), "hdH", "PCP", "LSL", 'H', new ItemStack(Items.GOLDEN_HELMET), 'P', new UnificationEntry(plate, Materials.Gold), 'C', new ItemStack(Items.GOLDEN_CHESTPLATE), 'L', new ItemStack(Items.GOLDEN_LEGGINGS), - 'S', new UnificationEntry(screw, Materials.Gold) - ); + 'S', new UnificationEntry(screw, Materials.Gold)); ModHandler.addShapedRecipe("diamond_horse_armor", new ItemStack(Items.DIAMOND_HORSE_ARMOR), "hdH", "PCP", "LSL", 'H', new ItemStack(Items.DIAMOND_HELMET), 'P', new UnificationEntry(plate, Materials.Diamond), 'C', new ItemStack(Items.DIAMOND_CHESTPLATE), 'L', new ItemStack(Items.DIAMOND_LEGGINGS), - 'S', new UnificationEntry(bolt, Materials.Diamond) - ); + 'S', new UnificationEntry(bolt, Materials.Diamond)); ModHandler.addShapedRecipe("chainmail_helmet", new ItemStack(Items.CHAINMAIL_HELMET), "PPP", "PhP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); - ModHandler.addShapedRecipe("chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), "PhP", "PPP", "PPP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + ModHandler.addShapedRecipe("chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), "PhP", "PPP", + "PPP", + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.addShapedRecipe("chainmail_leggings", new ItemStack(Items.CHAINMAIL_LEGGINGS), "PPP", "PhP", "P P", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); ModHandler.addShapedRecipe("chainmail_boots", new ItemStack(Items.CHAINMAIL_BOOTS), "P P", "PhP", - 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.ring, Materials.Iron)); RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.plate, Materials.Iron, 7) @@ -858,12 +901,10 @@ private static void metalRecipes() { ModHandler.removeRecipeByName(new ResourceLocation("minecraft:minecart")); ModHandler.addShapedRecipe("minecart_iron", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", 'W', MetaItems.IRON_MINECART_WHEELS.getStackForm(), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Iron)); ModHandler.addShapedRecipe("minecart_steel", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", 'W', MetaItems.STEEL_MINECART_WHEELS.getStackForm(), - 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel) - ); + 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel)); } /** @@ -926,14 +967,21 @@ private static void miscRecipes() { .outputs(new ItemStack(Items.BOW, 1)) .duration(100).EUt(4).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).fluidInputs(Water.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).fluidInputs(DistilledWater.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(Water.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(DistilledWater.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK).fluidInputs(Lava.getFluid(1000)).outputs(new ItemStack(Blocks.OBSIDIAN)).buildAndRegister(); - - FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1680).EUt(16).notConsumable(SHAPE_MOLD_ANVIL).fluidInputs(Iron.getFluid(L * 31)).outputs(new ItemStack(Blocks.ANVIL)).buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().input(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL).outputs(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL) + .fluidInputs(Water.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL) + .fluidInputs(DistilledWater.getFluid(250)).outputs(new ItemStack(Items.SNOWBALL)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(Water.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(DistilledWater.getFluid(1000)).outputs(new ItemStack(Blocks.SNOW)).buildAndRegister(); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK) + .fluidInputs(Lava.getFluid(1000)).outputs(new ItemStack(Blocks.OBSIDIAN)).buildAndRegister(); + + FLUID_SOLIDFICATION_RECIPES.recipeBuilder().duration(1680).EUt(16).notConsumable(SHAPE_MOLD_ANVIL) + .fluidInputs(Iron.getFluid(L * 31)).outputs(new ItemStack(Blocks.ANVIL)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().input(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL) + .outputs(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).buildAndRegister(); ModHandler.addSmeltingRecipe(new ItemStack(Items.SLIME_BALL), STICKY_RESIN.getStackForm(), 0.3f); @@ -955,62 +1003,115 @@ private static void miscRecipes() { .outputs(new ItemStack(Blocks.STONEBRICK, 1, 1)) .duration(40).EUt(1).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).input(stoneCobble.name(), 6).outputs(new ItemStack(Blocks.STONE_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.BRICK_BLOCK, 6)).outputs(new ItemStack(Blocks.BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.STONEBRICK, 6, GTValues.W)).outputs(new ItemStack(Blocks.STONE_BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.NETHER_BRICK, 6)).outputs(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.SANDSTONE, 6)).outputs(new ItemStack(Blocks.SANDSTONE_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 6)).outputs(new ItemStack(Blocks.QUARTZ_STAIRS, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.PURPUR_BLOCK, 6)).outputs(new ItemStack(Blocks.PURPUR_STAIRS, 4)).buildAndRegister(); - - - ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(2).inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0)).outputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 2)).buildAndRegister(); - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.STONE)).outputs(new ItemStack(Blocks.STONEBRICK, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.END_STONE)).outputs(new ItemStack(Blocks.END_BRICKS, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); - - - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE)).outputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE)).outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).outputs(new ItemStack(Blocks.SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); - RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); - + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).input(stoneCobble.name(), 6) + .outputs(new ItemStack(Blocks.STONE_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.BRICK_BLOCK, 6)).outputs(new ItemStack(Blocks.BRICK_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.STONEBRICK, 6, GTValues.W)) + .outputs(new ItemStack(Blocks.STONE_BRICK_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.NETHER_BRICK, 6)).outputs(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7).inputs(new ItemStack(Blocks.SANDSTONE, 6)) + .outputs(new ItemStack(Blocks.SANDSTONE_STAIRS, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 6)).outputs(new ItemStack(Blocks.QUARTZ_STAIRS, 4)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(7) + .inputs(new ItemStack(Blocks.PURPUR_BLOCK, 6)).outputs(new ItemStack(Blocks.PURPUR_STAIRS, 4)) + .buildAndRegister(); - CANNER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Blocks.PUMPKIN)).inputs(new ItemStack(Blocks.TORCH)).outputs(new ItemStack(Blocks.LIT_PUMPKIN)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().EUt(1).duration(100).circuitMeta(2) + .inputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0)).outputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 2)) + .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)).inputs(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputs(new ItemStack(Blocks.SEA_LANTERN)).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.STONE)) + .outputs(new ItemStack(Blocks.STONEBRICK, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.END_STONE)) + .outputs(new ItemStack(Blocks.END_BRICKS, 1, 0)).circuitMeta(4).duration(50).buildAndRegister(); + + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE)) + .outputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE)) + .outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.SANDSTONE, 1, 2)) + .outputs(new ItemStack(Blocks.SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().EUt(4).inputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 2)) + .outputs(new ItemStack(Blocks.RED_SANDSTONE, 1, 0)).circuitMeta(1).duration(50).buildAndRegister(); + + CANNER_RECIPES.recipeBuilder().EUt(4).duration(100).inputs(new ItemStack(Blocks.PUMPKIN)) + .inputs(new ItemStack(Blocks.TORCH)).outputs(new ItemStack(Blocks.LIT_PUMPKIN)).buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)) + .inputs(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputs(new ItemStack(Blocks.SEA_LANTERN)) + .buildAndRegister(); - ALLOY_SMELTER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.NETHERBRICK, 2)).inputs(new ItemStack(Items.NETHER_WART, 2)).outputs(new ItemStack(Blocks.RED_NETHER_BRICK)).buildAndRegister(); + ALLOY_SMELTER_RECIPES.recipeBuilder().EUt(4).duration(40).inputs(new ItemStack(Items.NETHERBRICK, 2)) + .inputs(new ItemStack(Items.NETHER_WART, 2)).outputs(new ItemStack(Blocks.RED_NETHER_BRICK)) + .buildAndRegister(); if (!ConfigHolder.recipes.hardMiscRecipes) { - ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).circuitMeta(4).input("plankWood", 4).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().circuitMeta(8).input(stoneCobble.name(), 8).outputs(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.OBSIDIAN, 4)).input(gem, Diamond, 2).inputs(new ItemStack(Items.BOOK)).outputs(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100).EUt(VA[ULV]).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(1).inputs(new ItemStack(Blocks.COBBLESTONE, 7)).inputs(new ItemStack(Items.BOW)).input(dust, Redstone).outputs(new ItemStack(Blocks.DISPENSER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(2).inputs(new ItemStack(Blocks.COBBLESTONE, 7)).input(dust, Redstone).outputs(new ItemStack(Blocks.DROPPER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, NetherQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, CertusQuartz).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)).input(dust, Redstone, 2).input(plate, Quartzite).outputs(new ItemStack(Blocks.OBSERVER)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)).inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(80).EUt(6).circuitMeta(4).input("plankWood", 4) + .outputs(new ItemStack(Blocks.CRAFTING_TABLE)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().circuitMeta(8).input(stoneCobble.name(), 8) + .outputs(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.OBSIDIAN, 4)).input(gem, Diamond, 2) + .inputs(new ItemStack(Items.BOOK)).outputs(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100) + .EUt(VA[ULV]).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(1) + .inputs(new ItemStack(Blocks.COBBLESTONE, 7)).inputs(new ItemStack(Items.BOW)).input(dust, Redstone) + .outputs(new ItemStack(Blocks.DISPENSER)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).circuitMeta(2) + .inputs(new ItemStack(Blocks.COBBLESTONE, 7)).input(dust, Redstone) + .outputs(new ItemStack(Blocks.DROPPER)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, NetherQuartz).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, CertusQuartz).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[LV]).inputs(new ItemStack(Blocks.COBBLESTONE, 6)) + .input(dust, Redstone, 2).input(plate, Quartzite).outputs(new ItemStack(Blocks.OBSERVER)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Blocks.OBSIDIAN, 8)) + .inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Blocks.ENDER_CHEST)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(VA[ULV]).inputs(new ItemStack(Blocks.STONE_SLAB, 1, 0)) + .inputs(new ItemStack(Items.STICK, 6)).outputs(new ItemStack(Items.ARMOR_STAND)).buildAndRegister(); } - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(3).inputs(new ItemStack(Blocks.NETHER_BRICK)).outputs(new ItemStack(Blocks.NETHER_BRICK_FENCE)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(3).inputs(new ItemStack(Blocks.NETHER_BRICK)) + .outputs(new ItemStack(Blocks.NETHER_BRICK_FENCE)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 0)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6).inputs(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 1)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6) + .inputs(new ItemStack(Blocks.COBBLESTONE, 1, 0)).outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 0)) + .buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).circuitMeta(6) + .inputs(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, 0)) + .outputs(new ItemStack(Blocks.COBBLESTONE_WALL, 1, 1)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.CHORUS_FRUIT_POPPED)).inputs(new ItemStack(Items.BLAZE_ROD)).outputs(new ItemStack(Blocks.END_ROD, 4)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.CHORUS_FRUIT_POPPED)) + .inputs(new ItemStack(Items.BLAZE_ROD)).outputs(new ItemStack(Blocks.END_ROD, 4)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input("chestWood", 1).inputs(new ItemStack(Items.SHULKER_SHELL, 2)).outputs(new ItemStack(Blocks.PURPLE_SHULKER_BOX)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(VA[ULV]).input("chestWood", 1) + .inputs(new ItemStack(Items.SHULKER_SHELL, 2)).outputs(new ItemStack(Blocks.PURPLE_SHULKER_BOX)) + .buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(1).input("wool", 1).inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.PAINTING)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.LEATHER)).inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.ITEM_FRAME)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).input("plankWood", 6).inputs(new ItemStack(Items.STICK)).circuitMeta(9).outputs(new ItemStack(Items.SIGN, 3)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).circuitMeta(1).input("wool", 1) + .inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.PAINTING)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).inputs(new ItemStack(Items.LEATHER)) + .inputs(new ItemStack(Items.STICK, 8)).outputs(new ItemStack(Items.ITEM_FRAME)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(100).EUt(4).input("plankWood", 6).inputs(new ItemStack(Items.STICK)) + .circuitMeta(9).outputs(new ItemStack(Items.SIGN, 3)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(10).EUt(2).inputs(new ItemStack(Items.BRICK, 3)).outputs(new ItemStack(Items.FLOWER_POT)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(10).EUt(2).inputs(new ItemStack(Items.BRICK, 3)) + .outputs(new ItemStack(Items.FLOWER_POT)).buildAndRegister(); - ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(16).inputs(new ItemStack(Items.GHAST_TEAR)).inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Items.END_CRYSTAL)).fluidInputs(Glass.getFluid(GTValues.L * 7)).buildAndRegister(); + ASSEMBLER_RECIPES.recipeBuilder().duration(30).EUt(16).inputs(new ItemStack(Items.GHAST_TEAR)) + .inputs(new ItemStack(Items.ENDER_EYE)).outputs(new ItemStack(Items.END_CRYSTAL)) + .fluidInputs(Glass.getFluid(GTValues.L * 7)).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() .input(OrePrefix.stick, Materials.Iron, 12) @@ -1059,10 +1160,9 @@ private static void miscRecipes() { 'L', new ItemStack(Items.LEATHER), 'C', new ItemStack(Blocks.CARPET, 1, GTValues.W), 'R', new UnificationEntry(ring, Iron), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); - for (FluidStack fluidStack : new FluidStack[]{Water.getFluid(200), DistilledWater.getFluid(36)}) { + for (FluidStack fluidStack : new FluidStack[] { Water.getFluid(200), DistilledWater.getFluid(36) }) { AUTOCLAVE_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.STONE, 1, 1)) .fluidInputs(fluidStack) @@ -1213,7 +1313,6 @@ private static void mixingRecipes() { } private static void dyeRecipes() { - RecipeMaps.EXTRACTOR_RECIPES.recipeBuilder() .inputs(new ItemStack(Blocks.RED_FLOWER, 1, 0)) .outputs(new ItemStack(Items.DYE, 2, 1)) diff --git a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java index 97f8746464a..9eb764c8870 100644 --- a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java @@ -14,6 +14,7 @@ import gregtech.common.blocks.wood.BlockGregPlanks; import gregtech.common.items.MetaItems; import gregtech.loaders.WoodTypeEntry; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -22,10 +23,11 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fml.common.registry.GameRegistry; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.Materials.*; @@ -129,8 +131,7 @@ private static List getDefaultEntries() { .material(TreatedWood) .registerAllOres() .registerAllUnificationInfo() - .build() - ); + .build()); } return DEFAULT_ENTRIES; } @@ -179,7 +180,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { } if (entry.addDoorsUnificationInfo) { OreDictUnifier.registerOre(entry.door, ConfigHolder.recipes.hardWoodRecipes ? - new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), new MaterialStack(Materials.Iron, M / 9)) : // screw + new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), + new MaterialStack(Materials.Iron, M / 9)) : // screw new ItemMaterialInfo(new MaterialStack(entry.material, M * 2))); } } @@ -207,7 +209,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { OreDictUnifier.registerOre(entry.fenceGate, fenceGate, entry.material); } if (entry.addFenceGatesUnificationInfo) { - OreDictUnifier.registerOre(entry.fenceGate, new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); + OreDictUnifier.registerOre(entry.fenceGate, + new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); } } @@ -216,7 +219,8 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { OreDictUnifier.registerOre(entry.stairs, stair, entry.material); } if (entry.addStairsUnificationInfo) { - OreDictUnifier.registerOre(entry.stairs, new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); + OreDictUnifier.registerOre(entry.stairs, + new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); } } @@ -295,8 +299,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { 'P', entry.planks.copy(), 'T', new ItemStack(Blocks.TRAPDOOR), 'R', new UnificationEntry(ring, Iron), - 'S', new UnificationEntry(screw, Iron) - ); + 'S', new UnificationEntry(screw, Iron)); // plank -> door assembling ASSEMBLER_RECIPES.recipeBuilder() @@ -309,8 +312,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { if (!hasDoorRecipe) { ModHandler.addShapedRecipe(name + "_door", GTUtility.copy(3, entry.door), "PP", "PP", "PP", - 'P', entry.planks.copy() - ); + 'P', entry.planks.copy()); } ASSEMBLER_RECIPES.recipeBuilder() @@ -373,15 +375,13 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.addShapedRecipe(hasFenceRecipe ? entry.fenceRecipeName : name + "_fence", entry.fence.copy(), "PSP", "PSP", "PSP", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } else { if (!hasFenceRecipe) { ModHandler.addShapedRecipe(name + "_fence", GTUtility.copy(3, entry.fence), "PSP", "PSP", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } } @@ -403,12 +403,12 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.removeRecipeByName(new ResourceLocation(entry.modid, entry.fenceGateRecipeName)); } - ModHandler.addShapedRecipe(hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", entry.fenceGate.copy(), + ModHandler.addShapedRecipe(hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", + entry.fenceGate.copy(), "F F", "SPS", "SPS", 'P', entry.planks.copy(), 'S', entry.getStick(), - 'F', new ItemStack(Items.FLINT) - ); + 'F', new ItemStack(Items.FLINT)); ModHandler.addShapedRecipe(name + "_fence_gate_screws", GTUtility.copy(2, entry.fenceGate), "IdI", "SPS", "SPS", @@ -420,8 +420,7 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { ModHandler.addShapedRecipe(name + "_fence_gate", entry.fenceGate.copy(), "SPS", "SPS", 'P', entry.planks.copy(), - 'S', entry.getStick() - ); + 'S', entry.getStick()); } } @@ -471,12 +470,14 @@ public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { * Standard recipes for GT woods */ private static void registerGTWoodRecipes() { - ModHandler.addShapedRecipe("treated_wood_planks", MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK, 8), + ModHandler.addShapedRecipe("treated_wood_planks", + MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK, 8), "PPP", "PBP", "PPP", 'P', "plankWood", 'B', FluidUtil.getFilledBucket(Creosote.getFluid(1000))); - ModHandler.addShapedRecipe("treated_wood_stick", OreDictUnifier.get(OrePrefix.stick, TreatedWood, ConfigHolder.recipes.nerfWoodCrafting ? 2 : 4), + ModHandler.addShapedRecipe("treated_wood_stick", + OreDictUnifier.get(OrePrefix.stick, TreatedWood, ConfigHolder.recipes.nerfWoodCrafting ? 2 : 4), "L", "L", 'L', MetaBlocks.PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK)); if (ConfigHolder.recipes.nerfWoodCrafting) { diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java index 8d0d3e2ef75..7513125c202 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/AcidRecipes.java @@ -16,7 +16,6 @@ public static void init() { } private static void sulfuricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(2) .input(dust, Sulfur) @@ -62,7 +61,6 @@ private static void sulfuricAcidRecipes() { } private static void nitricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Hydrogen.getFluid(3000)) @@ -127,7 +125,6 @@ private static void nitricAcidRecipes() { } private static void phosphoricAcidRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .input(dust, Phosphorus, 4) @@ -159,7 +156,5 @@ private static void phosphoricAcidRecipes() { .duration(320).EUt(VA[LV]).buildAndRegister(); } - private static void aceticAcidRecipes() { - - } + private static void aceticAcidRecipes() {} } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java index 90c271e2950..44be226b0c8 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/AssemblerRecipeLoader.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.common.ConfigHolder; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -19,7 +20,6 @@ public class AssemblerRecipeLoader { public static void init() { - // Gearbox-like ASSEMBLER_RECIPES.recipeBuilder() .input(plate, Bronze, 4) @@ -73,7 +73,8 @@ public static void init() { .input(rotor, TungstenSteel, 2) .input(pipeNormalFluid, TungstenSteel, 4) .inputs(METAL_CASING.getItemVariant(TUNGSTENSTEEL_ROBUST)) - .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, ConfigHolder.recipes.casingsPerCraft)) + .outputs(MULTIBLOCK_CASING.getItemVariant(EXTREME_ENGINE_INTAKE_CASING, + ConfigHolder.recipes.casingsPerCraft)) .duration(50).EUt(16).buildAndRegister(); ASSEMBLER_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java index 5ff0e665e9d..16ddc802f42 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/BrewingRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.unification.material.Material; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -13,8 +14,7 @@ public class BrewingRecipes { public static void init() { - - for (Material material : new Material[]{Talc, Soapstone, Redstone}) { + for (Material material : new Material[] { Talc, Soapstone, Redstone }) { BREWING_RECIPES.recipeBuilder() .input(dust, material) .fluidInputs(Oil.getFluid(1000)) @@ -35,14 +35,23 @@ public static void init() { } // Biomass - BREWING_RECIPES.recipeBuilder().duration(800).EUt(3).input("treeSapling", 1).fluidInputs(Water.getFluid(100)).fluidOutputs(Biomass.getFluid(100)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.POTATO)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.CARROT)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.CACTUS)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.REEDS)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.RED_MUSHROOM)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.BEETROOT)).fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); - BREWING_RECIPES.recipeBuilder().EUt(4).duration(128).input(BIO_CHAFF).fluidInputs(Water.getFluid(750)).fluidOutputs(Biomass.getFluid(750)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(800).EUt(3).input("treeSapling", 1).fluidInputs(Water.getFluid(100)) + .fluidOutputs(Biomass.getFluid(100)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.POTATO)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.CARROT)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.CACTUS)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.REEDS)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.BROWN_MUSHROOM)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Blocks.RED_MUSHROOM)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().duration(160).EUt(3).inputs(new ItemStack(Items.BEETROOT)) + .fluidInputs(Water.getFluid(20)).fluidOutputs(Biomass.getFluid(20)).buildAndRegister(); + BREWING_RECIPES.recipeBuilder().EUt(4).duration(128).input(BIO_CHAFF).fluidInputs(Water.getFluid(750)) + .fluidOutputs(Biomass.getFluid(750)).buildAndRegister(); } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java index f420f9fcb3d..56904e7dd4f 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ChemicalBathRecipes.java @@ -4,6 +4,7 @@ import gregtech.common.blocks.StoneVariantBlock; import gregtech.common.blocks.StoneVariantBlock.StoneVariant; import gregtech.common.blocks.wood.BlockGregPlanks; + import net.minecraft.init.Items; import static gregtech.api.GTValues.*; @@ -14,7 +15,6 @@ public class ChemicalBathRecipes { public static void init() { - CHEMICAL_BATH_RECIPES.recipeBuilder() .input(dust, Wood) .fluidInputs(Water.getFluid(100)) @@ -58,9 +58,11 @@ public static void init() { .duration(100).EUt(VA[ULV]).buildAndRegister(); CHEMICAL_BATH_RECIPES.recipeBuilder() - .inputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH).getItemVariant(StoneVariantBlock.StoneType.CONCRETE_LIGHT)) + .inputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH) + .getItemVariant(StoneVariantBlock.StoneType.CONCRETE_LIGHT)) .fluidInputs(Water.getFluid(100)) - .outputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH).getItemVariant(StoneVariantBlock.StoneType.CONCRETE_DARK)) + .outputs(MetaBlocks.STONE_BLOCKS.get(StoneVariant.SMOOTH) + .getItemVariant(StoneVariantBlock.StoneType.CONCRETE_DARK)) .duration(100).EUt(VA[ULV]).buildAndRegister(); CHEMICAL_BATH_RECIPES.recipeBuilder() diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java index 33dc55e3830..0a44f0a8b66 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ChemistryRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.fluids.store.FluidStorageKeys; + import net.minecraft.init.Items; import static gregtech.api.GTValues.*; @@ -12,7 +13,6 @@ public class ChemistryRecipes { public static void init() { - PetrochemRecipes.init(); DistillationRecipes.init(); SeparationRecipes.init(); @@ -30,7 +30,6 @@ public static void init() { NaquadahRecipes.init(); AcidRecipes.init(); - // A Few Random Recipes FLUID_HEATER_RECIPES.recipeBuilder() .circuitMeta(1) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java b/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java index 5e5707d5f17..010a74e0cdb 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/FuelRecipeChains.java @@ -8,7 +8,6 @@ public class FuelRecipeChains { public static void init() { - // High Octane Gasoline LARGE_CHEMICAL_RECIPES.recipeBuilder().EUt(VA[HV]).duration(100) .fluidInputs(Naphtha.getFluid(16000)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java index 49fe44d3e18..4a36c1eb79e 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/GemSlurryRecipes.java @@ -9,7 +9,6 @@ public class GemSlurryRecipes { public static void init() { - // Ruby MIXER_RECIPES.recipeBuilder().duration(280).EUt(VA[EV]) .input(crushed, Ruby, 2) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java index 8739093923e..0bd90974ed9 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/GrowthMediumRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe.chemistry; import gregtech.api.metatileentity.multiblock.CleanroomType; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -15,7 +16,6 @@ public class GrowthMediumRecipes { public static void init() { - // Bio Chaff MACERATOR_RECIPES.recipeBuilder().duration(200) .input(PLANT_BALL, 2) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java b/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java index 59bcd489698..01fd09384f6 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/LCRCombined.java @@ -8,7 +8,6 @@ public class LCRCombined { static void init() { - LARGE_CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(24) .fluidInputs(Methane.getFluid(3000)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java index 24045fd506d..b4a3087751c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/NaquadahRecipes.java @@ -22,7 +22,6 @@ public class NaquadahRecipes { // |> 0.25 Barium public static void init() { - // FLUOROANTIMONIC ACID CHEMICAL_RECIPES.recipeBuilder().EUt(VA[ULV]).duration(60) @@ -45,7 +44,6 @@ public static void init() { .fluidOutputs(Hydrogen.getFluid(2000)) .buildAndRegister(); - // STARTING POINT LARGE_CHEMICAL_RECIPES.recipeBuilder().EUt(VA[LuV]).duration(600) @@ -56,7 +54,6 @@ public static void init() { .output(dust, TitaniumTrifluoride, 4) .buildAndRegister(); - // ENRICHED NAQUADAH PROCESS CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[EV]).duration(400) @@ -94,7 +91,6 @@ public static void init() { .fluidOutputs(NaquadriaSolution.getFluid(150)) .buildAndRegister(); - // NAQUADRIA PROCESS CENTRIFUGE_RECIPES.recipeBuilder().EUt(VA[EV]).duration(400) @@ -132,7 +128,6 @@ public static void init() { .fluidOutputs(EnrichedNaquadahSolution.getFluid(150)) .buildAndRegister(); - // TRINIUM BLAST_RECIPES.recipeBuilder().duration(750).EUt(VA[LuV]).blastFurnaceTemp(Trinium.getBlastTemperature()) @@ -142,7 +137,6 @@ public static void init() { .output(dust, ZincSulfide, 2) .buildAndRegister(); - // BYPRODUCT PROCESSING // Titanium Trifluoride diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java index 1bb959cc6c4..08d8567299b 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/NuclearRecipes.java @@ -8,7 +8,6 @@ public class NuclearRecipes { public static void init() { - CHEMICAL_RECIPES.recipeBuilder().duration(200).EUt(VA[LV]) .input(dust, Uraninite, 3) .fluidInputs(HydrofluoricAcid.getFluid(4000)) @@ -34,6 +33,5 @@ public static void init() { .output(dust, Uranium238) .fluidOutputs(Fluorine.getFluid(6000)) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java index 623f662a1d4..abbf301bb49 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PetrochemRecipes.java @@ -65,7 +65,6 @@ public static void init() { } private static void desulfurizationRecipes() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(SulfuricHeavyFuel.getFluid(8000)) .fluidInputs(Hydrogen.getFluid(2000)) @@ -103,7 +102,6 @@ private static void desulfurizationRecipes() { } private static void distillationRecipes() { - DISTILLATION_RECIPES.recipeBuilder() .fluidInputs(RefineryGas.getFluid(1000)) .fluidOutputs(Butane.getFluid(60)) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java index c31041ff99e..a141203d3b4 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PlatGroupMetalsRecipes.java @@ -9,7 +9,6 @@ public class PlatGroupMetalsRecipes { public static void init() { - // Primary Chain // Platinum Group Sludge Production @@ -68,16 +67,16 @@ public static void init() { // MODIFY THIS RECIPE TO RE-BALANCE THE LINE // // Current Losses of Materials per recipe (update this if rebalanced): - // H: Loses - // N: Loses - // O: Loses + // H: Loses + // N: Loses + // O: Loses // Cl: Perfectly Conserved // // If modified, this is how much 1 of each product will change the above losses by: - // Pt: 266L of Cl + // Pt: 266L of Cl // // These numbers are not correct: - // Pd: 200L of N, 600L of H + // Pd: 200L of N, 600L of H // Ru/Rh: 667L of O // Ir/Os: 620L of O, 100L of H // @@ -93,7 +92,6 @@ public static void init() { .output(dust, PlatinumSludgeResidue, 2) .buildAndRegister(); - // PLATINUM ELECTROLYZER_RECIPES.recipeBuilder().duration(100).EUt(VA[MV]) @@ -102,7 +100,6 @@ public static void init() { .fluidOutputs(Chlorine.getFluid(800)) .buildAndRegister(); - // PALLADIUM CHEMICAL_RECIPES.recipeBuilder().duration(200).EUt(VA[MV]) @@ -112,7 +109,6 @@ public static void init() { .output(dust, AmmoniumChloride, 2) .buildAndRegister(); - // RHODIUM / RUTHENIUM CHEMICAL_RECIPES.recipeBuilder().duration(450).EUt(VA[EV]) @@ -137,7 +133,6 @@ public static void init() { .fluidOutputs(CarbonDioxide.getFluid(2000)) .buildAndRegister(); - // OSMIUM / IRIDIUM LARGE_CHEMICAL_RECIPES.recipeBuilder().duration(400).EUt(VA[IV]) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java index a799ec72a75..7a1531eeb7c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/PolymerRecipes.java @@ -18,7 +18,6 @@ public static void init() { } private static void polyethyleneProcess() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(SulfuricAcid.getFluid(1000)) .fluidInputs(Ethanol.getFluid(1000)) @@ -65,7 +64,6 @@ private static void polyethyleneProcess() { } private static void polyvinylChlorideProcess() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(3) .fluidInputs(Oxygen.getFluid(1000)) @@ -121,7 +119,6 @@ private static void polyvinylChlorideProcess() { } private static void ptfeProcess() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Chlorine.getFluid(6000)) @@ -178,7 +175,6 @@ private static void ptfeProcess() { } private static void epoxyProcess() { - CHEMICAL_RECIPES.recipeBuilder() .input(dustTiny, SodiumHydroxide) .fluidInputs(SeedOil.getFluid(6000)) @@ -326,7 +322,6 @@ private static void epoxyProcess() { } private static void styreneButadieneProcess() { - CHEMICAL_RECIPES.recipeBuilder() .fluidInputs(Ethylene.getFluid(1000)) .fluidInputs(Benzene.getFluid(1000)) @@ -503,6 +498,5 @@ public static void polycaprolactamProcess() { .fluidInputs(Nitrogen.getFluid(1000)) .output(ingot, Polycaprolactam, 1) .buildAndRegister(); - } } diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java index dbdaa04cdfb..7871a518e8c 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/ReactorRecipes.java @@ -4,6 +4,7 @@ import gregtech.api.unification.material.MarkerMaterials; import gregtech.api.unification.material.Materials; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -18,7 +19,6 @@ public class ReactorRecipes { public static void init() { - CHEMICAL_RECIPES.recipeBuilder() .circuitMeta(1) .fluidInputs(Isoprene.getFluid(144)) @@ -76,8 +76,6 @@ public static void init() { .fluidOutputs(PolyphenyleneSulfide.getFluid(1500)) .duration(240).EUt(360).buildAndRegister(); - - CHEMICAL_RECIPES.recipeBuilder() .input(dust, Polydimethylsiloxane, 9) .input(dust, Sulfur) diff --git a/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java b/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java index 7001a4b977e..3d51fc11124 100644 --- a/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/chemistry/SeparationRecipes.java @@ -5,6 +5,7 @@ import gregtech.api.util.GTUtility; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -29,7 +30,6 @@ public class SeparationRecipes { public static void init() { - // Centrifuge CENTRIFUGE_RECIPES.recipeBuilder() .fluidInputs(RefineryGas.getFluid(8000)) @@ -97,7 +97,8 @@ public static void init() { int healAmount = itemFood.getHealAmount(itemStack); float saturationModifier = itemFood.getSaturationModifier(itemStack); if (healAmount > 0) { - FluidStack outputStack = Methane.getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); + FluidStack outputStack = Methane + .getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5) .inputs(itemStack) @@ -570,7 +571,6 @@ public static void init() { .inputs(new ItemStack(Blocks.BOOKSHELF)) .outputs(new ItemStack(Items.BOOK, 3)) .duration(300).EUt(2).buildAndRegister(); - } @SuppressWarnings("unchecked") diff --git a/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java index 79bdee19c5b..0e1fd185aed 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/DecompositionRecipeHandler.java @@ -8,6 +8,7 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.MaterialStack; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -31,15 +32,16 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat if (material.getMaterialComponents().isEmpty() || (!material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING) && !material.hasFlag(DECOMPOSITION_BY_CENTRIFUGING)) || - //disable decomposition if explicitly disabled for this material or for one of it's components + // disable decomposition if explicitly disabled for this material or for one of it's components material.hasFlag(DISABLE_DECOMPOSITION) || - material.getMaterialComponents().size() > 6) return; + material.getMaterialComponents().size() > 6) + return; List outputs = new ArrayList<>(); List fluidOutputs = new ArrayList<>(); int totalInputAmount = 0; - //compute outputs + // compute outputs for (MaterialStack component : material.getMaterialComponents()) { totalInputAmount += component.amount; if (component.material.hasProperty(PropertyKey.DUST)) { @@ -49,9 +51,9 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat } } - //only reduce items + // only reduce items if (decomposePrefix != null) { - //calculate lowest common denominator + // calculate lowest common denominator List materialAmounts = new ArrayList<>(); materialAmounts.add(totalInputAmount); outputs.forEach(itemStack -> materialAmounts.add(itemStack.getCount())); @@ -65,7 +67,7 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat highestDivisor = i; } - //divide components + // divide components if (highestDivisor != 1) { List reducedOutputs = new ArrayList<>(); @@ -89,8 +91,7 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat } } - - //generate builder + // generate builder RecipeBuilder builder; if (material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING)) { builder = RecipeMaps.ELECTROLYZER_RECIPES.recipeBuilder() @@ -104,14 +105,14 @@ private static void processDecomposition(OrePrefix decomposePrefix, Material mat builder.outputs(outputs); builder.fluidOutputs(fluidOutputs); - //finish builder + // finish builder if (decomposePrefix != null) { builder.input(decomposePrefix, material, totalInputAmount); } else { builder.fluidInputs(material.getFluid(1000)); } - //register recipe + // register recipe builder.buildAndRegister(); } @@ -126,5 +127,4 @@ private static boolean isEveryMaterialReducible(int divisor, List mater private static int getSmallestMaterialAmount(List materialAmounts) { return materialAmounts.stream().min(Integer::compare).orElse(0); } - } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java index cc66ed01027..8ff1f825974 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java @@ -15,14 +15,16 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.loaders.recipe.CraftingComponent; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Nullable; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -56,8 +58,8 @@ public static void register() { for (int i = 0; i < GEM_ORDER.size(); i++) { OrePrefix gemPrefix = GEM_ORDER.get(i); OrePrefix prevGemPrefix = i == 0 ? null : GEM_ORDER.get(i - 1); - gemPrefix.addProcessingHandler(PropertyKey.GEM, (p, material, property) -> - processGemConversion(p, prevGemPrefix, material)); + gemPrefix.addProcessingHandler(PropertyKey.GEM, + (p, material, property) -> processGemConversion(p, prevGemPrefix, material)); } } @@ -102,7 +104,8 @@ public static void processDust(OrePrefix dustPrefix, Material mat, DustProperty if (oreProperty != null) { Material smeltingResult = oreProperty.getDirectSmeltResult(); if (smeltingResult != null) { - ModHandler.addSmeltingRecipe(OreDictUnifier.get(dustPrefix, mat), OreDictUnifier.get(OrePrefix.ingot, smeltingResult)); + ModHandler.addSmeltingRecipe(OreDictUnifier.get(dustPrefix, mat), + OreDictUnifier.get(OrePrefix.ingot, smeltingResult)); } } @@ -197,7 +200,8 @@ private static void processEBFRecipe(Material material, BlastProperty property, // Add Vacuum Freezer recipe if required. if (ingotHot.doGenerateItem(material)) { int vacuumEUt = property.getVacuumEUtOverride() != -1 ? property.getVacuumEUtOverride() : VA[MV]; - int vacuumDuration = property.getVacuumDurationOverride() != -1 ? property.getVacuumDurationOverride() : (int) material.getMass() * 3; + int vacuumDuration = property.getVacuumDurationOverride() != -1 ? property.getVacuumDurationOverride() : + (int) material.getMass() * 3; if (blastTemp < 5000) { RecipeMaps.VACUUM_RECIPES.recipeBuilder() @@ -262,7 +266,8 @@ public static void processTinyDust(OrePrefix orePrefix, Material material, DustP public static void processIngot(OrePrefix ingotPrefix, Material material, IngotProperty property) { if (material.hasFlag(MORTAR_GRINDABLE)) { ModHandler.addShapedRecipe(String.format("mortar_grind_%s", material), - OreDictUnifier.get(OrePrefix.dust, material), "X", "m", 'X', new UnificationEntry(ingotPrefix, material)); + OreDictUnifier.get(OrePrefix.dust, material), "X", "m", 'X', + new UnificationEntry(ingotPrefix, material)); } if (material.hasFlag(GENERATE_ROD)) { @@ -363,7 +368,6 @@ public static void processIngot(OrePrefix ingotPrefix, Material material, IngotP } } } - } public static void processGemConversion(OrePrefix gemPrefix, @Nullable OrePrefix prevPrefix, Material material) { @@ -495,12 +499,14 @@ public static void processBlock(OrePrefix blockPrefix, Material material, DustPr result.add(blockEntry); } - //do not allow hand crafting or uncrafting, extruding or alloy smelting of blacklisted blocks + // do not allow hand crafting or uncrafting, extruding or alloy smelting of blacklisted blocks if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_RECIPES)) { - //do not allow hand crafting or uncrafting of blacklisted blocks - if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && !ConfigHolder.recipes.disableManualCompression) { - ModHandler.addShapelessRecipe(String.format("block_compress_%s", material), blockStack, result.toArray()); + // do not allow hand crafting or uncrafting of blacklisted blocks + if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && + !ConfigHolder.recipes.disableManualCompression) { + ModHandler.addShapelessRecipe(String.format("block_compress_%s", material), blockStack, + result.toArray()); ModHandler.addShapelessRecipe(String.format("block_decompress_%s", material), GTUtility.copy((int) (materialAmount / M), OreDictUnifier.get(blockEntry)), diff --git a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java index 3ff64f66a45..c31486610f2 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/OreRecipeHandler.java @@ -15,7 +15,9 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.tuple.Pair; import java.util.List; @@ -50,7 +52,6 @@ public static void register() { OrePrefix.dustPure.addProcessingHandler(PropertyKey.ORE, OreRecipeHandler::processPureDust); } - private static void processMetalSmelting(OrePrefix crushedPrefix, Material material, OreProperty property) { Material smeltingResult = property.getDirectSmeltResult() != null ? property.getDirectSmeltResult() : material; @@ -69,7 +70,8 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert if (byproductStack.isEmpty()) byproductStack = OreDictUnifier.get(OrePrefix.dust, byproductMaterial); ItemStack crushedStack = OreDictUnifier.get(OrePrefix.crushed, material); ItemStack ingotStack; - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); double amountOfCrushedOre = property.getOreMultiplier(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { ingotStack = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial); @@ -87,7 +89,8 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert .input(orePrefix, material) .duration(10).EUt(16); if (material.hasProperty(PropertyKey.GEM) && !OreDictUnifier.get(OrePrefix.gem, material).isEmpty()) { - builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount()))); + builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, + OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount()))); } else { builder.outputs(GTUtility.copy((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, crushedStack)); } @@ -108,7 +111,7 @@ public static void processOre(OrePrefix orePrefix, Material material, OrePropert builder.buildAndRegister(); } - //do not try to add smelting recipes for materials which require blast furnace + // do not try to add smelting recipes for materials which require blast furnace if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial)) { ModHandler.addSmeltingRecipe(new UnificationEntry(orePrefix, material), ingotStack, 0.5f); } @@ -118,7 +121,7 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material); Material byproductMaterial = property.getOreByProduct(0, material); - //fallback for dirtyGravel, shard & clump + // fallback for dirtyGravel, shard & clump if (impureDustStack.isEmpty()) { impureDustStack = GTUtility.copyFirst( OreDictUnifier.get(OrePrefix.dirtyGravel, material), @@ -137,7 +140,8 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, .input(crushedPrefix, material) .outputs(impureDustStack) .duration(400) - .chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, property.getByProductMultiplier()), 1400, 850) + .chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, property.getByProductMultiplier()), + 1400, 850) .buildAndRegister(); ItemStack crushedPurifiedOre = GTUtility.copyFirst( @@ -175,7 +179,8 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, RecipeMaps.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder() .input(crushedPrefix, material) .outputs(crushedCentrifugedOre) - .chancedOutput(OrePrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), 3333, 0) + .chancedOutput(OrePrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), + 3333, 0) .output(OrePrefix.dust, Materials.Stone) .buildAndRegister(); @@ -186,7 +191,9 @@ public static void processCrushedOre(OrePrefix crushedPrefix, Material material, .input(crushedPrefix, material) .fluidInputs(washedInTuple.getKey().getFluid(washedInTuple.getValue())) .outputs(crushedPurifiedOre) - .chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), 7000, 580) + .chancedOutput( + OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), + 7000, 580) .chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000, 650) .duration(200).EUt(VA[LV]) .buildAndRegister(); @@ -318,7 +325,7 @@ public static void processDirtyDust(OrePrefix dustPrefix, Material material, Ore .outputs(dustStack) .duration(8).EUt(4).buildAndRegister(); - //dust gains same amount of material as normal dust + // dust gains same amount of material as normal dust processMetalSmelting(dustPrefix, material, property); } @@ -328,22 +335,25 @@ public static void processPureDust(OrePrefix purePrefix, Material material, OreP if (property.getSeparatedInto() != null && !property.getSeparatedInto().isEmpty()) { List separatedMaterial = property.getSeparatedInto(); - OrePrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) - ? OrePrefix.nugget : OrePrefix.dust; + OrePrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && + separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) ? + OrePrefix.nugget : OrePrefix.dust; - ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), prefix == OrePrefix.nugget ? 2 : 1); + ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), + prefix == OrePrefix.nugget ? 2 : 1); RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder() .input(purePrefix, material) .outputs(dustStack) .chancedOutput(OrePrefix.dust, separatedMaterial.get(0), 1000, 250) - .chancedOutput(separatedStack2, prefix == OrePrefix.dust ? 500 : 2000, prefix == OrePrefix.dust ? 150 : 600) + .chancedOutput(separatedStack2, prefix == OrePrefix.dust ? 500 : 2000, + prefix == OrePrefix.dust ? 150 : 600) .duration(200).EUt(24) .buildAndRegister(); } if (dustStack.isEmpty()) { - //fallback for reduced & cleanGravel + // fallback for reduced & cleanGravel dustStack = GTUtility.copyFirst( OreDictUnifier.get(OrePrefix.reduced, material), OreDictUnifier.get(OrePrefix.cleanGravel, material)); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java index 21eb68cab9f..24ec5349133 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PartsRecipeHandler.java @@ -18,6 +18,7 @@ import gregtech.common.ConfigHolder; import gregtech.common.items.MetaItems; import gregtech.common.items.behaviors.AbstractMaterialPartBehavior; + import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; @@ -30,8 +31,7 @@ public class PartsRecipeHandler { - private PartsRecipeHandler() { - } + private PartsRecipeHandler() {} public static void register() { OrePrefix.stick.addProcessingHandler(PropertyKey.DUST, PartsRecipeHandler::processStick); @@ -213,8 +213,10 @@ public static void processGear(OrePrefix gearPrefix, Material material, DustProp if (material.hasFlag(GENERATE_PLATE) && material.hasFlag(GENERATE_ROD)) { if (gearPrefix == OrePrefix.gearSmall) { - ModHandler.addShapedRecipe(String.format("small_gear_%s", material), OreDictUnifier.get(gearSmall, material), - " R ", "hPx", " R ", 'R', new UnificationEntry(stick, material), 'P', new UnificationEntry(plate, material)); + ModHandler.addShapedRecipe(String.format("small_gear_%s", material), + OreDictUnifier.get(gearSmall, material), + " R ", "hPx", " R ", 'R', new UnificationEntry(stick, material), 'P', + new UnificationEntry(plate, material)); RecipeMaps.EXTRUDER_RECIPES.recipeBuilder() .input(OrePrefix.ingot, material) diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java index cccaa0043f7..bd58e4263e8 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PipeRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.base.CaseFormat; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMaps; import gregtech.api.unification.OreDictUnifier; @@ -14,8 +13,11 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; import gregtech.common.items.MetaItems; + import net.minecraft.item.ItemStack; +import com.google.common.base.CaseFormat; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.ASSEMBLER_RECIPES; import static gregtech.api.unification.material.Materials.Glue; @@ -32,7 +34,8 @@ public static void register() { OrePrefix.pipeLargeFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeLarge); OrePrefix.pipeHugeFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeHuge); - OrePrefix.pipeQuadrupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeQuadruple); + OrePrefix.pipeQuadrupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, + PipeRecipeHandler::processPipeQuadruple); OrePrefix.pipeNonupleFluid.addProcessingHandler(PropertyKey.FLUID_PIPE, PipeRecipeHandler::processPipeNonuple); OrePrefix.pipeTinyItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeTiny); @@ -41,10 +44,14 @@ public static void register() { OrePrefix.pipeLargeItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeLarge); OrePrefix.pipeHugeItem.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeHuge); - OrePrefix.pipeSmallRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeNormalRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeLargeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - OrePrefix.pipeHugeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeSmallRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeNormalRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeLargeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); + OrePrefix.pipeHugeRestrictive.addProcessingHandler(PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); } private static void processRestrictivePipe(OrePrefix pipePrefix, Material material, ItemPipeProperties property) { @@ -63,9 +70,12 @@ private static void processRestrictivePipe(OrePrefix pipePrefix, Material materi .EUt(VA[ULV]) .buildAndRegister(); - ModHandler.addShapedRecipe(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pipePrefix.toString()) + "_" + material.toCamelCaseString(), + ModHandler.addShapedRecipe( + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, pipePrefix.toString()) + "_" + + material.toCamelCaseString(), OreDictUnifier.get(pipePrefix, material), "PR", "Rh", - 'P', new UnificationEntry(unrestrictive, material), 'R', OreDictUnifier.get(OrePrefix.ring, Materials.Iron)); + 'P', new UnificationEntry(unrestrictive, material), 'R', + OreDictUnifier.get(OrePrefix.ring, Materials.Iron)); } private static void processPipeTiny(OrePrefix pipePrefix, Material material, IMaterialProperty property) { @@ -102,8 +112,7 @@ private static void processPipeTiny(OrePrefix pipePrefix, Material material, IMa .fluidInputs(Glue.getFluid(10)) .output(pipePrefix, material, 2) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("tiny_%s_pipe", material), GTUtility.copy(2, pipeStack), " s ", "hXw", 'X', new UnificationEntry(OrePrefix.plate, material)); @@ -228,8 +237,7 @@ private static void processPipeLarge(OrePrefix pipePrefix, Material material, IM .fluidInputs(Glue.getFluid(50)) .output(pipePrefix, material) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("large_%s_pipe", material), pipeStack, "XXX", "w h", "XXX", 'X', new UnificationEntry(OrePrefix.plate, material)); @@ -270,8 +278,7 @@ private static void processPipeHuge(OrePrefix pipePrefix, Material material, IMa .fluidInputs(Glue.getFluid(100)) .output(pipePrefix, material) .buildAndRegister(); - } - else { + } else { ModHandler.addShapedRecipe(String.format("huge_%s_pipe", material), pipeStack, "XXX", "w h", "XXX", 'X', new UnificationEntry(OrePrefix.plateDouble, material)); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java index e65e1e6b748..9a412ddf7ab 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/PolarizingRecipeHandler.java @@ -10,15 +10,17 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + import net.minecraft.item.ItemStack; import static gregtech.api.GTValues.*; public class PolarizingRecipeHandler { - private static final OrePrefix[] POLARIZING_PREFIXES = new OrePrefix[]{ - OrePrefix.stick, OrePrefix.stickLong, OrePrefix.plate, OrePrefix.ingot, OrePrefix.plateDense, OrePrefix.rotor, - OrePrefix.bolt, OrePrefix.screw, OrePrefix.wireFine, OrePrefix.foil, OrePrefix.ring}; + private static final OrePrefix[] POLARIZING_PREFIXES = new OrePrefix[] { + OrePrefix.stick, OrePrefix.stickLong, OrePrefix.plate, OrePrefix.ingot, OrePrefix.plateDense, + OrePrefix.rotor, + OrePrefix.bolt, OrePrefix.screw, OrePrefix.wireFine, OrePrefix.foil, OrePrefix.ring }; public static void register() { for (OrePrefix orePrefix : POLARIZING_PREFIXES) { @@ -31,15 +33,16 @@ public static void processPolarizing(OrePrefix polarizingPrefix, Material materi if (magneticMaterial != null && polarizingPrefix.doGenerateItem(magneticMaterial)) { ItemStack magneticStack = OreDictUnifier.get(polarizingPrefix, magneticMaterial); - RecipeMaps.POLARIZER_RECIPES.recipeBuilder() //polarizing + RecipeMaps.POLARIZER_RECIPES.recipeBuilder() // polarizing .input(polarizingPrefix, material) .outputs(magneticStack) - .duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / GTValues.M)) + .duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / + GTValues.M)) .EUt(getVoltageMultiplier(material)) .buildAndRegister(); ModHandler.addSmeltingRecipe(new UnificationEntry(polarizingPrefix, magneticMaterial), - OreDictUnifier.get(polarizingPrefix, material)); //de-magnetizing + OreDictUnifier.get(polarizingPrefix, material)); // de-magnetizing } } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java index fa3ea10db1c..fcdc4fb2084 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/RecyclingRecipeHandler.java @@ -27,14 +27,13 @@ public class RecyclingRecipeHandler { (Predicate) orePrefix -> orePrefix.name().startsWith("gem"), (Predicate) orePrefix -> orePrefix.name().startsWith("cableGt"), (Predicate) orePrefix -> orePrefix.name().startsWith("wireGt"), - (Predicate) orePrefix -> orePrefix.name().startsWith("pipe") - ); + (Predicate) orePrefix -> orePrefix.name().startsWith("pipe")); private static final List IGNORE_ARC_SMELTING = Arrays.asList( OrePrefix.ingot, OrePrefix.gem, OrePrefix.nugget); public static void register() { - //registers universal maceration recipes for specified ore prefixes + // registers universal maceration recipes for specified ore prefixes for (OrePrefix orePrefix : OrePrefix.values()) { if (CRUSHING_PREFIXES.stream().anyMatch(object -> { if (object instanceof OrePrefix) @@ -50,11 +49,12 @@ public static void processCrushing(OrePrefix thingPrefix, Material material, Dus ArrayList materialStacks = new ArrayList<>(); materialStacks.add(new MaterialStack(material, thingPrefix.getMaterialAmount(material))); materialStacks.addAll(thingPrefix.secondaryMaterials); - //only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material - //if arc smelting gives different material, allow it - boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && !( - material.hasProperty(PropertyKey.INGOT) - && material.getProperty(PropertyKey.INGOT).getArcSmeltInto() != material); - RecyclingRecipes.registerRecyclingRecipes(OreDictUnifier.get(thingPrefix, material), materialStacks, ignoreArcSmelting, thingPrefix); + // only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material + // if arc smelting gives different material, allow it + boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && + !(material.hasProperty(PropertyKey.INGOT) && + material.getProperty(PropertyKey.INGOT).getArcSmeltInto() != material); + RecyclingRecipes.registerRecyclingRecipes(OreDictUnifier.get(thingPrefix, material), materialStacks, + ignoreArcSmelting, thingPrefix); } } diff --git a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java index 132062ea8da..1d5d8c57d2b 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; import gregtech.api.capability.IElectricItem; @@ -19,17 +18,21 @@ import gregtech.common.crafting.ToolHeadReplaceRecipe; import gregtech.common.items.MetaItems; import gregtech.common.items.ToolItems; + import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import javax.annotation.Nonnull; +import com.google.common.collect.ImmutableList; + import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.LATHE_RECIPES; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -67,12 +70,16 @@ public static void initializeMetaItems() { powerUnitItems.put(GTValues.IV, MetaItems.POWER_UNIT_IV); batteryItems.put(GTValues.ULV, Collections.singletonList(MetaItems.BATTERY_ULV_TANTALUM)); - batteryItems.put(GTValues.LV, ImmutableList.of(MetaItems.BATTERY_LV_LITHIUM, MetaItems.BATTERY_LV_CADMIUM, MetaItems.BATTERY_LV_SODIUM)); - batteryItems.put(GTValues.MV, ImmutableList.of(MetaItems.BATTERY_MV_LITHIUM, MetaItems.BATTERY_MV_CADMIUM, MetaItems.BATTERY_MV_SODIUM)); - batteryItems.put(GTValues.HV, ImmutableList.of(MetaItems.BATTERY_HV_LITHIUM, MetaItems.BATTERY_HV_CADMIUM, MetaItems.BATTERY_HV_SODIUM, MetaItems.ENERGIUM_CRYSTAL)); + batteryItems.put(GTValues.LV, ImmutableList.of(MetaItems.BATTERY_LV_LITHIUM, MetaItems.BATTERY_LV_CADMIUM, + MetaItems.BATTERY_LV_SODIUM)); + batteryItems.put(GTValues.MV, ImmutableList.of(MetaItems.BATTERY_MV_LITHIUM, MetaItems.BATTERY_MV_CADMIUM, + MetaItems.BATTERY_MV_SODIUM)); + batteryItems.put(GTValues.HV, ImmutableList.of(MetaItems.BATTERY_HV_LITHIUM, MetaItems.BATTERY_HV_CADMIUM, + MetaItems.BATTERY_HV_SODIUM, MetaItems.ENERGIUM_CRYSTAL)); batteryItems.put(GTValues.EV, ImmutableList.of(MetaItems.BATTERY_EV_VANADIUM, MetaItems.LAPOTRON_CRYSTAL)); batteryItems.put(GTValues.IV, ImmutableList.of(MetaItems.BATTERY_IV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB)); - batteryItems.put(GTValues.LuV, ImmutableList.of(MetaItems.BATTERY_LUV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); + batteryItems.put(GTValues.LuV, + ImmutableList.of(MetaItems.BATTERY_LUV_VANADIUM, MetaItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); batteryItems.put(GTValues.ZPM, ImmutableList.of(MetaItems.BATTERY_ZPM_NAQUADRIA, MetaItems.ENERGY_MODULE)); batteryItems.put(GTValues.UV, ImmutableList.of(MetaItems.BATTERY_UV_NAQUADRIA, MetaItems.ENERGY_CLUSTER)); @@ -88,7 +95,8 @@ public static void initializeMetaItems() { ToolHeadReplaceRecipe.setToolHeadForTool(OrePrefix.toolHeadBuzzSaw, ToolItems.BUZZSAW); ToolHeadReplaceRecipe.setToolHeadForTool(OrePrefix.toolHeadScrewdriver, ToolItems.SCREWDRIVER_LV); - ForgeRegistries.RECIPES.register(new ToolHeadReplaceRecipe().setRegistryName(new ResourceLocation(MODID, "replacetoolhead"))); + ForgeRegistries.RECIPES + .register(new ToolHeadReplaceRecipe().setRegistryName(new ResourceLocation(MODID, "replacetoolhead"))); } public static void registerPowerUnitRecipes() { @@ -96,9 +104,11 @@ public static void registerPowerUnitRecipes() { List tieredBatteryItems = batteryItems.get(tier); for (MetaValueItem batteryItem : tieredBatteryItems) { ItemStack batteryStack = batteryItem.getStackForm(); - long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null).getMaxCharge(); + long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null) + .getMaxCharge(); ItemStack powerUnitStack = powerUnitItems.get(tier).getMaxChargeOverrideStack(maxCharge); - String recipeName = String.format("%s_%s", powerUnitItems.get(tier).unlocalizedName, batteryItem.unlocalizedName); + String recipeName = String.format("%s_%s", powerUnitItems.get(tier).unlocalizedName, + batteryItem.unlocalizedName); ModHandler.addShapedEnergyTransferRecipe(recipeName, powerUnitStack, Ingredient.fromStacks(batteryStack), true, false, @@ -115,7 +125,8 @@ public static void registerPowerUnitRecipes() { private static void processTool(OrePrefix prefix, Material material, ToolProperty property) { UnificationEntry stick = new UnificationEntry(OrePrefix.stick, Materials.Wood); UnificationEntry plate = new UnificationEntry(OrePrefix.plate, material); - UnificationEntry ingot = new UnificationEntry(material.hasProperty(GEM) ? OrePrefix.gem : OrePrefix.ingot, material); + UnificationEntry ingot = new UnificationEntry(material.hasProperty(GEM) ? OrePrefix.gem : OrePrefix.ingot, + material); if (material.hasFlag(GENERATE_PLATE)) { addToolRecipe(material, ToolItems.MINING_HAMMER, true, @@ -234,7 +245,8 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too 'X', plate, 'S', steelPlate); - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.DRILL_LV, ToolItems.DRILL_MV, ToolItems.DRILL_HV, ToolItems.DRILL_EV, ToolItems.DRILL_IV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.DRILL_LV, ToolItems.DRILL_MV, + ToolItems.DRILL_HV, ToolItems.DRILL_EV, ToolItems.DRILL_IV }); // chainsaw toolPrefix = OrePrefix.toolHeadChainsaw; @@ -245,11 +257,12 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too 'S', steelPlate, 'R', steelRing); - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.CHAINSAW_LV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.CHAINSAW_LV }); // wrench toolPrefix = OrePrefix.toolHeadWrench; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.WRENCH_LV, ToolItems.WRENCH_HV, ToolItems.WRENCH_IV}); + addElectricToolRecipe(toolPrefix, material, + new IGTTool[] { ToolItems.WRENCH_LV, ToolItems.WRENCH_HV, ToolItems.WRENCH_IV }); ModHandler.addShapedRecipe(String.format("wrench_head_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -260,7 +273,7 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too // buzzsaw toolPrefix = OrePrefix.toolHeadBuzzSaw; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.BUZZSAW}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.BUZZSAW }); ModHandler.addShapedRecipe(String.format("buzzsaw_blade_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -280,7 +293,7 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too // screwdriver if (material.hasFlag(GENERATE_LONG_ROD)) { toolPrefix = OrePrefix.toolHeadScrewdriver; - addElectricToolRecipe(toolPrefix, material, new IGTTool[]{ToolItems.SCREWDRIVER_LV}); + addElectricToolRecipe(toolPrefix, material, new IGTTool[] { ToolItems.SCREWDRIVER_LV }); ModHandler.addShapedRecipe(String.format("screwdriver_tip_%s", material), OreDictUnifier.get(toolPrefix, material), @@ -304,7 +317,8 @@ public static void addElectricToolRecipe(OrePrefix toolHead, Material material, } } - public static void addToolRecipe(@Nonnull Material material, @Nonnull IGTTool tool, boolean mirrored, Object... recipe) { + public static void addToolRecipe(@Nonnull Material material, @Nonnull IGTTool tool, boolean mirrored, + Object... recipe) { if (mirrored) { ModHandler.addMirroredShapedRecipe(String.format("%s_%s", tool.getToolId(), material), tool.get(material), recipe); @@ -362,7 +376,7 @@ private static void registerFlintToolRecipes() { } private static void registerMortarRecipes() { - for (Material material : new Material[]{ + for (Material material : new Material[] { Materials.Bronze, Materials.Iron, Materials.Invar, Materials.Steel, Materials.DamascusSteel, Materials.CobaltBrass, Materials.WroughtIron }) { @@ -374,7 +388,7 @@ private static void registerMortarRecipes() { } private static void registerSoftToolRecipes() { - final Material[] softMaterials = new Material[]{ + final Material[] softMaterials = new Material[] { Materials.Wood, Materials.Rubber, Materials.Polyethylene, Materials.Polytetrafluoroethylene, Materials.Polybenzimidazole }; @@ -408,7 +422,8 @@ private static void registerSoftToolRecipes() { private static void registerElectricRecipes() { for (MetaValueItem batteryItem : batteryItems.get(LV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_lv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_LV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_lv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_LV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_LV.getStackForm(), @@ -418,7 +433,8 @@ private static void registerElectricRecipes() { 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.LV), 'B', batteryItem.getStackForm()); - ModHandler.addShapedEnergyTransferRecipe("magnet_lv_" + batteryItem.unlocalizedName, MetaItems.ITEM_MAGNET_LV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("magnet_lv_" + batteryItem.unlocalizedName, + MetaItems.ITEM_MAGNET_LV.getStackForm(), batteryItem::isItemEqual, true, true, "MwM", "MBM", "CPC", 'M', new UnificationEntry(OrePrefix.stick, Materials.SteelMagnetic), @@ -428,7 +444,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(MV)) { - ModHandler.addShapedEnergyTransferRecipe("tricorder_" + batteryItem.unlocalizedName, MetaItems.TRICORDER_SCANNER.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("tricorder_" + batteryItem.unlocalizedName, + MetaItems.TRICORDER_SCANNER.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_MV.getStackForm(), @@ -440,7 +457,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(HV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_hv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_HV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_hv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_HV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_HV.getStackForm(), @@ -450,7 +468,8 @@ private static void registerElectricRecipes() { 'C', new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.HV), 'B', batteryItem.getStackForm()); - ModHandler.addShapedEnergyTransferRecipe("magnet_hv_" + batteryItem.unlocalizedName, MetaItems.ITEM_MAGNET_HV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("magnet_hv_" + batteryItem.unlocalizedName, + MetaItems.ITEM_MAGNET_HV.getStackForm(), batteryItem::isItemEqual, true, true, "MwM", "MBM", "CPC", 'M', new UnificationEntry(OrePrefix.stick, Materials.NeodymiumMagnetic), @@ -460,7 +479,8 @@ private static void registerElectricRecipes() { } for (MetaValueItem batteryItem : batteryItems.get(LuV)) { - ModHandler.addShapedEnergyTransferRecipe("prospector_luv_" + batteryItem.unlocalizedName, MetaItems.PROSPECTOR_LUV.getStackForm(), + ModHandler.addShapedEnergyTransferRecipe("prospector_luv_" + batteryItem.unlocalizedName, + MetaItems.PROSPECTOR_LUV.getStackForm(), batteryItem::isItemEqual, true, true, "EPS", "CDC", "PBP", 'E', MetaItems.EMITTER_LuV.getStackForm(), diff --git a/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java index fad7c199b3d..388558a8d2d 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/WireCombiningHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.OreDictUnifier; @@ -10,6 +9,8 @@ import gregtech.api.unification.material.properties.WireProperties; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.stack.UnificationEntry; + +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.ArrayUtils; import java.util.Map; @@ -19,7 +20,7 @@ public class WireCombiningHandler { - private static final OrePrefix[] WIRE_DOUBLING_ORDER = new OrePrefix[]{ + private static final OrePrefix[] WIRE_DOUBLING_ORDER = new OrePrefix[] { wireGtSingle, wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; @@ -28,11 +29,9 @@ public class WireCombiningHandler { cableGtDouble, wireGtDouble, cableGtQuadruple, wireGtQuadruple, cableGtOctal, wireGtOctal, - cableGtHex, wireGtHex - ); + cableGtHex, wireGtHex); public static void register() { - // Generate Wire Packer/Unpacker recipes TODO Move into generateWireCombining? wireGtSingle.addProcessingHandler(PropertyKey.WIRE, WireCombiningHandler::processWireCompression); diff --git a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java index 851b221312f..129150429d5 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/WireRecipeHandler.java @@ -1,6 +1,5 @@ package gregtech.loaders.recipe.handlers; -import com.google.common.collect.ImmutableMap; import gregtech.api.GTValues; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.builders.AssemblerRecipeBuilder; @@ -12,6 +11,8 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; +import com.google.common.collect.ImmutableMap; + import java.util.Map; import static gregtech.api.GTValues.*; @@ -29,10 +30,10 @@ * - Rubber: This can be used for any cable EV-tier or lower. After that it is unavailable. * * - Silicone Rubber: This can be used for any cable tier, saving the amount of fluid needed. However, at IV, - * it will require a Foil of the cable material as well, making it undesirable. + * it will require a Foil of the cable material as well, making it undesirable. * * - Styrene-Butadiene Rubber (SBR): This can be used for any cable tier, and is the most optimal cable-covering - * fluid available. + * fluid available. * * Extra Materials for Cable Covering: * - Polyphenylene Sulfide (PPS): At LuV, this foil is required to cover cables. Lower tiers will not use it. @@ -46,11 +47,9 @@ public class WireRecipeHandler { cableGtDouble, 1, cableGtQuadruple, 2, cableGtOctal, 3, - cableGtHex, 5 - ); + cableGtHex, 5); public static void register() { - // Generate 1x Wire creation recipes (Wiremill, Extruder, Wire Cutters) wireGtSingle.addProcessingHandler(PropertyKey.WIRE, WireRecipeHandler::processWireSingle); @@ -62,10 +61,11 @@ public static void register() { wireGtHex.addProcessingHandler(PropertyKey.WIRE, WireRecipeHandler::generateCableCovering); } + private static final OrePrefix[] wireSizes = { wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; - private static final OrePrefix[] wireSizes = {wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex}; public static void processWireSingle(OrePrefix wirePrefix, Material material, WireProperties property) { - OrePrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : material.hasProperty(PropertyKey.GEM) ? gem : dust; + OrePrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : + material.hasProperty(PropertyKey.GEM) ? gem : dust; EXTRUDER_RECIPES.recipeBuilder() .input(prefix, material) @@ -102,7 +102,6 @@ public static void processWireSingle(OrePrefix wirePrefix, Material material, Wi } public static void generateCableCovering(OrePrefix wirePrefix, Material material, WireProperties property) { - // Superconductors have no Cables, so exit early if (property.isSuperconductor()) return; @@ -166,7 +165,8 @@ public static void generateCableCovering(OrePrefix wirePrefix, Material material .buildAndRegister(); } - private static void generateManualRecipe(OrePrefix wirePrefix, Material material, OrePrefix cablePrefix, int cableAmount) { + private static void generateManualRecipe(OrePrefix wirePrefix, Material material, OrePrefix cablePrefix, + int cableAmount) { int insulationAmount = INSULATION_AMOUNT.get(cablePrefix); Object[] ingredients = new Object[insulationAmount + 1]; ingredients[0] = new UnificationEntry(wirePrefix, material); @@ -175,8 +175,7 @@ private static void generateManualRecipe(OrePrefix wirePrefix, Material material } ModHandler.addShapelessRecipe(String.format("%s_cable_%d", material, cableAmount), OreDictUnifier.get(cablePrefix, material), - ingredients - ); + ingredients); PACKER_RECIPES.recipeBuilder() .input(wirePrefix, material) diff --git a/src/main/java/gregtech/modules/BaseGregTechModule.java b/src/main/java/gregtech/modules/BaseGregTechModule.java index 139be22a2eb..ed4244abcbf 100644 --- a/src/main/java/gregtech/modules/BaseGregTechModule.java +++ b/src/main/java/gregtech/modules/BaseGregTechModule.java @@ -2,12 +2,14 @@ import gregtech.api.modules.IGregTechModule; import gregtech.api.util.GTUtility; + import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.Set; +import javax.annotation.Nonnull; + public abstract class BaseGregTechModule implements IGregTechModule { @Nonnull diff --git a/src/main/java/gregtech/modules/GregTechModules.java b/src/main/java/gregtech/modules/GregTechModules.java index 7a5ede9668a..9c07e90db26 100644 --- a/src/main/java/gregtech/modules/GregTechModules.java +++ b/src/main/java/gregtech/modules/GregTechModules.java @@ -11,9 +11,9 @@ public class GregTechModules implements IModuleContainer { // Integration modules public static final String MODULE_JEI = "jei_integration"; public static final String MODULE_TOP = "top_integration"; - public static final String MODULE_CT = "ct_integration"; + public static final String MODULE_CT = "ct_integration"; public static final String MODULE_GRS = "grs_integration"; - public static final String MODULE_OC = "oc_integration"; + public static final String MODULE_OC = "oc_integration"; public static final String MODULE_HWYLA = "hwyla_integration"; public static final String MODULE_BAUBLES = "baubles_integration"; public static final String MODULE_FR = "fr_integration"; diff --git a/src/main/java/gregtech/modules/ModuleManager.java b/src/main/java/gregtech/modules/ModuleManager.java index 8cf46d333ef..f5e8c4dc310 100644 --- a/src/main/java/gregtech/modules/ModuleManager.java +++ b/src/main/java/gregtech/modules/ModuleManager.java @@ -1,9 +1,8 @@ package gregtech.modules; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import gregtech.api.GTValues; import gregtech.api.modules.*; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; @@ -11,6 +10,9 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.event.*; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -35,8 +37,7 @@ public class ModuleManager implements IModuleManager { private final Logger logger = LogManager.getLogger("GregTech Module Loader"); private Configuration config; - private ModuleManager() { - } + private ModuleManager() {} public static ModuleManager getInstance() { return INSTANCE; @@ -50,7 +51,8 @@ public boolean isModuleEnabled(ResourceLocation id) { public boolean isModuleEnabled(IGregTechModule module) { GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); String comment = getComment(module); - Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, annotation.containerID() + ":" + annotation.moduleID(), true, comment); + Property prop = getConfiguration().get(MODULE_CFG_CATEGORY_NAME, + annotation.containerID() + ":" + annotation.moduleID(), true, comment); return prop.getBoolean(); } @@ -80,13 +82,13 @@ public void registerContainer(IModuleContainer container) { } public void setup(ASMDataTable asmDataTable, File configDirectory) { - // find and register all containers registered with the @ModuleContainer annotation, then sort them by container name + // find and register all containers registered with the @ModuleContainer annotation, then sort them by container + // name discoverContainers(asmDataTable); containers = containers.entrySet().stream() .sorted(Map.Entry.comparingByKey()) .collect(Collectors.toMap( - Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new - )); + Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new)); currentStage = ModuleStage.M_SETUP; configFolder = new File(configDirectory, GTValues.MODID); @@ -265,7 +267,8 @@ private void configureModules(Map> modules) { GregTechModule annotation = module.getClass().getAnnotation(GregTechModule.class); String moduleID = annotation.moduleID(); toLoad.remove(new ResourceLocation(moduleID)); - logger.info("Module {} is missing at least one of module dependencies: {}, skipping loading...", moduleID, dependencies); + logger.info("Module {} is missing at least one of module dependencies: {}, skipping loading...", + moduleID, dependencies); } } } while (changed); @@ -334,7 +337,8 @@ private List getInstances(ASMDataTable table) { logger.error("Could not initialize module " + moduleID, e); } } else { - logger.info("Module {} is missing at least one of mod dependencies: {}, skipping loading...", moduleID, modDependencies); + logger.info("Module {} is missing at least one of mod dependencies: {}, skipping loading...", moduleID, + modDependencies); } } return instances.stream().sorted((m1, m2) -> { diff --git a/src/main/java/gregtech/tools/ToolsModule.java b/src/main/java/gregtech/tools/ToolsModule.java index d625768caec..8114b4c4628 100644 --- a/src/main/java/gregtech/tools/ToolsModule.java +++ b/src/main/java/gregtech/tools/ToolsModule.java @@ -7,23 +7,25 @@ import gregtech.modules.GregTechModules; import gregtech.tools.enchants.EnchantmentEnderDamage; import gregtech.tools.enchants.EnchantmentHardHammer; + import net.minecraft.enchantment.Enchantment; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + @GregTechModule( - moduleID = GregTechModules.MODULE_TOOLS, - containerID = GTValues.MODID, - name = "GregTech Tools", - description = "GregTech Tools Module. Cannot be disabled for now." -) + moduleID = GregTechModules.MODULE_TOOLS, + containerID = GTValues.MODID, + name = "GregTech Tools", + description = "GregTech Tools Module. Cannot be disabled for now.") public class ToolsModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Tools"); diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java index d225b74f40b..e1054198f71 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java @@ -1,6 +1,7 @@ package gregtech.tools.enchants; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.entity.Entity; @@ -20,7 +21,7 @@ public class EnchantmentEnderDamage extends Enchantment { public static final EnchantmentEnderDamage INSTANCE = new EnchantmentEnderDamage(); private EnchantmentEnderDamage() { - super(Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND}); + super(Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); this.setRegistryName(GTUtility.gregtechId("disjunction")); this.setName("disjunction"); } @@ -43,9 +44,13 @@ public int getMaxLevel() { @Override public void onEntityDamaged(@Nonnull EntityLivingBase user, @Nonnull Entity target, int level) { String entityName = EntityList.getEntityString(target); - if (target instanceof EntityLivingBase && (target instanceof EntityEnderman || target instanceof EntityDragon || target instanceof EntityEndermite || (entityName != null && entityName.toLowerCase().contains("ender")))) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7))); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, level * 200, Math.max(1, (5 * level) / 7))); + if (target instanceof EntityLivingBase && (target instanceof EntityEnderman || target instanceof EntityDragon || + target instanceof EntityEndermite || + (entityName != null && entityName.toLowerCase().contains("ender")))) { + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7))); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, level * 200, Math.max(1, (5 * level) / 7))); } } } diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java index 4539af8950a..b2e7806d42c 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java @@ -2,6 +2,7 @@ import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.util.GTUtility; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.init.Enchantments; @@ -15,7 +16,7 @@ public class EnchantmentHardHammer extends Enchantment { public static final EnchantmentHardHammer INSTANCE = new EnchantmentHardHammer(); private EnchantmentHardHammer() { - super(Rarity.UNCOMMON, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND}); + super(Rarity.UNCOMMON, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); this.setRegistryName(GTUtility.gregtechId("hard_hammer")); this.setName("hard_hammer"); } @@ -36,9 +37,9 @@ public int getMaxLevel() { @Override public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack) { - return super.canApplyAtEnchantingTable(stack) - && stack.getItem().getToolClasses(stack).contains(ToolClasses.PICKAXE) - && !stack.getItem().getToolClasses(stack).contains(ToolClasses.HARD_HAMMER); + return super.canApplyAtEnchantingTable(stack) && + stack.getItem().getToolClasses(stack).contains(ToolClasses.PICKAXE) && + !stack.getItem().getToolClasses(stack).contains(ToolClasses.HARD_HAMMER); } @Override @@ -46,4 +47,3 @@ protected boolean canApplyTogether(@Nonnull Enchantment ench) { return super.canApplyTogether(ench) && ench != Enchantments.SILK_TOUCH && ench != Enchantments.FORTUNE; } } - diff --git a/src/test/java/gregtech/Bootstrap.java b/src/test/java/gregtech/Bootstrap.java index 03484fbc012..6993ca15851 100644 --- a/src/test/java/gregtech/Bootstrap.java +++ b/src/test/java/gregtech/Bootstrap.java @@ -10,6 +10,7 @@ import gregtech.common.items.MetaItems; import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.modules.ModuleManager; + import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.Locale; import net.minecraft.network.INetHandler; @@ -48,7 +49,8 @@ public static void perform() { deobfuscatedEnvironment.setAccessible(true); deobfuscatedEnvironment.setBoolean(null, true); - Method setLocale = I18n.class.getDeclaredMethod("setLocale", Locale.class); // No need to care about obfuscation + Method setLocale = I18n.class.getDeclaredMethod("setLocale", Locale.class); // No need to care about + // obfuscation setLocale.setAccessible(true); setLocale.invoke(null, new Locale()); @@ -168,7 +170,8 @@ public INetHandler getClientPlayHandler() { } @Override - public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set channelSet, String channel, Side side) { + public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set channelSet, + String channel, Side side) { throw new UnsupportedOperationException(); } diff --git a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java index ecd26210a42..68ae9384de7 100644 --- a/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java @@ -10,9 +10,11 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.world.DummyWorld; import gregtech.common.metatileentities.MetaTileEntities; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -28,7 +30,6 @@ public static void bootstrap() { @Test public void trySearchNewRecipe() { - World world = DummyWorld.INSTANCE; // Create an empty recipe map to work with @@ -40,13 +41,12 @@ public void trySearchNewRecipe() { new SimpleRecipeBuilder().EUt(30), false); - MetaTileEntity at = - MetaTileEntities.registerMetaTileEntity(190, - new SimpleMachineMetaTileEntity( - GTUtility.gregtechId("chemical_reactor.lv"), - map, - null, - 1, false)); + MetaTileEntity at = MetaTileEntities.registerMetaTileEntity(190, + new SimpleMachineMetaTileEntity( + GTUtility.gregtechId("chemical_reactor.lv"), + map, + null, + 1, false)); MetaTileEntity atte = new MetaTileEntityHolder().setMetaTileEntity(at); ((MetaTileEntityHolder) atte.getHolder()).setWorld(world); map.recipeBuilder() @@ -56,6 +56,7 @@ public void trySearchNewRecipe() { .buildAndRegister(); AbstractRecipeLogic arl = new AbstractRecipeLogic(atte, map) { + @Override protected long getEnergyInputPerSecond() { return Long.MAX_VALUE; diff --git a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java index 546e56c8d3d..51302795940 100644 --- a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java +++ b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java @@ -4,15 +4,18 @@ import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.GTValues.*; import static org.hamcrest.CoreMatchers.is; @@ -21,6 +24,7 @@ public class EnergyContainerListTest { @Nonnull private static MetaTileEntity createDummyMTE() { return new MetaTileEntity(new ResourceLocation("")) { + @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return null; diff --git a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java index ed636cfa186..2f0dcb3b8c5 100644 --- a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java +++ b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java @@ -4,18 +4,21 @@ import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.unification.material.Materials; import gregtech.api.util.OverlayedFluidHandler; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import static net.minecraftforge.fluids.FluidRegistry.LAVA; import static net.minecraftforge.fluids.FluidRegistry.WATER; @@ -30,61 +33,61 @@ public static void bootstrap() { public void testSimpleFills() { new FluidHandlerTester(false, new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1000) - .expectContents(new FluidStack(WATER, 1000)); + .beginSimulation() + .fill(WATER, 1000) + .expectContents(new FluidStack(WATER, 1000)); new FluidHandlerTester(false, new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999)) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000)); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999)) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000)); new FluidHandlerTester(false, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000), null); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000), null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 333), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 666), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 999), null) - .fill(WATER, 333) - .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 332)); + .beginSimulation() + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 333), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 666), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 999), null) + .fill(WATER, 333) + .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 332)); new FluidHandlerTester(false, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1500) - .expectContents(new FluidStack(WATER, 1000), null); + .beginSimulation() + .fill(WATER, 1500) + .expectContents(new FluidStack(WATER, 1000), null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 1500) - .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 500)); + .beginSimulation() + .fill(WATER, 1500) + .expectContents(new FluidStack(WATER, 1000), new FluidStack(WATER, 500)); } @Test @@ -93,60 +96,60 @@ public void testMultipleFluidFills() { new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 800) - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null) - .drain(WATER, 1000) - .expectContents( - null, - new FluidStack(LAVA, 800), - null) - .fill(LAVA, 800) - .expectContents( - null, - new FluidStack(LAVA, 1000), - null) - .fill(LAVA, 800) - .expectContents( - null, - new FluidStack(LAVA, 1000), - null); + .fill(WATER, 800) + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null) + .drain(WATER, 1000) + .expectContents( + null, + new FluidStack(LAVA, 800), + null) + .fill(LAVA, 800) + .expectContents( + null, + new FluidStack(LAVA, 1000), + null) + .fill(LAVA, 800) + .expectContents( + null, + new FluidStack(LAVA, 1000), + null); new FluidHandlerTester(true, new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 800) - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 600), - new FluidStack(LAVA, 800)) - .drain(WATER, 1600) - .expectContents( - null, - null, - new FluidStack(LAVA, 800)) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 600), - null, - new FluidStack(LAVA, 1000)) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 1000), - new FluidStack(LAVA, 400), - new FluidStack(LAVA, 1000)) - .fill(WATER, 69420) - .expectContents( - new FluidStack(LAVA, 1000), - new FluidStack(LAVA, 400), - new FluidStack(LAVA, 1000)); + .fill(WATER, 800) + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 600), + new FluidStack(LAVA, 800)) + .drain(WATER, 1600) + .expectContents( + null, + null, + new FluidStack(LAVA, 800)) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 600), + null, + new FluidStack(LAVA, 1000)) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 1000), + new FluidStack(LAVA, 400), + new FluidStack(LAVA, 1000)) + .fill(WATER, 69420) + .expectContents( + new FluidStack(LAVA, 1000), + new FluidStack(LAVA, 400), + new FluidStack(LAVA, 1000)); } @Test @@ -154,36 +157,34 @@ public void testMixedSameFluidFill() { new FluidHandlerTester(new FluidTankList(true, new FluidTankList(false, new FluidTank(1000), - new FluidTank(1000) - ), + new FluidTank(1000)), new FluidTank(1000), new FluidTank(1000))) // distinct slots first - .beginSimulation() - .fill(WATER, 800) - .fill(WATER, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - null, - new FluidStack(WATER, 1000), - new FluidStack(WATER, 400)); + .beginSimulation() + .fill(WATER, 800) + .fill(WATER, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + null, + new FluidStack(WATER, 1000), + new FluidStack(WATER, 400)); new FluidHandlerTester(new FluidTankList(false, new FluidTankList(true, new FluidTank(1000), - new FluidTank(1000) - ), + new FluidTank(1000)), new FluidTank(1000), new FluidTank(1000))) // non-distinct slots first - .beginSimulation() - .fill(WATER, 800) - .fill(WATER, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 1000), - new FluidStack(WATER, 400), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(WATER, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 1000), + new FluidStack(WATER, 400), + null); } @Test @@ -192,121 +193,122 @@ public void testDrain() { new FluidTank(1000), new FluidTank(1000), new FluidTank(1000)) - .fill(WATER, 1500) - .fill(LAVA, 500) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500), - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - new FluidStack(WATER, 500), - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - null, - new FluidStack(LAVA, 500)) - .drain(1000) - .expectContents( - null, - null, - null) - .fill(LAVA, 500) - .fill(WATER, 1500) - .expectContents( - new FluidStack(LAVA, 500), - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500)) - .drain(1000) - .expectContents( - null, - new FluidStack(WATER, 1000), - new FluidStack(WATER, 500)) - .drain(500) - .expectContents( - null, - new FluidStack(WATER, 500), - new FluidStack(WATER, 500)) - .drain(1000) - .expectContents( - null, - null, - null); + .fill(WATER, 1500) + .fill(LAVA, 500) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500), + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + new FluidStack(WATER, 500), + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + null, + new FluidStack(LAVA, 500)) + .drain(1000) + .expectContents( + null, + null, + null) + .fill(LAVA, 500) + .fill(WATER, 1500) + .expectContents( + new FluidStack(LAVA, 500), + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500)) + .drain(1000) + .expectContents( + null, + new FluidStack(WATER, 1000), + new FluidStack(WATER, 500)) + .drain(500) + .expectContents( + null, + new FluidStack(WATER, 500), + new FluidStack(WATER, 500)) + .drain(1000) + .expectContents( + null, + null, + null); } @Test public void testFilterOrdering() { SingleFluidFilter waterFilter = new SingleFluidFilter(new FluidStack(WATER, 1), false); SingleFluidFilter lavaFilter = new SingleFluidFilter(new FluidStack(LAVA, 1), false); - SingleFluidFilter creosoteFilter = new SingleFluidFilter(new FluidStack(Materials.Creosote.getFluid(), 1), false); + SingleFluidFilter creosoteFilter = new SingleFluidFilter(new FluidStack(Materials.Creosote.getFluid(), 1), + false); new FluidHandlerTester(false, new FilteredFluidHandler(1000).setFilter(waterFilter), new FilteredFluidHandler(1000).setFilter(lavaFilter), new FilteredFluidHandler(1000).setFilter(creosoteFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FilteredFluidHandler(1000).setFilter(lavaFilter), new FilteredFluidHandler(1000).setFilter(creosoteFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 1000), - new FluidStack(LAVA, 800), - null); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 1000), + new FluidStack(LAVA, 800), + null); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FluidTank(1000)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(WATER, 800), - new FluidStack(LAVA, 800)); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(WATER, 800), + new FluidStack(LAVA, 800)); new FluidHandlerTester(true, new FilteredFluidHandler(1000).setFilter(waterFilter), new FluidTank(1000)) - .beginSimulation() - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(WATER, 800), - new FluidStack(LAVA, 800)); + .beginSimulation() + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(WATER, 800), + new FluidStack(LAVA, 800)); new FluidHandlerTester(true, new FluidTank(1000), new FilteredFluidHandler(1000).setFilter(waterFilter)) - .beginSimulation() - .fill(WATER, 800) - .fill(LAVA, 800) - .expectContents( - new FluidStack(LAVA, 800), - new FluidStack(WATER, 800)); + .beginSimulation() + .fill(WATER, 800) + .fill(LAVA, 800) + .expectContents( + new FluidStack(LAVA, 800), + new FluidStack(WATER, 800)); new FluidHandlerTester(true, new FluidTank(1000), new FilteredFluidHandler(1000).setFilter(waterFilter)) - .beginSimulation() - .fill(LAVA, 800) - .fill(WATER, 800) - .expectContents( - new FluidStack(LAVA, 800), - new FluidStack(WATER, 800)); + .beginSimulation() + .fill(LAVA, 800) + .fill(WATER, 800) + .expectContents( + new FluidStack(LAVA, 800), + new FluidStack(WATER, 800)); } private static final class FluidHandlerTester { @@ -412,8 +414,9 @@ FluidHandlerTester expectContents(@Nonnull FluidStack... optionalFluidStacks) { if (!eq(tank.getFluid(), optionalFluidStacks[i])) { throw new AssertionError("Contents of the tank don't match expected state.\n" + "Expected: [\n " + Arrays.stream(optionalFluidStacks) - .map(FluidHandlerTester::ftos) - .collect(Collectors.joining(",\n ")) + "\n]\n" + + .map(FluidHandlerTester::ftos) + .collect(Collectors.joining(",\n ")) + + "\n]\n" + "Tank: " + this.tank.toString(true)); } } diff --git a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java index 5578234dad6..b229f1cc5e4 100644 --- a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java @@ -1,6 +1,5 @@ package gregtech.api.capability.impl; -import com.google.common.collect.ImmutableList; import gregtech.Bootstrap; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.metatileentity.MetaTileEntity; @@ -19,21 +18,25 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMaintenanceHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + +import com.google.common.collect.ImmutableList; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + import static gregtech.api.util.GTUtility.gregtechId; import static org.hamcrest.CoreMatchers.*; @@ -46,7 +49,6 @@ public static void bootstrap() { @Test public void trySearchNewRecipe() { - World world = DummyWorld.INSTANCE; // Create a recipe Map to be used for testing @@ -65,41 +67,39 @@ public void trySearchNewRecipe() { .blastFurnaceTemp(1) .buildAndRegister(); - RecipeMapMultiblockController mbt = - MetaTileEntities.registerMetaTileEntity(509, - new MetaTileEntityElectricBlastFurnace( - // super function calls the world, which equal null in test - gregtechId("electric_blast_furnace")) { - @Override - public boolean canBeDistinct() { - return false; - } - - @Override - public void reinitializeStructurePattern() { - - } - - // function checks for the temperature of the recipe against the coils - @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { - return true; - } - - // ignore maintenance problems - @Override - public boolean hasMaintenanceMechanics() { - return false; - } - - // ignore muffler outputs - @Override - public boolean hasMufflerMechanics() { - return false; - } - }); - - //isValid() check in the dirtying logic requires both a metatileentity and a holder + RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(509, + new MetaTileEntityElectricBlastFurnace( + // super function calls the world, which equal null in test + gregtechId("electric_blast_furnace")) { + + @Override + public boolean canBeDistinct() { + return false; + } + + @Override + public void reinitializeStructurePattern() {} + + // function checks for the temperature of the recipe against the coils + @Override + public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + return true; + } + + // ignore maintenance problems + @Override + public boolean hasMaintenanceMechanics() { + return false; + } + + // ignore muffler outputs + @Override + public boolean hasMufflerMechanics() { + return false; + } + }); + + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -118,8 +118,9 @@ public boolean hasMufflerMechanics() { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -131,6 +132,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -141,7 +143,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -152,7 +156,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, true) { + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, + true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -164,7 +170,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -219,7 +225,6 @@ protected IMultipleTankHandler getInputTank() { protected IMultipleTankHandler getOutputTank() { return importFluidBus.getExportFluids(); } - }; mbl.isOutputsFull = false; @@ -279,7 +284,6 @@ protected IMultipleTankHandler getOutputTank() { @Test public void trySearchNewRecipeDistinct() { - World world = DummyWorld.INSTANCE; // Create a recipe Map to be used for testing @@ -298,42 +302,38 @@ public void trySearchNewRecipeDistinct() { .blastFurnaceTemp(1) .buildAndRegister(); - RecipeMapMultiblockController mbt = - MetaTileEntities.registerMetaTileEntity(510, - new MetaTileEntityElectricBlastFurnace( - // super function calls the world, which equal null in test - gregtechId("electric_blast_furnace")) { - - @Override - public boolean hasMufflerMechanics() { - return false; - } - - // ignore maintenance problems - @Override - public boolean hasMaintenanceMechanics() { - return false; - } + RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(510, + new MetaTileEntityElectricBlastFurnace( + // super function calls the world, which equal null in test + gregtechId("electric_blast_furnace")) { + @Override + public boolean hasMufflerMechanics() { + return false; + } - @Override - public void reinitializeStructurePattern() { + // ignore maintenance problems + @Override + public boolean hasMaintenanceMechanics() { + return false; + } - } + @Override + public void reinitializeStructurePattern() {} - @Override - public boolean isDistinct() { - return true; - } + @Override + public boolean isDistinct() { + return true; + } - // function checks for the temperature of the recipe against the coils - @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { - return true; - } - }); + // function checks for the temperature of the recipe against the coils + @Override + public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + return true; + } + }); - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -352,9 +352,9 @@ public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -366,6 +366,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus importItemBus2 = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -377,6 +378,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -387,7 +389,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -398,7 +402,9 @@ public MultiblockControllerBase getController() { return mbt; } }; - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, true) { + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.lv"), 1, + true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -410,7 +416,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -474,7 +480,6 @@ protected List getInputBuses() { a.add(importItemBus2.getImportItems()); return a; } - }; MatcherAssert.assertThat(mbt.isDistinct(), is(true)); @@ -549,21 +554,21 @@ protected List getInputBuses() { @Test public void testMaintenancePenalties() { - TestableMaintenanceHatch maintenanceHatch = new TestableMaintenanceHatch(gregtechId("maintenance.hatch"), false); + TestableMaintenanceHatch maintenanceHatch = new TestableMaintenanceHatch(gregtechId("maintenance.hatch"), + false); RecipeMapMultiblockController mbt = MetaTileEntities.registerMetaTileEntity(508, new MetaTileEntityElectricBlastFurnace( // super function calls the world, which equal null in test gregtechId("electric_blast_furnace")) { + @Override public boolean canBeDistinct() { return false; } @Override - public void reinitializeStructurePattern() { - - } + public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override @@ -586,14 +591,14 @@ public boolean hasMufflerMechanics() { @Override public List getAbilities(MultiblockAbility ability) { if (ability == MultiblockAbility.MAINTENANCE_HATCH) { - //noinspection unchecked + // noinspection unchecked return (List) ImmutableList.of(maintenanceHatch); } return super.getAbilities(ability); } }); - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -614,8 +619,9 @@ public List getAbilities(MultiblockAbility ability) { maintenanceHatch.myController = mbt; - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -627,6 +633,7 @@ public MultiblockControllerBase getController() { } }; MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -638,7 +645,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); diff --git a/src/test/java/gregtech/api/recipes/RecipeMapTest.java b/src/test/java/gregtech/api/recipes/RecipeMapTest.java index 5c204db6bc6..4c158bee333 100644 --- a/src/test/java/gregtech/api/recipes/RecipeMapTest.java +++ b/src/test/java/gregtech/api/recipes/RecipeMapTest.java @@ -7,12 +7,14 @@ import gregtech.api.recipes.map.MapFluidIngredient; import gregtech.api.recipes.map.MapItemStackIngredient; import gregtech.api.recipes.map.MapOreDictIngredient; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.hamcrest.MatcherAssert; import org.hamcrest.core.IsNot; import org.junit.jupiter.api.BeforeAll; @@ -83,11 +85,13 @@ public void setupRecipes() { public void findRecipe() { MatcherAssert.assertThat(map.getRecipeList().size(), is(3)); - Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), Collections.singletonList(null)); + Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), + Collections.singletonList(null)); MatcherAssert.assertThat(r, notNullValue()); // This test is failing for me locally -dan - Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1))); + Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), + Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1))); MatcherAssert.assertThat(r2, notNullValue()); } @@ -99,8 +103,7 @@ public void findRecipeFluidOnly() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ); + NitrogenDioxide.getFluid(1000))); MatcherAssert.assertThat(r, notNullValue()); } @@ -111,8 +114,7 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ); + NitrogenDioxide.getFluid(1000))); MatcherAssert.assertThat(r, notNullValue()); assert map.removeRecipe(r); MatcherAssert.assertThat(map.findRecipe(30, @@ -120,16 +122,15 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)) - ), nullValue()); + NitrogenDioxide.getFluid(1000))), + nullValue()); MatcherAssert.assertThat(map.getRecipeList().size(), is(2)); } @Test public void recipeLookupIgnoresStackAmount() { MapItemStackIngredient ingFromStack = new MapItemStackIngredient( - new ItemStack(Blocks.COBBLESTONE), 0, null - ); + new ItemStack(Blocks.COBBLESTONE), 0, null); RecipeBuilder r = new RecipeBuilder<>() .inputs(new ItemStack(Blocks.COBBLESTONE)) @@ -138,8 +139,10 @@ public void recipeLookupIgnoresStackAmount() { .EUt(1).duration(1); Recipe rec = (Recipe) r.build().getResult(); - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); - MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(1)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(1)); MatcherAssert.assertThat(ingFromStack, equalTo(ing0FromGTRecipeInput)); MatcherAssert.assertThat(ingFromStack, equalTo(ing1FromGTRecipeInput)); @@ -150,8 +153,7 @@ public void recipeLookupIgnoresStackAmount() { @Test public void recipeLookupIgnoresFluidStackAmount() { MapFluidIngredient ingFromStack = new MapFluidIngredient( - new FluidStack(FluidRegistry.getFluid("water"), 1000) - ); + new FluidStack(FluidRegistry.getFluid("water"), 1000)); RecipeBuilder r = new RecipeBuilder<>() .fluidInputs(new FluidStack(FluidRegistry.getFluid("water"), 1000)) @@ -192,7 +194,8 @@ public void MapIngredientEquals() { .EUt(1).duration(1); Recipe rec = (Recipe) r.build().getResult(); - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); MapOreDictIngredient ing1FromGTRecipeInput = new MapOreDictIngredient(OreDictionary.getOreID("cobblestone")); MatcherAssert.assertThat(ing0FromGTRecipeInput, new IsNot<>(equalTo(ing1FromGTRecipeInput))); @@ -214,16 +217,19 @@ public void MapHashCollision() { Recipe rec = (Recipe) r.build().getResult(); - //create the MapItemStackIngredient and call hashCode so the hash cached to the "hash" field + // create the MapItemStackIngredient and call hashCode so the hash cached to the "hash" field - MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing0FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(0).getInputStacks()[0], rec.getInputs().get(0)); ing0FromGTRecipeInput.hashCode(); - MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing1FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(1).getInputStacks()[0], rec.getInputs().get(0)); ing1FromGTRecipeInput.hashCode(); - MapItemStackIngredient ing2FromGTRecipeInput = new MapItemStackIngredient(rec.getInputs().get(2).getInputStacks()[0], rec.getInputs().get(0)); + MapItemStackIngredient ing2FromGTRecipeInput = new MapItemStackIngredient( + rec.getInputs().get(2).getInputStacks()[0], rec.getInputs().get(0)); ing1FromGTRecipeInput.hashCode(); - //Reflection so the equals in AbstractMapIngredient doesn't return false due to anonymous class check failure + // Reflection so the equals in AbstractMapIngredient doesn't return false due to anonymous class check failure try { Field hash = AbstractMapIngredient.class.getDeclaredField("hash"); @@ -235,14 +241,14 @@ public void MapHashCollision() { throw new RuntimeException(e); } - //Add the cobblestone ingredients to the map, which should considered equals. + // Add the cobblestone ingredients to the map, which should considered equals. Object2ObjectOpenHashMap map = new Object2ObjectOpenHashMap<>(); map.put(ing0FromGTRecipeInput, ing0FromGTRecipeInput); map.put(ing1FromGTRecipeInput, ing1FromGTRecipeInput); MatcherAssert.assertThat(map.keySet().size(), is(1)); - //Add the stone, which is not equal and is a new key + // Add the stone, which is not equal and is a new key map.put(ing2FromGTRecipeInput, ing2FromGTRecipeInput); MatcherAssert.assertThat(map.keySet().size(), is(2)); diff --git a/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java b/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java index 09ec9255de6..f36cec796b5 100644 --- a/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java +++ b/src/test/java/gregtech/api/recipes/chance/boost/ChanceBoostTest.java @@ -3,9 +3,8 @@ import gregtech.api.GTValues; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.chance.ChanceEntry; -import gregtech.api.recipes.chance.boost.BoostableChanceEntry; -import gregtech.api.recipes.chance.boost.ChanceBoostFunction; import gregtech.api.recipes.chance.output.BoostableChanceOutput; + import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; @@ -23,7 +22,9 @@ public class ChanceBoostTest { private static final int RESULT_TWO_BOOST = BASE_AMOUNT + (BOOST_AMOUNT * 2); @SuppressWarnings("DataFlowIssue") - private static final BoostableChanceEntry CHANCE_ENTRY = new BoostableChanceOutput<>(null, BASE_AMOUNT, BOOST_AMOUNT) { + private static final BoostableChanceEntry CHANCE_ENTRY = new BoostableChanceOutput<>(null, BASE_AMOUNT, + BOOST_AMOUNT) { + @Override public @NotNull ChanceEntry copy() { return null; diff --git a/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java b/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java index 25e3ba87c46..4e6cbf026c9 100644 --- a/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java +++ b/src/test/java/gregtech/api/recipes/chance/output/ChancedOutputLogicTest.java @@ -1,8 +1,9 @@ package gregtech.api.recipes.chance.output; -import com.google.common.collect.ImmutableList; import gregtech.api.recipes.chance.ChanceEntry; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; + +import com.google.common.collect.ImmutableList; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; @@ -14,6 +15,7 @@ public class ChancedOutputLogicTest { private static class TestChancedOutput extends ChancedOutput { + public TestChancedOutput(@NotNull String ingredient, int chance) { super(ingredient, chance); } @@ -24,7 +26,8 @@ public TestChancedOutput(@NotNull String ingredient, int chance) { } } - private static > void listsMatch(@NotNull List original, @Nullable List rolled) { + private static > void listsMatch(@NotNull List original, + @Nullable List rolled) { MatcherAssert.assertThat(rolled, CoreMatchers.notNullValue()); MatcherAssert.assertThat(rolled.size(), CoreMatchers.is(original.size())); for (int i = 0; i < original.size(); i++) { @@ -37,8 +40,7 @@ public void testORLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.OR.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); listsMatch(chanceEntries, list); @@ -49,8 +51,7 @@ public void testANDLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", 0) - ); + new TestChancedOutput("c", 0)); List list = ChancedOutputLogic.AND.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.nullValue()); @@ -58,8 +59,7 @@ public void testANDLogic() { chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); list = ChancedOutputLogic.AND.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); listsMatch(chanceEntries, list); @@ -70,8 +70,7 @@ public void testXORLogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.XOR.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.notNullValue()); @@ -84,8 +83,7 @@ public void testNONELogic() { List chanceEntries = ImmutableList.of( new TestChancedOutput("a", ChancedOutputLogic.getMaxChancedValue()), new TestChancedOutput("b", ChancedOutputLogic.getMaxChancedValue()), - new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue()) - ); + new TestChancedOutput("c", ChancedOutputLogic.getMaxChancedValue())); List list = ChancedOutputLogic.NONE.roll(chanceEntries, ChanceBoostFunction.NONE, 0, 0); MatcherAssert.assertThat(list, CoreMatchers.nullValue()); diff --git a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java index 48f08df660b..13e03f3775f 100644 --- a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java @@ -22,21 +22,24 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.annotation.Nonnull; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import javax.annotation.Nonnull; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -73,9 +76,7 @@ public boolean canBeDistinct() { } @Override - public void reinitializeStructurePattern() { - - } + public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override @@ -91,11 +92,13 @@ public boolean hasMaintenanceMechanics() { }); try { - Field field = MetaTileEntityElectricBlastFurnace.class.getSuperclass().getDeclaredField("recipeMapWorkable"); + Field field = MetaTileEntityElectricBlastFurnace.class.getSuperclass() + .getDeclaredField("recipeMapWorkable"); field.setAccessible(true); Object recipeMapWorkableField = field.get(mbt); - Method setParallelLimitMethod = recipeMapWorkableField.getClass().getSuperclass().getSuperclass().getDeclaredMethod("setParallelLimit", int.class); + Method setParallelLimitMethod = recipeMapWorkableField.getClass().getSuperclass().getSuperclass() + .getDeclaredMethod("setParallelLimit", int.class); setParallelLimitMethod.setAccessible(true); setParallelLimitMethod.invoke(recipeMapWorkableField, 4); @@ -103,7 +106,7 @@ public boolean hasMaintenanceMechanics() { e.printStackTrace(); } - //isValid() check in the dirtying logic requires both a metatileentity and a holder + // isValid() check in the dirtying logic requires both a metatileentity and a holder try { Field field = MetaTileEntity.class.getDeclaredField("holder"); field.setAccessible(true); @@ -122,8 +125,9 @@ public boolean hasMaintenanceMechanics() { ((MetaTileEntityHolder) mbt.getHolder()).setWorld(world); - //Controller and isAttachedToMultiBlock need the world so we fake it here. + // Controller and isAttachedToMultiBlock need the world so we fake it here. importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -135,6 +139,7 @@ public MultiblockControllerBase getController() { } }; exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -146,6 +151,7 @@ public MultiblockControllerBase getController() { } }; importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -157,6 +163,7 @@ public MultiblockControllerBase getController() { } }; secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.zpm"), 7, false) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -168,6 +175,7 @@ public MultiblockControllerBase getController() { } }; exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.export.uhv"), 9, true) { + @Override public boolean isAttachedToMultiBlock() { return true; @@ -179,7 +187,7 @@ public MultiblockControllerBase getController() { } }; - //Controller is a private field but we need that information + // Controller is a private field but we need that information try { Field field = MetaTileEntityMultiblockPart.class.getDeclaredField("controllerTile"); field.setAccessible(true); @@ -196,7 +204,6 @@ public MultiblockControllerBase getController() { @Test public void findMultipliedRecipe_AtMaxParallelsTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(511); int parallelLimit = 4; @@ -223,31 +230,33 @@ public void findMultipliedRecipe_AtMaxParallelsTest() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), importFluidBus.getImportFluids(), + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(120)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); - - //Check the recipe inputs - //assertEquals(CountableIngredient.from(new ItemStack(Blocks.COBBLESTONE), 4), parallelRecipe.getInputs().get(0)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); + // Check the recipe inputs + // assertEquals(CountableIngredient.from(new ItemStack(Blocks.COBBLESTONE), 4), + // parallelRecipe.getInputs().get(0)); } @Test public void findMultipliedRecipe_LessThanMaxParallelsTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(512); int parallelLimit = 4; @@ -274,30 +283,32 @@ public void findMultipliedRecipe_LessThanMaxParallelsTest() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 2), false); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), importFluidBus.getImportFluids(), + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(60)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); - //Check the recipe inputs + // Check the recipe inputs MatcherAssert.assertThat(parallelRecipe.getInputs().get(0).getAmount(), is(2)); } @Test public void findMultipliedRecipe_FluidOnlyMaxParallelTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(519); int parallelLimit = 4; @@ -325,30 +336,32 @@ public void findMultipliedRecipe_FluidOnlyMaxParallelTest() { importFluidBus.getImportFluids().fill(Materials.Toluene.getFluid(4000), true); secondImportFluidBus.getImportFluids().fill(Materials.RawGasoline.getFluid(50000), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), tankHandler, - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), tankHandler, + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(1920)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(10)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getFluidOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(Materials.Gasoline.getFluid(44000).equals(parallelRecipe.getFluidOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(Materials.Gasoline.getFluid(44000).equals(parallelRecipe.getFluidOutputs().get(0)), + is(true)); } @Test public void findMultipliedRecipe_FluidOnlyLessThanMaxParallelTest() { - MetaTileEntityElectricBlastFurnace EBF = initEBF(520); int parallelLimit = 4; @@ -376,32 +389,34 @@ public void findMultipliedRecipe_FluidOnlyLessThanMaxParallelTest() { importFluidBus.getImportFluids().fill(Materials.Toluene.getFluid(2000), true); secondImportFluidBus.getImportFluids().fill(Materials.RawGasoline.getFluid(50000), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); - RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, importItemBus.getImportItems(), tankHandler, - exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, EBF); + RecipeBuilder parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, + importItemBus.getImportItems(), tankHandler, + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, + EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getEUt(), is(960)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(parallelRecipe.getDuration(), is(10)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getFluidOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(Materials.Gasoline.getFluid(22000).equals(parallelRecipe.getFluidOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(Materials.Gasoline.getFluid(22000).equals(parallelRecipe.getFluidOutputs().get(0)), + is(true)); } @Test public void findAppendedParallelItemRecipe_AtMaxParallelsTest() { MetaTileEntityElectricBlastFurnace EBF = initEBF(513); - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -429,26 +444,26 @@ public void findAppendedParallelItemRecipe_AtMaxParallelsTest() { RecipeBuilder parallelRecipe = logic.findAppendedParallelItemRecipe(map, importItemBus.getImportItems(), exportItemBus.getExportItems(), parallelLimit, 120, EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(4)); - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(parallelRecipe.getEUt(), is(30)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getDuration(), is(400)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 4), parallelRecipe.getOutputs().get(0)), is(true)); } @Test public void findAppendedParallelItemRecipe_LessThanMaxParallelsTest() { MetaTileEntityElectricBlastFurnace EBF = initEBF(514); - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -476,19 +491,20 @@ public void findAppendedParallelItemRecipe_LessThanMaxParallelsTest() { RecipeBuilder parallelRecipe = logic.findAppendedParallelItemRecipe(map, importItemBus.getImportItems(), exportItemBus.getExportItems(), parallelLimit, 120, EBF); - //Check if the correct number of parallels were done + // Check if the correct number of parallels were done MatcherAssert.assertThat(parallelRecipe.getParallel(), is(2)); - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(parallelRecipe.getEUt(), is(30)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(parallelRecipe.getDuration(), is(200)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(parallelRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat( + hashStrategy.equals(new ItemStack(Blocks.STONE, 2), parallelRecipe.getOutputs().get(0)), is(true)); } // An end-to-end test for finding parallel recipes @@ -499,6 +515,7 @@ public void findParallelRecipe_Test() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -548,22 +565,21 @@ public MetaTileEntity getMetaTileEntity() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 128, parallelLimit); - - //Check that the EUt of the recipe was multiplied correctly + // Check that the EUt of the recipe was multiplied correctly MatcherAssert.assertThat(outputRecipe.getEUt(), is(120)); - //Check if the recipe duration was not modified + // Check if the recipe duration was not modified MatcherAssert.assertThat(outputRecipe.getDuration(), is(100)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(outputRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), is(true)); - + MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), + is(true)); } // An end-to-end test for finding parallel recipes @@ -574,6 +590,7 @@ public void findParallelRecipe_FailingFromInputTest() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -621,10 +638,10 @@ public MetaTileEntity getMetaTileEntity() { IParallelableRecipeLogic logic = new ParallelableTestLogic(EBF, map, ParallelLogicType.MULTIPLY); // Don't populate the input bus, so the recipe will fail - //importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); + // importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 32, parallelLimit); MatcherAssert.assertThat(outputRecipe, nullValue()); @@ -638,6 +655,7 @@ public void findParallelRecipe_FailingFromOutputTest() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -690,8 +708,8 @@ public MetaTileEntity getMetaTileEntity() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK, 16), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.BONE_BLOCK, 16), false); - - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), Integer.MAX_VALUE, parallelLimit); MatcherAssert.assertThat(outputRecipe, nullValue()); @@ -704,6 +722,7 @@ public void applyParallelBonus_Test() { int parallelLimit = 4; MultiblockRecipeLogic mrl = new MultiblockRecipeLogic(mbt) { + @Override protected long getEnergyStored() { return Long.MAX_VALUE; @@ -753,20 +772,21 @@ public MetaTileEntity getMetaTileEntity() { // Initially populate the input bus importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), exportItemBus.getExportItems(), + Recipe outputRecipe = logic.findParallelRecipe(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), 128, parallelLimit); - - //Check that the EUt of the recipe was not modified + // Check that the EUt of the recipe was not modified MatcherAssert.assertThat(outputRecipe.getEUt(), is(1)); - //Check if the recipe duration was multiplied correctly + // Check if the recipe duration was multiplied correctly MatcherAssert.assertThat(outputRecipe.getDuration(), is(50)); - //Check the recipe outputs + // Check the recipe outputs MatcherAssert.assertThat(outputRecipe.getOutputs().isEmpty(), is(false)); - MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), is(true)); + MatcherAssert.assertThat(hashStrategy.equals(new ItemStack(Blocks.STONE, 4), outputRecipe.getOutputs().get(0)), + is(true)); } private static class ParallelableTestLogic implements IParallelableRecipeLogic { @@ -776,7 +796,8 @@ private static class ParallelableTestLogic implements IParallelableRecipeLogic { private final ParallelLogicType logicType; private final boolean enableBonusOverride; - public ParallelableTestLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, ParallelLogicType logicType) { + public ParallelableTestLogic(MetaTileEntity metaTileEntity, RecipeMap recipeMap, + ParallelLogicType logicType) { this(metaTileEntity, recipeMap, logicType, false); } diff --git a/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java b/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java index ac80de58ecb..d503cff24ea 100644 --- a/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java +++ b/src/test/java/gregtech/api/recipes/logic/OverclockingTest.java @@ -1,6 +1,5 @@ package gregtech.api.recipes.logic; - import org.junit.jupiter.api.Test; import static gregtech.api.GTValues.*; @@ -118,7 +117,8 @@ public void testHeatingCoilsDiffTemp() { final int machineTier = HV; // 1800K recipe, 1800K machine - int[] oc = testHeatingOC(recipeDuration, recipeTier, recipeVoltage, machineTier, (int) V[machineTier], 1800, 1800); + int[] oc = testHeatingOC(recipeDuration, recipeTier, recipeVoltage, machineTier, (int) V[machineTier], 1800, + 1800); // 0 EU discounts, 2 overclocks assertThat(oc[0], is(recipeVoltage * ((int) Math.pow(4, 2)))); @@ -170,12 +170,13 @@ public void testFusionReactor() { assertThat(oc[1], is(recipeDuration / ((int) Math.pow(2, 2)))); } - private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage) { + private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.standardOverclockingLogic( recipeVoltage, @@ -186,7 +187,8 @@ private static int[] testOC(int recipeDuration, int recipeTier, int recipeVoltag OverclockingLogic.STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } - private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage, + private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage, int recipeTemperature, int machineTemperature) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking @@ -194,7 +196,7 @@ private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recip recipeVoltage = OverclockingLogic.applyCoilEUtDiscount(recipeVoltage, machineTemperature, recipeTemperature); // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.heatingCoilOverclockingLogic( recipeVoltage, @@ -205,12 +207,13 @@ private static int[] testHeatingOC(int recipeDuration, int recipeTier, int recip recipeTemperature); } - private static int[] testFusionOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, int maxVoltage) { + private static int[] testFusionOC(int recipeDuration, int recipeTier, int recipeVoltage, int machineTier, + int maxVoltage) { int numberOfOCs = machineTier - recipeTier; if (recipeTier == ULV) numberOfOCs--; // no ULV overclocking // cannot overclock, so return the starting values - if (numberOfOCs <= 0) return new int[]{recipeVoltage, recipeDuration}; + if (numberOfOCs <= 0) return new int[] { recipeVoltage, recipeDuration }; return OverclockingLogic.standardOverclockingLogic( recipeVoltage, diff --git a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java index 3f1e5b89eac..06c0540d406 100644 --- a/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java @@ -17,9 +17,11 @@ import gregtech.common.metatileentities.electric.SimpleMachineMetaTileEntityResizable; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -33,9 +35,12 @@ public class ParallelLogicTest { MetaTileEntityItemBus importItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, false); MetaTileEntityItemBus exportItemBus = new MetaTileEntityItemBus(gregtechId("item_bus.export.lv"), 1, true); - MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false); - MetaTileEntityFluidHatch secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, false); - MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, true); + MetaTileEntityFluidHatch importFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false); + MetaTileEntityFluidHatch secondImportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + false); + MetaTileEntityFluidHatch exportFluidBus = new MetaTileEntityFluidHatch(gregtechId("fluid_hatch.import.lv"), 1, + true); @BeforeAll public static void bootstrap() { @@ -44,7 +49,6 @@ public static void bootstrap() { @Test public void getMaxRecipeMultiplier_ItemLimitTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -68,15 +72,14 @@ public void getMaxRecipeMultiplier_ItemLimitTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 3), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(3)); - } @Test public void getMaxRecipeMultiplier_FluidLimitTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -100,15 +103,14 @@ public void getMaxRecipeMultiplier_FluidLimitTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void getMaxRecipeMultiplier_LimitFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -132,15 +134,14 @@ public void getMaxRecipeMultiplier_LimitFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Naphtha.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void getMaxRecipeMultiplier_ItemFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -164,15 +165,14 @@ public void getMaxRecipeMultiplier_ItemFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void getMaxRecipeMultiplier_FluidFailureTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -196,15 +196,14 @@ public void getMaxRecipeMultiplier_FluidFailureTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Naphtha.getFluid(8000), true); - int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), importFluidBus.getImportFluids(), parallelLimit); + int itemRatio = ParallelLogic.getMaxRecipeMultiplier(recipe, importItemBus.getImportItems(), + importFluidBus.getImportFluids(), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void limitParallelByItems_MaxParallelTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -228,15 +227,14 @@ public void limitParallelByItems_MaxParallelTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(8000), true); - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByItems_LessThanMaxParallelsTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -264,16 +262,14 @@ public void limitParallelByItems_LessThanMaxParallelsTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.STONE, 62), false); - - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void limitParallelByItems_SplitAcrossStacksTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -301,16 +297,14 @@ public void limitParallelByItems_SplitAcrossStacksTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.STONE, 62), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.STONE, 62), false); - - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByItems_ItemOutputFullTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -340,15 +334,14 @@ public void limitParallelByItems_ItemOutputFullTest() { exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK), false); exportItemBus.getExportItems().insertItem(3, new ItemStack(Blocks.BONE_BLOCK), false); - int itemRatio = ParallelLogic.limitParallelByItems(recipe, new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByItems(recipe, + new OverlayedItemHandler(exportItemBus.getExportItems()), parallelLimit); assertThat(itemRatio, is(0)); - } @Test public void limitParallelByFluids_MaxParallelTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -370,15 +363,14 @@ public void limitParallelByFluids_MaxParallelTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(4)); - } @Test public void limitParallelByFluids_PartialParallelsTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -402,15 +394,14 @@ public void limitParallelByFluids_PartialParallelsTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); exportFluidBus.getExportFluids().fill(Materials.Acetone.getFluid(15800), true); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(2)); - } @Test public void limitParallelByFluids_FluidOutputFullTest() { - int parallelLimit = 4; // Create a recipe Map to be used for testing @@ -434,10 +425,10 @@ public void limitParallelByFluids_FluidOutputFullTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); exportFluidBus.getExportFluids().fill(Materials.Acetone.getFluid(16000), true); - int itemRatio = ParallelLogic.limitParallelByFluids(recipe, new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); + int itemRatio = ParallelLogic.limitParallelByFluids(recipe, + new OverlayedFluidHandler(exportFluidBus.getExportFluids()), parallelLimit); assertThat(itemRatio, is(0)); - } @Test @@ -485,7 +476,6 @@ public void getMaxRatioItem_SameNonConsumedTest() { recipe, parallelLimit); assertThat(thirdItemRatio, is(parallelLimit)); - } @Test @@ -513,12 +503,10 @@ public void getMaxRatioItem_DifferentNonConsumedTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 4), false); importItemBus.getImportItems().insertItem(1, new ItemStack(Blocks.STONE, 1), false); - int itemRatio = ParallelLogic.getMaxRatioItem(GTHashMaps.fromItemHandler(importItemBus.getImportItems()), recipe, parallelLimit); assertThat(itemRatio, is(4)); - } @Test @@ -544,12 +532,10 @@ public void getMaxRatioItem_OnlyNonConsumedTest() { importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.STONE, 1), false); - int itemRatio = ParallelLogic.getMaxRatioItem(GTHashMaps.fromItemHandler(importItemBus.getImportItems()), recipe, parallelLimit); assertThat(itemRatio, is(parallelLimit)); - } @Test @@ -597,7 +583,6 @@ public void getMaxRatioItem_OnlyNonConsumedWithStacksizeTest() { recipe, parallelLimit); assertThat(secondItemRatio, is(parallelLimit)); - } @Test @@ -624,7 +609,8 @@ public void getMaxRatioFluid_RegularFluidInputsTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -640,11 +626,11 @@ public void getMaxRatioFluid_RegularFluidInputsTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2500), true); - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -672,7 +658,8 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -688,7 +675,8 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2000), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -696,11 +684,11 @@ public void getMaxRatioFluid_SameNonConsumedTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Water.getFluid(2500), true); - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -728,7 +716,8 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Water.getFluid(1000), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); @@ -737,7 +726,8 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { importFluidBus.getImportFluids().fill(Materials.Water.getFluid(1000), true); secondImportFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(1), true); - IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), secondImportFluidBus.getImportFluids().getTankAt(0)); + IMultipleTankHandler tankHandler = new FluidTankList(false, importFluidBus.getImportFluids().getTankAt(0), + secondImportFluidBus.getImportFluids().getTankAt(0)); int fluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(tankHandler), recipe, parallelLimit); @@ -759,7 +749,6 @@ public void getMaxRatioFluid_DifferentNonConsumedTest() { recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -786,16 +775,17 @@ public void getMaxRatioFluid_OnlyNonConsumedTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(0), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); - // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(4), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -803,12 +793,11 @@ public void getMaxRatioFluid_OnlyNonConsumedTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(2500), true); - - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test @@ -835,16 +824,17 @@ public void getMaxRatioFluid_OnlyNonConsumedWithStacksizeTest() { // Test Not enough fluid for 1 parallel importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(500), true); - int fluidRatioFailure = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioFailure = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioFailure, is(0)); - // Test Parallel Limit Exactly equal inputs importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(500), true); - int fluidRatioExact = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int fluidRatioExact = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(fluidRatioExact, is(parallelLimit)); @@ -852,17 +842,15 @@ public void getMaxRatioFluid_OnlyNonConsumedWithStacksizeTest() { // Test Parallel Limit with > max parallels importFluidBus.getImportFluids().fill(Materials.Acetone.getFluid(2500), true); - - int secondFluidRatio = ParallelLogic.getMaxRatioFluid(GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), + int secondFluidRatio = ParallelLogic.getMaxRatioFluid( + GTHashMaps.fromFluidHandler(importFluidBus.getImportFluids()), recipe, parallelLimit); assertThat(secondFluidRatio, is(parallelLimit)); - } @Test public void doParallelRecipes_ExistingEUValueTest() { - int parallelAmount = 4; // Do not specify the EUt or duration to test how they are taken into account @@ -871,18 +859,21 @@ public void doParallelRecipes_ExistingEUValueTest() { .output(Items.CARROT) .build().getResult(); - SimpleMachineMetaTileEntityResizable macerator = MetaTileEntities.registerMetaTileEntity(1, new SimpleMachineMetaTileEntityResizable( - gregtechId("macerator"), - RecipeMaps.MACERATOR_RECIPES, - -1, - 4, - null, - GTValues.EV)); + SimpleMachineMetaTileEntityResizable macerator = MetaTileEntities.registerMetaTileEntity(1, + new SimpleMachineMetaTileEntityResizable( + gregtechId("macerator"), + RecipeMaps.MACERATOR_RECIPES, + -1, + 4, + null, + GTValues.EV)); macerator.getImportItems().setStackInSlot(0, new ItemStack(Blocks.STONE, 10)); - RecipeBuilder testMaceratorRecipe = doParallelRecipes(maceratorRecipe, RecipeMaps.MACERATOR_RECIPES, macerator.getImportItems(), - macerator.getImportFluids(), macerator.getExportItems(), macerator.getExportFluids(), parallelAmount, GTValues.V[GTValues.EV], macerator); + RecipeBuilder testMaceratorRecipe = doParallelRecipes(maceratorRecipe, RecipeMaps.MACERATOR_RECIPES, + macerator.getImportItems(), + macerator.getImportFluids(), macerator.getExportItems(), macerator.getExportFluids(), parallelAmount, + GTValues.V[GTValues.EV], macerator); assertThat(testMaceratorRecipe, notNullValue()); @@ -891,6 +882,5 @@ public void doParallelRecipes_ExistingEUValueTest() { // 150 is the default duration value assigned to macerator recipes when not specified assertThat(testMaceratorRecipe.getDuration(), is(150)); - } } diff --git a/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java b/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java index 8d4425973f4..e3daea5e015 100644 --- a/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java +++ b/src/test/java/gregtech/api/recipes/recipeproperties/RecipePropertyStorageTest.java @@ -12,6 +12,7 @@ import static org.hamcrest.CoreMatchers.is; public class RecipePropertyStorageTest { + private static final String propInt1Key = "propInt1"; private static final DefaultProperty propInt1 = new DefaultProperty<>(propInt1Key, Integer.class); @@ -49,7 +50,6 @@ public void storing_property_with_wrong_cast_fails() { MatcherAssert.assertThat(storage.store(wrongCast, "This is not int"), is(false)); } - @Test public void storing_property_without_value_fails() { MatcherAssert.assertThat(storage.store(propInt1, null), is(false)); @@ -57,23 +57,23 @@ public void storing_property_without_value_fails() { @Test public void get_size_returns_correct_value() { - storage.store(propInt1, 1); //succeeds + storage.store(propInt1, 1); // succeeds MatcherAssert.assertThat(storage.getSize(), is(1)); - storage.store(propInt2, 2); //succeeds + storage.store(propInt2, 2); // succeeds MatcherAssert.assertThat(storage.getSize(), is(2)); - storage.store(propInt1, 1); //fails + storage.store(propInt1, 1); // fails MatcherAssert.assertThat(storage.getSize(), is(2)); } @Test public void get_recipe_properties_returns_correct_value() { - storage.store(propInt1, 1); //succeeds - storage.store(propInt2, 2); //succeeds + storage.store(propInt1, 1); // succeeds + storage.store(propInt2, 2); // succeeds Map, Object> map = new HashMap<>(); map.put(propInt1, 1); @@ -83,13 +83,15 @@ public void get_recipe_properties_returns_correct_value() { Set, Object>> actualProperties = storage.getRecipeProperties(); MatcherAssert.assertThat(actualProperties.size(), is(2)); - MatcherAssert.assertThat(actualProperties.containsAll(expectedProperties) && expectedProperties.containsAll(actualProperties), is(true)); + MatcherAssert.assertThat( + actualProperties.containsAll(expectedProperties) && expectedProperties.containsAll(actualProperties), + is(true)); } @Test public void get_recipe_property_value_returns_correct_value_if_exists() { final int expectedValue = 1; - storage.store(propInt1, expectedValue); //succeeds + storage.store(propInt1, expectedValue); // succeeds int actual = storage.getRecipePropertyValue(propInt1, 0); @@ -99,7 +101,7 @@ public void get_recipe_property_value_returns_correct_value_if_exists() { @Test public void get_recipe_property_value_returns_default_value_if_does_not_exists() { final int expectedValue = 0; - storage.store(propInt1, 1); //succeeds + storage.store(propInt1, 1); // succeeds int actual = storage.getRecipePropertyValue(propInt2, expectedValue); @@ -107,10 +109,10 @@ public void get_recipe_property_value_returns_default_value_if_does_not_exists() } @Test - //CT way + // CT way public void get_recipe_property_keys() { - storage.store(propInt1, 1); //succeeds - storage.store(propInt2, 2); //succeeds + storage.store(propInt1, 1); // succeeds + storage.store(propInt2, 2); // succeeds Set expectedKeys = new HashSet<>(); expectedKeys.add(propInt1.getKey()); @@ -118,15 +120,16 @@ public void get_recipe_property_keys() { Set actualKeys = storage.getRecipePropertyKeys(); - MatcherAssert.assertThat(expectedKeys.containsAll(actualKeys) && actualKeys.containsAll(expectedKeys), is(true)); + MatcherAssert.assertThat(expectedKeys.containsAll(actualKeys) && actualKeys.containsAll(expectedKeys), + is(true)); } @Test - //CT way + // CT way public void get_raw_recipe_property_value_via_string_key() { final int expectedValue = 1; - storage.store(propInt1, expectedValue); //succeeds + storage.store(propInt1, expectedValue); // succeeds Object actualValue = storage.getRawRecipePropertyValue(propInt1.getKey()); diff --git a/src/test/java/gregtech/api/util/OreGlobTest.java b/src/test/java/gregtech/api/util/OreGlobTest.java index e76d72b1403..f9f888f02f2 100644 --- a/src/test/java/gregtech/api/util/OreGlobTest.java +++ b/src/test/java/gregtech/api/util/OreGlobTest.java @@ -8,6 +8,7 @@ import gregtech.common.covers.filter.oreglob.impl.OreGlobParser; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; + import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; import org.junit.jupiter.api.BeforeAll; @@ -34,20 +35,15 @@ public void compileTest() { append( match("dust"), everything(), - match("Gold") - ), + match("Gold")), and( append( match("plate"), - everything() - ), + everything()), not(append( everything(), match("Double"), - everything() - )) - ) - )); + everything()))))); assertCompile("1^2^3^4^5^!(1^2^3)", xor( @@ -59,9 +55,7 @@ public void compileTest() { not(xor( match("1"), match("2"), - match("3") - )) - )); + match("3"))))); assertCompile("(??***)(?*?*?****?*???*?)()()()", chars(10, true)); assertCompile("(?)(??)(??*)(??**)", chars(7, true)); @@ -74,30 +68,24 @@ public void compileTest() { not(append( match("a"), match("b"), - match("c") - ))); + match("c")))); assertCompile("!(a b c)", not(append( match("a"), match("b"), - match("c") - ))); + match("c")))); assertCompile("!(a b) c", append( not(append( match("a"), - match("b") - )), - match("c") - )); + match("b"))), + match("c"))); assertCompile("(!a b) c", append( not(append( match("a"), - match("b") - )), - match("c") - )); + match("b"))), + match("c"))); assertCompile("?*", nonempty()); assertCompile("!()", nonempty()); @@ -107,29 +95,24 @@ public void compileTest() { assertCompile("!(x) !(y)", or( not(match("x")), - not(match("y")) - )); + not(match("y")))); assertCompile("(a | b | !*)", or( match("a"), - match("b") - )); + match("b"))); assertCompile("(() | () | abc)", or( empty(), - match("abc") - )); + match("abc"))); assertCompile("((a | ()) | b | ())", or( or( match("a"), - empty() - ), - match("b") - )); + empty()), + match("b"))); assertCompile("(() | !())", everything()); @@ -139,20 +122,17 @@ public void compileTest() { assertCompile("((a | ()) | ())", or( match("a"), - empty() - )); + empty())); assertCompile("(a & b & *)", and( match("a"), - match("b") - )); + match("b"))); assertCompile("(a & b & !())", and( match("a"), - match("b") - )); + match("b"))); assertCompile("(a & b & !*)", nothing()); assertCompile("(() & ?)", nothing()); diff --git a/src/test/java/gregtech/api/util/SmallDigitsTest.java b/src/test/java/gregtech/api/util/SmallDigitsTest.java index 4a535744f71..e21e88bde84 100644 --- a/src/test/java/gregtech/api/util/SmallDigitsTest.java +++ b/src/test/java/gregtech/api/util/SmallDigitsTest.java @@ -20,7 +20,8 @@ public void testNoNesting() { @Test public void testNested() { - MatcherAssert.assertThat(SmallDigits.toSmallDownNumbers("(CuAu4)(ZnCu3)Fe2(Ni(AuAgCu3)Fe3)4"), is("(CuAu₄)(ZnCu₃)Fe₂(Ni(AuAgCu₃)Fe₃)₄")); + MatcherAssert.assertThat(SmallDigits.toSmallDownNumbers("(CuAu4)(ZnCu3)Fe2(Ni(AuAgCu3)Fe3)4"), + is("(CuAu₄)(ZnCu₃)Fe₂(Ni(AuAgCu₃)Fe₃)₄")); } @Test diff --git a/src/test/java/gregtech/api/util/TierByVoltageTest.java b/src/test/java/gregtech/api/util/TierByVoltageTest.java index 9035fb8796e..b0f75d0ac86 100644 --- a/src/test/java/gregtech/api/util/TierByVoltageTest.java +++ b/src/test/java/gregtech/api/util/TierByVoltageTest.java @@ -1,6 +1,5 @@ package gregtech.api.util; - import org.junit.jupiter.api.Test; import static gregtech.api.GTValues.*; diff --git a/src/test/java/gregtech/client/I18nTest.java b/src/test/java/gregtech/client/I18nTest.java index f3d6ea1f18f..c012116a581 100644 --- a/src/test/java/gregtech/client/I18nTest.java +++ b/src/test/java/gregtech/client/I18nTest.java @@ -1,7 +1,9 @@ package gregtech.client; import gregtech.Bootstrap; + import net.minecraft.client.resources.I18n; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java b/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java index 037ad8e6e04..b5402ff0afa 100644 --- a/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java +++ b/src/test/java/gregtech/common/covers/CoverFluidRegulatorTest.java @@ -3,12 +3,14 @@ import gregtech.Bootstrap; import gregtech.api.capability.impl.FluidHandlerProxy; import gregtech.api.capability.impl.FluidTankList; + import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -32,7 +34,6 @@ public static void bootstrap() { @Test public void doKeepExact_does_nothing_if_no_destination_tank_exists() { - // Create a regulator for testing with, and set it to "Keep Exact" mode CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; @@ -40,9 +41,8 @@ public void doKeepExact_does_nothing_if_no_destination_tank_exists() { FluidStack water = new FluidStack(FluidRegistry.WATER, 1234); // Source consists of only an output tank containing a bit of water - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, new FluidTank(water.copy(), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, new FluidTank(water.copy(), 64000))); // Tell it to keep exact from a machine with an empty fluid tank and null target fluid tank int amountTransferred = cfr.doKeepExact(1000, source, null, isWater, 1000); @@ -58,14 +58,12 @@ public void doKeepExact_moves_one_fluid_into_an_empty_tank() { FluidStack water = new FluidStack(FluidRegistry.WATER, 1234); - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, new FluidTank(water.copy(), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, new FluidTank(water.copy(), 64000))); // Dest consists of one empty input tank - IFluidHandler dest = - new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), - new FluidTankList(false)); + IFluidHandler dest = new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), + new FluidTankList(false)); // Tell it to keep exact from a machine with an empty fluid tank and no target fluid tank int amountTransferred = cfr.doKeepExact(1000, source, dest, isWater, 1000); @@ -79,14 +77,12 @@ public void doKeepExact_moves_only_as_much_fluid_as_exists_in_the_source() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy(new FluidTankList(false), - new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 1234), 64000))); + IFluidHandler source = new FluidHandlerProxy(new FluidTankList(false), + new FluidTankList(false, + new FluidTank(new FluidStack(FluidRegistry.WATER, 1234), 64000))); - IFluidHandler dest = - new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), - new FluidTankList(false)); + IFluidHandler dest = new FluidHandlerProxy(new FluidTankList(false, new FluidTank(64000)), + new FluidTankList(false)); int amountTransferred = cfr.doKeepExact(10000, source, dest, isWater, 10000); @@ -98,16 +94,14 @@ public void doKeepExact_moves_only_the_fluid_required_if_more_could_be_moved() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000)), new FluidTankList(false)); int amountTransferred = cfr.doKeepExact(10000, source, dest, isWater, 144); @@ -121,19 +115,17 @@ public void doKeepExact_moves_multiple_valid_fluids() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 100mB water, another with nothing - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), - new FluidTank(64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), + new FluidTank(64000)), new FluidTankList(false)); // accept any fluid this time @@ -148,8 +140,10 @@ public void doKeepExact_moves_multiple_valid_fluids() { IFluidTankProperties tank2 = dest.getTankProperties()[1]; MatcherAssert.assertThat(tank1.getContents(), notNullValue()); MatcherAssert.assertThat(tank2.getContents(), notNullValue()); - MatcherAssert.assertThat(tank1.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.WATER, 144)), is(true)); - MatcherAssert.assertThat(tank2.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.LAVA, 144)), is(true)); + MatcherAssert.assertThat(tank1.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.WATER, 144)), + is(true)); + MatcherAssert.assertThat(tank2.getContents().isFluidStackIdentical(new FluidStack(FluidRegistry.LAVA, 144)), + is(true)); } @Test @@ -159,15 +153,13 @@ public void doKeepExact_respects_transfer_limit_with_one_fluid() { cfr.transferMode = TransferMode.KEEP_EXACT; // One output tank full of water - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000))); // One input tank with nothing in it - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, new FluidTank(64000)), new FluidTankList(false)); @@ -184,19 +176,17 @@ public void doKeepExact_respects_transfer_limit_with_multiple_fluids() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 100mB water, another with nothing - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), - new FluidTank(64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 100), 64000), + new FluidTank(64000)), new FluidTankList(false)); // accept any fluid this time @@ -212,19 +202,17 @@ public void doKeepExact_does_nothing_if_levels_are_already_correct_in_dest() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 144mB water, another with 144mB lava - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 144), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 144), 64000)), new FluidTankList(false)); // accept any fluid this time @@ -240,19 +228,17 @@ public void doKeepExact_ignores_fluids_not_in_filter() { CoverFluidRegulator cfr = new CoverFluidRegulator(null, null, EnumFacing.UP, 0, 1000); cfr.transferMode = TransferMode.KEEP_EXACT; - IFluidHandler source = - new FluidHandlerProxy( + IFluidHandler source = new FluidHandlerProxy( new FluidTankList(false), new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); + new FluidTank(new FluidStack(FluidRegistry.WATER, 64000), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 64000), 64000))); // One tank with 144mB water, another with 100mB lava - IFluidHandler dest = - new FluidHandlerProxy( + IFluidHandler dest = new FluidHandlerProxy( new FluidTankList(false, - new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), - new FluidTank(new FluidStack(FluidRegistry.LAVA, 100), 64000)), + new FluidTank(new FluidStack(FluidRegistry.WATER, 144), 64000), + new FluidTank(new FluidStack(FluidRegistry.LAVA, 100), 64000)), new FluidTankList(false)); // accept any fluid this time diff --git a/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java b/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java index caa35b2a97a..48ef15749ab 100644 --- a/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java +++ b/src/test/java/gregtech/common/metatileentities/converter/ConverterTraitTest.java @@ -6,10 +6,12 @@ import gregtech.api.capability.IEnergyContainer; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; + import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; + import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -47,7 +49,8 @@ public void Test_FE_To_EU() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -71,7 +74,8 @@ public void Test_FE_To_EU_Off_Ratio() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -95,7 +99,8 @@ public void Test_Show_FE_Minimum() { converter_1A.setFeToEu(true); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -111,7 +116,8 @@ public void Test_EU_To_FE() { resetEnergyStorage(); converter_1A.setFeToEu(false); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.SOUTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.SOUTH); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH); MatcherAssert.assertThat(container, notNullValue()); MatcherAssert.assertThat(storage, notNullValue()); @@ -135,7 +141,8 @@ public void Test_No_Energy_Loss() { resetEnergyStorage(); converter_1A.setFeToEu(false); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.SOUTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.SOUTH); IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH); MatcherAssert.assertThat(container, notNullValue()); MatcherAssert.assertThat(storage, notNullValue()); @@ -185,7 +192,8 @@ public void Test_Non_Identical_Ratio_Configuration() { ConfigHolder.compat.energy.euToFeRatio = 1; IEnergyStorage storage = converter_1A.getCapability(CapabilityEnergy.ENERGY, EnumFacing.SOUTH); - IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, EnumFacing.NORTH); + IEnergyContainer container = converter_1A.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, + EnumFacing.NORTH); MatcherAssert.assertThat(storage, notNullValue()); MatcherAssert.assertThat(container, notNullValue()); @@ -207,7 +215,8 @@ public void Test_Non_Identical_Ratio_Configuration() { } private static void resetEnergyStorage() { - ((ConverterTraitTestWrapper) converter_1A.getCapability(GregtechCapabilities.CAPABILITY_CONVERTER, null)).drainStorage(); + ((ConverterTraitTestWrapper) converter_1A.getCapability(GregtechCapabilities.CAPABILITY_CONVERTER, null)) + .drainStorage(); FEStorage.extractEnergy(Integer.MAX_VALUE, false); EUStorage.removeEnergy(Long.MAX_VALUE); } @@ -230,9 +239,11 @@ protected ConverterTrait initializeTrait() { public T getCapability(Capability capability, EnumFacing side) { if (side == null) return (T) converterTrait; if (isFeToEu()) { - return (T) (side == getFrontFacing() ? converterTrait.getEnergyEUContainer() : converterTrait.getEnergyFEContainer()); + return (T) (side == getFrontFacing() ? converterTrait.getEnergyEUContainer() : + converterTrait.getEnergyFEContainer()); } - return (T) (side == getFrontFacing() ? converterTrait.getEnergyFEContainer() : converterTrait.getEnergyEUContainer()); + return (T) (side == getFrontFacing() ? converterTrait.getEnergyFEContainer() : + converterTrait.getEnergyEUContainer()); } @Override diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java b/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java index 6d8de9b7711..de9a1172121 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/PowerSubstationTest.java @@ -3,6 +3,7 @@ import gregtech.Bootstrap; import gregtech.api.metatileentity.multiblock.IBatteryData; import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation.PowerStationEnergyBank; + import org.hamcrest.Matcher; import org.hamcrest.MatcherAssert; import org.jetbrains.annotations.NotNull; diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java index 59c2cce0c07..3542313a3f0 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/HPCATest.java @@ -3,6 +3,7 @@ import gregtech.Bootstrap; import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA.HPCAGridHandler; import gregtech.common.metatileentities.multiblock.hpca.helper.HPCAHelper; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -38,7 +39,7 @@ public void Test_Edge_No_Computation() { assertThat(maxCWUt, is(0)); assertThat(upkeepEUt, is(32 * 4)); - assertThat(maxEUt, is (128 * 4)); + assertThat(maxEUt, is(128 * 4)); assertThat(maxCoolingDemand, is(0)); assertThat(maxCoolingAmount, is(4 * 4)); diff --git a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java index 9dbfc5e14fa..aa87f9254e8 100644 --- a/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java +++ b/src/test/java/gregtech/common/metatileentities/multiblock/hpca/helper/HPCAHelper.java @@ -16,7 +16,8 @@ public static HPCAGridHandler gridBuilder(UnaryOperator b) { return b.apply(new GridHandlerBuilder()).build(); } - public static IHPCAComputationProvider getComputation(int cwuPerTick, int coolingPerTick, int upkeepEUt, int maxEUt) { + public static IHPCAComputationProvider getComputation(int cwuPerTick, int coolingPerTick, int upkeepEUt, + int maxEUt) { return new HPCAComputationProviderTestImpl(upkeepEUt, maxEUt, cwuPerTick, coolingPerTick); } diff --git a/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java b/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java index 1ed28f5ea5e..6172b07d901 100644 --- a/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java +++ b/src/test/java/gregtech/common/metatileentities/storage/QuantumChestTest.java @@ -4,12 +4,14 @@ import gregtech.api.GTValues; import gregtech.api.util.GTUtility; import gregtech.api.util.world.DummyWorld; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -21,6 +23,7 @@ import static org.hamcrest.MatcherAssert.assertThat; public class QuantumChestTest { + private static ItemStack GRAVEL; private static ItemStack SAND; @@ -55,7 +58,8 @@ public void Test_Single_Insertion() { insertItem(combinedInventory, GRAVEL.copy(), false); int expected = 64; stack = exportItems.getStackInSlot(0); - reason = String.format("Got %d in the export slot when it should be %d", exportItems.getStackInSlot(0).getCount(), expected); + reason = String.format("Got %d in the export slot when it should be %d", + exportItems.getStackInSlot(0).getCount(), expected); assertThat(reason, stack.getCount(), is(expected)); stack = insertItem(combinedInventory, GRAVEL.copy(), true); @@ -64,7 +68,8 @@ public void Test_Single_Insertion() { insertItem(combinedInventory, GRAVEL.copy(), false); stack = virtualInventory.getStackInSlot(0); - reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), expected); + reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), + expected); assertThat(reason, stack.getCount(), is(expected)); stack = importItems.insertItem(0, SAND.copy(), true); @@ -76,7 +81,8 @@ public void Test_Single_Insertion() { assertThat(reason, !stack.isEmpty() && stack.isItemEqual(SAND)); stack = virtualInventory.getStackInSlot(0); - reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), expected); + reason = String.format("Got %d in the virtualized inventory when it should be %d", stack.getCount(), + expected); assertThat(reason, stack.getCount(), is(expected)); } } @@ -91,12 +97,15 @@ public void Test_Stack_In_Slot() { expected = 64; int exportCount = quantumChest.getExportItems().getStackInSlot(0).getCount(); - String reason = String.format("The combined count using the chest's handler and the export slot got %d, should've been %d", exportCount, expected); + String reason = String.format( + "The combined count using the chest's handler and the export slot got %d, should've been %d", + exportCount, expected); assertThat(reason, exportCount, is(expected)); expected = 192; int virtualizedAmount = itemInventory.getStackInSlot(0).getCount(); - reason = String.format("The virtualized amount in the chest's handler got %d, should've been %d", exportCount, expected); + reason = String.format("The virtualized amount in the chest's handler got %d, should've been %d", + exportCount, expected); assertThat(reason, virtualizedAmount, is(expected)); } } @@ -114,9 +123,9 @@ public void Test_Export_Checking() { insertItem(itemHandler, GRAVEL.copy(), false); - String reason = "The virtualized stack is not the same as the export slot!"; - boolean isEqual = ItemStack.areItemsEqual(export, quantumChest.virtualItemStack) && export.getMetadata() == quantumChest.virtualItemStack.getMetadata(); + boolean isEqual = ItemStack.areItemsEqual(export, quantumChest.virtualItemStack) && + export.getMetadata() == quantumChest.virtualItemStack.getMetadata(); assertThat(reason, isEqual, is(true)); } } @@ -186,9 +195,11 @@ public void Test_Voiding() { insertItem(quantumChest.getCombinedInventory(), stack, false); // UHV qchest stores exactly Integer.MAX_VALUE, so it will be 64 items less than expected - long transferred = quantumChest.getTier() == GTValues.UHV ? quantumChest.itemsStoredInside + 64 : quantumChest.itemsStoredInside; + long transferred = quantumChest.getTier() == GTValues.UHV ? quantumChest.itemsStoredInside + 64 : + quantumChest.itemsStoredInside; - assertThat(String.format("%s voided %s too early!", quantumChest.getMetaFullName(), stack), transferred == quantumChest.maxStoredItems); + assertThat(String.format("%s voided %s too early!", quantumChest.getMetaFullName(), stack), + transferred == quantumChest.maxStoredItems); quantumChest.setVoiding(true); ItemStack remainder = insertItem(quantumChest.getItemInventory(), stack, false); @@ -209,7 +220,8 @@ public void Test_Extraction() { int extractedCount = testAllSlots(quantumChest.getExportItems(), true); int expected = 64; - String reason = String.format("Quantum chest failed to insert %d items into export slot, actually was %d!", expected, extractedCount); + String reason = String.format("Quantum chest failed to insert %d items into export slot, actually was %d!", + expected, extractedCount); assertThat(reason, extractedCount, is(expected)); quantumChest.getExportItems().extractItem(0, 64, false); @@ -232,7 +244,8 @@ private static QuantumChestWrapper[] createInstances() { QuantumChestWrapper[] quantumChests = new QuantumChestWrapper[10]; for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - quantumChests[i] = new QuantumChestWrapper(gregtechId("super_chest." + voltageName), i + 1, 4000000L * (int) Math.pow(2, i)); + quantumChests[i] = new QuantumChestWrapper(gregtechId("super_chest." + voltageName), i + 1, + 4000000L * (int) Math.pow(2, i)); } for (int i = 5; i < quantumChests.length; i++) { @@ -252,6 +265,7 @@ private static int testAllSlots(IItemHandler handler, boolean simulate) { } private static class QuantumChestWrapper extends MetaTileEntityQuantumChest { + public QuantumChestWrapper(ResourceLocation metaTileEntityId, int tier, long maxStoredItems) { super(metaTileEntityId, tier, maxStoredItems); } diff --git a/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java b/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java index b2ae0c6c021..f79406525e5 100644 --- a/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java +++ b/src/test/java/gregtech/common/metatileentities/storage/QuantumTankTest.java @@ -2,6 +2,7 @@ import gregtech.Bootstrap; import gregtech.api.GTValues; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; @@ -9,6 +10,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -24,6 +26,7 @@ public class QuantumTankTest { private static FluidStack LAVA; private static ItemStack BUCKET_WATER; private static ItemStack BUCKET_LAVA; + @BeforeAll public static void bootstrap() { Bootstrap.perform(); @@ -65,7 +68,8 @@ public void Test_Voiding() { FluidStack resource = WATER.copy(); resource.amount = Integer.MAX_VALUE; int inserted = handler.fill(resource, true); - assertThat("Quantum Tank accepted too much fluid!", inserted == handler.getTankProperties()[0].getCapacity()); + assertThat("Quantum Tank accepted too much fluid!", + inserted == handler.getTankProperties()[0].getCapacity()); quantumTank.setVoiding(true); inserted = handler.fill(resource, true); @@ -100,7 +104,8 @@ private QuantumTankWrapper[] createInstances() { QuantumTankWrapper[] quantumTanks = new QuantumTankWrapper[10]; for (int i = 0; i < 5; i++) { String voltageName = GTValues.VN[i + 1].toLowerCase(); - quantumTanks[i] = new QuantumTankWrapper(gregtechId("super_tank." + voltageName), i + 1, 4000000 * (int) Math.pow(2, i)); + quantumTanks[i] = new QuantumTankWrapper(gregtechId("super_tank." + voltageName), i + 1, + 4000000 * (int) Math.pow(2, i)); } for (int i = 5; i < quantumTanks.length; i++) { @@ -141,14 +146,16 @@ private void fakeUpdate(boolean isRemote) { if (currentFluid == null) { // tank had fluid, but now is empty updatePreviousFluid(null); - } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && previousFluid.amount != currentFluid.amount) { - // tank has fluid with changed amount - previousFluid.amount = currentFluid.amount; - writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); - } else if (!previousFluid.equals(currentFluid)) { - // tank has a different fluid from before - updatePreviousFluid(currentFluid); - } + } else if (previousFluid.getFluid().equals(currentFluid.getFluid()) && + previousFluid.amount != currentFluid.amount) { + // tank has fluid with changed amount + previousFluid.amount = currentFluid.amount; + writeCustomData(UPDATE_FLUID_AMOUNT, buf -> buf.writeInt(currentFluid.amount)); + } else + if (!previousFluid.equals(currentFluid)) { + // tank has a different fluid from before + updatePreviousFluid(currentFluid); + } } } } From 5901bc912c9c3c5b03bf91747fff6c0276c3d773 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:11:52 -0600 Subject: [PATCH 13/77] Move to JetBrains annotations over findbugs (#2199) --- .editorconfig | 4 +- build.gradle | 6 +- dependencies.gradle | 4 +- .../api/block/BlockCustomParticle.java | 17 +-- .../api/block/BuiltInRenderBlock.java | 8 +- .../api/block/IHeatingCoilBlockStats.java | 6 +- .../api/block/UnlistedBooleanProperty.java | 10 +- .../api/block/UnlistedIntegerProperty.java | 10 +- .../api/block/UnlistedStringProperty.java | 8 +- .../api/block/VariantActiveBlock.java | 17 +-- .../java/gregtech/api/block/VariantBlock.java | 20 +-- .../gregtech/api/block/VariantItemBlock.java | 6 +- .../api/block/machines/BlockMachine.java | 132 +++++++++-------- .../api/block/machines/MachineItemBlock.java | 27 ++-- .../api/capability/IDataAccessHatch.java | 8 +- .../java/gregtech/api/capability/IFilter.java | 12 +- .../capability/IFilteredFluidContainer.java | 4 +- .../api/capability/IMultipleTankHandler.java | 18 +-- .../IOpticalComputationProvider.java | 10 +- .../api/capability/IPropertyFluidFilter.java | 4 +- .../capability/impl/AbstractRecipeLogic.java | 52 +++---- .../capability/impl/BoilerRecipeLogic.java | 20 +-- .../impl/CapabilityCompatProvider.java | 2 +- .../api/capability/impl/CleanroomLogic.java | 10 +- .../impl/CombinedCapabilityProvider.java | 10 +- .../capability/impl/CommonFluidFilters.java | 16 +- .../api/capability/impl/EUToFEProvider.java | 6 +- .../api/capability/impl/ElectricItem.java | 10 +- .../impl/EnergyContainerBatteryBuffer.java | 6 +- .../impl/EnergyContainerHandler.java | 10 +- .../capability/impl/EnergyContainerList.java | 8 +- .../capability/impl/FilteredFluidHandler.java | 6 +- .../capability/impl/FilteredItemHandler.java | 6 +- .../api/capability/impl/FluidDrillLogic.java | 10 +- .../capability/impl/FluidHandlerDelegate.java | 2 +- .../capability/impl/FluidHandlerProxy.java | 3 +- .../api/capability/impl/FluidTankList.java | 16 +- .../api/capability/impl/FuelRecipeLogic.java | 10 +- .../impl/GTFluidHandlerItemStack.java | 8 +- .../impl/GTSimpleFluidHandlerItemStack.java | 8 +- .../impl/GhostCircuitItemStackHandler.java | 20 +-- .../impl/HeatingCoilRecipeLogic.java | 8 +- .../capability/impl/ItemHandlerDelegate.java | 10 +- .../api/capability/impl/ItemHandlerList.java | 15 +- .../api/capability/impl/ItemHandlerProxy.java | 10 +- .../api/capability/impl/MultiFluidFilter.java | 11 +- .../impl/MultiblockFuelRecipeLogic.java | 12 +- .../impl/MultiblockRecipeLogic.java | 14 +- .../capability/impl/PrimitiveRecipeLogic.java | 6 +- .../api/capability/impl/RecipeLogicSteam.java | 18 +-- .../capability/impl/SingleFluidFilter.java | 8 +- .../capability/impl/SteamMultiWorkable.java | 6 +- .../impl/SteamMultiblockRecipeLogic.java | 6 +- .../impl/VoidFluidHandlerItemStack.java | 6 +- .../api/capability/impl/miner/MinerLogic.java | 29 ++-- .../impl/miner/MultiblockMinerLogic.java | 14 +- .../api/damagesources/DamageSourceTool.java | 6 +- .../api/damagesources/DamageSources.java | 2 +- .../gregtech/api/fluids/GTFluidMaterial.java | 4 +- src/main/java/gregtech/api/gui/Widget.java | 3 +- .../api/gui/impl/ModularUIContainer.java | 27 ++-- .../api/gui/resources/ResourceHelper.java | 13 +- .../api/gui/widgets/AdvancedTextWidget.java | 9 +- .../api/gui/widgets/PhantomFluidWidget.java | 7 +- .../api/gui/widgets/PhantomSlotWidget.java | 7 +- .../api/gui/widgets/PhantomTankWidget.java | 9 +- .../api/gui/widgets/SliderWidget.java | 7 +- .../gregtech/api/gui/widgets/SlotWidget.java | 21 ++- .../gregtech/api/gui/widgets/TankWidget.java | 3 +- .../api/gui/widgets/TextFieldWidget2.java | 3 +- .../api/items/armor/ArmorLogicSuite.java | 6 +- .../api/items/armor/ArmorMetaItem.java | 49 +++---- .../gregtech/api/items/armor/ArmorUtils.java | 9 +- .../gregtech/api/items/armor/IArmorLogic.java | 3 +- .../api/items/armor/ISpecialArmorLogic.java | 8 +- .../behavior/MonitorPluginBaseBehavior.java | 7 +- .../InaccessibleItemStackHandler.java | 10 +- .../items/materialitem/MetaPrefixItem.java | 33 ++--- .../items/metaitem/FilteredFluidStats.java | 2 +- .../api/items/metaitem/FoodStats.java | 4 +- .../gregtech/api/items/metaitem/MetaItem.java | 89 ++++++------ .../items/metaitem/stats/IFoodBehavior.java | 4 +- .../items/metaitem/stats/IItemBehaviour.java | 5 +- .../stats/IItemDurabilityManager.java | 3 +- .../metaitem/stats/IItemHUDProvider.java | 4 +- .../gregtech/api/items/toolitem/IGTTool.java | 33 ++--- .../api/items/toolitem/ItemGTAxe.java | 115 ++++++++------- .../api/items/toolitem/ItemGTHoe.java | 117 ++++++++------- .../api/items/toolitem/ItemGTSword.java | 107 +++++++------- .../api/items/toolitem/ItemGTTool.java | 115 ++++++++------- .../api/items/toolitem/ToolBuilder.java | 11 +- .../api/items/toolitem/ToolHelper.java | 19 ++- .../items/toolitem/TreeFellingListener.java | 9 +- .../items/toolitem/aoe/AoESymmetrical.java | 3 +- .../toolitem/behavior/IToolBehavior.java | 42 +++--- .../api/metatileentity/IDataInfoProvider.java | 6 +- .../api/metatileentity/IVoidable.java | 4 +- .../metatileentity/MetaTileEntityHolder.java | 34 ++--- .../SimpleGeneratorMetaTileEntity.java | 7 +- .../SimpleMachineMetaTileEntity.java | 3 +- .../metatileentity/SteamMetaTileEntity.java | 3 +- .../metatileentity/TieredMetaTileEntity.java | 7 +- .../WorkableTieredMetaTileEntity.java | 7 +- .../multiblock/CleanroomType.java | 13 +- .../multiblock/DummyCleanroom.java | 14 +- .../multiblock/FuelMultiblockController.java | 6 +- .../multiblock/ICleanroomProvider.java | 4 +- .../multiblock/ICleanroomReceiver.java | 2 +- .../multiblock/IPassthroughHatch.java | 4 +- .../MultiMapMultiblockController.java | 3 +- .../multiblock/MultiblockControllerBase.java | 13 +- .../RecipeMapMultiblockController.java | 9 +- .../gregtech/api/modules/IGregTechModule.java | 9 +- .../gregtech/api/pattern/BlockPattern.java | 7 +- .../gregtech/api/pattern/BlockWorldState.java | 4 +- .../api/pattern/MultiblockShapeInfo.java | 6 +- .../api/pipenet/IBlockAppearance.java | 6 +- .../gregtech/api/pipenet/PipeNetWalker.java | 3 +- .../gregtech/api/pipenet/WorldPipeNet.java | 8 +- .../gregtech/api/pipenet/block/BlockPipe.java | 102 +++++++------ .../api/pipenet/block/ItemBlockPipe.java | 8 +- .../block/material/BlockMaterialPipe.java | 10 +- .../block/material/ItemBlockMaterialPipe.java | 6 +- .../material/TileEntityMaterialPipeBase.java | 12 +- .../longdist/BlockLongDistancePipe.java | 20 ++- .../longdist/LongDistancePipeType.java | 5 +- .../tile/PipeCoverableImplementation.java | 4 +- .../api/pipenet/tile/TileEntityPipeBase.java | 18 +-- .../gregtech/api/recipes/FluidCellInput.java | 2 +- .../java/gregtech/api/recipes/ModHandler.java | 66 ++++----- .../java/gregtech/api/recipes/Recipe.java | 17 +-- .../gregtech/api/recipes/RecipeBuilder.java | 14 +- .../java/gregtech/api/recipes/RecipeMap.java | 137 +++++++++--------- .../builders/AssemblyLineRecipeBuilder.java | 28 ++-- .../recipes/builders/BlastRecipeBuilder.java | 5 +- .../CircuitAssemblerRecipeBuilder.java | 4 +- .../recipes/builders/FusionRecipeBuilder.java | 5 +- .../builders/GasCollectorRecipeBuilder.java | 5 +- .../builders/ImplosionRecipeBuilder.java | 5 +- .../builders/ResearchRecipeBuilder.java | 6 +- .../UniversalDistillationRecipeBuilder.java | 2 +- .../recipes/category/GTRecipeCategory.java | 29 ++-- .../ingredients/GTRecipeFluidInput.java | 4 +- .../recipes/ingredients/GTRecipeInput.java | 3 +- .../recipes/ingredients/GTRecipeOreInput.java | 4 +- .../ingredients/IntCircuitIngredient.java | 4 +- .../ingredients/nbtmatch/NBTCondition.java | 4 +- .../ingredients/nbtmatch/NBTMatcher.java | 10 +- .../logic/IParallelableRecipeLogic.java | 40 ++--- .../api/recipes/logic/OverclockingLogic.java | 14 +- .../api/recipes/logic/ParallelLogic.java | 49 +++---- .../recipes/machines/IResearchRecipeMap.java | 12 +- .../machines/RecipeMapAssemblyLine.java | 19 ++- .../machines/RecipeMapFluidCanner.java | 4 +- .../machines/RecipeMapFormingPress.java | 4 +- .../recipes/machines/RecipeMapFurnace.java | 4 +- .../recipes/machines/RecipeMapScanner.java | 3 +- .../java/gregtech/api/recipes/map/Branch.java | 7 +- .../recipes/map/MapItemStackIngredient.java | 7 +- .../map/MapItemStackNBTIngredient.java | 7 +- .../recipes/map/MapOreDictNBTIngredient.java | 2 +- .../recipeproperties/CleanroomProperty.java | 8 +- .../recipeproperties/ResearchProperty.java | 6 +- .../ResearchPropertyData.java | 14 +- .../recipeproperties/ScanProperty.java | 4 +- .../recipeproperties/TemperatureProperty.java | 5 +- .../api/recipes/recipes/DummyRecipe.java | 10 +- .../api/terminal/TerminalRegistry.java | 8 +- .../terminal/hardware/HardwareProvider.java | 10 +- .../hardware/IHardwareCapability.java | 6 +- .../api/terminal/util/SearchEngine.java | 6 +- .../api/unification/OreDictUnifier.java | 23 ++- .../unification/material/MarkerMaterial.java | 4 +- .../api/unification/material/Material.java | 55 +++---- .../material/info/MaterialIconSet.java | 13 +- .../material/info/MaterialIconType.java | 23 ++- .../material/properties/BlastProperty.java | 5 +- .../material/properties/IngotProperty.java | 2 +- .../material/properties/OreProperty.java | 15 +- .../material/properties/RotorProperty.java | 4 +- .../registry/IMaterialRegistryManager.java | 20 +-- .../material/registry/MaterialRegistry.java | 12 +- .../api/unification/ore/StoneType.java | 5 +- .../unification/stack/EmptyVariantMap.java | 2 +- .../unification/stack/ItemAndMetadata.java | 14 +- .../api/unification/stack/ItemVariantMap.java | 18 +-- .../api/unification/stack/MaterialStack.java | 5 +- .../stack/MultiItemVariantMap.java | 3 +- .../stack/SingleItemVariantMap.java | 2 +- .../unification/stack/UnificationEntry.java | 4 +- .../stack/UnmodifiableSetViewVariantMap.java | 8 +- .../api/util/AssemblyLineManager.java | 25 ++-- .../gregtech/api/util/BaseCreativeTab.java | 6 +- .../java/gregtech/api/util/BlockUtility.java | 4 +- .../gregtech/api/util/DummyContainer.java | 4 +- src/main/java/gregtech/api/util/DyeUtil.java | 8 +- .../gregtech/api/util/EntityDamageUtil.java | 10 +- .../api/util/FluidTankSwitchShim.java | 2 +- .../api/util/GTControlledRegistry.java | 6 +- .../java/gregtech/api/util/GTHashMaps.java | 21 ++- .../java/gregtech/api/util/GTStringUtils.java | 12 +- .../gregtech/api/util/GTTransferUtils.java | 15 +- .../java/gregtech/api/util/GTUtility.java | 36 +++-- .../IFluidTankPropertiesHashStrategy.java | 5 +- .../api/util/ItemStackHashStrategy.java | 3 +- .../gregtech/api/util/LocalizationUtils.java | 6 +- .../java/gregtech/api/util/MCGuiUtil.java | 6 +- .../api/util/OverlayedFluidHandler.java | 14 +- .../api/util/OverlayedItemHandler.java | 16 +- .../java/gregtech/api/util/SlotDelegate.java | 26 ++-- .../java/gregtech/api/util/SmallDigits.java | 10 +- .../java/gregtech/api/util/TaskScheduler.java | 4 +- .../api/util/VirtualTankRegistry.java | 8 +- .../gregtech/api/util/oreglob/OreGlob.java | 23 ++- .../api/util/oreglob/OreGlobTextBuilder.java | 14 +- .../util/oreglob/OreGlobTextFormatting.java | 6 +- .../api/util/world/DummyChunkProvider.java | 9 +- .../api/util/world/DummySaveHandler.java | 36 ++--- .../gregtech/api/util/world/DummyWorld.java | 26 ++-- .../BedrockFluidVeinHandler.java | 14 +- .../BedrockFluidVeinSaveData.java | 6 +- .../bedrockFluids/ChunkPosDimension.java | 4 +- .../config/BedrockFluidDepositDefinition.java | 5 +- .../worldgen/config/IWorldgenDefinition.java | 5 +- .../api/worldgen/config/OreConfigUtils.java | 5 +- .../worldgen/config/OreDepositDefinition.java | 5 +- .../api/worldgen/config/WorldGenRegistry.java | 9 +- .../generator/GTWorldGenCapability.java | 10 +- .../gregtech/asm/GregTechLoadingPlugin.java | 4 +- .../java/gregtech/asm/hooks/BlockHooks.java | 4 +- .../gregtech/asm/hooks/RenderChunkHooks.java | 2 +- .../gregtech/asm/hooks/RenderItemHooks.java | 6 +- .../java/gregtech/asm/util/ObfMapping.java | 5 +- .../java/gregtech/client/ClientProxy.java | 5 +- .../client/event/ClientEventHandler.java | 7 +- .../client/event/FluidVisualHandler.java | 10 +- .../model/ActiveVariantBlockBakedModel.java | 13 +- .../model/BorderlessLampBakedModel.java | 4 +- .../client/model/EmissiveOreBakedModel.java | 4 +- .../gregtech/client/model/OreBakedModel.java | 9 +- .../client/model/SimpleStateMapper.java | 5 +- .../model/customtexture/CustomTexture.java | 7 +- .../CustomTextureBakedModel.java | 14 +- .../customtexture/CustomTextureModel.java | 37 +++-- .../CustomTextureModelHandler.java | 9 +- .../customtexture/MetadataSectionCTM.java | 7 +- .../client/model/lamp/LampBakedModel.java | 9 +- .../modelfactories/BakedModelHandler.java | 14 +- .../client/particle/GTBloomParticle.java | 6 +- .../client/particle/GTLaserBeamParticle.java | 19 ++- .../client/particle/GTNameTagParticle.java | 8 +- .../client/particle/GTOverheatParticle.java | 19 ++- .../gregtech/client/particle/GTParticle.java | 8 +- .../client/particle/GTParticleManager.java | 11 +- .../client/renderer/ICubeRenderer.java | 7 +- .../client/renderer/IRenderSetup.java | 6 +- .../renderer/handler/DynamiteRenderer.java | 6 +- .../renderer/handler/MetaTileEntityTESR.java | 10 +- .../renderer/handler/PortalRenderer.java | 8 +- .../client/renderer/pipe/CableRenderer.java | 3 +- .../renderer/pipe/FluidPipeRenderer.java | 3 +- .../renderer/pipe/ItemPipeRenderer.java | 3 +- .../renderer/pipe/OpticalPipeRenderer.java | 3 +- .../client/renderer/pipe/PipeRenderer.java | 3 +- .../cube/AlignedOrientedOverlayRenderer.java | 5 +- .../texture/cube/SimpleOverlayRenderer.java | 3 +- .../shader/postprocessing/BloomType.java | 4 +- .../client/utils/AdvCCRSConsumer.java | 11 +- .../client/utils/BloomEffectUtil.java | 33 ++--- .../client/utils/EffectRenderContext.java | 16 +- .../client/utils/FacadeBlockAccess.java | 22 +-- .../gregtech/client/utils/IBloomEffect.java | 6 +- .../gregtech/client/utils/RenderUtil.java | 7 +- .../client/utils/TrackedDummyWorld.java | 11 +- .../gregtech/common/ToolEventHandlers.java | 19 ++- .../gregtech/common/blocks/BlockAsphalt.java | 8 +- .../common/blocks/BlockBoilerCasing.java | 8 +- .../common/blocks/BlockBrittleCharcoal.java | 14 +- .../common/blocks/BlockCleanroomCasing.java | 24 ++- .../common/blocks/BlockCompressed.java | 23 +-- .../common/blocks/BlockFireboxCasing.java | 8 +- .../gregtech/common/blocks/BlockFrame.java | 51 +++---- .../common/blocks/BlockFusionCasing.java | 8 +- .../common/blocks/BlockGlassCasing.java | 21 ++- .../common/blocks/BlockGregStairs.java | 6 +- .../common/blocks/BlockHermeticCasing.java | 12 +- .../gregtech/common/blocks/BlockLamp.java | 30 ++-- .../common/blocks/BlockLampBorderless.java | 6 +- .../common/blocks/BlockMachineCasing.java | 13 +- .../common/blocks/BlockMaterialBase.java | 40 ++--- .../common/blocks/BlockMetalCasing.java | 8 +- .../common/blocks/BlockMultiblockCasing.java | 8 +- .../java/gregtech/common/blocks/BlockOre.java | 38 ++--- .../common/blocks/BlockSteamCasing.java | 17 +-- .../common/blocks/BlockSurfaceRock.java | 46 +++--- .../common/blocks/BlockTurbineCasing.java | 9 +- .../common/blocks/BlockWarningSign.java | 4 +- .../common/blocks/BlockWarningSign1.java | 4 +- .../gregtech/common/blocks/BlockWireCoil.java | 19 +-- .../common/blocks/MaterialItemBlock.java | 7 +- .../gregtech/common/blocks/MetaBlocks.java | 7 +- .../gregtech/common/blocks/OreItemBlock.java | 6 +- .../common/blocks/StoneVariantBlock.java | 29 ++-- .../common/blocks/foam/BlockFoam.java | 36 ++--- .../blocks/foam/BlockPetrifiedFoam.java | 6 +- .../blocks/properties/PropertyMaterial.java | 13 +- .../blocks/properties/PropertyStoneType.java | 11 +- .../common/blocks/wood/BlockGregPlanks.java | 4 +- .../common/blocks/wood/BlockGregWoodSlab.java | 28 ++-- .../common/blocks/wood/BlockRubberLeaves.java | 29 ++-- .../common/blocks/wood/BlockRubberLog.java | 10 +- .../blocks/wood/BlockRubberSapling.java | 32 ++-- .../gregtech/common/command/CommandHand.java | 14 +- .../common/command/CommandRecipeCheck.java | 11 +- .../common/command/CommandShaders.java | 12 +- .../command/worldgen/CommandWorldgen.java | 8 +- .../worldgen/CommandWorldgenReload.java | 12 +- .../gregtech/common/covers/CoverConveyor.java | 18 +-- .../common/covers/CoverFluidFilter.java | 7 +- .../common/covers/CoverItemFilter.java | 8 +- .../common/covers/CoverItemVoiding.java | 10 +- .../common/covers/CoverMachineController.java | 4 +- .../gregtech/common/covers/CoverPump.java | 8 +- .../common/covers/DistributionMode.java | 4 +- .../common/covers/ManualImportExportMode.java | 4 +- .../gregtech/common/covers/TransferMode.java | 4 +- .../gregtech/common/covers/VoidingMode.java | 4 +- .../detector/CoverDetectorEnergyAdvanced.java | 12 +- .../covers/filter/FluidFilterContainer.java | 6 +- .../covers/filter/ItemFilterContainer.java | 6 +- .../covers/filter/SimpleFluidFilter.java | 4 +- .../common/covers/filter/SmartItemFilter.java | 5 +- .../oreglob/impl/ImpossibleOreGlob.java | 8 +- .../filter/oreglob/impl/NodeOreGlob.java | 11 +- .../oreglob/impl/NodeVisualXMLHandler.java | 13 +- .../filter/oreglob/impl/NodeVisualizer.java | 2 +- .../filter/oreglob/impl/OreGlobParser.java | 4 +- .../filter/oreglob/node/AnyCharNode.java | 4 +- .../filter/oreglob/node/BranchNode.java | 6 +- .../covers/filter/oreglob/node/EmptyNode.java | 4 +- .../covers/filter/oreglob/node/ErrorNode.java | 6 +- .../filter/oreglob/node/EverythingNode.java | 4 +- .../covers/filter/oreglob/node/GroupNode.java | 4 +- .../covers/filter/oreglob/node/MatchNode.java | 4 +- .../filter/oreglob/node/OreGlobNode.java | 8 +- .../common/crafting/FacadeRecipe.java | 16 +- .../common/crafting/FluidReplaceRecipe.java | 14 +- .../crafting/GTFluidCraftingIngredient.java | 2 +- .../common/crafting/GTShapedOreRecipe.java | 7 +- .../common/crafting/GTShapelessOreRecipe.java | 7 +- .../ShapedOreEnergyTransferRecipe.java | 10 +- .../crafting/ToolHeadReplaceRecipe.java | 16 +- .../gui/widget/HighlightedTextField.java | 3 +- .../widget/appeng/slot/AEFluidConfigSlot.java | 7 +- .../widget/appeng/slot/AEItemConfigSlot.java | 7 +- .../craftingstation/ItemListGridWidget.java | 3 +- .../craftingstation/ItemListSlotWidget.java | 12 +- .../orefilter/ItemOreFilterTestSlot.java | 15 +- .../widget/orefilter/OreFilterTestSlot.java | 3 +- .../orefilter/OreGlobCompileStatusWidget.java | 4 +- .../gregtech/common/inventory/IItemList.java | 4 +- .../appeng/SerializableFluidList.java | 7 +- .../handlers/CycleItemStackHandler.java | 4 +- .../handlers/TapeItemStackHandler.java | 6 +- .../handlers/ToolItemStackHandler.java | 6 +- .../inventory/itemsource/ItemSources.java | 3 +- .../common/items/EnchantmentTableTweaks.java | 4 +- .../java/gregtech/common/items/ToolItems.java | 8 +- .../common/items/armor/AdvancedJetpack.java | 4 +- .../items/armor/AdvancedNanoMuscleSuite.java | 15 +- .../items/armor/AdvancedQuarkTechSuite.java | 15 +- .../gregtech/common/items/armor/IJetpack.java | 4 +- .../common/items/armor/IStepAssist.java | 4 +- .../gregtech/common/items/armor/Jetpack.java | 16 +- .../common/items/armor/NanoMuscleSuite.java | 12 +- .../items/armor/NightvisionGoggles.java | 8 +- .../common/items/armor/PowerlessJetpack.java | 25 ++-- .../common/items/armor/QuarkTechSuite.java | 12 +- .../AbstractMaterialPartBehavior.java | 6 +- .../items/behaviors/ColorSprayBehaviour.java | 3 +- .../items/behaviors/DataItemBehavior.java | 5 +- .../items/behaviors/FoamSprayerBehavior.java | 3 +- .../items/behaviors/ItemMagnetBehavior.java | 12 +- .../items/behaviors/LighterBehaviour.java | 15 +- .../behaviors/MultiblockBuilderBehavior.java | 6 +- .../behaviors/ProspectorScannerBehavior.java | 16 +- .../items/behaviors/TooltipBehavior.java | 8 +- .../items/behaviors/TricorderBehavior.java | 6 +- .../items/behaviors/TurbineRotorBehavior.java | 8 +- .../items/tool/BlockRotatingBehavior.java | 15 +- .../items/tool/DisableShieldBehavior.java | 12 +- .../items/tool/EntityDamageBehavior.java | 14 +- .../common/items/tool/GrassPathBehavior.java | 15 +- .../items/tool/HarvestCropsBehavior.java | 15 +- .../common/items/tool/HarvestIceBehavior.java | 12 +- .../common/items/tool/HoeGroundBehavior.java | 17 +-- .../common/items/tool/PlungerBehavior.java | 16 +- .../common/items/tool/RotateRailBehavior.java | 18 +-- .../common/items/tool/TorchPlaceBehavior.java | 18 +-- .../items/tool/TreeFellingBehavior.java | 12 +- .../MetaTileEntityClipboard.java | 6 +- .../converter/ConverterTrait.java | 8 +- .../converter/MetaTileEntityConverter.java | 3 +- .../electric/MetaTileEntityBatteryBuffer.java | 11 +- .../electric/MetaTileEntityBlockBreaker.java | 3 +- .../electric/MetaTileEntityCharger.java | 10 +- .../electric/MetaTileEntityDiode.java | 11 +- .../electric/MetaTileEntityFisher.java | 9 +- .../electric/MetaTileEntityGasCollector.java | 7 +- .../electric/MetaTileEntityHull.java | 13 +- .../electric/MetaTileEntityItemCollector.java | 3 +- .../MetaTileEntityMagicEnergyAbsorber.java | 3 +- .../electric/MetaTileEntityMiner.java | 15 +- .../electric/MetaTileEntityPump.java | 3 +- .../multi/MetaTileEntityCokeOven.java | 5 +- .../multi/MetaTileEntityCokeOvenHatch.java | 3 +- .../multi/MetaTileEntityLargeBoiler.java | 9 +- .../multi/MetaTileEntityMultiblockTank.java | 15 +- .../MetaTileEntityPrimitiveBlastFurnace.java | 5 +- .../MetaTileEntityPrimitiveWaterPump.java | 5 +- .../multi/MetaTileEntityPumpHatch.java | 3 +- .../multi/MetaTileEntityTankValve.java | 9 +- .../electric/MetaTileEntityAssemblyLine.java | 29 ++-- .../electric/MetaTileEntityCleanroom.java | 33 ++--- .../electric/MetaTileEntityCrackingUnit.java | 10 +- .../electric/MetaTileEntityDataBank.java | 17 +-- .../MetaTileEntityDistillationTower.java | 6 +- .../MetaTileEntityElectricBlastFurnace.java | 14 +- .../electric/MetaTileEntityFluidDrill.java | 9 +- .../electric/MetaTileEntityFusionReactor.java | 31 ++-- .../MetaTileEntityImplosionCompressor.java | 4 +- .../MetaTileEntityLargeChemicalReactor.java | 8 +- .../electric/MetaTileEntityLargeMiner.java | 12 +- .../electric/MetaTileEntityMultiSmelter.java | 12 +- .../MetaTileEntityProcessingArray.java | 13 +- .../electric/MetaTileEntityPyrolyseOven.java | 10 +- .../electric/MetaTileEntityVacuumFreezer.java | 4 +- .../MetaTileEntityCentralMonitor.java | 3 +- .../MetaTileEntityMonitorScreen.java | 8 +- .../MetaTileEntityLargeCombustionEngine.java | 8 +- .../generator/MetaTileEntityLargeTurbine.java | 8 +- .../MetaTileEntityAutoMaintenanceHatch.java | 3 +- ...etaTileEntityCleaningMaintenanceHatch.java | 7 +- .../MetaTileEntityComputationHatch.java | 11 +- .../MetaTileEntityDataAccessHatch.java | 15 +- .../MetaTileEntityEnergyHatch.java | 7 +- .../MetaTileEntityFluidHatch.java | 9 +- .../multiblockpart/MetaTileEntityItemBus.java | 9 +- .../MetaTileEntityMachineHatch.java | 13 +- .../MetaTileEntityMaintenanceHatch.java | 7 +- .../MetaTileEntityMufflerHatch.java | 3 +- .../MetaTileEntityMultiFluidHatch.java | 3 +- .../MetaTileEntityOpticalDataHatch.java | 13 +- .../MetaTileEntityPassthroughHatchFluid.java | 9 +- .../MetaTileEntityPassthroughHatchItem.java | 9 +- .../MetaTileEntityReservoirHatch.java | 7 +- .../MetaTileEntityRotorHolder.java | 15 +- .../appeng/ExportOnlyAESlot.java | 3 +- .../appeng/MetaTileEntityAEHostablePart.java | 9 +- .../appeng/MetaTileEntityMEInputBus.java | 29 ++-- .../appeng/MetaTileEntityMEInputHatch.java | 7 +- .../appeng/MetaTileEntityMEOutputBus.java | 17 +-- .../appeng/MetaTileEntityMEOutputHatch.java | 7 +- .../appeng/stack/WrappedFluidStack.java | 9 +- .../appeng/stack/WrappedItemStack.java | 11 +- .../steam/MetaTileEntitySteamGrinder.java | 11 +- .../multi/steam/MetaTileEntitySteamOven.java | 11 +- .../MetaTileEntityCharcoalPileIgniter.java | 23 ++- .../metatileentities/steam/SteamMiner.java | 7 +- .../steam/boiler/SteamBoiler.java | 7 +- .../steam/boiler/SteamCoalBoiler.java | 6 +- .../steam/boiler/SteamLavaBoiler.java | 9 +- .../MetaTileEntitySteamHatch.java | 3 +- .../MetaTileEntitySteamItemBus.java | 7 +- .../storage/CraftingRecipeMemory.java | 2 +- .../storage/MetaTileEntityBuffer.java | 3 +- .../storage/MetaTileEntityCrate.java | 3 +- .../storage/MetaTileEntityCreativeChest.java | 3 +- .../storage/MetaTileEntityCreativeEnergy.java | 3 +- .../storage/MetaTileEntityCreativeTank.java | 3 +- .../storage/MetaTileEntityDrum.java | 3 +- .../storage/MetaTileEntityLockedSafe.java | 8 +- .../MetaTileEntityLongDistanceEndpoint.java | 10 +- .../storage/MetaTileEntityQuantumChest.java | 19 ++- .../storage/MetaTileEntityQuantumTank.java | 7 +- .../storage/MetaTileEntityWorkbench.java | 6 +- .../common/pipelike/cable/BlockCable.java | 21 ++- .../common/pipelike/cable/Insulation.java | 4 +- .../pipelike/cable/net/EnergyNetWalker.java | 3 +- .../pipelike/cable/tile/TileEntityCable.java | 13 +- .../pipelike/fluidpipe/BlockFluidPipe.java | 17 +-- .../pipelike/fluidpipe/FluidPipeType.java | 4 +- .../MetaTileEntityLDFluidEndpoint.java | 3 +- .../pipelike/fluidpipe/net/PipeTankList.java | 8 +- .../pipelike/itempipe/BlockItemPipe.java | 11 +- .../pipelike/itempipe/ItemPipeType.java | 4 +- .../MetaTileEntityLDItemEndpoint.java | 11 +- .../pipelike/itempipe/net/ItemNetHandler.java | 11 +- .../pipelike/itempipe/net/ItemNetWalker.java | 4 +- .../pipelike/itempipe/net/ItemRoutePath.java | 8 +- .../itempipe/tile/TileEntityItemPipe.java | 3 +- .../common/pipelike/laser/BlockLaserPipe.java | 17 +-- .../pipelike/laser/net/LaserNetHandler.java | 6 +- .../pipelike/laser/net/LaserPipeNet.java | 3 +- .../pipelike/laser/net/LaserRoutePath.java | 10 +- .../pipelike/laser/net/WorldLaserPipeNet.java | 6 +- .../pipelike/optical/BlockOpticalPipe.java | 25 ++-- .../pipelike/optical/OpticalPipeType.java | 4 +- .../optical/net/OpticalNetHandler.java | 26 ++-- .../optical/net/OpticalNetWalker.java | 2 +- .../pipelike/optical/net/OpticalPipeNet.java | 3 +- .../optical/net/OpticalRoutePath.java | 8 +- .../optical/net/WorldOpticalPipeNet.java | 6 +- .../optical/tile/TileEntityOpticalPipe.java | 14 +- .../app/prospector/ProspectingTexture.java | 4 +- .../app/prospector/ProspectorApp.java | 5 +- .../app/prospector/ProspectorMode.java | 6 +- .../widget/WidgetProspectingMap.java | 12 +- .../worldprospector/WorldProspectorARApp.java | 7 +- .../terminal/hardware/BatteryHardware.java | 10 +- .../worldgen/AbstractItemLootEntry.java | 7 +- .../common/worldgen/WorldGenRubberTree.java | 10 +- src/main/java/gregtech/core/CoreModule.java | 5 +- .../criterion/AbstractCriterion.java | 4 +- .../internal/AdvancementTrigger.java | 17 +-- .../command/internal/GregTechCommand.java | 13 +- .../internal/MaterialRegistryImpl.java | 16 +- .../internal/MaterialRegistryManager.java | 27 ++-- .../integration/IntegrationModule.java | 9 +- .../integration/IntegrationSubmodule.java | 7 +- .../integration/RecipeCompatUtil.java | 13 +- .../crafttweaker/CraftTweakerModule.java | 5 +- .../block/CTHeatingCoilBlockStats.java | 11 +- .../crafttweaker/recipe/CTNBTMatcher.java | 8 +- .../recipe/CTNBTMultiItemMatcher.java | 9 +- .../crafttweaker/recipe/CTRecipeBuilder.java | 21 ++- .../recipe/MetaTileEntityBracketHandler.java | 3 +- .../integration/ctm/IFacadeWrapper.java | 13 +- .../groovy/GroovyScriptModule.java | 7 +- .../hwyla/renderer/RendererOffsetString.java | 3 - .../jei/JustEnoughItemsModule.java | 9 +- .../jei/basic/BasicRecipeCategory.java | 17 +-- .../jei/basic/GTFluidVeinCategory.java | 15 +- .../integration/jei/basic/GTOreCategory.java | 11 +- .../jei/basic/MaterialTreeCategory.java | 13 +- .../jei/basic/OreByProductCategory.java | 15 +- .../multiblock/MultiblockInfoCategory.java | 15 +- .../MultiblockInfoRecipeWrapper.java | 20 +-- .../jei/recipe/FacadeRecipeWrapper.java | 3 +- .../jei/recipe/FacadeRegistryPlugin.java | 13 +- .../jei/recipe/GTRecipeWrapper.java | 13 +- .../jei/recipe/IntCircuitCategory.java | 5 +- .../jei/recipe/IntCircuitRecipeWrapper.java | 3 - .../jei/recipe/RecipeMapCategory.java | 25 ++-- .../jei/utils/AdvancedRecipeWrapper.java | 7 +- .../JEIResourceDepositCategoryUtils.java | 3 +- .../jei/utils/MachineSubtypeHandler.java | 7 +- .../jei/utils/MetaItemSubtypeHandler.java | 5 +- .../jei/utils/ModularUIGuiHandler.java | 19 ++- .../jei/utils/render/CompositeDrawable.java | 7 +- .../jei/utils/render/CompositeRenderer.java | 5 +- .../utils/render/FluidStackTextRenderer.java | 7 +- .../utils/render/ItemStackTextRenderer.java | 7 +- .../DriverRecipeMapMultiblockController.java | 7 +- .../provider/CapabilityInfoProvider.java | 9 +- .../provider/ControllableInfoProvider.java | 9 +- .../provider/ConverterInfoProvider.java | 9 +- .../provider/CoverInfoProvider.java | 41 +++--- .../provider/DiodeInfoProvider.java | 7 +- .../ElectricContainerInfoProvider.java | 11 +- .../theoneprobe/provider/LDPipeProvider.java | 9 +- .../provider/LaserContainerInfoProvider.java | 4 +- .../provider/MaintenanceInfoProvider.java | 5 +- .../provider/MultiRecipeMapInfoProvider.java | 11 +- .../provider/MultiblockInfoProvider.java | 11 +- .../provider/PrimitivePumpInfoProvider.java | 7 +- .../provider/RecipeLogicInfoProvider.java | 11 +- .../provider/TransformerInfoProvider.java | 7 +- .../provider/WorkableInfoProvider.java | 11 +- .../debug/DebugPipeNetInfoProvider.java | 7 +- .../java/gregtech/loaders/WoodTypeEntry.java | 61 ++++---- .../loaders/recipe/RecyclingRecipes.java | 9 +- .../loaders/recipe/WoodRecipeLoader.java | 8 +- .../handlers/MaterialRecipeHandler.java | 4 +- .../recipe/handlers/ToolRecipeHandler.java | 5 +- .../gregtech/modules/BaseGregTechModule.java | 6 +- src/main/java/gregtech/tools/ToolsModule.java | 7 +- .../enchants/EnchantmentEnderDamage.java | 4 +- .../tools/enchants/EnchantmentHardHammer.java | 6 +- .../impl/EnergyContainerListTest.java | 13 +- .../capability/impl/FluidTankListTest.java | 7 +- .../impl/MultiblockRecipeLogicTest.java | 9 +- .../logic/IParallelableRecipeLogicTest.java | 18 +-- src/test/java/jabel/TestModernJavaSyntax.java | 5 +- 594 files changed, 3351 insertions(+), 3676 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8df9e318396..14c3798da03 100644 --- a/.editorconfig +++ b/.editorconfig @@ -73,7 +73,7 @@ ij_java_case_statement_on_separate_line = true ij_java_catch_on_new_line = false ij_java_class_annotation_wrap = split_into_lines ij_java_class_brace_style = end_of_line -ij_java_class_count_to_use_import_on_demand = 5 +ij_java_class_count_to_use_import_on_demand = 999 ij_java_class_names_in_javadoc = 1 ij_java_deconstruction_list_wrap = normal ij_java_do_not_indent_top_level_class_members = false @@ -111,7 +111,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = *,|,javax.**,java.**,|,$* +ij_java_imports_layout = gregtech.**,|,net.**,|,codechickenlib.**,|,*,|,javax.**,java.**,|,$* ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true diff --git a/build.gradle b/build.gradle index 23915b84226..ddcf2f8fcdc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1699743071 +//version: 1700970468 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -501,8 +501,8 @@ dependencies { testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0" } - compileOnlyApi 'org.jetbrains:annotations:23.0.0' - annotationProcessor 'org.jetbrains:annotations:23.0.0' + compileOnlyApi 'org.jetbrains:annotations:24.1.0' + annotationProcessor 'org.jetbrains:annotations:24.1.0' patchedMinecraft('net.minecraft:launchwrapper:1.17.2') { transitive = false } diff --git a/dependencies.gradle b/dependencies.gradle index ffe5c4160cc..7325a64e96f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -58,8 +58,10 @@ minecraft { } configurations { - compileClassPath { + implementation { // exclude GNU trove, FastUtil is superior and still updated exclude group: "net.sf.trove4j", module: "trove4j" + // exclude javax.annotation from findbugs, jetbrains annotations are superior + exclude group: "com.google.code.findbugs", module: "jsr305" } } diff --git a/src/main/java/gregtech/api/block/BlockCustomParticle.java b/src/main/java/gregtech/api/block/BlockCustomParticle.java index a1f7d937be7..0b0457e08b6 100644 --- a/src/main/java/gregtech/api/block/BlockCustomParticle.java +++ b/src/main/java/gregtech/api/block/BlockCustomParticle.java @@ -22,8 +22,7 @@ import codechicken.lib.vec.Vector3; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class BlockCustomParticle extends Block implements ICustomParticleBlock { @@ -40,8 +39,8 @@ public BlockCustomParticle(Material materialIn) { @Override @SideOnly(Side.CLIENT) - public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, - @Nonnull ParticleManager manager) { + public boolean addHitEffects(@NotNull IBlockState state, @NotNull World worldObj, RayTraceResult target, + @NotNull ParticleManager manager) { Pair atlasSprite = getParticleTexture(worldObj, target.getBlockPos()); ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), manager); @@ -50,7 +49,7 @@ public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj @Override @SideOnly(Side.CLIENT) - public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager manager) { + public boolean addDestroyEffects(@NotNull World world, @NotNull BlockPos pos, @NotNull ParticleManager manager) { Pair atlasSprite = getParticleTexture(world, pos); ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), atlasSprite.getRight(), manager); @@ -67,8 +66,8 @@ public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleMana } @Override - public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, - @Nonnull Entity entity) { + public boolean addRunningEffects(@NotNull IBlockState state, World world, @NotNull BlockPos pos, + @NotNull Entity entity) { if (world.isRemote) { Pair atlasSprite = getParticleTexture(world, pos); ParticleHandlerUtil.addBlockRunningEffects(world, entity, atlasSprite.getLeft(), atlasSprite.getRight()); @@ -77,8 +76,8 @@ public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnu } @Override - public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, - @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, + public boolean addLandingEffects(@NotNull IBlockState state, @NotNull WorldServer worldObj, + @NotNull BlockPos blockPosition, @NotNull IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) { PacketBlockParticle packet = new PacketBlockParticle(blockPosition, new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles); diff --git a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java index b20f59f7759..e0570e9974b 100644 --- a/src/main/java/gregtech/api/block/BuiltInRenderBlock.java +++ b/src/main/java/gregtech/api/block/BuiltInRenderBlock.java @@ -4,7 +4,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockRenderLayer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class BuiltInRenderBlock extends BlockCustomParticle { @@ -12,7 +12,7 @@ public BuiltInRenderBlock(Material materialIn) { super(materialIn); } - @Nonnull + @NotNull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT_MIPPED; @@ -20,13 +20,13 @@ public BlockRenderLayer getRenderLayer() { @Override @SuppressWarnings("deprecation") - public boolean isOpaqueCube(@Nonnull IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") - public boolean isFullCube(@Nonnull IBlockState state) { + public boolean isFullCube(@NotNull IBlockState state) { return false; } } diff --git a/src/main/java/gregtech/api/block/IHeatingCoilBlockStats.java b/src/main/java/gregtech/api/block/IHeatingCoilBlockStats.java index fc50d764c52..5f6e5c49c06 100644 --- a/src/main/java/gregtech/api/block/IHeatingCoilBlockStats.java +++ b/src/main/java/gregtech/api/block/IHeatingCoilBlockStats.java @@ -3,8 +3,8 @@ import gregtech.api.recipes.recipeproperties.TemperatureProperty; import gregtech.api.unification.material.Material; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Implement this interface on the Block Enum for your Heating Coil block @@ -16,7 +16,7 @@ public interface IHeatingCoilBlockStats { /** * @return The Unique Name of the Heating Coil */ - @Nonnull + @NotNull String getName(); /** diff --git a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java index bfe40475459..26ca1c32ac0 100644 --- a/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java +++ b/src/main/java/gregtech/api/block/UnlistedBooleanProperty.java @@ -2,17 +2,17 @@ import net.minecraftforge.common.property.IUnlistedProperty; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class UnlistedBooleanProperty implements IUnlistedProperty { private final String name; - public UnlistedBooleanProperty(@Nonnull String name) { + public UnlistedBooleanProperty(@NotNull String name) { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -23,14 +23,14 @@ public boolean isValid(Boolean value) { return true; } - @Nonnull + @NotNull @Override public Class getType() { return Boolean.class; } @Override - public String valueToString(@Nonnull Boolean value) { + public String valueToString(@NotNull Boolean value) { return value.toString(); } } diff --git a/src/main/java/gregtech/api/block/UnlistedIntegerProperty.java b/src/main/java/gregtech/api/block/UnlistedIntegerProperty.java index 8a509f50c09..657cd3e96de 100644 --- a/src/main/java/gregtech/api/block/UnlistedIntegerProperty.java +++ b/src/main/java/gregtech/api/block/UnlistedIntegerProperty.java @@ -2,17 +2,17 @@ import net.minecraftforge.common.property.IUnlistedProperty; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class UnlistedIntegerProperty implements IUnlistedProperty { private final String name; - public UnlistedIntegerProperty(@Nonnull String name) { + public UnlistedIntegerProperty(@NotNull String name) { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -23,14 +23,14 @@ public boolean isValid(Integer integer) { return true; } - @Nonnull + @NotNull @Override public Class getType() { return Integer.class; } @Override - public String valueToString(@Nonnull Integer integer) { + public String valueToString(@NotNull Integer integer) { return integer.toString(); } } diff --git a/src/main/java/gregtech/api/block/UnlistedStringProperty.java b/src/main/java/gregtech/api/block/UnlistedStringProperty.java index 4b1d8438d6b..f569b192a91 100644 --- a/src/main/java/gregtech/api/block/UnlistedStringProperty.java +++ b/src/main/java/gregtech/api/block/UnlistedStringProperty.java @@ -2,17 +2,17 @@ import net.minecraftforge.common.property.IUnlistedProperty; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class UnlistedStringProperty implements IUnlistedProperty { private final String name; - public UnlistedStringProperty(@Nonnull String name) { + public UnlistedStringProperty(@NotNull String name) { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -23,7 +23,7 @@ public boolean isValid(String s) { return true; } - @Nonnull + @NotNull @Override public Class getType() { return String.class; diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index 7e3a4172716..e2fd7864005 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -30,6 +30,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectSet; +import org.jetbrains.annotations.NotNull; import team.chisel.ctm.client.state.CTMExtendedState; import java.util.EnumMap; @@ -39,8 +40,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class VariantActiveBlock & IStringSerializable> extends VariantBlock { private static final Int2ObjectMap> ACTIVE_BLOCKS = new Int2ObjectOpenHashMap<>(); @@ -91,19 +90,19 @@ protected boolean canSilkHarvest() { return false; } - @Nonnull + @NotNull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { return layer == getRenderLayer() || layer == BloomEffectUtil.getEffectiveBloomLayer(isBloomEnabled(getState(state))); } - @Nonnull + @NotNull @Override public IBlockState getStateFromMeta(int meta) { return super.getStateFromMeta(meta).withProperty(ACTIVE_DEPRECATED, false); @@ -118,7 +117,7 @@ public int getMetaFromState(IBlockState state) { return meta + state.getValue(VARIANT).ordinal(); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { Class enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class, 0); @@ -128,10 +127,10 @@ protected BlockStateContainer createBlockState() { new IUnlistedProperty[] { ACTIVE }); } - @Nonnull + @NotNull @Override - public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos) { + public IExtendedBlockState getExtendedState(@NotNull IBlockState state, @NotNull IBlockAccess world, + @NotNull BlockPos pos) { IExtendedBlockState ext = ((IExtendedBlockState) state) .withProperty(ACTIVE, Minecraft.getMinecraft().world != null && isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos)); diff --git a/src/main/java/gregtech/api/block/VariantBlock.java b/src/main/java/gregtech/api/block/VariantBlock.java index 94eb2270b06..25b2ebbe389 100644 --- a/src/main/java/gregtech/api/block/VariantBlock.java +++ b/src/main/java/gregtech/api/block/VariantBlock.java @@ -20,14 +20,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class VariantBlock & IStringSerializable> extends Block implements IWalkingSpeedBonus { protected PropertyEnum VARIANT; @@ -48,7 +48,7 @@ public VariantBlock(Material materialIn) { } @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList list) { for (T variant : VALUES) { list.add(getItemVariant(variant)); } @@ -74,7 +74,7 @@ public ItemStack getItemVariant(T variant, int amount) { return new ItemStack(this, amount, variant.ordinal()); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { Class enumClass = getActualTypeParameter(getClass(), VariantBlock.class, 0); @@ -85,8 +85,8 @@ protected BlockStateContainer createBlockState() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List tooltip, - @Nonnull ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World player, List tooltip, + @NotNull ITooltipFlag advanced) { // tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; if (I18n.hasKey(unlocalizedVariantTooltip)) @@ -98,11 +98,11 @@ public void addInformation(@Nonnull ItemStack stack, @Nullable World player, Lis } @Override - public int damageDropped(@Nonnull IBlockState state) { + public int damageDropped(@NotNull IBlockState state) { return getMetaFromState(state); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { @@ -115,7 +115,7 @@ public int getMetaFromState(IBlockState state) { } @Override - public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Entity entityIn) { + public void onEntityWalk(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { // Short circuit if there is no bonus speed if (getWalkingSpeedBonus() == 1.0D) { return; diff --git a/src/main/java/gregtech/api/block/VariantItemBlock.java b/src/main/java/gregtech/api/block/VariantItemBlock.java index 3aa02bdfc28..62bf5a561a2 100644 --- a/src/main/java/gregtech/api/block/VariantItemBlock.java +++ b/src/main/java/gregtech/api/block/VariantItemBlock.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class VariantItemBlock & IStringSerializable, T extends VariantBlock> extends ItemBlock { @@ -27,9 +27,9 @@ public IBlockState getBlockState(ItemStack stack) { return block.getStateFromMeta(getMetadata(stack.getItemDamage())); } - @Nonnull + @NotNull @Override - public String getTranslationKey(@Nonnull ItemStack stack) { + public String getTranslationKey(@NotNull ItemStack stack) { return super.getTranslationKey(stack) + '.' + genericBlock.getState(getBlockState(stack)).getName(); } } diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index 5f0caaad155..f9a77ccbe07 100644 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -61,12 +61,10 @@ import codechicken.lib.vec.Cuboid6; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.util.GTUtility.getMetaTileEntity; @SuppressWarnings("deprecation") @@ -95,13 +93,13 @@ public BlockMachine() { @Nullable @Override - public String getHarvestTool(@Nonnull IBlockState state) { + public String getHarvestTool(@NotNull IBlockState state) { String value = ((IExtendedBlockState) state).getValue(HARVEST_TOOL); return value == null ? ToolClasses.WRENCH : value; } @Override - public int getHarvestLevel(@Nonnull IBlockState state) { + public int getHarvestLevel(@NotNull IBlockState state) { Integer value = ((IExtendedBlockState) state).getValue(HARVEST_LEVEL); return value == null ? 1 : value; } @@ -111,10 +109,10 @@ public boolean causesSuffocation(IBlockState state) { return state.getValue(OPAQUE); } - @Nonnull + @NotNull @Override - public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, - @Nonnull BlockPos pos) { + public IBlockState getActualState(@NotNull IBlockState state, @NotNull IBlockAccess worldIn, + @NotNull BlockPos pos) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity == null) return state; @@ -123,7 +121,7 @@ public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAcc .withProperty(HARVEST_LEVEL, metaTileEntity.getHarvestLevel()); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { OPAQUE }, @@ -131,14 +129,14 @@ protected BlockStateContainer createBlockState() { } @Override - public float getPlayerRelativeBlockHardness(@Nonnull IBlockState state, @Nonnull EntityPlayer player, - @Nonnull World worldIn, @Nonnull BlockPos pos) { + public float getPlayerRelativeBlockHardness(@NotNull IBlockState state, @NotNull EntityPlayer player, + @NotNull World worldIn, @NotNull BlockPos pos) { // make sure our extended block state info is here for callers (since forge does not do it for us in this case) state = state.getBlock().getActualState(state, worldIn, pos); return super.getPlayerRelativeBlockHardness(state, player, worldIn, pos); } - @Nonnull + @NotNull @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(OPAQUE, meta % 2 == 0); @@ -150,20 +148,20 @@ public int getMetaFromState(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @Override - public float getBlockHardness(@Nonnull IBlockState blockState, @Nonnull World worldIn, @Nonnull BlockPos pos) { + public float getBlockHardness(@NotNull IBlockState blockState, @NotNull World worldIn, @NotNull BlockPos pos) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); return metaTileEntity == null ? 1.0f : metaTileEntity.getBlockHardness(); } @Override - public float getExplosionResistance(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity exploder, - @Nonnull Explosion explosion) { + public float getExplosionResistance(@NotNull World world, @NotNull BlockPos pos, @Nullable Entity exploder, + @NotNull Explosion explosion) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity == null ? 1.0f : metaTileEntity.getBlockResistance(); } @@ -178,15 +176,15 @@ private static List getCollisionBox(IBlockAccess blockAccess, Bl } @Override - public boolean doesSideBlockRendering(@Nonnull IBlockState state, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public boolean doesSideBlockRendering(@NotNull IBlockState state, @NotNull IBlockAccess world, + @NotNull BlockPos pos, @NotNull EnumFacing face) { return state.isOpaqueCube() && getMetaTileEntity(world, pos) != null; } - @Nonnull + @NotNull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@NotNull IBlockState state, @NotNull RayTraceResult target, @NotNull World world, + @NotNull BlockPos pos, @NotNull EntityPlayer player) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) return ItemStack.EMPTY; @@ -197,8 +195,8 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + public void addCollisionBoxToList(@NotNull IBlockState state, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull AxisAlignedBB entityBox, @NotNull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { for (Cuboid6 axisAlignedBB : getCollisionBox(worldIn, pos)) { AxisAlignedBB offsetBox = axisAlignedBB.aabb().offset(pos); @@ -208,13 +206,13 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, @Nonnull World worldIn, - @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@NotNull IBlockState blockState, @NotNull World worldIn, + @NotNull BlockPos pos, @NotNull Vec3d start, @NotNull Vec3d end) { return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos)); } @Override - public boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) { + public boolean rotateBlock(@NotNull World world, @NotNull BlockPos pos, @NotNull EnumFacing axis) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) return false; if (metaTileEntity.hasFrontFacing() && metaTileEntity.isValidFrontFacing(axis)) { @@ -226,7 +224,7 @@ public boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull @Nullable @Override - public EnumFacing[] getValidRotations(@Nonnull World world, @Nonnull BlockPos pos) { + public EnumFacing[] getValidRotations(@NotNull World world, @NotNull BlockPos pos) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null || !metaTileEntity.hasFrontFacing()) return null; return Arrays.stream(EnumFacing.VALUES) @@ -235,8 +233,8 @@ public EnumFacing[] getValidRotations(@Nonnull World world, @Nonnull BlockPos po } @Override - public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, - @Nonnull EnumDyeColor color) { + public boolean recolorBlock(@NotNull World world, @NotNull BlockPos pos, @NotNull EnumFacing side, + @NotNull EnumDyeColor color) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null || metaTileEntity.getPaintingColor() == color.colorValue) return false; @@ -245,8 +243,8 @@ public boolean recolorBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnul } @Override - public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityLivingBase placer, ItemStack stack) { + public void onBlockPlacedBy(World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityLivingBase placer, ItemStack stack) { IGregTechTileEntity holder = (IGregTechTileEntity) worldIn.getTileEntity(pos); MetaTileEntity sampleMetaTileEntity = GregTechAPI.MTE_REGISTRY.getObjectById(stack.getItemDamage()); if (holder != null && sampleMetaTileEntity != null) { @@ -297,7 +295,7 @@ public void onBlockPlacedBy(World worldIn, @Nonnull BlockPos pos, @Nonnull IBloc } @Override - public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity != null) { if (!metaTileEntity.keepsInventory()) { @@ -316,8 +314,8 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull IBlockState state, int fortune) { + public void getDrops(@NotNull NonNullList drops, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull IBlockState state, int fortune) { MetaTileEntity metaTileEntity = tileEntities.get() == null ? getMetaTileEntity(world, pos) : tileEntities.get(); if (metaTileEntity == null) return; if (!metaTileEntity.shouldDropWhenDestroyed()) return; @@ -339,8 +337,8 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + public boolean onBlockActivated(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = (CuboidRayTraceResult) RayTracer.retraceBlock(worldIn, playerIn, pos); @@ -362,7 +360,7 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ } @Override - public void onBlockClicked(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull EntityPlayer playerIn) { + public void onBlockClicked(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull EntityPlayer playerIn) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity == null) return; CuboidRayTraceResult rayTraceResult = (CuboidRayTraceResult) RayTracer.retraceBlock(worldIn, playerIn, pos); @@ -372,31 +370,31 @@ public void onBlockClicked(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnu } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + public boolean canConnectRedstone(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, @Nullable EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity != null && metaTileEntity.canConnectRedstone(side == null ? null : side.getOpposite()); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, - @Nonnull EnumFacing side) { + public int getWeakPower(@NotNull IBlockState blockState, @NotNull IBlockAccess blockAccess, @NotNull BlockPos pos, + @NotNull EnumFacing side) { MetaTileEntity metaTileEntity = getMetaTileEntity(blockAccess, pos); return metaTileEntity == null ? 0 : metaTileEntity.getOutputRedstoneSignal(side == null ? null : side.getOpposite()); } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@NotNull IBlockState state, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull Block blockIn, @NotNull BlockPos fromPos) { TileEntity holder = worldIn.getTileEntity(pos); if (holder instanceof IGregTechTileEntity gregTechTile) { EnumFacing facing = GTUtility.getFacingToNeighbor(pos, fromPos); @@ -421,8 +419,8 @@ public void onNeighborChange(IBlockAccess world, @NotNull BlockPos pos, @NotNull protected final ThreadLocal tileEntities = new ThreadLocal<>(); @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, - @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@NotNull World worldIn, @NotNull EntityPlayer player, @NotNull BlockPos pos, + @NotNull IBlockState state, @Nullable TileEntity te, @NotNull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : ((IGregTechTileEntity) te).getMetaTileEntity()); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); @@ -434,15 +432,15 @@ public TileEntity createNewTileEntity(@Nullable World worldIn, int meta) { return new MetaTileEntityHolder(); } - @Nonnull + @NotNull @Override @SideOnly(Side.CLIENT) - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return MetaTileEntityRenderer.BLOCK_RENDER_TYPE; } @Override - public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { return true; } @@ -456,30 +454,30 @@ public boolean isFullCube(IBlockState state) { return state.getValue(OPAQUE); } - @Nonnull + @NotNull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@NotNull IBlockAccess worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EnumFacing face) { MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); return metaTileEntity == null ? BlockFaceShape.SOLID : metaTileEntity.getCoverFaceShape(face); } @Override - public int getLightValue(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public int getLightValue(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos) { // since it is called on neighbor blocks MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity == null ? 0 : metaTileEntity.getLightValue(); } @Override - public int getLightOpacity(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + public int getLightOpacity(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos) { // since it is called on neighbor blocks MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); return metaTileEntity == null ? 0 : metaTileEntity.getLightOpacity(); } @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList items) { for (MetaTileEntity metaTileEntity : GregTechAPI.MTE_REGISTRY) { if (metaTileEntity.isInCreativeTab(tab)) { metaTileEntity.getSubItems(tab, items); @@ -487,16 +485,16 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList getParticleTexture(World world, Bloc } @Override - public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull Entity entity) { + public boolean canEntityDestroy(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull Entity entity) { MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos); if (metaTileEntity == null) { return super.canEntityDestroy(state, world, pos, entity); @@ -537,8 +535,8 @@ public boolean canEntityDestroy(@Nonnull IBlockState state, @Nonnull IBlockAcces @SideOnly(Side.CLIENT) @Override - public void randomDisplayTick(@Nonnull IBlockState stateIn, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull Random rand) { + public void randomDisplayTick(@NotNull IBlockState stateIn, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull Random rand) { super.randomDisplayTick(stateIn, worldIn, pos, rand); MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos); if (metaTileEntity != null) metaTileEntity.randomDisplayTick(); diff --git a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java index 8d7263b0068..1186eaefa7c 100644 --- a/src/main/java/gregtech/api/block/machines/MachineItemBlock.java +++ b/src/main/java/gregtech/api/block/machines/MachineItemBlock.java @@ -34,14 +34,13 @@ import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MachineItemBlock extends ItemBlock { private static final Set ADDITIONAL_CREATIVE_TABS = new ObjectArraySet<>(); @@ -77,16 +76,16 @@ public MachineItemBlock(BlockMachine block) { setHasSubtypes(true); } - @Nonnull + @NotNull @Override - public String getTranslationKey(@Nonnull ItemStack stack) { + public String getTranslationKey(@NotNull ItemStack stack) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); return metaTileEntity == null ? "unnamed" : metaTileEntity.getMetaName(); } @Override - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, + public boolean placeBlockAt(@NotNull ItemStack stack, @NotNull EntityPlayer player, @NotNull World world, + @NotNull BlockPos pos, @NotNull EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); // prevent rendering glitch before meta tile entity sync to client, but after block placement @@ -109,7 +108,7 @@ public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer play @Nullable @Override - public String getCreatorModId(@Nonnull ItemStack itemStack) { + public String getCreatorModId(@NotNull ItemStack itemStack) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(itemStack); if (metaTileEntity == null) { return GTValues.MODID; @@ -120,7 +119,7 @@ public String getCreatorModId(@Nonnull ItemStack itemStack) { @Nullable @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); return metaTileEntity == null ? null : metaTileEntity.initItemStackCapabilities(stack); } @@ -130,9 +129,9 @@ public boolean hasContainerItem(ItemStack stack) { return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null) != null; } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { + public ItemStack getContainerItem(@NotNull ItemStack itemStack) { if (!hasContainerItem(itemStack)) { return ItemStack.EMPTY; } @@ -152,8 +151,8 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, - @Nonnull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); if (metaTileEntity == null) return; @@ -199,7 +198,7 @@ public CreativeTabs[] getCreativeTabs() { } @Override - public int getItemStackLimit(@Nonnull ItemStack stack) { + public int getItemStackLimit(@NotNull ItemStack stack) { MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack); return metaTileEntity != null ? metaTileEntity.getItemStackLimit(stack) : super.getItemStackLimit(stack); } diff --git a/src/main/java/gregtech/api/capability/IDataAccessHatch.java b/src/main/java/gregtech/api/capability/IDataAccessHatch.java index d8d42eb0681..ff5ec3d2f26 100644 --- a/src/main/java/gregtech/api/capability/IDataAccessHatch.java +++ b/src/main/java/gregtech/api/capability/IDataAccessHatch.java @@ -2,11 +2,11 @@ import gregtech.api.recipes.Recipe; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collection; -import javax.annotation.Nonnull; - public interface IDataAccessHatch { /** @@ -16,7 +16,7 @@ public interface IDataAccessHatch { * @param recipe the recipe to check * @return if the recipe is available for use */ - default boolean isRecipeAvailable(@Nonnull Recipe recipe) { + default boolean isRecipeAvailable(@NotNull Recipe recipe) { Collection list = new ArrayList<>(); list.add(this); return isRecipeAvailable(recipe, list); @@ -27,7 +27,7 @@ default boolean isRecipeAvailable(@Nonnull Recipe recipe) { * @param seen the hatches already checked * @return if the recipe is available for use */ - boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen); + boolean isRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen); /** * @return true if this Data Access Hatch is creative or not diff --git a/src/main/java/gregtech/api/capability/IFilter.java b/src/main/java/gregtech/api/capability/IFilter.java index d677dbb42d0..292bc0830d8 100644 --- a/src/main/java/gregtech/api/capability/IFilter.java +++ b/src/main/java/gregtech/api/capability/IFilter.java @@ -1,10 +1,10 @@ package gregtech.api.capability; +import org.jetbrains.annotations.NotNull; + import java.util.Comparator; import java.util.function.Predicate; -import javax.annotation.Nonnull; - /** * Base type for generic filters. In addition to the predicate method, this interface provides priority primarily used * in insertion logic. @@ -32,7 +32,7 @@ public interface IFilter extends Predicate { * @return if this filter accepts the instance */ @Override - boolean test(@Nonnull T t); + boolean test(@NotNull T t); /** * Return insertion priority for this filter. The priority is applied on some insertion logics, to prioritize @@ -70,12 +70,12 @@ default int getPriority() { * @return reverse of this filter */ @Override - @Nonnull + @NotNull default IFilter negate() { return new IFilter<>() { @Override - public boolean test(@Nonnull T t) { + public boolean test(@NotNull T t) { return !IFilter.this.test(t); } @@ -85,7 +85,7 @@ public int getPriority() { } @Override - @Nonnull + @NotNull public IFilter negate() { return IFilter.this; } diff --git a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java index 524ad54eee8..c1920fda635 100644 --- a/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java +++ b/src/main/java/gregtech/api/capability/IFilteredFluidContainer.java @@ -2,9 +2,9 @@ import net.minecraftforge.fluids.FluidStack; -import java.util.Comparator; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Comparator; /** * Interface for fluid containers ({@link net.minecraftforge.fluids.IFluidTank IFluidTank} or diff --git a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java index bc779c0597b..b9e89c71d30 100644 --- a/src/main/java/gregtech/api/capability/IMultipleTankHandler.java +++ b/src/main/java/gregtech/api/capability/IMultipleTankHandler.java @@ -9,13 +9,13 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Comparator; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Base class for multi-tank fluid handlers. Handles insertion logic, along with other standard * {@link IFluidHandler} functionalities. @@ -45,7 +45,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFluidTanks(); /** @@ -53,7 +53,7 @@ public interface IMultipleTankHandler extends IFluidHandler, Iterable getFilter() { return this.delegate instanceof IFilteredFluidContainer filtered ? filtered.getFilter() : null; } - @Nonnull + @NotNull public IFluidTankProperties[] getTankProperties() { return delegate instanceof IFluidHandler fluidHandler ? fluidHandler.getTankProperties() : diff --git a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java index ff3c94655a6..a30c2219bc7 100644 --- a/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java +++ b/src/main/java/gregtech/api/capability/IOpticalComputationProvider.java @@ -1,10 +1,10 @@ package gregtech.api.capability; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collection; -import javax.annotation.Nonnull; - /** * MUST be implemented on any multiblock which uses * Transmitter Computation Hatches in its structure. @@ -32,7 +32,7 @@ default int requestCWUt(int cwut, boolean simulate) { * @param seen The Optical Computation Providers already checked * @return The amount of CWU/t that could be supplied. */ - int requestCWUt(int cwut, boolean simulate, @Nonnull Collection seen); + int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen); /** * The maximum of CWU/t that this computation provider can provide. @@ -48,7 +48,7 @@ default int getMaxCWUt() { * * @param seen The Optical Computation Providers already checked */ - int getMaxCWUt(@Nonnull Collection seen); + int getMaxCWUt(@NotNull Collection seen); /** * Whether this Computation Provider can "Bridge" with other Computation Providers. @@ -66,5 +66,5 @@ default boolean canBridge() { * * @param seen The Optical Computation Providers already checked */ - boolean canBridge(@Nonnull Collection seen); + boolean canBridge(@NotNull Collection seen); } diff --git a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java index bf5aa13605c..1b97a5a3e2a 100644 --- a/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java +++ b/src/main/java/gregtech/api/capability/IPropertyFluidFilter.java @@ -15,8 +15,6 @@ import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; - import static gregtech.api.fluids.FluidConstants.CRYOGENIC_FLUID_THRESHOLD; /** @@ -30,7 +28,7 @@ public interface IPropertyFluidFilter extends IFilter { @Override - default boolean test(@Nonnull FluidStack stack) { + default boolean test(@NotNull FluidStack stack) { Fluid fluid = stack.getFluid(); if (fluid.getTemperature() < CRYOGENIC_FLUID_THRESHOLD && !isCryoProof()) return false; diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 898314816c7..a241b32b3a0 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -29,12 +29,12 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.ULV; import static gregtech.api.recipes.logic.OverclockingLogic.*; @@ -157,7 +157,7 @@ public boolean consumesEnergy() { return true; } - @Nonnull + @NotNull @Override public final String getName() { // this is final so machines are not accidentally given multiple workable instances @@ -402,7 +402,7 @@ protected boolean checkPreviousRecipe() { * @param recipe the recipe to check * @return true if the recipe is allowed to be used, else false */ - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { return checkCleanroomRequirement(recipe); } @@ -410,7 +410,7 @@ public boolean checkRecipe(@Nonnull Recipe recipe) { * @param recipe the recipe to check * @return if the cleanroom requirement is met */ - protected boolean checkCleanroomRequirement(@Nonnull Recipe recipe) { + protected boolean checkCleanroomRequirement(@NotNull Recipe recipe) { CleanroomType requiredType = recipe.getProperty(CleanroomProperty.getInstance(), null); if (requiredType == null) return true; @@ -482,7 +482,7 @@ public void setParallelLimit(int amount) { * @return the parallel logic type to use for recipes */ @Override - @Nonnull + @NotNull public ParallelLogicType getParallelLogicType() { return ParallelLogicType.MULTIPLY; } @@ -491,7 +491,7 @@ public ParallelLogicType getParallelLogicType() { * @param tanks the tanks to check * @return the minimum fluid capacity of the tanks */ - protected static int getMinTankCapacity(@Nonnull IMultipleTankHandler tanks) { + protected static int getMinTankCapacity(@NotNull IMultipleTankHandler tanks) { if (tanks.getTanks() == 0) { return 0; } @@ -524,7 +524,7 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul * @param recipeMap the recipemap to check * @return true if the recipemap is valid for recipe search */ - public boolean isRecipeMapValid(@Nonnull RecipeMap recipeMap) { + public boolean isRecipeMapValid(@NotNull RecipeMap recipeMap) { return true; } @@ -533,7 +533,7 @@ public boolean isRecipeMapValid(@Nonnull RecipeMap recipeMap) { * @param stackB the second stack to check * @return true if both ItemStacks are equal */ - protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull ItemStack stackB) { + protected static boolean areItemStacksEqual(@NotNull ItemStack stackA, @NotNull ItemStack stackB) { return (stackA.isEmpty() && stackB.isEmpty()) || (ItemStack.areItemsEqual(stackA, stackB) && ItemStack.areItemStackTagsEqual(stackA, stackB)); @@ -552,8 +552,8 @@ protected static boolean areItemStacksEqual(@Nonnull ItemStack stackA, @Nonnull * a specific bus * @return - true if the recipe is successful, false if the recipe is not successful */ - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, - @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, + @NotNull IItemHandlerModifiable importInventory) { this.overclockResults = calculateOverclock(recipe); modifyOverclockPost(overclockResults, recipe.getRecipePropertyStorage()); @@ -593,7 +593,7 @@ protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, * @param resultOverclock the overclock data to use. Format: {@code [EUt, duration]}. * @return true if there is enough energy to continue recipe progress */ - protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { + protected boolean hasEnoughPower(@NotNull int[] resultOverclock) { // Format of resultOverclock: EU/t, duration int totalEUt = resultOverclock[0] * resultOverclock[1]; @@ -630,7 +630,7 @@ protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { * @param overclockResults The overclocked recipe EUt and duration, in format [EUt, duration] * @param storage the RecipePropertyStorage of the recipe being processed */ - protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) {} + protected void modifyOverclockPost(int[] overclockResults, @NotNull IRecipePropertyStorage storage) {} /** * Calculates the overclocked Recipe's final duration and EU/t @@ -638,8 +638,8 @@ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePrope * @param recipe the recipe to run * @return an int array of {OverclockedEUt, OverclockedDuration} */ - @Nonnull - protected int[] calculateOverclock(@Nonnull Recipe recipe) { + @NotNull + protected int[] calculateOverclock(@NotNull Recipe recipe) { // perform the actual overclocking return performOverclocking(recipe); } @@ -651,8 +651,8 @@ protected int[] calculateOverclock(@Nonnull Recipe recipe) { * @param recipe the recipe to overclock * @return an int array of {OverclockedEUt, OverclockedDuration} */ - @Nonnull - protected int[] performOverclocking(@Nonnull Recipe recipe) { + @NotNull + protected int[] performOverclocking(@NotNull Recipe recipe) { int[] values = { recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt()) }; modifyOverclockPre(values, recipe.getRecipePropertyStorage()); @@ -691,7 +691,7 @@ protected int getNumberOfOCs(int recipeEUt) { * @param values an array of [recipeEUt, recipeDuration, numberOfOCs] * @param storage the RecipePropertyStorage of the recipe being processed */ - protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropertyStorage storage) {} + protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) {} /** * Calls the desired overclocking logic to be run for the recipe. @@ -705,8 +705,8 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert * @param amountOC the maximum amount of overclocks to perform * @return an int array of {OverclockedEUt, OverclockedDuration} */ - @Nonnull - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + @NotNull + protected int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { return standardOverclockingLogic( Math.abs(recipeEUt), @@ -969,7 +969,7 @@ public void setOverclockTier(final int tier) { } @Override - public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { if (dataId == GregtechDataCodes.WORKABLE_ACTIVE) { this.isActive = buf.readBoolean(); getMetaTileEntity().scheduleRenderUpdate(); @@ -980,18 +980,18 @@ public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { } @Override - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { buf.writeBoolean(this.isActive); buf.writeBoolean(this.workingEnabled); } @Override - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { this.isActive = buf.readBoolean(); this.workingEnabled = buf.readBoolean(); } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound compound = new NBTTagCompound(); @@ -1018,7 +1018,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound compound) { + public void deserializeNBT(@NotNull NBTTagCompound compound) { this.workingEnabled = compound.getBoolean("WorkEnabled"); this.canRecipeProgress = compound.getBoolean("CanRecipeProgress"); this.progressTime = compound.getInteger("Progress"); diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index f7cd06dda87..292437e8921 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -19,12 +19,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.BOILER_HEAT; import static gregtech.api.capability.GregtechDataCodes.BOILER_LAST_TICK_STEAM; @@ -240,13 +240,13 @@ protected void completeRecipe() { wasActiveAndNeedsUpdate = true; } - @Nonnull + @NotNull @Override public MetaTileEntityLargeBoiler getMetaTileEntity() { return (MetaTileEntityLargeBoiler) super.getMetaTileEntity(); } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound compound = super.serializeNBT(); @@ -258,7 +258,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound compound) { + public void deserializeNBT(@NotNull NBTTagCompound compound) { super.deserializeNBT(compound); this.currentHeat = compound.getInteger("Heat"); this.excessFuel = compound.getInteger("ExcessFuel"); @@ -267,21 +267,21 @@ public void deserializeNBT(@Nonnull NBTTagCompound compound) { } @Override - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { super.writeInitialSyncData(buf); buf.writeVarInt(currentHeat); buf.writeVarInt(lastTickSteamOutput); } @Override - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { super.receiveInitialSyncData(buf); this.currentHeat = buf.readVarInt(); this.lastTickSteamOutput = buf.readVarInt(); } @Override - public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == BOILER_HEAT) { this.currentHeat = buf.readVarInt(); @@ -328,7 +328,7 @@ public long getMaxVoltage() { * @return a valid boiler fluid from a container */ @Nullable - private static FluidStack getBoilerFluidFromContainer(@Nonnull IFluidHandler fluidHandler, int amount) { + private static FluidStack getBoilerFluidFromContainer(@NotNull IFluidHandler fluidHandler, int amount) { if (amount == 0) return null; FluidStack drainedWater = fluidHandler.drain(Materials.Water.getFluid(amount), true); if (drainedWater == null || drainedWater.amount == 0) { diff --git a/src/main/java/gregtech/api/capability/impl/CapabilityCompatProvider.java b/src/main/java/gregtech/api/capability/impl/CapabilityCompatProvider.java index d40d9f39746..4c48ee61a95 100644 --- a/src/main/java/gregtech/api/capability/impl/CapabilityCompatProvider.java +++ b/src/main/java/gregtech/api/capability/impl/CapabilityCompatProvider.java @@ -4,7 +4,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public abstract class CapabilityCompatProvider implements ICapabilityProvider { diff --git a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java index 42e4a24ae0f..24390dc9545 100644 --- a/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java +++ b/src/main/java/gregtech/api/capability/impl/CleanroomLogic.java @@ -10,7 +10,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CleanroomLogic { @@ -169,7 +169,7 @@ protected int getTierDifference() { * writes all needed values to NBT * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeToNBT(NBTTagCompound)} method */ - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound data) { data.setBoolean("isActive", this.isActive); data.setBoolean("isWorkingEnabled", this.isWorkingEnabled); data.setBoolean("wasActiveAndNeedsUpdate", this.wasActiveAndNeedsUpdate); @@ -183,7 +183,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} * method */ - public void readFromNBT(@Nonnull NBTTagCompound data) { + public void readFromNBT(@NotNull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); this.isWorkingEnabled = data.getBoolean("isWorkingEnabled"); this.wasActiveAndNeedsUpdate = data.getBoolean("wasActiveAndNeedsUpdate"); @@ -196,7 +196,7 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { buf.writeBoolean(this.isActive); buf.writeBoolean(this.isWorkingEnabled); buf.writeBoolean(this.wasActiveAndNeedsUpdate); @@ -209,7 +209,7 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { setActive(buf.readBoolean()); setWorkingEnabled(buf.readBoolean()); setWasActiveAndNeedsUpdate(buf.readBoolean()); diff --git a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java index 1b02128f099..3f5f7dbf2e9 100644 --- a/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java +++ b/src/main/java/gregtech/api/capability/impl/CombinedCapabilityProvider.java @@ -4,10 +4,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class CombinedCapabilityProvider implements ICapabilityProvider { @@ -22,7 +22,7 @@ public CombinedCapabilityProvider(List providers) { } @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { for (ICapabilityProvider provider : providers) { if (provider.hasCapability(capability, facing)) { return true; @@ -33,7 +33,7 @@ public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFa @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { for (ICapabilityProvider provider : providers) { T cap = provider.getCapability(capability, facing); if (cap != null) { diff --git a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java index 6b76b5adc35..bca26ca9f25 100644 --- a/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java +++ b/src/main/java/gregtech/api/capability/impl/CommonFluidFilters.java @@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Common fluid filter implementations. @@ -19,7 +19,7 @@ public enum CommonFluidFilters implements IFilter { ALLOW_ALL { @Override - public boolean test(@Nonnull FluidStack fluid) { + public boolean test(@NotNull FluidStack fluid) { return true; } @@ -36,7 +36,7 @@ public IFilter negate() { DISALLOW_ALL { @Override - public boolean test(@Nonnull FluidStack fluid) { + public boolean test(@NotNull FluidStack fluid) { return false; } @@ -53,7 +53,7 @@ public IFilter negate() { BOILER_FLUID { @Override - public boolean test(@Nonnull FluidStack fluid) { + public boolean test(@NotNull FluidStack fluid) { if (matchesFluid(fluid, FluidRegistry.WATER) || matchesFluid(fluid, Materials.DistilledWater)) { return true; } @@ -75,7 +75,7 @@ public int getPriority() { STEAM { @Override - public boolean test(@Nonnull FluidStack fluid) { + public boolean test(@NotNull FluidStack fluid) { return matchesFluid(fluid, Materials.Steam); } @@ -87,7 +87,7 @@ public int getPriority() { LIGHTER_FUEL { @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { return matchesFluid(fluidStack, Materials.Butane) || matchesFluid(fluidStack, Materials.Propane); } @@ -104,7 +104,7 @@ public int getPriority() { * @param fluidMaterial material with fluid * @return whether the fluid in fluid stack and fluid associated with the material are equal */ - public static boolean matchesFluid(@Nonnull FluidStack fluidStack, @Nonnull Material fluidMaterial) { + public static boolean matchesFluid(@NotNull FluidStack fluidStack, @NotNull Material fluidMaterial) { return fluidStack.tag == null && fluidStack.getFluid() == fluidMaterial.getFluid(); } @@ -115,7 +115,7 @@ public static boolean matchesFluid(@Nonnull FluidStack fluidStack, @Nonnull Mate * @param fluid fluid * @return whether the fluid in fluid stack and fluid parameter are equal */ - public static boolean matchesFluid(@Nonnull FluidStack fluidStack, @Nonnull Fluid fluid) { + public static boolean matchesFluid(@NotNull FluidStack fluidStack, @NotNull Fluid fluid) { return fluidStack.tag == null && fluidStack.getFluid() == fluid; } } diff --git a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java index beeba3c3d8f..299e8f2af14 100644 --- a/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java +++ b/src/main/java/gregtech/api/capability/impl/EUToFEProvider.java @@ -13,7 +13,7 @@ import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class EUToFEProvider extends CapabilityCompatProvider { @@ -29,14 +29,14 @@ public EUToFEProvider(TileEntity tileEntity) { } @Override - public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, EnumFacing facing) { return ConfigHolder.compat.energy.nativeEUToFE && capability == GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER && hasUpvalueCapability(CapabilityEnergy.ENERGY, facing); } @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { + public T getCapability(@NotNull Capability capability, EnumFacing facing) { if (!ConfigHolder.compat.energy.nativeEUToFE || capability != GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER) return null; diff --git a/src/main/java/gregtech/api/capability/impl/ElectricItem.java b/src/main/java/gregtech/api/capability/impl/ElectricItem.java index 9300b8bed9d..076813ff469 100644 --- a/src/main/java/gregtech/api/capability/impl/ElectricItem.java +++ b/src/main/java/gregtech/api/capability/impl/ElectricItem.java @@ -11,13 +11,13 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.Constants.NBT; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ElectricItem implements IElectricItem, ICapabilityProvider { protected final ItemStack itemStack; @@ -150,13 +150,13 @@ public int getTier() { } @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? (T) this : null; } } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java index b1e61ce109f..b9f124c2400 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerBatteryBuffer.java @@ -13,11 +13,11 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public class EnergyContainerBatteryBuffer extends EnergyContainerHandler { public static final long AMPS_PER_BATTERY = 2L; @@ -238,7 +238,7 @@ public boolean outputsEnergy(EnumFacing side) { return !inputsEnergy(side); } - @Nonnull + @NotNull @Override public final String getName() { return GregtechDataCodes.BATTERY_BUFFER_ENERGY_CONTAINER_TRAIT; diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java index 9d3ad8b26b6..81972c3f5d7 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerHandler.java @@ -16,9 +16,9 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandlerModifiable; -import java.util.function.Predicate; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Predicate; public class EnergyContainerHandler extends MTETrait implements IEnergyContainer { @@ -79,7 +79,7 @@ public long getOutputPerSec() { return lastEnergyOutputPerSec; } - @Nonnull + @NotNull @Override public String getName() { return GregtechDataCodes.ENERGY_CONTAINER_TRAIT; @@ -93,7 +93,7 @@ public T getCapability(Capability capability) { return null; } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound compound = new NBTTagCompound(); @@ -102,7 +102,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound compound) { + public void deserializeNBT(@NotNull NBTTagCompound compound) { this.energyStored = compound.getLong("EnergyStored"); notifyEnergyListener(true); } diff --git a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java index da175b75639..5db650b32d2 100644 --- a/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java +++ b/src/main/java/gregtech/api/capability/impl/EnergyContainerList.java @@ -4,9 +4,9 @@ import net.minecraft.util.EnumFacing; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class EnergyContainerList implements IEnergyContainer { @@ -21,7 +21,7 @@ public class EnergyContainerList implements IEnergyContainer { /** The number of energy containers at the highest input voltage in the list. */ private final int numHighestInputContainers; - public EnergyContainerList(@Nonnull List energyContainerList) { + public EnergyContainerList(@NotNull List energyContainerList) { this.energyContainerList = energyContainerList; long totalInputVoltage = 0; long totalOutputVoltage = 0; @@ -62,7 +62,7 @@ public EnergyContainerList(@Nonnull List energyContainerList) * * @return [newVoltage, newAmperage] */ - @Nonnull + @NotNull private static long[] calculateVoltageAmperage(long voltage, long amperage) { if (voltage > 1 && amperage > 1) { // don't operate if there is no voltage or no amperage diff --git a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java index ad8765c5ed5..7d6e2f6d811 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredFluidHandler.java @@ -7,8 +7,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class FilteredFluidHandler extends FluidTank implements IFilteredFluidContainer { @@ -39,7 +39,7 @@ public IFilter getFilter() { * @param filter new filter instance * @return this */ - @Nonnull + @NotNull public FilteredFluidHandler setFilter(@Nullable IFilter filter) { this.filter = filter; return this; diff --git a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java index 2ed16f744af..63e3131365e 100644 --- a/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java +++ b/src/main/java/gregtech/api/capability/impl/FilteredItemHandler.java @@ -7,9 +7,9 @@ import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; -import java.util.function.Predicate; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Predicate; public class FilteredItemHandler extends GTItemStackHandler { @@ -37,7 +37,7 @@ public FilteredItemHandler setFillPredicate(Predicate fillPredicate) } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return fillPredicate == null || fillPredicate.test(stack); } } diff --git a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java index 20f762df005..e7a1e6930cf 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java @@ -12,7 +12,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class FluidDrillLogic { @@ -254,7 +254,7 @@ public boolean isInventoryFull() { * writes all needed values to NBT * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeToNBT(NBTTagCompound)} method */ - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound data) { data.setBoolean("isActive", this.isActive); data.setBoolean("isWorkingEnabled", this.isWorkingEnabled); data.setBoolean("wasActiveAndNeedsUpdate", this.wasActiveAndNeedsUpdate); @@ -269,7 +269,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} * method */ - public void readFromNBT(@Nonnull NBTTagCompound data) { + public void readFromNBT(@NotNull NBTTagCompound data) { this.isActive = data.getBoolean("isActive"); this.isWorkingEnabled = data.getBoolean("isWorkingEnabled"); this.wasActiveAndNeedsUpdate = data.getBoolean("wasActiveAndNeedsUpdate"); @@ -283,7 +283,7 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { buf.writeBoolean(this.isActive); buf.writeBoolean(this.isWorkingEnabled); buf.writeBoolean(this.wasActiveAndNeedsUpdate); @@ -296,7 +296,7 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { setActive(buf.readBoolean()); setWorkingEnabled(buf.readBoolean()); setWasActiveAndNeedsUpdate(buf.readBoolean()); diff --git a/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java b/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java index 48bf699983b..f6e2a369aba 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java +++ b/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java @@ -4,7 +4,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class FluidHandlerDelegate implements IFluidHandler { diff --git a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java index a4bf50ed9b8..0117f14316a 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/FluidHandlerProxy.java @@ -5,12 +5,11 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import com.google.common.collect.Lists; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; - public class FluidHandlerProxy implements IFluidHandler { public IFluidHandler input; diff --git a/src/main/java/gregtech/api/capability/impl/FluidTankList.java b/src/main/java/gregtech/api/capability/impl/FluidTankList.java index 41b9de569b6..29594258fb4 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidTankList.java +++ b/src/main/java/gregtech/api/capability/impl/FluidTankList.java @@ -10,14 +10,14 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class FluidTankList implements IMultipleTankHandler, INBTSerializable { private final MultiFluidTankEntry[] fluidTanks; @@ -30,14 +30,14 @@ public FluidTankList(boolean allowSameFluidFill, IFluidTank... fluidTanks) { this.allowSameFluidFill = allowSameFluidFill; } - public FluidTankList(boolean allowSameFluidFill, @Nonnull List fluidTanks) { + public FluidTankList(boolean allowSameFluidFill, @NotNull List fluidTanks) { ArrayList list = new ArrayList<>(); for (IFluidTank tank : fluidTanks) list.add(wrapIntoEntry(tank)); this.fluidTanks = list.toArray(new MultiFluidTankEntry[0]); this.allowSameFluidFill = allowSameFluidFill; } - public FluidTankList(boolean allowSameFluidFill, @Nonnull IMultipleTankHandler parent, + public FluidTankList(boolean allowSameFluidFill, @NotNull IMultipleTankHandler parent, IFluidTank... additionalTanks) { ArrayList list = new ArrayList<>(parent.getFluidTanks()); for (IFluidTank tank : additionalTanks) list.add(wrapIntoEntry(tank)); @@ -49,7 +49,7 @@ private MultiFluidTankEntry wrapIntoEntry(IFluidTank tank) { return tank instanceof MultiFluidTankEntry entry ? entry : new MultiFluidTankEntry(this, tank); } - @Nonnull + @NotNull @Override public List getFluidTanks() { return Collections.unmodifiableList(Arrays.asList(fluidTanks)); @@ -60,13 +60,13 @@ public int getTanks() { return fluidTanks.length; } - @Nonnull + @NotNull @Override public MultiFluidTankEntry getTankAt(int index) { return fluidTanks[index]; } - @Nonnull + @NotNull @Override public IFluidTankProperties[] getTankProperties() { ArrayList propertiesList = new ArrayList<>(); diff --git a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java index f126e354753..1222349e113 100644 --- a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java @@ -6,9 +6,9 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; -import java.util.function.Supplier; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Supplier; public class FuelRecipeLogic extends RecipeLogicEnergy { @@ -17,7 +17,7 @@ public FuelRecipeLogic(MetaTileEntity tileEntity, RecipeMap recipeMap, super(tileEntity, recipeMap, energyContainer); } - @Nonnull + @NotNull @Override public ParallelLogicType getParallelLogicType() { return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS @@ -29,13 +29,13 @@ public boolean consumesEnergy() { } @Override - protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { + protected boolean hasEnoughPower(@NotNull int[] resultOverclock) { // generators always have enough power to run recipes return true; } @Override - protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPost(int[] overclockResults, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPost(overclockResults, storage); // make EUt negative so it is consumed overclockResults[0] = -overclockResults[0]; diff --git a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java index d55f0477dfc..8e1d72cda81 100644 --- a/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTFluidHandlerItemStack.java @@ -8,8 +8,8 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class GTFluidHandlerItemStack extends FluidHandlerItemStack implements IFilteredFluidContainer { @@ -26,7 +26,7 @@ public class GTFluidHandlerItemStack extends FluidHandlerItemStack implements IF * @param container The container itemStack, data is stored on it directly as NBT. * @param capacity The maximum capacity of this fluid tank. */ - public GTFluidHandlerItemStack(@Nonnull ItemStack container, int capacity) { + public GTFluidHandlerItemStack(@NotNull ItemStack container, int capacity) { super(container, capacity); } @@ -36,7 +36,7 @@ public IFilter getFilter() { return this.filter; } - @Nonnull + @NotNull public GTFluidHandlerItemStack setFilter(@Nullable IFilter filter) { this.filter = filter; return this; diff --git a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java index 6eda40fbc36..8e1116ceb5b 100644 --- a/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/GTSimpleFluidHandlerItemStack.java @@ -8,8 +8,8 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class GTSimpleFluidHandlerItemStack extends FluidHandlerItemStackSimple implements IFilteredFluidContainer { @@ -26,7 +26,7 @@ public class GTSimpleFluidHandlerItemStack extends FluidHandlerItemStackSimple i * @param container The container itemStack, data is stored on it directly as NBT. * @param capacity The maximum capacity of this fluid tank. */ - public GTSimpleFluidHandlerItemStack(@Nonnull ItemStack container, int capacity) { + public GTSimpleFluidHandlerItemStack(@NotNull ItemStack container, int capacity) { super(container, capacity); } @@ -36,7 +36,7 @@ public IFilter getFilter() { return this.filter; } - @Nonnull + @NotNull public GTSimpleFluidHandlerItemStack setFilter(@Nullable IFilter filter) { this.filter = filter; return this; diff --git a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java index 27854110540..81a2b901f8a 100644 --- a/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java +++ b/src/main/java/gregtech/api/capability/impl/GhostCircuitItemStackHandler.java @@ -11,11 +11,11 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public class GhostCircuitItemStackHandler extends GTItemStackHandler implements IItemHandlerModifiable, INotifiableHandler { @@ -87,7 +87,7 @@ public void setCircuitValue(int config) { * * @param stack Item stack to read circuit value from */ - public void setCircuitValueFromStack(@Nonnull ItemStack stack) { + public void setCircuitValueFromStack(@NotNull ItemStack stack) { setCircuitValue(!stack.isEmpty() && IntCircuitIngredient.isIntegratedCircuit(stack) ? IntCircuitIngredient.getCircuitConfiguration(stack) : NO_CONFIG); } @@ -106,7 +106,7 @@ public void addCircuitValue(int configDelta) { } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { validateSlot(slot); setCircuitValueFromStack(stack); } @@ -116,21 +116,21 @@ public int getSlots() { return 1; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { validateSlot(slot); return this.circuitStack; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { validateSlot(slot); return stack; // reject all item insertions } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount <= 0) return ItemStack.EMPTY; @@ -162,13 +162,13 @@ public void removeNotifiableMetaTileEntity(MetaTileEntity metaTileEntity) { this.notifiableEntities.remove(metaTileEntity); } - public void write(@Nonnull NBTTagCompound tag) { + public void write(@NotNull NBTTagCompound tag) { if (this.circuitValue != NO_CONFIG) { tag.setByte("GhostCircuit", (byte) this.circuitValue); } } - public void read(@Nonnull NBTTagCompound tag) { + public void read(@NotNull NBTTagCompound tag) { int circuitValue = tag.hasKey("GhostCircuit", Constants.NBT.TAG_ANY_NUMERIC) ? tag.getInteger("GhostCircuit") : NO_CONFIG; if (circuitValue < IntCircuitIngredient.CIRCUIT_MIN || circuitValue > IntCircuitIngredient.CIRCUIT_MAX) diff --git a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java index 2ddd1e750cf..a19076ca0e8 100644 --- a/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/HeatingCoilRecipeLogic.java @@ -6,7 +6,7 @@ import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; import gregtech.api.recipes.recipeproperties.TemperatureProperty; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import static gregtech.api.recipes.logic.OverclockingLogic.heatingCoilOverclockingLogic; @@ -24,7 +24,7 @@ public HeatingCoilRecipeLogic(RecipeMapMultiblockController metaTileEntity) { } @Override - protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPre(values, storage); // coil EU/t discount values[0] = OverclockingLogic.applyCoilEUtDiscount(values[0], @@ -32,9 +32,9 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert storage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0)); } - @Nonnull + @NotNull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + protected int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int amountOC) { return heatingCoilOverclockingLogic( Math.abs(recipeEUt), diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerDelegate.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerDelegate.java index b7fcf009141..ba066f289e8 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerDelegate.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerDelegate.java @@ -3,7 +3,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ItemHandlerDelegate implements IItemHandler { @@ -18,19 +18,19 @@ public int getSlots() { return delegate.getSlots(); } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { return delegate.getStackInSlot(slot); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return delegate.insertItem(slot, stack, simulate); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return delegate.extractItem(slot, amount, simulate); diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java index 6fcbe6379a9..c696ee00759 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerList.java @@ -6,11 +6,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.*; -import javax.annotation.Nonnull; - /** * Efficiently delegates calls into multiple item handlers */ @@ -40,14 +39,14 @@ public int getSlots() { } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { IItemHandler itemHandler = handlerBySlotIndex.get(slot); if (!(itemHandler instanceof IItemHandlerModifiable)) throw new UnsupportedOperationException("Handler " + itemHandler + " does not support this method"); ((IItemHandlerModifiable) itemHandler).setStackInSlot(slot - baseIndexOffset.get(itemHandler), stack); } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { IItemHandler itemHandler = handlerBySlotIndex.get(slot); @@ -61,21 +60,21 @@ public int getSlotLimit(int slot) { return itemHandler.getSlotLimit(slot - baseIndexOffset.get(itemHandler)); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { IItemHandler itemHandler = handlerBySlotIndex.get(slot); return itemHandler.insertItem(slot - baseIndexOffset.get(itemHandler), stack, simulate); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { IItemHandler itemHandler = handlerBySlotIndex.get(slot); return itemHandler.extractItem(slot - baseIndexOffset.get(itemHandler), amount, simulate); } - @Nonnull + @NotNull public Collection getBackingHandlers() { return Collections.unmodifiableCollection(handlerBySlotIndex.values()); } diff --git a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java index 28a5ad86edc..3e219a428d0 100644 --- a/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java +++ b/src/main/java/gregtech/api/capability/impl/ItemHandlerProxy.java @@ -3,7 +3,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ItemHandlerProxy implements IItemHandler { @@ -20,20 +20,20 @@ public int getSlots() { return insertHandler.getSlots() + extractHandler.getSlots(); } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { return slot < insertHandler.getSlots() ? insertHandler.getStackInSlot(slot) : extractHandler.getStackInSlot(slot - insertHandler.getSlots()); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return slot < insertHandler.getSlots() ? insertHandler.insertItem(slot, stack, simulate) : stack; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return slot >= insertHandler.getSlots() ? diff --git a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java index 1e88a0d5b02..9e4a46dd264 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/MultiFluidFilter.java @@ -5,13 +5,12 @@ import net.minecraftforge.fluids.FluidStack; import com.google.common.collect.Iterables; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - /** * Basic filter with multiple fluid templates. Can be either whitelist or blacklist. */ @@ -20,7 +19,7 @@ public final class MultiFluidFilter implements IFilter { private final boolean blacklist; private final FluidStack[] fluids; - public MultiFluidFilter(boolean blacklist, @Nonnull FluidStack... fluids) { + public MultiFluidFilter(boolean blacklist, @NotNull FluidStack... fluids) { this.blacklist = blacklist; this.fluids = fluids; } @@ -30,7 +29,7 @@ public MultiFluidFilter(boolean blacklist, Iterable fluids) { this.fluids = Iterables.toArray(fluids, FluidStack.class); } - @Nonnull + @NotNull public List getFluids() { return Collections.unmodifiableList(Arrays.asList(fluids)); } @@ -44,7 +43,7 @@ public boolean isBlacklist() { } @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { for (FluidStack fluid : this.fluids) { if (fluid.isFluidEqual(fluid)) return true; } @@ -58,7 +57,7 @@ public int getPriority() { IFilter.whitelistPriority(this.fluids.length); } - @Nonnull + @NotNull @Override public IFilter negate() { return new MultiFluidFilter(!this.blacklist, this.fluids); diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java index 93cd0ebd095..2333a2742e9 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java @@ -13,9 +13,9 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class MultiblockFuelRecipeLogic extends MultiblockRecipeLogic { @@ -26,7 +26,7 @@ public MultiblockFuelRecipeLogic(RecipeMapMultiblockController tileEntity) { } @Override - protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) { // apply maintenance bonuses Tuple maintenanceValues = getMaintenanceValues(); @@ -37,7 +37,7 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert } @Override - protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPost(int[] overclockResults, @NotNull IRecipePropertyStorage storage) { // apply maintenance penalties Tuple maintenanceValues = getMaintenanceValues(); @@ -50,14 +50,14 @@ protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePrope overclockResults[0] = -overclockResults[0]; } - @Nonnull + @NotNull @Override public ParallelLogicType getParallelLogicType() { return ParallelLogicType.MULTIPLY; // TODO APPEND_FLUIDS } @Override - protected boolean hasEnoughPower(@Nonnull int[] resultOverclock) { + protected boolean hasEnoughPower(@NotNull int[] resultOverclock) { // generators always have enough power to run recipes return true; } diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java index b6073d037bc..3917d4a7bda 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java @@ -18,13 +18,13 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MultiblockRecipeLogic extends AbstractRecipeLogic { // Used for distinct mode @@ -282,7 +282,7 @@ protected boolean prepareRecipeDistinct(Recipe recipe) { } @Override - protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPre(values, storage); // apply maintenance bonuses @@ -295,7 +295,7 @@ protected void modifyOverclockPre(@Nonnull int[] values, @Nonnull IRecipePropert } @Override - protected void modifyOverclockPost(int[] overclockResults, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPost(int[] overclockResults, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPost(overclockResults, storage); // apply maintenance penalties @@ -336,7 +336,7 @@ public long getMaximumOverclockVoltage() { return Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()); } - @Nonnull + @NotNull protected Tuple getMaintenanceValues() { MultiblockWithDisplayBase displayBase = this.metaTileEntity instanceof MultiblockWithDisplayBase ? (MultiblockWithDisplayBase) metaTileEntity : null; @@ -350,7 +350,7 @@ protected Tuple getMaintenanceValues() { } @Override - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { RecipeMapMultiblockController controller = (RecipeMapMultiblockController) metaTileEntity; if (controller.checkRecipe(recipe, false)) { controller.checkRecipe(recipe, true); diff --git a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java index 72e7c8fd332..182b900ae3b 100644 --- a/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java @@ -5,7 +5,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import static gregtech.api.recipes.logic.OverclockingLogic.standardOverclockingLogic; @@ -43,9 +43,9 @@ public long getMaxVoltage() { return GTValues.LV; } - @Nonnull + @NotNull @Override - protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, + protected int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int recipeDuration, int amountOC) { return standardOverclockingLogic( 1, diff --git a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java index c32af96f849..c5d7dcbb960 100644 --- a/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java +++ b/src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java @@ -27,7 +27,7 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.fluids.IFluidTank; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class RecipeLogicSteam extends AbstractRecipeLogic implements IVentable { @@ -96,7 +96,7 @@ public void setVentingSide(EnumFacing ventingSide) { } @Override - public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == GregtechDataCodes.NEEDS_VENTING) { this.needsVenting = buf.readBoolean(); @@ -109,7 +109,7 @@ public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { } @Override - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { super.writeInitialSyncData(buf); buf.writeByte(getVentingSide().getIndex()); buf.writeBoolean(needsVenting); @@ -117,7 +117,7 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { } @Override - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { super.receiveInitialSyncData(buf); this.ventingSide = EnumFacing.VALUES[buf.readByte()]; this.needsVenting = buf.readBoolean(); @@ -177,7 +177,7 @@ public void update() { } @Override - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { return super.checkRecipe(recipe) && !this.needsVenting; } @@ -188,9 +188,9 @@ protected void completeRecipe() { tryDoVenting(); } - @Nonnull + @NotNull @Override - protected int[] calculateOverclock(@Nonnull Recipe recipe) { + protected int[] calculateOverclock(@NotNull Recipe recipe) { // EUt, Duration int[] result = new int[2]; @@ -227,7 +227,7 @@ public long getMaxVoltage() { return GTValues.V[GTValues.LV]; } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound compound = super.serializeNBT(); @@ -238,7 +238,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound compound) { + public void deserializeNBT(@NotNull NBTTagCompound compound) { super.deserializeNBT(compound); this.ventingSide = EnumFacing.VALUES[compound.getInteger("VentingSide")]; this.needsVenting = compound.getBoolean("NeedsVenting"); diff --git a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java index db4178ba433..51c1d8eb682 100644 --- a/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java +++ b/src/main/java/gregtech/api/capability/impl/SingleFluidFilter.java @@ -4,7 +4,7 @@ import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Basic filter with one fluid template. Can be either whitelist or blacklist. @@ -14,12 +14,12 @@ public final class SingleFluidFilter implements IFilter { private final FluidStack fluid; private final boolean blacklist; - public SingleFluidFilter(@Nonnull FluidStack fluid, boolean blacklist) { + public SingleFluidFilter(@NotNull FluidStack fluid, boolean blacklist) { this.fluid = fluid; this.blacklist = blacklist; } - @Nonnull + @NotNull public FluidStack getFluid() { return fluid; } @@ -33,7 +33,7 @@ public boolean isBlacklist() { } @Override - public boolean test(@Nonnull FluidStack fluid) { + public boolean test(@NotNull FluidStack fluid) { return this.fluid.isFluidEqual(fluid) != this.blacklist; } diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java index cb293fe9bbe..6db74825342 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiWorkable.java @@ -4,7 +4,7 @@ import gregtech.api.metatileentity.multiblock.RecipeMapSteamMultiblockController; import gregtech.api.recipes.RecipeBuilder; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * General Recipe Handler for Steam Multiblocks. @@ -18,14 +18,14 @@ public SteamMultiWorkable(RecipeMapSteamMultiblockController tileEntity, double super(tileEntity, tileEntity.recipeMap, tileEntity.getSteamFluidTank(), conversionRate); } - @Nonnull + @NotNull @Override public ParallelLogicType getParallelLogicType() { return ParallelLogicType.APPEND_ITEMS; } @Override - public void applyParallelBonus(@Nonnull RecipeBuilder builder) { + public void applyParallelBonus(@NotNull RecipeBuilder builder) { int currentRecipeEU = builder.getEUt(); int currentRecipeDuration = builder.getDuration() / getParallelLimit(); builder.EUt((int) Math.min(32.0, Math.ceil(currentRecipeEU * 1.33))) diff --git a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java index 6cb6e3ed9ef..b227f3942c2 100644 --- a/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java @@ -21,7 +21,7 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class SteamMultiblockRecipeLogic extends AbstractRecipeLogic { @@ -122,8 +122,8 @@ public boolean isAllowOverclocking() { } @Override - protected boolean setupAndConsumeRecipeInputs(@Nonnull Recipe recipe, - @Nonnull IItemHandlerModifiable importInventory) { + protected boolean setupAndConsumeRecipeInputs(@NotNull Recipe recipe, + @NotNull IItemHandlerModifiable importInventory) { RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity; if (controller.checkRecipe(recipe, false) && super.setupAndConsumeRecipeInputs(recipe, importInventory)) { diff --git a/src/main/java/gregtech/api/capability/impl/VoidFluidHandlerItemStack.java b/src/main/java/gregtech/api/capability/impl/VoidFluidHandlerItemStack.java index 2cfbab45a9b..36da74f785c 100755 --- a/src/main/java/gregtech/api/capability/impl/VoidFluidHandlerItemStack.java +++ b/src/main/java/gregtech/api/capability/impl/VoidFluidHandlerItemStack.java @@ -5,7 +5,7 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import static net.minecraftforge.fluids.capability.templates.EmptyFluidHandler.EMPTY_TANK_PROPERTIES_ARRAY; @@ -19,7 +19,7 @@ public class VoidFluidHandlerItemStack extends FluidHandlerItemStack { * * @param container The container itemStack. */ - public VoidFluidHandlerItemStack(@Nonnull ItemStack container) { + public VoidFluidHandlerItemStack(@NotNull ItemStack container) { this(container, Integer.MAX_VALUE); } @@ -29,7 +29,7 @@ public VoidFluidHandlerItemStack(@Nonnull ItemStack container) { * @param container The container itemStack. * @param capacity max amount to void in each operation */ - public VoidFluidHandlerItemStack(@Nonnull ItemStack container, final int capacity) { + public VoidFluidHandlerItemStack(@NotNull ItemStack container, final int capacity) { super(container, capacity); } diff --git a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java index 98faab4159d..5b1ca454f3d 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java @@ -33,6 +33,7 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.LinkedList; @@ -40,8 +41,6 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -import javax.annotation.Nonnull; - public class MinerLogic { private static final short MAX_SPEED = Short.MAX_VALUE; @@ -88,7 +87,7 @@ public class MinerLogic { * @param speed the speed in ticks per block mined * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ - public MinerLogic(@Nonnull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, + public MinerLogic(@NotNull MetaTileEntity metaTileEntity, int fortune, int speed, int maximumRadius, ICubeRenderer pipeTexture) { this.metaTileEntity = metaTileEntity; this.miner = (IMiner) metaTileEntity; @@ -267,7 +266,7 @@ protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldSer * @param blockState the {@link IBlockState} of the block being mined */ protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, - @Nonnull IBlockState blockState) { + @NotNull IBlockState blockState) { blockState.getBlock().getDrops(blockDrops, world, blockToMine, blockState, 0); // regular ores do not get // fortune applied } @@ -307,7 +306,7 @@ private void mineAndInsertItems(NonNullList blockDrops, WorldServer w * @param pos the {@link BlockPos} of the miner itself * @param currentRadius the currently set mining radius */ - public void initPos(@Nonnull BlockPos pos, int currentRadius) { + public void initPos(@NotNull BlockPos pos, int currentRadius) { x.set(pos.getX() - currentRadius); z.set(pos.getZ() - currentRadius); y.set(pos.getY() - 1); @@ -328,8 +327,8 @@ public void initPos(@Nonnull BlockPos pos, int currentRadius) { * @param z the z coordinate * @return {@code true} if the coordinates are invalid, else false */ - private static boolean checkCoordinatesInvalid(@Nonnull AtomicInteger x, @Nonnull AtomicInteger y, - @Nonnull AtomicInteger z) { + private static boolean checkCoordinatesInvalid(@NotNull AtomicInteger x, @NotNull AtomicInteger y, + @NotNull AtomicInteger z) { return x.get() == Integer.MAX_VALUE && y.get() == Integer.MAX_VALUE && z.get() == Integer.MAX_VALUE; } @@ -407,7 +406,7 @@ private LinkedList getBlocksToMine() { * @param values to find the mean of * @return the mean value */ - private static long mean(@Nonnull long[] values) { + private static long mean(@NotNull long[] values) { if (values.length == 0L) return 0L; @@ -421,7 +420,7 @@ private static long mean(@Nonnull long[] values) { * @param world the {@link World} to get the average tick time of * @return the mean tick time */ - private static double getMeanTickTime(@Nonnull World world) { + private static double getMeanTickTime(@NotNull World world) { return mean(Objects.requireNonNull(world.getMinecraftServer()).tickTimeArray) * 1.0E-6D; } @@ -444,8 +443,8 @@ private static double getQuotient(double base) { * @param map the recipemap from which to get the drops * @param tier the tier at which the operation is performed, used for calculating the chanced output boost */ - protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, - int fortuneLevel, @Nonnull RecipeMap map, int tier) { + protected static void applyTieredHammerNoRandomDrops(@NotNull IBlockState blockState, List drops, + int fortuneLevel, @NotNull RecipeMap map, int tier) { ItemStack itemStack = GTUtility.toItem(blockState); Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList()); if (recipe != null && !recipe.getOutputs().isEmpty()) { @@ -502,7 +501,7 @@ protected ICubeRenderer getPipeTexture() { * writes all needed values to NBT * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#writeToNBT(NBTTagCompound)} method */ - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound data) { data.setTag("xPos", new NBTTagInt(x.get())); data.setTag("yPos", new NBTTagInt(y.get())); data.setTag("zPos", new NBTTagInt(z.get())); @@ -527,7 +526,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's {@link MetaTileEntity#readFromNBT(NBTTagCompound)} * method */ - public void readFromNBT(@Nonnull NBTTagCompound data) { + public void readFromNBT(@NotNull NBTTagCompound data) { x.set(data.getInteger("xPos")); y.set(data.getInteger("yPos")); z.set(data.getInteger("zPos")); @@ -551,7 +550,7 @@ public void readFromNBT(@Nonnull NBTTagCompound data) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#writeInitialSyncData(PacketBuffer)} method */ - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { buf.writeInt(pipeLength); buf.writeBoolean(this.isActive); buf.writeBoolean(this.isWorkingEnabled); @@ -563,7 +562,7 @@ public void writeInitialSyncData(@Nonnull PacketBuffer buf) { * This MUST be called and returned in the MetaTileEntity's * {@link MetaTileEntity#receiveInitialSyncData(PacketBuffer)} method */ - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { this.pipeLength = buf.readInt(); setActive(buf.readBoolean()); setWorkingEnabled(buf.readBoolean()); diff --git a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java index 99faf2b318f..6585c7e93cc 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java @@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MultiblockMinerLogic extends MinerLogic { @@ -60,7 +60,7 @@ protected void getSmallOreBlockDrops(NonNullList blockDrops, WorldSer @Override protected void getRegularBlockDrops(NonNullList blockDrops, WorldServer world, BlockPos blockToMine, - @Nonnull IBlockState blockState) { + @NotNull IBlockState blockState) { if (!isSilkTouchMode) // 3X the ore compared to the single blocks applyTieredHammerNoRandomDrops(blockState, blockDrops, 3, this.blockDropRecipeMap, this.voltageTier); else @@ -68,7 +68,7 @@ protected void getRegularBlockDrops(NonNullList blockDrops, WorldServ } @Override - public void initPos(@Nonnull BlockPos pos, int currentRadius) { + public void initPos(@NotNull BlockPos pos, int currentRadius) { if (!isChunkMode) { super.initPos(pos, currentRadius); } else { @@ -131,28 +131,28 @@ protected ICubeRenderer getPipeTexture() { } @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound data) { data.setBoolean("isChunkMode", isChunkMode); data.setBoolean("isSilkTouchMode", isSilkTouchMode); return super.writeToNBT(data); } @Override - public void readFromNBT(@Nonnull NBTTagCompound data) { + public void readFromNBT(@NotNull NBTTagCompound data) { this.isChunkMode = data.getBoolean("isChunkMode"); this.isSilkTouchMode = data.getBoolean("isSilkTouchMode"); super.readFromNBT(data); } @Override - public void writeInitialSyncData(@Nonnull PacketBuffer buf) { + public void writeInitialSyncData(@NotNull PacketBuffer buf) { super.writeInitialSyncData(buf); buf.writeBoolean(this.isChunkMode); buf.writeBoolean(this.isSilkTouchMode); } @Override - public void receiveInitialSyncData(@Nonnull PacketBuffer buf) { + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { super.receiveInitialSyncData(buf); this.isChunkMode = buf.readBoolean(); this.isSilkTouchMode = buf.readBoolean(); diff --git a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java index d0d046d8924..628c6dadcaf 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSourceTool.java +++ b/src/main/java/gregtech/api/damagesources/DamageSourceTool.java @@ -6,7 +6,7 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.translation.I18n; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class DamageSourceTool extends EntityDamageSource { @@ -17,10 +17,10 @@ public DamageSourceTool(String type, EntityLivingBase player, String deathMessag this.deathMessage = deathMessage; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public ITextComponent getDeathMessage(@Nonnull EntityLivingBase target) { + public ITextComponent getDeathMessage(@NotNull EntityLivingBase target) { if (deathMessage == null || damageSourceEntity == null || !I18n.canTranslate(deathMessage)) return super.getDeathMessage(target); return new TextComponentTranslation(deathMessage, target.getDisplayName(), damageSourceEntity.getDisplayName()); diff --git a/src/main/java/gregtech/api/damagesources/DamageSources.java b/src/main/java/gregtech/api/damagesources/DamageSources.java index c4ad36b5127..2283c396139 100644 --- a/src/main/java/gregtech/api/damagesources/DamageSources.java +++ b/src/main/java/gregtech/api/damagesources/DamageSources.java @@ -9,7 +9,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSource; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class DamageSources { diff --git a/src/main/java/gregtech/api/fluids/GTFluidMaterial.java b/src/main/java/gregtech/api/fluids/GTFluidMaterial.java index b5372c1495b..44cdfadb254 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidMaterial.java +++ b/src/main/java/gregtech/api/fluids/GTFluidMaterial.java @@ -3,13 +3,13 @@ import net.minecraft.block.material.MapColor; import net.minecraft.block.material.MaterialLiquid; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class GTFluidMaterial extends MaterialLiquid { private final boolean blocksMovement; - public GTFluidMaterial(@Nonnull MapColor color, boolean blocksMovement) { + public GTFluidMaterial(@NotNull MapColor color, boolean blocksMovement) { super(color); this.blocksMovement = blocksMovement; } diff --git a/src/main/java/gregtech/api/gui/Widget.java b/src/main/java/gregtech/api/gui/Widget.java index be7a34b2ebb..68451897b4f 100644 --- a/src/main/java/gregtech/api/gui/Widget.java +++ b/src/main/java/gregtech/api/gui/Widget.java @@ -23,6 +23,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -31,8 +32,6 @@ import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nullable; - /** * Widget is functional element of ModularUI * It can draw, perform actions, react to key press and mouse diff --git a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java index de6753738cd..553bf064239 100644 --- a/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java +++ b/src/main/java/gregtech/api/gui/impl/ModularUIContainer.java @@ -20,13 +20,12 @@ import net.minecraft.network.play.server.SPacketSetSlot; import io.netty.buffer.Unpooled; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class ModularUIContainer extends Container implements WidgetUIAccess { protected final HashMap slotMap = new HashMap<>(); @@ -103,13 +102,13 @@ public ModularUI getModularUI() { } @Override - public void onContainerClosed(@Nonnull EntityPlayer playerIn) { + public void onContainerClosed(@NotNull EntityPlayer playerIn) { super.onContainerClosed(playerIn); modularUI.triggerCloseListeners(); } @Override - public void addListener(@Nonnull IContainerListener listener) { + public void addListener(@NotNull IContainerListener listener) { super.addListener(listener); modularUI.guiWidgets.values().forEach(Widget::detectAndSendChanges); } @@ -140,9 +139,9 @@ public void detectAndSendChanges() { } } - @Nonnull + @NotNull @Override - public ItemStack slotClick(int slotId, int dragType, @Nonnull ClickType clickTypeIn, @Nonnull EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, @NotNull ClickType clickTypeIn, @NotNull EntityPlayer player) { if (slotId >= 0 && slotId < inventorySlots.size()) { Slot slot = getSlot(slotId); ItemStack result = slotMap.get(slot).slotClick(dragType, clickTypeIn, player); @@ -181,9 +180,9 @@ public boolean attemptMergeStack(ItemStack itemStack, boolean fromContainer, boo return GTUtility.mergeItemStack(itemStack, inventorySlots, simulate); } - @Nonnull + @NotNull @Override - public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { + public ItemStack transferStackInSlot(@NotNull EntityPlayer player, int index) { Slot slot = inventorySlots.get(index); if (!slot.canTakeStack(player)) { return ItemStack.EMPTY; @@ -232,12 +231,12 @@ public ItemStack transferStackInSlot(@Nonnull EntityPlayer player, int index) { } @Override - public boolean canMergeSlot(@Nonnull ItemStack stack, @Nonnull Slot slotIn) { + public boolean canMergeSlot(@NotNull ItemStack stack, @NotNull Slot slotIn) { return slotMap.get(slotIn).canMergeSlot(stack); } @Override - public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { + public boolean canInteractWith(@NotNull EntityPlayer playerIn) { return playerIn == this.modularUI.entityPlayer && this.modularUI.holder.isValid(); } @@ -276,22 +275,22 @@ public EmptySlotPlaceholder() { super(EMPTY_INVENTORY, 0, -100000, -100000); } - @Nonnull + @NotNull @Override public ItemStack getStack() { return ItemStack.EMPTY; } @Override - public void putStack(@Nonnull ItemStack stack) {} + public void putStack(@NotNull ItemStack stack) {} @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean isItemValid(@NotNull ItemStack stack) { return false; } @Override - public boolean canTakeStack(@Nonnull EntityPlayer playerIn) { + public boolean canTakeStack(@NotNull EntityPlayer playerIn) { return false; } diff --git a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java index 7dd56f551f4..45f1c98eaf2 100644 --- a/src/main/java/gregtech/api/gui/resources/ResourceHelper.java +++ b/src/main/java/gregtech/api/gui/resources/ResourceHelper.java @@ -11,14 +11,13 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; - /** * Original copied from com.brandon3055.draconicevolution.helpers; *

@@ -72,7 +71,7 @@ public static boolean isResourceExist(String rs) { * @return if the resource exists */ @SideOnly(Side.CLIENT) - public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull String textureResource, + public static boolean doResourcepacksHaveTexture(@NotNull String modid, @NotNull String textureResource, boolean format) { if (format) textureResource = String.format(DIR_FORMAT, textureResource); return doResourcepacksHaveResource(modid, textureResource); @@ -84,7 +83,7 @@ public static boolean doResourcepacksHaveTexture(@Nonnull String modid, @Nonnull * @return if the resource exists */ @SideOnly(Side.CLIENT) - public static boolean doResourcepacksHaveResource(@Nonnull String modid, @Nonnull String resource) { + public static boolean doResourcepacksHaveResource(@NotNull String modid, @NotNull String resource) { return doResourcepacksHaveResource(new ResourceLocation(modid, resource)); } @@ -93,7 +92,7 @@ public static boolean doResourcepacksHaveResource(@Nonnull String modid, @Nonnul * @return if the resource exists */ @SideOnly(Side.CLIENT) - public static boolean doResourcepacksHaveResource(@Nonnull ResourceLocation resource) { + public static boolean doResourcepacksHaveResource(@NotNull ResourceLocation resource) { IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); try { // check if the texture file exists @@ -112,7 +111,7 @@ public static boolean doResourcepacksHaveResource(@Nonnull ResourceLocation reso * @param textureResource the location of the texture * @return if the resource exists */ - public static boolean isTextureExist(@Nonnull String modid, @Nonnull String textureResource) { + public static boolean isTextureExist(@NotNull String modid, @NotNull String textureResource) { URL url = ResourceHelper.class.getResource(String.format("/assets/%s/textures/%s.png", modid, textureResource)); return url != null; } @@ -124,7 +123,7 @@ public static boolean isTextureExist(@Nonnull String modid, @Nonnull String text * @return if the resource exists */ @SuppressWarnings("unused") - public static boolean isTextureExist(@Nonnull ResourceLocation textureResource) { + public static boolean isTextureExist(@NotNull ResourceLocation textureResource) { return isTextureExist(textureResource.getNamespace(), textureResource.getPath()); } } diff --git a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java index a6988624841..02cfc268de0 100644 --- a/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/AdvancedTextWidget.java @@ -21,6 +21,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; import org.lwjgl.input.Mouse; import java.util.ArrayList; @@ -29,8 +30,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - /** * Represents a text-component based widget, which obtains * text from server and automatically synchronizes it with clients @@ -263,17 +262,17 @@ public void drawInForeground(int mouseX, int mouseY) { private static class WrapScreen extends GuiScreen { @Override - public void handleComponentHover(@Nonnull ITextComponent component, int x, int y) { + public void handleComponentHover(@NotNull ITextComponent component, int x, int y) { super.handleComponentHover(component, x, y); } @Override - public boolean handleComponentClick(@Nonnull ITextComponent component) { + public boolean handleComponentClick(@NotNull ITextComponent component) { return super.handleComponentClick(component); } @Override - protected void drawHoveringText(@Nonnull List textLines, int x, int y, @Nonnull FontRenderer font) { + protected void drawHoveringText(@NotNull List textLines, int x, int y, @NotNull FontRenderer font) { GuiUtils.drawHoveringText(textLines, x, y, width, height, 256, font); } } diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java index f7f90bd4767..f6d3f4857f7 100644 --- a/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/PhantomFluidWidget.java @@ -24,6 +24,7 @@ import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler.Target; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.io.IOException; @@ -33,8 +34,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import javax.annotation.Nonnull; - import static gregtech.api.util.GTUtility.getFluidFromContainer; public class PhantomFluidWidget extends Widget implements IIngredientSlot, IGhostIngredientTarget { @@ -94,14 +93,14 @@ public List> getPhantomTargets(Object ingredient) { Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new Target() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { FluidStack ingredientStack; if (ingredient instanceof FluidStack) ingredientStack = (FluidStack) ingredient; diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java index 0490d7310b8..5eb18fb9900 100644 --- a/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/PhantomSlotWidget.java @@ -11,6 +11,7 @@ import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler.Target; +import org.jetbrains.annotations.NotNull; import org.lwjgl.input.Mouse; import java.awt.*; @@ -18,8 +19,6 @@ import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - public class PhantomSlotWidget extends SlotWidget implements IGhostIngredientTarget { private boolean clearSlotOnRightClick; @@ -84,14 +83,14 @@ public List> getPhantomTargets(Object ingredient) { Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new Target() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { if (ingredient instanceof ItemStack) { int mouseButton = Mouse.getEventButton(); boolean shiftDown = TooltipHelper.isShiftDown(); diff --git a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java index 53299b3d133..f3bc29c7fd5 100644 --- a/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/PhantomTankWidget.java @@ -19,6 +19,8 @@ import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler.Target; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.io.IOException; @@ -27,9 +29,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; import static gregtech.api.util.GTUtility.getFluidFromContainer; @@ -70,14 +69,14 @@ public List> getPhantomTargets(Object ingredient) { Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new Target() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { FluidStack stack = getFluidFromContainer(ingredient); if (stack != null) { diff --git a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java index 73ec60ec40c..9e0315e530e 100644 --- a/src/main/java/gregtech/api/gui/widgets/SliderWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SliderWidget.java @@ -15,12 +15,11 @@ import net.minecraft.util.math.MathHelper; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.BiFunction; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class SliderWidget extends Widget { public static final BiFunction DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name, @@ -55,7 +54,7 @@ public SliderWidget(String name, int xPosition, int yPosition, int width, int he this.sliderPosition = (currentValue - min) / (max - min); } - public SliderWidget setSliderIcon(@Nonnull TextureArea sliderIcon) { + public SliderWidget setSliderIcon(@NotNull TextureArea sliderIcon) { Preconditions.checkNotNull(sliderIcon, "sliderIcon"); this.sliderIcon = sliderIcon; return this; diff --git a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java index 1e0e680d8ec..1ec32dbfa9f 100644 --- a/src/main/java/gregtech/api/gui/widgets/SlotWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/SlotWidget.java @@ -27,13 +27,12 @@ import net.minecraftforge.items.SlotItemHandler; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public class SlotWidget extends Widget implements INativeWidget { protected final Slot slotReference; @@ -309,26 +308,26 @@ public boolean isHover() { } @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean isItemValid(@NotNull ItemStack stack) { return SlotWidget.this.canPutStack(stack) && super.isItemValid(stack); } @Override - public boolean canTakeStack(@Nonnull EntityPlayer playerIn) { + public boolean canTakeStack(@NotNull EntityPlayer playerIn) { return SlotWidget.this.canTakeStack(playerIn) && super.canTakeStack(playerIn); } @Override - public void putStack(@Nonnull ItemStack stack) { + public void putStack(@NotNull ItemStack stack) { super.putStack(stack); if (changeListener != null) { changeListener.run(); } } - @Nonnull + @NotNull @Override - public final ItemStack onTake(@Nonnull EntityPlayer thePlayer, @Nonnull ItemStack stack) { + public final ItemStack onTake(@NotNull EntityPlayer thePlayer, @NotNull ItemStack stack) { return onItemTake(thePlayer, super.onTake(thePlayer, stack), false); } @@ -365,7 +364,7 @@ public boolean isHover() { } @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean isItemValid(@NotNull ItemStack stack) { return SlotWidget.this.canPutStack(stack) && super.isItemValid(stack); } @@ -375,16 +374,16 @@ public boolean canTakeStack(EntityPlayer playerIn) { } @Override - public void putStack(@Nonnull ItemStack stack) { + public void putStack(@NotNull ItemStack stack) { super.putStack(stack); if (changeListener != null) { changeListener.run(); } } - @Nonnull + @NotNull @Override - public final ItemStack onTake(@Nonnull EntityPlayer thePlayer, @Nonnull ItemStack stack) { + public final ItemStack onTake(@NotNull EntityPlayer thePlayer, @NotNull ItemStack stack) { return onItemTake(thePlayer, super.onTake(thePlayer, stack), false); } diff --git a/src/main/java/gregtech/api/gui/widgets/TankWidget.java b/src/main/java/gregtech/api/gui/widgets/TankWidget.java index 2be6bdfeca8..44e04a2768d 100644 --- a/src/main/java/gregtech/api/gui/widgets/TankWidget.java +++ b/src/main/java/gregtech/api/gui/widgets/TankWidget.java @@ -32,13 +32,12 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - public class TankWidget extends Widget implements IIngredientSlot { public final IFluidTank fluidTank; diff --git a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java index 4a7a57980b0..19e24e049bb 100644 --- a/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java +++ b/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java @@ -15,6 +15,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.Nullable; import org.lwjgl.input.Keyboard; import java.util.function.Consumer; @@ -22,8 +23,6 @@ import java.util.function.Supplier; import java.util.regex.Pattern; -import javax.annotation.Nullable; - /** * @author brachy84 */ diff --git a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java index 1fedb208ce4..e4e6c67da6a 100644 --- a/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java +++ b/src/main/java/gregtech/api/items/armor/ArmorLogicSuite.java @@ -18,9 +18,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public abstract class ArmorLogicSuite implements ISpecialArmorLogic, IItemHUDProvider { @@ -40,7 +40,7 @@ protected ArmorLogicSuite(int energyPerUse, long maxCapacity, int tier, EntityEq public abstract void onArmorTick(World world, EntityPlayer player, ItemStack itemStack); @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { diff --git a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java index 223fb0a7425..e7e663377d0 100644 --- a/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java +++ b/src/main/java/gregtech/api/items/armor/ArmorMetaItem.java @@ -25,9 +25,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Multimap; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ArmorMetaItem.ArmorMetaValueItem> extends MetaItem implements IArmorItem, ISpecialArmor, IEnchantabilityHelper { @@ -43,16 +42,16 @@ protected T constructMetaValueItem(short metaValue, String unlocalizedName) { return (T) new ArmorMetaValueItem(metaValue, unlocalizedName); } - @Nonnull + @NotNull private IArmorLogic getArmorLogic(ItemStack itemStack) { T metaValueItem = getItem(itemStack); return metaValueItem == null ? new DummyArmorLogic() : metaValueItem.getArmorLogic(); } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { Multimap multimap = super.getAttributeModifiers(slot, stack); IArmorLogic armorLogic = getArmorLogic(stack); multimap.putAll(armorLogic.getAttributeModifiers(slot, stack)); @@ -60,7 +59,7 @@ public Multimap getAttributeModifiers(@Nonnull Entity } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, int slot) { IArmorLogic armorLogic = getArmorLogic(armor); if (armorLogic instanceof ISpecialArmorLogic) { @@ -70,7 +69,7 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) { + public int getArmorDisplay(EntityPlayer player, @NotNull ItemStack armor, int slot) { IArmorLogic armorLogic = getArmorLogic(armor); if (armorLogic instanceof ISpecialArmorLogic) { return ((ISpecialArmorLogic) armorLogic).getArmorDisplay(player, armor, slot); @@ -79,14 +78,14 @@ public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int sl } @Override - public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, + public void damageArmor(EntityLivingBase entity, @NotNull ItemStack stack, DamageSource source, int damage, int slot) { IArmorLogic armorLogic = getArmorLogic(stack); armorLogic.damageArmor(entity, stack, source, damage, getSlotByIndex(slot)); } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, double damage, int slot) { IArmorLogic armorLogic = getArmorLogic(armor); if (armorLogic instanceof ISpecialArmorLogic) { @@ -97,14 +96,14 @@ public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemSta } @Override - public void onArmorTick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull ItemStack itemStack) { + public void onArmorTick(@NotNull World world, @NotNull EntityPlayer player, @NotNull ItemStack itemStack) { IArmorLogic armorLogic = getArmorLogic(itemStack); armorLogic.onArmorTick(world, player, itemStack); } @Override - public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSlot armorType, - @Nonnull Entity entity) { + public boolean isValidArmor(@NotNull ItemStack stack, @NotNull EntityEquipmentSlot armorType, + @NotNull Entity entity) { IArmorLogic armorLogic = getArmorLogic(stack); return super.isValidArmor(stack, armorType, entity) && armorLogic.isValidArmor(stack, entity, armorType); @@ -112,15 +111,15 @@ public boolean isValidArmor(@Nonnull ItemStack stack, @Nonnull EntityEquipmentSl @Nullable @Override - public EntityEquipmentSlot getEquipmentSlot(@Nonnull ItemStack stack) { + public EntityEquipmentSlot getEquipmentSlot(@NotNull ItemStack stack) { IArmorLogic armorLogic = getArmorLogic(stack); return armorLogic.getEquipmentSlot(stack); } @Nullable @Override - public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nonnull EntityEquipmentSlot slot, - @Nonnull String type) { + public String getArmorTexture(@NotNull ItemStack stack, @NotNull Entity entity, @NotNull EntityEquipmentSlot slot, + @NotNull String type) { IArmorLogic armorLogic = getArmorLogic(stack); return armorLogic.getArmorTexture(stack, entity, slot, type); } @@ -128,8 +127,8 @@ public String getArmorTexture(@Nonnull ItemStack stack, @Nonnull Entity entity, @Nullable @Override @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack itemStack, - @Nonnull EntityEquipmentSlot armorSlot, @Nonnull ModelBiped _default) { + public ModelBiped getArmorModel(@NotNull EntityLivingBase entityLiving, @NotNull ItemStack itemStack, + @NotNull EntityEquipmentSlot armorSlot, @NotNull ModelBiped _default) { IArmorLogic armorLogic = getArmorLogic(itemStack); return armorLogic.getArmorModel(entityLiving, itemStack, armorSlot, _default); } @@ -147,8 +146,8 @@ public int getArmorLayerColor(ItemStack itemStack, int layerIndex) { } @Override - public void renderHelmetOverlay(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, - @Nonnull ScaledResolution resolution, float partialTicks) { + public void renderHelmetOverlay(@NotNull ItemStack stack, @NotNull EntityPlayer player, + @NotNull ScaledResolution resolution, float partialTicks) { IArmorLogic armorLogic = getArmorLogic(stack); armorLogic.renderHelmetOverlay(stack, player, resolution, partialTicks); } @@ -175,7 +174,7 @@ protected ArmorMetaValueItem(int metaValue, String unlocalizedName) { setMaxStackSize(1); } - @Nonnull + @NotNull public IArmorLogic getArmorLogic() { return armorLogic; } @@ -205,17 +204,17 @@ public ArmorMetaValueItem setRarity(EnumRarity rarity) { } @Override - public boolean isEnchantable(@Nonnull ItemStack stack) { + public boolean isEnchantable(@NotNull ItemStack stack) { return true; } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { return 50; } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { EntityEquipmentSlot slot = this.getEquipmentSlot(stack); if (slot == null || enchantment.type == null) { return false; diff --git a/src/main/java/gregtech/api/items/armor/ArmorUtils.java b/src/main/java/gregtech/api/items/armor/ArmorUtils.java index 12794ed3d02..2729c46fa38 100644 --- a/src/main/java/gregtech/api/items/armor/ArmorUtils.java +++ b/src/main/java/gregtech/api/items/armor/ArmorUtils.java @@ -24,14 +24,13 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - public class ArmorUtils { public static final Side SIDE = FMLCommonHandler.instance().getSide(); @@ -114,7 +113,7 @@ public static void spawnParticle(World world, EntityPlayer player, EnumParticleT } } - public static void playJetpackSound(@Nonnull EntityPlayer player) { + public static void playJetpackSound(@NotNull EntityPlayer player) { if (player.world.isRemote) { float cons = (float) player.motionY + player.moveForward; cons = MathHelper.clamp(cons, 0.6F, 1.0F); @@ -205,7 +204,7 @@ public static List format(List input) { return output; } - @Nonnull + @NotNull public static String format(long value) { return new DecimalFormat("###,###.##").format(value); } @@ -243,7 +242,7 @@ public void draw() { } } - @Nonnull + @NotNull private Pair getStringCoord(int index) { int posX; int posY; diff --git a/src/main/java/gregtech/api/items/armor/IArmorLogic.java b/src/main/java/gregtech/api/items/armor/IArmorLogic.java index 66ad1627bab..b8c906d4388 100644 --- a/src/main/java/gregtech/api/items/armor/IArmorLogic.java +++ b/src/main/java/gregtech/api/items/armor/IArmorLogic.java @@ -17,11 +17,10 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.Nullable; import java.util.UUID; -import javax.annotation.Nullable; - /** * Defines abstract armor logic that can be added to ArmorMetaItem to control it * It can implement {@link net.minecraftforge.common.ISpecialArmor} for extended damage calculations diff --git a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java index acab02f1da0..dda46689d2f 100644 --- a/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java +++ b/src/main/java/gregtech/api/items/armor/ISpecialArmorLogic.java @@ -7,7 +7,7 @@ import net.minecraft.util.DamageSource; import net.minecraftforge.common.ISpecialArmor.ArmorProperties; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Armor logic that wraps {@link net.minecraftforge.common.ISpecialArmor} methods @@ -23,7 +23,7 @@ public interface ISpecialArmorLogic extends IArmorLogic { * same priority, damage will be distributed between them based on there * absorption ratio. */ - ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, + ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot); /** @@ -31,7 +31,7 @@ ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, * * @return The number of armor points for display, 2 per shield. */ - int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot); + int getArmorDisplay(EntityPlayer player, @NotNull ItemStack armor, int slot); /** * Simple check to see if the armor should interact with "Unblockable" damage @@ -41,7 +41,7 @@ ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, * Returning true here means that the armor is able to meaningfully respond * to this damage source. Otherwise, no interaction is allowed. */ - default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + default boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { return false; } diff --git a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java index 3e4183e8d6f..79f0cd2edf0 100644 --- a/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java +++ b/src/main/java/gregtech/api/items/behavior/MonitorPluginBaseBehavior.java @@ -30,12 +30,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; import io.netty.buffer.Unpooled; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public abstract class MonitorPluginBaseBehavior implements IItemBehaviour, ItemUIFactory, IDirtyNotifiable { protected MetaTileEntityMonitorScreen screen; @@ -101,7 +100,7 @@ public void readFromNBT(NBTTagCompound data) { * @param id PacketID * @param buf PacketBuffer */ - public final void writePluginData(int id, @Nonnull Consumer buf) { + public final void writePluginData(int id, @NotNull Consumer buf) { if (screen != null && this.screen.getWorld() != null && !this.screen.getWorld().isRemote) { screen.writeCustomData(GregtechDataCodes.UPDATE_PLUGIN_DATA, packetBuffer -> { packetBuffer.writeVarInt(id); @@ -124,7 +123,7 @@ public void readPluginData(int id, PacketBuffer buf) {} * @param id PacketID * @param dataWriter PacketBuffer */ - public final void writePluginAction(int id, @Nonnull Consumer dataWriter) { + public final void writePluginAction(int id, @NotNull Consumer dataWriter) { PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); dataWriter.accept(buffer); GregTechAPI.networkHandler.sendToServer(new PacketPluginSynced( diff --git a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java index 237a1ca09fb..41276b586a4 100644 --- a/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java +++ b/src/main/java/gregtech/api/items/itemhandlers/InaccessibleItemStackHandler.java @@ -4,7 +4,7 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class InaccessibleItemStackHandler extends GTItemStackHandler { @@ -12,17 +12,17 @@ public InaccessibleItemStackHandler(MetaTileEntity metaTileEntity) { super(metaTileEntity); } - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return stack; } - @Nonnull + @NotNull public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; } - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { this.stacks.set(slot, stack); } } diff --git a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java index a117bd7e2ef..35172727add 100644 --- a/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java +++ b/src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java @@ -33,15 +33,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaPrefixItem extends StandardMetaItem { private final MaterialRegistry registry; @@ -55,7 +54,7 @@ public class MetaPrefixItem extends StandardMetaItem { purifyMap.put(OrePrefix.dustPure, OrePrefix.dust); } - public MetaPrefixItem(@Nonnull MaterialRegistry registry, @Nonnull OrePrefix orePrefix) { + public MetaPrefixItem(@NotNull MaterialRegistry registry, @NotNull OrePrefix orePrefix) { super(); this.registry = registry; this.prefix = orePrefix; @@ -99,9 +98,9 @@ protected static boolean canGenerate(OrePrefix orePrefix, Material material) { return orePrefix.doGenerateItem(material); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack itemStack) { + public String getItemStackDisplayName(@NotNull ItemStack itemStack) { Material material = getMaterial(itemStack); if (material == null || prefix == null) return ""; return prefix.getLocalNameForItem(material); @@ -109,7 +108,7 @@ public String getItemStackDisplayName(@Nonnull ItemStack itemStack) { @Override @SideOnly(Side.CLIENT) - protected int getColorForItemStack(@Nonnull ItemStack stack, int tintIndex) { + protected int getColorForItemStack(@NotNull ItemStack stack, int tintIndex) { if (tintIndex == 0) { Material material = getMaterial(stack); if (material == null) @@ -147,13 +146,13 @@ public void registerModels() { } @Override - public int getItemStackLimit(@Nonnull ItemStack stack) { + public int getItemStackLimit(@NotNull ItemStack stack) { if (prefix == null) return 64; return prefix.maxStackSize; } @Override - public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, + public void onUpdate(@NotNull ItemStack itemStack, @NotNull World worldIn, @NotNull Entity entityIn, int itemSlot, boolean isSelected) { super.onUpdate(itemStack, worldIn, entityIn, itemSlot, isSelected); if (metaItems.containsKey((short) itemStack.getItemDamage()) && entityIn instanceof EntityLivingBase entity) { @@ -182,8 +181,8 @@ public void onUpdate(@Nonnull ItemStack itemStack, @Nonnull World worldIn, @Nonn @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, - @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn, @NotNull List lines, + @NotNull ITooltipFlag tooltipFlag) { super.addInformation(itemStack, worldIn, lines, tooltipFlag); Material material = getMaterial(itemStack); if (prefix == null || material == null) return; @@ -197,7 +196,7 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn * @return the material */ @Nullable - public Material getMaterial(@Nonnull ItemStack stack) { + public Material getMaterial(@NotNull ItemStack stack) { return registry.getObjectById(stack.getMetadata()); } @@ -206,7 +205,7 @@ public Material getMaterial(@Nonnull ItemStack stack) { * * @return the material */ - @Nonnull + @NotNull protected Material getMaterial(int metadata) { return Objects.requireNonNull(registry.getObjectById(metadata)); } @@ -217,7 +216,7 @@ protected Material getMaterial(int metadata) { * @return the material */ @Nullable - public static Material tryGetMaterial(@Nonnull ItemStack itemStack) { + public static Material tryGetMaterial(@NotNull ItemStack itemStack) { if (itemStack.getItem() instanceof MetaPrefixItem metaPrefixItem) { return metaPrefixItem.getMaterial(itemStack); } @@ -229,7 +228,7 @@ public OrePrefix getOrePrefix() { } @Override - public int getItemBurnTime(@Nonnull ItemStack itemStack) { + public int getItemBurnTime(@NotNull ItemStack itemStack) { Material material = getMaterial(itemStack); DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST); if (property != null) return (int) (property.getBurnTime() * prefix.getMaterialAmount(material) / GTValues.M); @@ -237,7 +236,7 @@ public int getItemBurnTime(@Nonnull ItemStack itemStack) { } @Override - public boolean isBeaconPayment(@Nonnull ItemStack stack) { + public boolean isBeaconPayment(@NotNull ItemStack stack) { Material material = getMaterial(stack); if (material != null && this.prefix != OrePrefix.ingot && this.prefix != OrePrefix.gem) { ToolProperty property = material.getProperty(PropertyKey.TOOL); @@ -273,7 +272,7 @@ public boolean onEntityItemUpdate(EntityItem itemEntity) { return false; } - protected void addMaterialTooltip(@Nonnull List lines, @Nonnull ItemStack itemStack) { + protected void addMaterialTooltip(@NotNull List lines, @NotNull ItemStack itemStack) { if (this.prefix.tooltipFunc != null) { lines.addAll(this.prefix.tooltipFunc.apply(getMaterial(itemStack))); } diff --git a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java index 2c3cbf3dff5..75bfaae996b 100644 --- a/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java +++ b/src/main/java/gregtech/api/items/metaitem/FilteredFluidStats.java @@ -11,7 +11,7 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class FilteredFluidStats implements IItemComponent, IItemCapabilityProvider { diff --git a/src/main/java/gregtech/api/items/metaitem/FoodStats.java b/src/main/java/gregtech/api/items/metaitem/FoodStats.java index 2a7533a624e..a7d1c343ffa 100644 --- a/src/main/java/gregtech/api/items/metaitem/FoodStats.java +++ b/src/main/java/gregtech/api/items/metaitem/FoodStats.java @@ -9,9 +9,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -import java.util.List; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.List; /** * Simple {@link gregtech.api.items.metaitem.stats.IFoodBehavior} implementation diff --git a/src/main/java/gregtech/api/items/metaitem/MetaItem.java b/src/main/java/gregtech/api/items/metaitem/MetaItem.java index 3124992ad78..ba1f713f010 100644 --- a/src/main/java/gregtech/api/items/metaitem/MetaItem.java +++ b/src/main/java/gregtech/api/items/metaitem/MetaItem.java @@ -67,14 +67,13 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.builder.ToStringBuilder; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.time.Instant; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * MetaItem is item that can have up to Short.MAX_VALUE items inside one id. * These items even can be edible, have custom behaviours, be electric or act like fluid containers! @@ -195,13 +194,13 @@ protected int getColorForItemStack(ItemStack stack, int tintIndex) { } @Override - public boolean showDurabilityBar(@Nonnull ItemStack stack) { + public boolean showDurabilityBar(@NotNull ItemStack stack) { // meta items now handle durability bars via custom rendering return false; } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack stack) { + public double getDurabilityForDisplay(@NotNull ItemStack stack) { T metaValueItem = getItem(stack); if (metaValueItem != null && metaValueItem.getDurabilityManager() != null) { return metaValueItem.getDurabilityManager().getDurabilityForDisplay(stack); @@ -209,10 +208,10 @@ public double getDurabilityForDisplay(@Nonnull ItemStack stack) { return -1.0; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public EnumRarity getRarity(@Nonnull ItemStack stack) { + public EnumRarity getRarity(@NotNull ItemStack stack) { T metaValueItem = getItem(stack); if (metaValueItem != null && metaValueItem.getRarity() != null) return metaValueItem.getRarity(); else return super.getRarity(stack); @@ -261,7 +260,7 @@ protected short formatRawItemDamage(short metaValue) { public void registerSubItems() {} @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { T metaValueItem = getItem(stack); if (metaValueItem == null) { return null; @@ -278,7 +277,7 @@ public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable ////////////////////////////////////////////////////////////////// @Override - public int getItemBurnTime(@Nonnull ItemStack itemStack) { + public int getItemBurnTime(@NotNull ItemStack itemStack) { T metaValueItem = getItem(itemStack); if (metaValueItem == null) { return super.getItemBurnTime(itemStack); @@ -307,7 +306,7 @@ public List getBehaviours(ItemStack itemStack) { } @Override - public int getItemStackLimit(@Nonnull ItemStack stack) { + public int getItemStackLimit(@NotNull ItemStack stack) { T metaValueItem = getItem(stack); if (metaValueItem == null) { return 64; @@ -315,9 +314,9 @@ public int getItemStackLimit(@Nonnull ItemStack stack) { return metaValueItem.getMaxStackSize(stack); } - @Nonnull + @NotNull @Override - public EnumAction getItemUseAction(@Nonnull ItemStack stack) { + public EnumAction getItemUseAction(@NotNull ItemStack stack) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { return useManager.getUseAction(stack); @@ -326,7 +325,7 @@ public EnumAction getItemUseAction(@Nonnull ItemStack stack) { } @Override - public int getMaxItemUseDuration(@Nonnull ItemStack stack) { + public int getMaxItemUseDuration(@NotNull ItemStack stack) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { return useManager.getMaxItemUseDuration(stack); @@ -335,7 +334,7 @@ public int getMaxItemUseDuration(@Nonnull ItemStack stack) { } @Override - public void onUsingTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase player, int count) { + public void onUsingTick(@NotNull ItemStack stack, @NotNull EntityLivingBase player, int count) { if (player instanceof EntityPlayer) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { @@ -345,7 +344,7 @@ public void onUsingTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase play } @Override - public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player, + public void onPlayerStoppedUsing(@NotNull ItemStack stack, @NotNull World world, @NotNull EntityLivingBase player, int timeLeft) { if (player instanceof EntityPlayer) { IItemUseManager useManager = getUseManager(stack); @@ -356,7 +355,7 @@ public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, } @Override - public ItemStack onItemUseFinish(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase player) { + public ItemStack onItemUseFinish(@NotNull ItemStack stack, @NotNull World world, @NotNull EntityLivingBase player) { if (player instanceof EntityPlayer) { IItemUseManager useManager = getUseManager(stack); if (useManager != null) { @@ -367,7 +366,7 @@ public ItemStack onItemUseFinish(@Nonnull ItemStack stack, @Nonnull World world, } @Override - public boolean onLeftClickEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull Entity entity) { + public boolean onLeftClickEntity(@NotNull ItemStack stack, @NotNull EntityPlayer player, @NotNull Entity entity) { boolean returnValue = false; for (IItemBehaviour behaviour : getBehaviours(stack)) { if (behaviour.onLeftClickEntity(stack, player, entity)) { @@ -378,8 +377,8 @@ public boolean onLeftClickEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer } @Override - public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, - @Nonnull EntityLivingBase target, @Nonnull EnumHand hand) { + public boolean itemInteractionForEntity(@NotNull ItemStack stack, @NotNull EntityPlayer playerIn, + @NotNull EntityLivingBase target, @NotNull EnumHand hand) { boolean returnValue = false; for (IItemBehaviour behaviour : getBehaviours(stack)) { if (behaviour.itemInteractionForEntity(stack, playerIn, target, hand)) { @@ -389,9 +388,9 @@ public boolean itemInteractionForEntity(@Nonnull ItemStack stack, @Nonnull Entit return returnValue; } - @Nonnull + @NotNull @Override - public ActionResult onItemRightClick(@Nonnull World world, EntityPlayer player, @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, EntityPlayer player, @NotNull EnumHand hand) { ItemStack itemStack = player.getHeldItem(hand); for (IItemBehaviour behaviour : getBehaviours(itemStack)) { ActionResult behaviourResult = behaviour.onItemRightClick(world, player, hand); @@ -411,11 +410,11 @@ public ActionResult onItemRightClick(@Nonnull World world, EntityPlay return ActionResult.newResult(EnumActionResult.PASS, itemStack); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { ItemStack itemStack = player.getHeldItem(hand); for (IItemBehaviour behaviour : getBehaviours(itemStack)) { EnumActionResult behaviourResult = behaviour.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, @@ -429,10 +428,10 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, @Nonnull World world return EnumActionResult.PASS; } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); ItemStack originalStack = stack.copy(); @@ -452,10 +451,10 @@ public EnumActionResult onItemUse(EntityPlayer player, @Nonnull World world, @No return EnumActionResult.PASS; } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { HashMultimap modifiers = HashMultimap.create(); T metaValueItem = getItem(stack); if (metaValueItem != null) { @@ -467,7 +466,7 @@ public Multimap getAttributeModifiers(@Nonnull Entity } @Override - public boolean isEnchantable(@Nonnull ItemStack stack) { + public boolean isEnchantable(@NotNull ItemStack stack) { T metaValueItem = getItem(stack); if (metaValueItem != null) { IEnchantabilityHelper helper = metaValueItem.getEnchantabilityHelper(); @@ -477,7 +476,7 @@ public boolean isEnchantable(@Nonnull ItemStack stack) { } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { T metaValueItem = getItem(stack); if (metaValueItem != null) { IEnchantabilityHelper helper = metaValueItem.getEnchantabilityHelper(); @@ -487,7 +486,7 @@ public int getItemEnchantability(@Nonnull ItemStack stack) { } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { T metaValueItem = getItem(stack); if (metaValueItem != null) { IEnchantabilityHelper helper = metaValueItem.getEnchantabilityHelper(); @@ -497,7 +496,7 @@ public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Ench } @Override - public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull Entity entityIn, int itemSlot, + public void onUpdate(@NotNull ItemStack stack, @NotNull World worldIn, @NotNull Entity entityIn, int itemSlot, boolean isSelected) { for (IItemBehaviour behaviour : getBehaviours(stack)) { behaviour.onUpdate(stack, entityIn); @@ -505,7 +504,7 @@ public void onUpdate(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) { // if item is equal, and old item has electric item capability, remove charge tags to stop reequip animation // when charge is altered @@ -534,7 +533,7 @@ public String getTranslationKey(ItemStack stack) { return metaItem == null ? getTranslationKey() : getTranslationKey() + "." + metaItem.unlocalizedName; } - @Nonnull + @NotNull @Override public String getItemStackDisplayName(ItemStack stack) { if (stack.getItemDamage() >= metaItemOffset) { @@ -561,8 +560,8 @@ public String getItemStackDisplayName(ItemStack stack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, - @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn, @NotNull List lines, + @NotNull ITooltipFlag tooltipFlag) { T item = getItem(itemStack); if (item == null) return; String unlocalizedTooltip = "metaitem." + item.unlocalizedName + ".tooltip"; @@ -638,7 +637,7 @@ private static void addDischargeItemTooltip(List tooltip, long maxCharge } @Override - public boolean hasContainerItem(@Nonnull ItemStack itemStack) { + public boolean hasContainerItem(@NotNull ItemStack itemStack) { T item = getItem(itemStack); if (item == null) { return false; @@ -646,9 +645,9 @@ public boolean hasContainerItem(@Nonnull ItemStack itemStack) { return item.getContainerItemProvider() != null; } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { + public ItemStack getContainerItem(@NotNull ItemStack itemStack) { T item = getItem(itemStack); if (item == null) { return ItemStack.EMPTY; @@ -659,7 +658,7 @@ public ItemStack getContainerItem(@Nonnull ItemStack itemStack) { return provider == null ? ItemStack.EMPTY : provider.getContainerItem(itemStack); } - @Nonnull + @NotNull @Override public CreativeTabs[] getCreativeTabs() { if (additionalCreativeTabs.isEmpty()) return defaultCreativeTabs; // short circuit @@ -695,7 +694,7 @@ protected boolean isInCreativeTab(CreativeTabs tab) { } @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList subItems) { + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList subItems) { if (!isInCreativeTab(tab)) return; for (T item : metaItems.values()) { if (!item.isInCreativeTab(tab)) continue; @@ -713,7 +712,7 @@ public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlaye // IOverlayRenderAware @Override - public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition) { + public void renderItemOverlayIntoGUI(@NotNull ItemStack stack, int xPosition, int yPosition) { ToolChargeBarRenderer.renderBarsItem(this, stack, xPosition, yPosition); } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java index b1c1da05c47..2fc74c6d9a1 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IFoodBehavior.java @@ -4,9 +4,9 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -import java.util.List; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.List; public interface IFoodBehavior extends IItemComponent { diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java index bd0a72dd988..eb2b743d176 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemBehaviour.java @@ -16,11 +16,10 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.NotNull; import java.util.List; -import javax.annotation.Nonnull; - public interface IItemBehaviour extends IItemComponent { default boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer player, Entity entity) { @@ -54,5 +53,5 @@ default ActionResult onItemRightClick(World world, EntityPlayer playe return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } - default void addPropertyOverride(@Nonnull Item item) {} + default void addPropertyOverride(@NotNull Item item) {} } diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java index 119c8785ab4..ad45a50dfee 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemDurabilityManager.java @@ -3,11 +3,10 @@ import net.minecraft.item.ItemStack; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.awt.*; -import javax.annotation.Nullable; - public interface IItemDurabilityManager extends IItemComponent { /** The durability remaining on this item (double from 0 to 1). */ diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IItemHUDProvider.java b/src/main/java/gregtech/api/items/metaitem/stats/IItemHUDProvider.java index f9e83475213..6047af01b5e 100644 --- a/src/main/java/gregtech/api/items/metaitem/stats/IItemHUDProvider.java +++ b/src/main/java/gregtech/api/items/metaitem/stats/IItemHUDProvider.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Provides a drawable HUD for the item @@ -34,7 +34,7 @@ default void drawHUD(ItemStack stack) {/**/} * @param stack the stack the provider should use */ @SideOnly(Side.CLIENT) - static void tryDrawHud(@Nonnull IItemHUDProvider provider, @Nonnull ItemStack stack) { + static void tryDrawHud(@NotNull IItemHUDProvider provider, @NotNull ItemStack stack) { if (provider.shouldDrawHUD()) provider.drawHUD(stack); } } diff --git a/src/main/java/gregtech/api/items/toolitem/IGTTool.java b/src/main/java/gregtech/api/items/toolitem/IGTTool.java index ed3219d685e..300c36f537e 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTTool.java @@ -68,6 +68,8 @@ import forestry.api.arboriculture.IToolGrafter; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -76,9 +78,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.items.armor.IArmorLogic.ATTACK_DAMAGE_MODIFIER; import static gregtech.api.items.armor.IArmorLogic.ATTACK_SPEED_MODIFIER; import static gregtech.api.items.toolitem.ToolHelper.*; @@ -121,7 +120,7 @@ public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHam @Nullable String getOreDictName(); - @Nonnull + @NotNull List getSecondaryOreDicts(); @Nullable @@ -514,8 +513,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { .anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); } - default boolean definition$doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + default boolean definition$doesSneakBypassUse(@NotNull ItemStack stack, @NotNull IBlockAccess world, + @NotNull BlockPos pos, @NotNull EntityPlayer player) { return getToolStats().doesSneakBypassUse(); } @@ -621,9 +620,9 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return new CombinedCapabilityProvider(providers); } - default EnumActionResult definition$onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, - float hitY, float hitZ, @Nonnull EnumHand hand) { + default EnumActionResult definition$onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, + @NotNull BlockPos pos, @NotNull EnumFacing facing, float hitX, + float hitY, float hitZ, @NotNull EnumHand hand) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) == EnumActionResult.SUCCESS) { @@ -663,7 +662,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { return ActionResult.newResult(EnumActionResult.PASS, stack); } - default void definition$getSubItems(@Nonnull NonNullList items) { + default void definition$getSubItems(@NotNull NonNullList items) { if (getMarkerItem() != null) { items.add(getMarkerItem().get()); } else if (isElectric()) { @@ -676,8 +675,8 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { // Client-side methods @SideOnly(Side.CLIENT) - default void definition$addInformation(@Nonnull ItemStack stack, @Nullable World world, - @Nonnull List tooltip, ITooltipFlag flag) { + default void definition$addInformation(@NotNull ItemStack stack, @Nullable World world, + @NotNull List tooltip, ITooltipFlag flag) { if (!(stack.getItem() instanceof IGTTool)) return; IGTTool tool = (IGTTool) stack.getItem(); @@ -798,7 +797,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) { } } - default boolean definition$canApplyAtEnchantingTable(@Nonnull ItemStack stack, Enchantment enchantment) { + default boolean definition$canApplyAtEnchantingTable(@NotNull ItemStack stack, Enchantment enchantment) { if (stack.isEmpty()) return false; // special case enchants from other mods @@ -1007,19 +1006,19 @@ default void toolUsed(ItemStack item, EntityLivingBase user, Entity entity) { // ITool @Override - default boolean canUse(@Nonnull EnumHand hand, @Nonnull EntityPlayer player, @Nonnull BlockPos pos) { + default boolean canUse(@NotNull EnumHand hand, @NotNull EntityPlayer player, @NotNull BlockPos pos) { return get().getToolClasses(player.getHeldItem(hand)).contains(ToolClasses.WRENCH); } @Override - default void used(@Nonnull EnumHand hand, @Nonnull EntityPlayer player, @Nonnull BlockPos pos) { + default void used(@NotNull EnumHand hand, @NotNull EntityPlayer player, @NotNull BlockPos pos) { damageItem(player.getHeldItem(hand), player); playSound(player); } // IHideFacades @Override - default boolean shouldHideFacades(@Nonnull ItemStack stack, @Nonnull EntityPlayer player) { + default boolean shouldHideFacades(@NotNull ItemStack stack, @NotNull EntityPlayer player) { return get().getToolClasses(stack).contains(ToolClasses.WRENCH); } @@ -1040,7 +1039,7 @@ default float getSaplingModifier(ItemStack stack, World world, EntityPlayer play // IOverlayRenderAware @Override - default void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition) { + default void renderItemOverlayIntoGUI(@NotNull ItemStack stack, int xPosition, int yPosition) { ToolChargeBarRenderer.renderBarsTool(this, stack, xPosition, yPosition); } } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java index 405ef425369..5acd7f41780 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTAxe.java @@ -23,15 +23,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ItemGTAxe extends ItemAxe implements IGTTool { protected final String domain, id; @@ -106,7 +105,7 @@ public String getOreDictName() { return oreDict; } - @Nonnull + @NotNull @Override public List getSecondaryOreDicts() { return this.secondaryOreDicts; @@ -119,197 +118,197 @@ public Supplier getMarkerItem() { } @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { if (this.isInCreativeTab(tab)) definition$getSubItems(items); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { return LocalizationUtils.format(getTranslationKey(), getToolMaterial(stack).getLocalizedName()); } @Override - public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState state) { + public float getDestroySpeed(@NotNull ItemStack stack, @NotNull IBlockState state) { return definition$getDestroySpeed(stack, state); } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, - @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@NotNull ItemStack itemstack, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@NotNull ItemStack stack, @NotNull World worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { return getTotalEnchantability(stack); } @Override - public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) { + public boolean getIsRepairable(@NotNull ItemStack toRepair, @NotNull ItemStack repair) { return definition$getIsRepairable(toRepair, repair); } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + public int getHarvestLevel(@NotNull ItemStack stack, @NotNull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } - @Nonnull + @NotNull @Override - public Set getToolClasses(@Nonnull ItemStack stack) { + public Set getToolClasses(@NotNull ItemStack stack) { return this.toolClasses; } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, - @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@NotNull ItemStack stack, @NotNull ItemStack shield, + @NotNull EntityLivingBase entity, @NotNull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@NotNull ItemStack stack, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @Override - public boolean shouldCauseBlockBreakReset(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack) { + public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull ItemStack newStack) { return definition$shouldCauseBlockBreakReset(oldStack, newStack); } @Override - public boolean hasContainerItem(@Nonnull ItemStack stack) { + public boolean hasContainerItem(@NotNull ItemStack stack) { return definition$hasContainerItem(stack); } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack stack) { + public ItemStack getContainerItem(@NotNull ItemStack stack) { return definition$getContainerItem(stack); } @Override - public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack stack) { + public boolean onEntitySwing(@NotNull EntityLivingBase entityLiving, @NotNull ItemStack stack) { return definition$onEntitySwing(entityLiving, stack); } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, - @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@NotNull World world, @NotNull BlockPos pos, @NotNull ItemStack stack, + @NotNull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @Override - public boolean isDamaged(@Nonnull ItemStack stack) { + public boolean isDamaged(@NotNull ItemStack stack) { return definition$isDamaged(stack); } @Override - public int getDamage(@Nonnull ItemStack stack) { + public int getDamage(@NotNull ItemStack stack) { return definition$getDamage(stack); } @Override - public int getMaxDamage(@Nonnull ItemStack stack) { + public int getMaxDamage(@NotNull ItemStack stack) { return definition$getMaxDamage(stack); } @Override - public void setDamage(@Nonnull ItemStack stack, int damage) { + public void setDamage(@NotNull ItemStack stack, int damage) { definition$setDamage(stack, damage); } @Override - public boolean showDurabilityBar(@Nonnull ItemStack stack) { + public boolean showDurabilityBar(@NotNull ItemStack stack) { return false; } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack stack) { + public double getDurabilityForDisplay(@NotNull ItemStack stack) { return definition$getDurabilityForDisplay(stack); } @Nullable @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { return definition$initCapabilities(stack, nbt); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } - @Nonnull + @NotNull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, - @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, + @NotNull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { return definition$canApplyAtEnchantingTable(stack, enchantment); } @Override - public boolean canHarvestBlock(@Nonnull IBlockState state, @Nonnull ItemStack stack) { + public boolean canHarvestBlock(@NotNull IBlockState state, @NotNull ItemStack stack) { return ToolHelper.isToolEffective(state, getToolClasses(stack), getTotalHarvestLevel(stack)); } public static class Builder extends ToolBuilder { - @Nonnull - public static ItemGTAxe.Builder of(@Nonnull String domain, @Nonnull String id) { + @NotNull + public static ItemGTAxe.Builder of(@NotNull String domain, @NotNull String id) { return new ItemGTAxe.Builder(domain, id); } - public Builder(@Nonnull String domain, @Nonnull String id) { + public Builder(@NotNull String domain, @NotNull String id) { super(domain, id); } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java index 8e56c245339..7f52587be7c 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java @@ -23,15 +23,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ItemGTHoe extends ItemHoe implements IGTTool { protected final String domain, id; @@ -106,7 +105,7 @@ public String getOreDictName() { return oreDict; } - @Nonnull + @NotNull @Override public List getSecondaryOreDicts() { return this.secondaryOreDicts; @@ -119,187 +118,187 @@ public Supplier getMarkerItem() { } @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { if (this.isInCreativeTab(tab)) definition$getSubItems(items); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { return LocalizationUtils.format(getTranslationKey(), getToolMaterial(stack).getLocalizedName()); } @Override - public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState state) { + public float getDestroySpeed(@NotNull ItemStack stack, @NotNull IBlockState state) { return definition$getDestroySpeed(stack, state); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@NotNull ItemStack itemstack, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@NotNull ItemStack stack, @NotNull World worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { return getTotalEnchantability(stack); } @Override - public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) { + public boolean getIsRepairable(@NotNull ItemStack toRepair, @NotNull ItemStack repair) { return definition$getIsRepairable(toRepair, repair); } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + public int getHarvestLevel(@NotNull ItemStack stack, @NotNull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } - @Nonnull + @NotNull @Override - public Set getToolClasses(@Nonnull ItemStack stack) { + public Set getToolClasses(@NotNull ItemStack stack) { return this.toolClasses; } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, - @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@NotNull ItemStack stack, @NotNull ItemStack shield, + @NotNull EntityLivingBase entity, @NotNull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@NotNull ItemStack stack, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @Override - public boolean shouldCauseBlockBreakReset(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack) { + public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull ItemStack newStack) { return definition$shouldCauseBlockBreakReset(oldStack, newStack); } @Override - public boolean hasContainerItem(@Nonnull ItemStack stack) { + public boolean hasContainerItem(@NotNull ItemStack stack) { return definition$hasContainerItem(stack); } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack stack) { + public ItemStack getContainerItem(@NotNull ItemStack stack) { return definition$getContainerItem(stack); } @Override - public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack stack) { + public boolean onEntitySwing(@NotNull EntityLivingBase entityLiving, @NotNull ItemStack stack) { return definition$onEntitySwing(entityLiving, stack); } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, - @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@NotNull World world, @NotNull BlockPos pos, @NotNull ItemStack stack, + @NotNull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @Override - public boolean isDamaged(@Nonnull ItemStack stack) { + public boolean isDamaged(@NotNull ItemStack stack) { return definition$isDamaged(stack); } @Override - public int getDamage(@Nonnull ItemStack stack) { + public int getDamage(@NotNull ItemStack stack) { return definition$getDamage(stack); } @Override - public int getMaxDamage(@Nonnull ItemStack stack) { + public int getMaxDamage(@NotNull ItemStack stack) { return definition$getMaxDamage(stack); } @Override - public void setDamage(@Nonnull ItemStack stack, int damage) { + public void setDamage(@NotNull ItemStack stack, int damage) { definition$setDamage(stack, damage); } @Override - public boolean showDurabilityBar(@Nonnull ItemStack stack) { + public boolean showDurabilityBar(@NotNull ItemStack stack) { return false; } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack stack) { + public double getDurabilityForDisplay(@NotNull ItemStack stack) { return definition$getDurabilityForDisplay(stack); } @Nullable @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { return definition$initCapabilities(stack, nbt); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } - @Nonnull + @NotNull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, - @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, + @NotNull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { return definition$canApplyAtEnchantingTable(stack, enchantment); } @Override - public boolean canHarvestBlock(@Nonnull IBlockState state, @Nonnull ItemStack stack) { + public boolean canHarvestBlock(@NotNull IBlockState state, @NotNull ItemStack stack) { return ToolHelper.isToolEffective(state, getToolClasses(stack), getTotalHarvestLevel(stack)); } // Hoe specific overrides - @Nonnull + @NotNull @Override public String getMaterialName() { return ""; } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { // try to do the vanilla hoe behavior first EnumActionResult result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); @@ -308,8 +307,8 @@ public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World w } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, - @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { getToolStats().getBehaviors().forEach(behavior -> behavior.hitEntity(stack, target, attacker)); // damage by 1, as this is what vanilla does ToolHelper.damageItem(stack, attacker, 1); @@ -318,12 +317,12 @@ public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase tar public static class Builder extends ToolBuilder { - @Nonnull - public static Builder of(@Nonnull String domain, @Nonnull String id) { + @NotNull + public static Builder of(@NotNull String domain, @NotNull String id) { return new Builder(domain, id); } - public Builder(@Nonnull String domain, @Nonnull String id) { + public Builder(@NotNull String domain, @NotNull String id) { super(domain, id); } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java index 9f71e5a5f46..5b95f6f3718 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTSword.java @@ -23,15 +23,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ItemGTSword extends ItemSword implements IGTTool { private final String domain; @@ -77,9 +76,9 @@ public String getToolId() { return id; } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { return LocalizationUtils.format(getTranslationKey(), getToolMaterial(stack).getLocalizedName()); } @@ -115,7 +114,7 @@ public String getOreDictName() { return oredict; } - @Nonnull + @NotNull @Override public List getSecondaryOreDicts() { return this.secondaryOreDicts; @@ -128,173 +127,173 @@ public Supplier getMarkerItem() { } @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { if (this.isInCreativeTab(tab)) definition$getSubItems(items); } @Override - public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState state) { + public float getDestroySpeed(@NotNull ItemStack stack, @NotNull IBlockState state) { return definition$getDestroySpeed(stack, state); } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, - @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@NotNull ItemStack itemstack, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@NotNull ItemStack stack, @NotNull World worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { return definition$canApplyAtEnchantingTable(stack, enchantment); } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { return getTotalEnchantability(stack); } @Override - public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) { + public boolean getIsRepairable(@NotNull ItemStack toRepair, @NotNull ItemStack repair) { return definition$getIsRepairable(toRepair, repair); } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, - @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@NotNull World world, @NotNull BlockPos pos, @NotNull ItemStack stack, + @NotNull EntityPlayer player) { return false; } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + public int getHarvestLevel(@NotNull ItemStack stack, @NotNull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } - @Nonnull + @NotNull @Override - public Set getToolClasses(@Nonnull ItemStack stack) { + public Set getToolClasses(@NotNull ItemStack stack) { return this.toolClasses; } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, - @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@NotNull ItemStack stack, @NotNull ItemStack shield, + @NotNull EntityLivingBase entity, @NotNull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@NotNull ItemStack stack, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @Override - public boolean shouldCauseBlockBreakReset(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack) { + public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull ItemStack newStack) { return definition$shouldCauseBlockBreakReset(oldStack, newStack); } @Override - public boolean hasContainerItem(@Nonnull ItemStack stack) { + public boolean hasContainerItem(@NotNull ItemStack stack) { return definition$hasContainerItem(stack); } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack stack) { + public ItemStack getContainerItem(@NotNull ItemStack stack) { return definition$getContainerItem(stack); } @Override - public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack stack) { + public boolean onEntitySwing(@NotNull EntityLivingBase entityLiving, @NotNull ItemStack stack) { return definition$onEntitySwing(entityLiving, stack); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @Override - public boolean isDamaged(@Nonnull ItemStack stack) { + public boolean isDamaged(@NotNull ItemStack stack) { return definition$isDamaged(stack); } @Override - public int getDamage(@Nonnull ItemStack stack) { + public int getDamage(@NotNull ItemStack stack) { return definition$getDamage(stack); } @Override - public int getMaxDamage(@Nonnull ItemStack stack) { + public int getMaxDamage(@NotNull ItemStack stack) { return definition$getMaxDamage(stack); } @Override - public void setDamage(@Nonnull ItemStack stack, int damage) { + public void setDamage(@NotNull ItemStack stack, int damage) { definition$setDamage(stack, damage); } @Override - public boolean showDurabilityBar(@Nonnull ItemStack stack) { + public boolean showDurabilityBar(@NotNull ItemStack stack) { return false; } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack stack) { + public double getDurabilityForDisplay(@NotNull ItemStack stack) { return definition$getDurabilityForDisplay(stack); } @Nullable @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { return definition$initCapabilities(stack, nbt); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } - @Nonnull + @NotNull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, - @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, + @NotNull EnumHand hand) { // do not utilize IGTTool method to prevent a config gui from appearing return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @Override - public boolean canHarvestBlock(@Nonnull IBlockState state, @Nonnull ItemStack stack) { + public boolean canHarvestBlock(@NotNull IBlockState state, @NotNull ItemStack stack) { // special case vanilla behavior if (state.getBlock().getHarvestTool(state) == null) { return ToolHelper.isToolEffective(state, getToolClasses(stack), getTotalHarvestLevel(stack)); @@ -305,12 +304,12 @@ public boolean canHarvestBlock(@Nonnull IBlockState state, @Nonnull ItemStack st public static class Builder extends ToolBuilder { - @Nonnull - public static ItemGTSword.Builder of(@Nonnull String domain, @Nonnull String id) { + @NotNull + public static ItemGTSword.Builder of(@NotNull String domain, @NotNull String id) { return new ItemGTSword.Builder(domain, id); } - public Builder(@Nonnull String domain, @Nonnull String id) { + public Builder(@NotNull String domain, @NotNull String id) { super(domain, id); } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java index 7fcd5a9d896..edcfa83126d 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTTool.java @@ -23,15 +23,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.collect.Multimap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * GT-styled ItemTool (generic tool item). *

@@ -112,7 +111,7 @@ public String getOreDictName() { return oreDict; } - @Nonnull + @NotNull @Override public List getSecondaryOreDicts() { return this.secondaryOreDicts; @@ -125,197 +124,197 @@ public Supplier getMarkerItem() { } @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubItems(@NotNull CreativeTabs tab, @NotNull NonNullList items) { if (this.isInCreativeTab(tab)) definition$getSubItems(items); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { return LocalizationUtils.format(getTranslationKey(), getToolMaterial(stack).getLocalizedName()); } @Override - public float getDestroySpeed(@Nonnull ItemStack stack, @Nonnull IBlockState state) { + public float getDestroySpeed(@NotNull ItemStack stack, @NotNull IBlockState state) { return definition$getDestroySpeed(stack, state); } @Override - public boolean hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, - @Nonnull EntityLivingBase attacker) { + public boolean hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { return definition$hitEntity(stack, target, attacker); } @Override - public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean onBlockStartBreak(@NotNull ItemStack itemstack, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$onBlockStartBreak(itemstack, pos, player); } @Override - public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EntityLivingBase entityLiving) { + public boolean onBlockDestroyed(@NotNull ItemStack stack, @NotNull World worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EntityLivingBase entityLiving) { return definition$onBlockDestroyed(stack, worldIn, state, pos, entityLiving); } @Override - public int getItemEnchantability(@Nonnull ItemStack stack) { + public int getItemEnchantability(@NotNull ItemStack stack) { return getTotalEnchantability(stack); } @Override - public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) { + public boolean getIsRepairable(@NotNull ItemStack toRepair, @NotNull ItemStack repair) { return definition$getIsRepairable(toRepair, repair); } - @Nonnull + @NotNull @Override - public Multimap getAttributeModifiers(@Nonnull EntityEquipmentSlot slot, - @Nonnull ItemStack stack) { + public Multimap getAttributeModifiers(@NotNull EntityEquipmentSlot slot, + @NotNull ItemStack stack) { return definition$getAttributeModifiers(slot, stack); } @Override - public int getHarvestLevel(@Nonnull ItemStack stack, @Nonnull String toolClass, @Nullable EntityPlayer player, + public int getHarvestLevel(@NotNull ItemStack stack, @NotNull String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { return definition$getHarvestLevel(stack, toolClass, player, blockState); } - @Nonnull + @NotNull @Override - public Set getToolClasses(@Nonnull ItemStack stack) { + public Set getToolClasses(@NotNull ItemStack stack) { return this.toolClasses; } @Override - public boolean canDisableShield(@Nonnull ItemStack stack, @Nonnull ItemStack shield, - @Nonnull EntityLivingBase entity, @Nonnull EntityLivingBase attacker) { + public boolean canDisableShield(@NotNull ItemStack stack, @NotNull ItemStack shield, + @NotNull EntityLivingBase entity, @NotNull EntityLivingBase attacker) { return definition$canDisableShield(stack, shield, entity, attacker); } @Override - public boolean doesSneakBypassUse(@Nonnull ItemStack stack, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityPlayer player) { + public boolean doesSneakBypassUse(@NotNull ItemStack stack, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityPlayer player) { return definition$doesSneakBypassUse(stack, world, pos, player); } @Override - public boolean shouldCauseBlockBreakReset(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack) { + public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull ItemStack newStack) { return definition$shouldCauseBlockBreakReset(oldStack, newStack); } @Override - public boolean hasContainerItem(@Nonnull ItemStack stack) { + public boolean hasContainerItem(@NotNull ItemStack stack) { return definition$hasContainerItem(stack); } - @Nonnull + @NotNull @Override - public ItemStack getContainerItem(@Nonnull ItemStack stack) { + public ItemStack getContainerItem(@NotNull ItemStack stack) { return definition$getContainerItem(stack); } @Override - public boolean onEntitySwing(@Nonnull EntityLivingBase entityLiving, @Nonnull ItemStack stack) { + public boolean onEntitySwing(@NotNull EntityLivingBase entityLiving, @NotNull ItemStack stack) { return definition$onEntitySwing(entityLiving, stack); } @Override - public boolean canDestroyBlockInCreative(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ItemStack stack, - @Nonnull EntityPlayer player) { + public boolean canDestroyBlockInCreative(@NotNull World world, @NotNull BlockPos pos, @NotNull ItemStack stack, + @NotNull EntityPlayer player) { return definition$canDestroyBlockInCreative(world, pos, stack, player); } @Override - public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, + public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) { return definition$shouldCauseReequipAnimation(oldStack, newStack, slotChanged); } @Override - public boolean isDamaged(@Nonnull ItemStack stack) { + public boolean isDamaged(@NotNull ItemStack stack) { return definition$isDamaged(stack); } @Override - public int getDamage(@Nonnull ItemStack stack) { + public int getDamage(@NotNull ItemStack stack) { return definition$getDamage(stack); } @Override - public int getMaxDamage(@Nonnull ItemStack stack) { + public int getMaxDamage(@NotNull ItemStack stack) { return definition$getMaxDamage(stack); } @Override - public void setDamage(@Nonnull ItemStack stack, int damage) { + public void setDamage(@NotNull ItemStack stack, int damage) { definition$setDamage(stack, damage); } @Override - public boolean showDurabilityBar(@Nonnull ItemStack stack) { + public boolean showDurabilityBar(@NotNull ItemStack stack) { return false; } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack stack) { + public double getDurabilityForDisplay(@NotNull ItemStack stack) { return definition$getDurabilityForDisplay(stack); } @Nullable @Override - public ICapabilityProvider initCapabilities(@Nonnull ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable NBTTagCompound nbt) { return definition$initCapabilities(stack, nbt); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { return definition$onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { return definition$onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } - @Nonnull + @NotNull @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, - @Nonnull EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, + @NotNull EnumHand hand) { return definition$onItemRightClick(world, player, hand); } @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { definition$addInformation(stack, world, tooltip, flag); } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack, @Nonnull Enchantment enchantment) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack, @NotNull Enchantment enchantment) { return definition$canApplyAtEnchantingTable(stack, enchantment); } @Override - public boolean canHarvestBlock(@Nonnull IBlockState state, @Nonnull ItemStack stack) { + public boolean canHarvestBlock(@NotNull IBlockState state, @NotNull ItemStack stack) { return ToolHelper.isToolEffective(state, getToolClasses(stack), getTotalHarvestLevel(stack)); } public static class Builder extends ToolBuilder { - @Nonnull - public static Builder of(@Nonnull String domain, @Nonnull String id) { + @NotNull + public static Builder of(@NotNull String domain, @NotNull String id) { return new Builder(domain, id); } - public Builder(@Nonnull String domain, @Nonnull String id) { + public Builder(@NotNull String domain, @NotNull String id) { super(domain, id); } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java index 073e689451b..30f82b5c1a0 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolBuilder.java @@ -4,13 +4,12 @@ import net.minecraft.util.SoundEvent; import it.unimi.dsi.fastutil.objects.ObjectArraySet; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.function.Supplier; import java.util.function.UnaryOperator; -import javax.annotation.Nonnull; - public abstract class ToolBuilder { protected final String domain, id; @@ -66,22 +65,22 @@ public ToolBuilder toolClasses(Set tools) { return this; } - public ToolBuilder oreDict(@Nonnull String oreDict) { + public ToolBuilder oreDict(@NotNull String oreDict) { this.oreDict = oreDict; return this; } - public ToolBuilder oreDict(@Nonnull Enum oreDict) { + public ToolBuilder oreDict(@NotNull Enum oreDict) { this.oreDict = oreDict.name(); return this; } - public ToolBuilder secondaryOreDicts(@Nonnull Enum... oreDicts) { + public ToolBuilder secondaryOreDicts(@NotNull Enum... oreDicts) { Arrays.stream(oreDicts).map(Enum::name).forEach(this.secondaryOreDicts::add); return this; } - public ToolBuilder secondaryOreDicts(@Nonnull String... oreDicts) { + public ToolBuilder secondaryOreDicts(@NotNull String... oreDicts) { this.secondaryOreDicts.addAll(Arrays.asList(oreDicts)); return this; } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java index ffd5ee89594..2e0a3335df0 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java @@ -51,6 +51,8 @@ import com.google.common.collect.ImmutableSet; import it.unimi.dsi.fastutil.objects.ObjectArraySet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -58,9 +60,6 @@ import java.util.*; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.LV; import static gregtech.api.GTValues.V; @@ -220,7 +219,7 @@ public static ItemStack getAndSetToolData(IGTTool tool, Material material, int m * @param stack stack to be damaged * @param entity entity that has damaged this stack */ - public static void damageItemWhenCrafting(@Nonnull ItemStack stack, @Nullable EntityLivingBase entity) { + public static void damageItemWhenCrafting(@NotNull ItemStack stack, @Nullable EntityLivingBase entity) { int damage = 2; if (stack.getItem() instanceof IGTTool) { damage = ((IGTTool) stack.getItem()).getToolStats().getToolDamagePerCraft(stack); @@ -242,7 +241,7 @@ public static void damageItemWhenCrafting(@Nonnull ItemStack stack, @Nullable En * @param stack stack to be damaged * @param entity entity that has damaged this stack */ - public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBase entity) { + public static void damageItem(@NotNull ItemStack stack, @Nullable EntityLivingBase entity) { damageItem(stack, entity, 1); } @@ -254,7 +253,7 @@ public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBa * @param entity entity that has damaged this stack * @param damage how much damage the stack will take */ - public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBase entity, int damage) { + public static void damageItem(@NotNull ItemStack stack, @Nullable EntityLivingBase entity, int damage) { if (!(stack.getItem() instanceof IGTTool)) { if (entity != null) stack.damageItem(damage, entity); } else { @@ -319,7 +318,7 @@ public static void damageItem(@Nonnull ItemStack stack, @Nullable EntityLivingBa * @param world the world in which the click happened * @param hand the hand holding the item */ - public static void onActionDone(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull EnumHand hand) { + public static void onActionDone(@NotNull EntityPlayer player, @NotNull World world, @NotNull EnumHand hand) { ItemStack stack = player.getHeldItem(hand); IGTTool tool = (IGTTool) stack.getItem(); ToolHelper.damageItem(stack, player); @@ -597,7 +596,7 @@ public static Set getHarvestableBlocks(ItemStack stack, EntityPlayer p return getHarvestableBlocks(stack, aoeDefiniton, player.world, player, rayTraceResult); } - public static RayTraceResult getPlayerDefaultRaytrace(@Nonnull EntityPlayer player) { + public static RayTraceResult getPlayerDefaultRaytrace(@NotNull EntityPlayer player) { Vec3d lookPos = player.getPositionEyes(1F); Vec3d rotation = player.getLook(1); Vec3d realLookPos = lookPos.add(rotation.x * 5, rotation.y * 5, rotation.z * 5); @@ -759,8 +758,8 @@ public static boolean removeBlockRoutine(@Nullable IBlockState state, World worl * @param state the BlockState of the block * @return the silk touch drop */ - @Nonnull - public static ItemStack getSilkTouchDrop(@Nonnull IBlockState state) { + @NotNull + public static ItemStack getSilkTouchDrop(@NotNull IBlockState state) { try { return (ItemStack) GET_SILK_TOUCH_DROP.invokeExact(state.getBlock(), state); } catch (Throwable ignored) { diff --git a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java index 2a73aac9dd3..c93507a95b1 100644 --- a/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java +++ b/src/main/java/gregtech/api/items/toolitem/TreeFellingListener.java @@ -12,12 +12,11 @@ import net.minecraftforge.fml.relauncher.Side; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public final class TreeFellingListener { private final EntityPlayerMP player; @@ -30,8 +29,8 @@ private TreeFellingListener(EntityPlayerMP player, ItemStack tool, Deque onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, - @Nonnull EnumHand hand) { + @NotNull + default ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, + @NotNull EnumHand hand) { return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } @SideOnly(Side.CLIENT) - default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) {} + default void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) {} /** * Add the necessary NBT information to the tool @@ -138,7 +138,7 @@ default void addInformation(@Nonnull ItemStack stack, @Nullable World world, @No * @param stack the tool * @param tag the nbt tag to add to */ - default void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) {} + default void addBehaviorNBT(@NotNull ItemStack stack, @NotNull NBTTagCompound tag) {} /** * Add a capability to a tool. diff --git a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java index 4991ba06cd0..51665a7f1fb 100644 --- a/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java +++ b/src/main/java/gregtech/api/metatileentity/IDataInfoProvider.java @@ -2,12 +2,12 @@ import net.minecraft.util.text.ITextComponent; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public interface IDataInfoProvider { - @Nonnull + @NotNull List getDataInfo(); } diff --git a/src/main/java/gregtech/api/metatileentity/IVoidable.java b/src/main/java/gregtech/api/metatileentity/IVoidable.java index 16d60b6e3c7..96a6fe86ccb 100644 --- a/src/main/java/gregtech/api/metatileentity/IVoidable.java +++ b/src/main/java/gregtech/api/metatileentity/IVoidable.java @@ -2,7 +2,7 @@ import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public interface IVoidable { @@ -35,7 +35,7 @@ enum VoidingMode implements IStringSerializable { this.localeName = name; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java index bfaf3dd00d9..9d5662a1153 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityHolder.java @@ -45,13 +45,11 @@ import appeng.me.helpers.IGridProxyable; import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.text.DecimalFormat; import java.util.ArrayList; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.INITIALIZE_MTE; @InterfaceList(value = { @@ -122,7 +120,7 @@ public void notifyBlockUpdate() { } @Override - public void readFromNBT(@Nonnull NBTTagCompound compound) { + public void readFromNBT(@NotNull NBTTagCompound compound) { super.readFromNBT(compound); customName = compound.getString(GregtechDataCodes.CUSTOM_NAME); if (compound.hasKey("MetaId", NBT.TAG_STRING)) { @@ -146,9 +144,9 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { } } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { super.writeToNBT(compound); compound.setString(GregtechDataCodes.CUSTOM_NAME, getName()); if (metaTileEntity != null) { @@ -175,7 +173,7 @@ public void invalidate() { } @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { Object metaTileEntityValue = metaTileEntity == null ? null : metaTileEntity.getCoverCapability(capability, facing); return metaTileEntityValue != null || super.hasCapability(capability, facing); @@ -183,7 +181,7 @@ public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFa @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { T metaTileEntityValue = metaTileEntity == null ? null : metaTileEntity.getCoverCapability(capability, facing); return metaTileEntityValue != null ? metaTileEntityValue : super.getCapability(capability, facing); } @@ -383,21 +381,21 @@ public void onChunkUnload() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + public boolean shouldRefresh(@NotNull World world, @NotNull BlockPos pos, IBlockState oldState, IBlockState newState) { return oldState.getBlock() != newState.getBlock(); // MetaTileEntityHolder should never refresh (until block // changes) } @Override - public void rotate(@Nonnull Rotation rotationIn) { + public void rotate(@NotNull Rotation rotationIn) { if (metaTileEntity != null) { metaTileEntity.setFrontFacing(rotationIn.rotate(metaTileEntity.getFrontFacing())); } } @Override - public void mirror(@Nonnull Mirror mirrorIn) { + public void mirror(@NotNull Mirror mirrorIn) { if (metaTileEntity != null) { rotate(mirrorIn.toRotation(metaTileEntity.getFrontFacing())); } @@ -418,7 +416,7 @@ public boolean shouldRenderInPass(int pass) { return false; } - @Nonnull + @NotNull @Override public AxisAlignedBB getRenderBoundingBox() { if (metaTileEntity instanceof IFastRenderMetaTileEntity) { @@ -486,7 +484,7 @@ private void updateNameTagParticle() { } } - @Nonnull + @NotNull @Override public String getName() { return this.customName == null ? "" : this.customName; @@ -497,7 +495,7 @@ public boolean hasCustomName() { return this.customName != null && !this.customName.isEmpty(); } - @Nonnull + @NotNull @Override public ITextComponent getDisplayName() { return this.hasCustomName() ? new TextComponentString(this.getName()) : @@ -508,7 +506,7 @@ public ITextComponent getDisplayName() { @Nullable @Override @Method(modid = GTValues.MODID_APPENG) - public IGridNode getGridNode(@Nonnull AEPartLocation part) { + public IGridNode getGridNode(@NotNull AEPartLocation part) { // Forbid it connects the faces it shouldn't connect. if (this.getCableConnectionType(part) == AECableType.NONE) { return null; @@ -517,10 +515,10 @@ public IGridNode getGridNode(@Nonnull AEPartLocation part) { return proxy == null ? null : proxy.getNode(); } - @Nonnull + @NotNull @Override @Method(modid = GTValues.MODID_APPENG) - public AECableType getCableConnectionType(@Nonnull AEPartLocation part) { + public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return metaTileEntity == null ? AECableType.NONE : metaTileEntity.getCableConnectionType(part); } @@ -528,7 +526,7 @@ public AECableType getCableConnectionType(@Nonnull AEPartLocation part) { @Method(modid = GTValues.MODID_APPENG) public void securityBreak() {} - @Nonnull + @NotNull @Override @Method(modid = GTValues.MODID_APPENG) public IGridNode getActionableNode() { diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 074ace86e8b..3cac1149fcb 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -29,13 +29,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Function; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class SimpleGeneratorMetaTileEntity extends WorkableTieredMetaTileEntity implements IActiveOutputSide { private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value @@ -139,7 +138,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { String key = this.metaTileEntityId.getPath().split("\\.")[0]; String mainKey = String.format("gregtech.machine.%s.tooltip", key); diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index e414c212236..b5746f071c0 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -46,13 +46,12 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.List; import java.util.function.Function; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity diff --git a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java index 2093b72e7ff..a2c53bda0f1 100644 --- a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java @@ -35,12 +35,11 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Objects; -import javax.annotation.Nullable; - public abstract class SteamMetaTileEntity extends MetaTileEntity { protected static final int STEAM_CAPACITY = 16000; diff --git a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java index 16c9090233b..0c03b3bc794 100644 --- a/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/TieredMetaTileEntity.java @@ -23,12 +23,11 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public abstract class TieredMetaTileEntity extends MetaTileEntity implements IEnergyChangeListener, ITieredMetaTileEntity { @@ -59,7 +58,7 @@ protected SimpleSidedCubeRenderer getBaseRenderer() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant()) diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index 2b4e6b8a5be..69c42322da8 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -24,14 +24,13 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.Function; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity implements IDataInfoProvider, ICleanroomReceiver { @@ -157,7 +156,7 @@ public SoundEvent getSound() { return workable.getRecipeMap().getSound(); } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java index 9eea63c0cf4..0d12a1013f1 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/CleanroomType.java @@ -1,12 +1,11 @@ package gregtech.api.metatileentity.multiblock; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class CleanroomType { private static final Map CLEANROOM_TYPES = new Object2ObjectOpenHashMap<>(); @@ -19,7 +18,7 @@ public class CleanroomType { private final String name; private final String translationKey; - public CleanroomType(@Nonnull String name, @Nonnull String translationKey) { + public CleanroomType(@NotNull String name, @NotNull String translationKey) { if (CLEANROOM_TYPES.get(name) != null) throw new IllegalArgumentException( String.format("CleanroomType with name %s is already registered!", name)); @@ -29,18 +28,18 @@ public CleanroomType(@Nonnull String name, @Nonnull String translationKey) { CLEANROOM_TYPES.put(name, this); } - @Nonnull + @NotNull public String getName() { return this.name; } - @Nonnull + @NotNull public String getTranslationKey() { return this.translationKey; } @Nullable - public static CleanroomType getByName(@Nonnull String name) { + public static CleanroomType getByName(@NotNull String name) { return CLEANROOM_TYPES.get(name); } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java index 198a972b725..6b51624ed4c 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/DummyCleanroom.java @@ -1,10 +1,10 @@ package gregtech.api.metatileentity.multiblock; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Collections; -import javax.annotation.Nonnull; - public final class DummyCleanroom implements ICleanroomProvider { private final boolean allowsAllTypes; @@ -15,20 +15,20 @@ public final class DummyCleanroom implements ICleanroomProvider { * * @param types the types to provide */ - @Nonnull - public static DummyCleanroom createForTypes(@Nonnull Collection types) { + @NotNull + public static DummyCleanroom createForTypes(@NotNull Collection types) { return new DummyCleanroom(types, false); } /** * Create a Dummy Cleanroom that provides all types */ - @Nonnull + @NotNull public static DummyCleanroom createForAllTypes() { return new DummyCleanroom(Collections.emptyList(), true); } - private DummyCleanroom(@Nonnull Collection allowedTypes, boolean allowsAllTypes) { + private DummyCleanroom(@NotNull Collection allowedTypes, boolean allowsAllTypes) { this.allowedTypes = allowedTypes; this.allowsAllTypes = allowsAllTypes; } @@ -54,7 +54,7 @@ public int getEnergyTier() { } @Override - public boolean checkCleanroomType(@Nonnull CleanroomType type) { + public boolean checkCleanroomType(@NotNull CleanroomType type) { if (allowsAllTypes) return true; return allowedTypes.contains(type); } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java index a67d7ec7b09..faad3421dc1 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java @@ -18,11 +18,11 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public abstract class FuelMultiblockController extends RecipeMapMultiblockController { public FuelMultiblockController(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier) { @@ -75,7 +75,7 @@ protected boolean isDynamoTierTooLow() { return false; } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomProvider.java b/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomProvider.java index d3e072232b4..ea9c6a65324 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomProvider.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomProvider.java @@ -1,6 +1,6 @@ package gregtech.api.metatileentity.multiblock; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Implement this interface in order to make a TileEntity into a block that provides a Cleanroom to other blocks @@ -11,7 +11,7 @@ public interface ICleanroomProvider { * @param type the type to check * @return if the type is fulfilled */ - boolean checkCleanroomType(@Nonnull CleanroomType type); + boolean checkCleanroomType(@NotNull CleanroomType type); /** * Sets the cleanroom's clean amount diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomReceiver.java b/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomReceiver.java index 4d4304582af..af729726b23 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomReceiver.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ICleanroomReceiver.java @@ -1,6 +1,6 @@ package gregtech.api.metatileentity.multiblock; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * Implement this interface in order to make a TileEntity into a block that recieves a cleanroom from other blocks diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/IPassthroughHatch.java b/src/main/java/gregtech/api/metatileentity/multiblock/IPassthroughHatch.java index 2fcb43c9fe5..0a03a3ebd47 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/IPassthroughHatch.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/IPassthroughHatch.java @@ -1,6 +1,6 @@ package gregtech.api.metatileentity.multiblock; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Used with {@link IMultiblockAbilityPart} for hatches allowed in cleanroom-like structures for pass-through @@ -12,6 +12,6 @@ public interface IPassthroughHatch { * @return the type of data passed into/out of the hatch */ @SuppressWarnings("unused") - @Nonnull + @NotNull Class getPassthroughType(); } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java index 667333aec1c..53d204a0d2b 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java @@ -26,11 +26,10 @@ import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - @SuppressWarnings("unused") public abstract class MultiMapMultiblockController extends RecipeMapMultiblockController implements IMultipleRecipeMaps { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java index ef8cf414ed3..933ec7b1259 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java @@ -49,15 +49,14 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; public abstract class MultiblockControllerBase extends MetaTileEntity implements IMultiblockController { @@ -109,7 +108,7 @@ public void update() { /** * @return structure pattern of this multiblock */ - @Nonnull + @NotNull protected abstract BlockPattern createStructurePattern(); public EnumFacing getUpwardsFacing() { @@ -164,7 +163,7 @@ public boolean shouldRenderOverlay(IMultiblockPart sourcePart) { * @return The overlay to render on the Multiblock Controller */ @SideOnly(Side.CLIENT) - @Nonnull + @NotNull protected ICubeRenderer getFrontOverlay() { return Textures.MULTIBLOCK_WORKABLE_OVERLAY; } @@ -174,7 +173,7 @@ public TextureAtlasSprite getFrontDefaultTexture() { return getFrontOverlay().getParticleSprite(); } - public static TraceabilityPredicate tilePredicate(@Nonnull BiFunction predicate, + public static TraceabilityPredicate tilePredicate(@NotNull BiFunction predicate, @Nullable Supplier candidates) { return new TraceabilityPredicate(blockWorldState -> { TileEntity tileEntity = blockWorldState.getTileEntity(); @@ -589,7 +588,7 @@ public void explodeMultiblock(float explosionPower) { * @param part the part to check * @return if the multiblock part is terrain and weather resistant */ - public boolean isMultiblockPartWeatherResistant(@Nonnull IMultiblockPart part) { + public boolean isMultiblockPartWeatherResistant(@NotNull IMultiblockPart part) { return false; } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index e81be4277aa..4301adbacce 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -32,13 +32,12 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IDataInfoProvider, ICleanroomReceiver, IDistinctBusController { @@ -89,7 +88,7 @@ public MultiblockRecipeLogic getRecipeMapWorkable() { * Performs extra checks for validity of given recipe before multiblock * will start it's processing. */ - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return true; } @@ -260,7 +259,7 @@ public SoundEvent getSound() { return recipeMap.getSound(); } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); diff --git a/src/main/java/gregtech/api/modules/IGregTechModule.java b/src/main/java/gregtech/api/modules/IGregTechModule.java index 847a87878ec..737633cea4c 100644 --- a/src/main/java/gregtech/api/modules/IGregTechModule.java +++ b/src/main/java/gregtech/api/modules/IGregTechModule.java @@ -4,13 +4,12 @@ import net.minecraftforge.fml.common.event.*; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; - /** * All modules must implement this interface. *

@@ -25,7 +24,7 @@ public interface IGregTechModule { * e.g. new ResourceLocation("gregtech", "foo_module") represents a dependency on the module * "foo_module" in the container "gregtech" */ - @Nonnull + @NotNull default Set getDependencyUids() { return Collections.emptySet(); } @@ -59,7 +58,7 @@ default void registerPackets() {} * @return A list of classes to subscribe to the Forge event bus. * As the class gets subscribed, not any specific instance, event handlers must be static! */ - @Nonnull + @NotNull default List> getEventBusSubscribers() { return Collections.emptyList(); } @@ -71,6 +70,6 @@ default boolean processIMC(FMLInterModComms.IMCMessage message) { /** * @return A logger to use for this module. */ - @Nonnull + @NotNull Logger getLogger(); } diff --git a/src/main/java/gregtech/api/pattern/BlockPattern.java b/src/main/java/gregtech/api/pattern/BlockPattern.java index ec3cba8402b..667202c7404 100644 --- a/src/main/java/gregtech/api/pattern/BlockPattern.java +++ b/src/main/java/gregtech/api/pattern/BlockPattern.java @@ -23,6 +23,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Array; import java.util.Arrays; @@ -31,8 +32,6 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class BlockPattern { static EnumFacing[] FACINGS = { EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP, @@ -57,8 +56,8 @@ public class BlockPattern { */ public int[] formedRepetitionCount; - public BlockPattern(@Nonnull TraceabilityPredicate[][][] predicatesIn, @Nonnull RelativeDirection[] structureDir, - @Nonnull int[][] aisleRepetitions) { + public BlockPattern(@NotNull TraceabilityPredicate[][][] predicatesIn, @NotNull RelativeDirection[] structureDir, + @NotNull int[][] aisleRepetitions) { this.blockMatches = predicatesIn; this.globalCount = new HashMap<>(); this.layerCount = new HashMap<>(); diff --git a/src/main/java/gregtech/api/pattern/BlockWorldState.java b/src/main/java/gregtech/api/pattern/BlockWorldState.java index 07fef964ba8..74dfa1c4526 100644 --- a/src/main/java/gregtech/api/pattern/BlockWorldState.java +++ b/src/main/java/gregtech/api/pattern/BlockWorldState.java @@ -7,9 +7,9 @@ import net.minecraft.util.math.BlockPos.MutableBlockPos; import net.minecraft.world.World; -import java.util.Map; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Map; public class BlockWorldState { diff --git a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java index a4bd56a9150..a768aae5c68 100644 --- a/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java +++ b/src/main/java/gregtech/api/pattern/MultiblockShapeInfo.java @@ -9,14 +9,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; -import javax.annotation.Nonnull; - public class MultiblockShapeInfo { /** {@code [x][y][z]} */ @@ -81,7 +81,7 @@ public Builder where(char symbol, Supplier partSupplier, EnumFacing frontSide "Supplier must supply either a MetaTileEntity or an IBlockState! Actual: " + part.getClass()); } - @Nonnull + @NotNull private BlockInfo[][][] bakeArray() { final int maxZ = shape.size(); final int maxY = shape.get(0).length; diff --git a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java index e7326479210..38f089b154e 100644 --- a/src/main/java/gregtech/api/pipenet/IBlockAppearance.java +++ b/src/main/java/gregtech/api/pipenet/IBlockAppearance.java @@ -5,7 +5,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be @@ -24,8 +24,8 @@ public interface IBlockAppearance { * @param pos The Position of the block. * @param side The side of the block. */ - @Nonnull - IBlockState getVisualState(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side); + @NotNull + IBlockState getVisualState(@NotNull IBlockAccess world, @NotNull BlockPos pos, @NotNull EnumFacing side); /** * This function returns whether the block's renderer will visually connect to other blocks implementing diff --git a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java index bbcc08842a2..3b70d1cf3b4 100644 --- a/src/main/java/gregtech/api/pipenet/PipeNetWalker.java +++ b/src/main/java/gregtech/api/pipenet/PipeNetWalker.java @@ -10,11 +10,10 @@ import net.minecraft.world.World; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.Nullable; import java.util.*; -import javax.annotation.Nullable; - /** * This is a helper class to get information about a pipe net *

diff --git a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java index aa6d2d47ac1..23860461888 100644 --- a/src/main/java/gregtech/api/pipenet/WorldPipeNet.java +++ b/src/main/java/gregtech/api/pipenet/WorldPipeNet.java @@ -9,11 +9,11 @@ import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants.NBT; +import org.jetbrains.annotations.NotNull; + import java.lang.ref.WeakReference; import java.util.*; -import javax.annotation.Nonnull; - public abstract class WorldPipeNet> extends WorldSavedData { private WeakReference worldRef = new WeakReference<>(null); @@ -147,9 +147,9 @@ public void readFromNBT(NBTTagCompound nbt) { } } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { NBTTagList allPipeNets = new NBTTagList(); for (T pipeNet : pipeNets) { NBTTagCompound pNetTag = pipeNet.serializeNBT(); diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 0333f07e149..5468aae38dd 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -49,15 +49,13 @@ import codechicken.lib.raytracer.RayTracer; import codechicken.lib.vec.Cuboid6; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.metatileentity.MetaTileEntity.FULL_CUBE_COLLISION; @SuppressWarnings("deprecation") @@ -139,10 +137,10 @@ public static Cuboid6 getCoverSideBox(EnumFacing side, float thickness) { public abstract void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack); @Override - public abstract void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items); + public abstract void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items); @Override - public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { pipeTile.getCoverableImplementation().dropAllCovers(); @@ -153,13 +151,13 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void onBlockAdded(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void onBlockAdded(World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { worldIn.scheduleUpdate(pos, this, 1); } @Override - public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull Random rand) { + public void updateTick(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull Random rand) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { int activeConnections = pipeTile.getConnections(); @@ -170,8 +168,8 @@ public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityLivingBase placer, @NotNull ItemStack stack) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { setTileEntityData((TileEntityPipeBase) pipeTile, stack); @@ -191,8 +189,8 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull Block blockIn, @Nonnull BlockPos fromPos) { + public void neighborChanged(@NotNull IBlockState state, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull Block blockIn, @NotNull BlockPos fromPos) { if (worldIn.isRemote) return; IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null) { @@ -225,9 +223,9 @@ public void onNeighborChange(@NotNull IBlockAccess world, @NotNull BlockPos pos, } @Override - public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull World world, - @Nonnull BlockPos observerPos, @Nonnull Block changedBlock, - @Nonnull BlockPos changedBlockPos) { + public void observedNeighborChange(@NotNull IBlockState observerState, @NotNull World world, + @NotNull BlockPos observerPos, @NotNull Block changedBlock, + @NotNull BlockPos changedBlockPos) { PipeNet net = getWorldPipeNet(world).getNetFromPos(observerPos); if (net != null) { net.onNeighbourUpdate(changedBlockPos); @@ -235,28 +233,28 @@ public void observedNeighborChange(@Nonnull IBlockState observerState, @Nonnull } @Override - public boolean canConnectRedstone(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + public boolean canConnectRedstone(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, @Nullable EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(world, pos); return pipeTile != null && pipeTile.getCoverableImplementation().canConnectRedstone(side); } @Override - public boolean shouldCheckWeakPower(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side) { + public boolean shouldCheckWeakPower(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EnumFacing side) { // The check in World::getRedstonePower in the vanilla code base is reversed. Setting this to false will // actually cause getWeakPower to be called, rather than prevent it. return false; } @Override - public int getWeakPower(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, - @Nonnull EnumFacing side) { + public int getWeakPower(@NotNull IBlockState blockState, @NotNull IBlockAccess blockAccess, @NotNull BlockPos pos, + @NotNull EnumFacing side) { IPipeTile pipeTile = getPipeTileEntity(blockAccess, pos); return pipeTile == null ? 0 : pipeTile.getCoverableImplementation().getOutputRedstoneSignal(side.getOpposite()); } - public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, + public void updateActiveNodeStatus(@NotNull World worldIn, BlockPos pos, IPipeTile pipeTile) { if (worldIn.isRemote) return; @@ -273,7 +271,7 @@ public void updateActiveNodeStatus(@Nonnull World worldIn, BlockPos pos, @Nullable @Override - public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) { + public TileEntity createNewTileEntity(@NotNull World worldIn, int meta) { return createNewTileEntity(false); } @@ -283,10 +281,10 @@ public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) { */ protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) {} - @Nonnull + @NotNull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@NotNull IBlockState state, @NotNull RayTraceResult target, @NotNull World world, + @NotNull BlockPos pos, @NotNull EntityPlayer player) { IPipeTile pipeTile = getPipeTileEntity(world, pos); if (pipeTile == null) { return ItemStack.EMPTY; @@ -302,8 +300,8 @@ public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResul } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + public boolean onBlockActivated(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = getServerCollisionRayTrace(playerIn, pos, worldIn); @@ -452,12 +450,12 @@ public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stac return EnumActionResult.PASS; } - protected boolean isPipeTool(@Nonnull ItemStack stack) { + protected boolean isPipeTool(@NotNull ItemStack stack) { return ToolHelper.isTool(stack, ToolClasses.WRENCH); } @Override - public void onBlockClicked(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull EntityPlayer playerIn) { + public void onBlockClicked(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull EntityPlayer playerIn) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); CuboidRayTraceResult rayTraceResult = (CuboidRayTraceResult) RayTracer.retraceBlock(worldIn, playerIn, pos); if (pipeTile == null || rayTraceResult == null) { @@ -483,16 +481,16 @@ public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, En @SuppressWarnings("unchecked") @Override - public void harvestBlock(@Nonnull World worldIn, @Nonnull EntityPlayer player, @Nonnull BlockPos pos, - @Nonnull IBlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack) { + public void harvestBlock(@NotNull World worldIn, @NotNull EntityPlayer player, @NotNull BlockPos pos, + @NotNull IBlockState state, @Nullable TileEntity te, @NotNull ItemStack stack) { tileEntities.set(te == null ? tileEntities.get() : (IPipeTile) te); super.harvestBlock(worldIn, player, pos, state, te, stack); tileEntities.set(null); } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull IBlockState state, int fortune) { + public void getDrops(@NotNull NonNullList drops, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull IBlockState state, int fortune) { IPipeTile pipeTile = tileEntities.get() == null ? getPipeTileEntity(world, pos) : tileEntities.get(); if (pipeTile == null) return; @@ -504,8 +502,8 @@ public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAcces } @Override - public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull AxisAlignedBB entityBox, @Nonnull List collidingBoxes, + public void addCollisionBoxToList(@NotNull IBlockState state, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull AxisAlignedBB entityBox, @NotNull List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { // This iterator causes some heap memory overhead IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); @@ -524,8 +522,8 @@ public void addCollisionBoxToList(@Nonnull IBlockState state, @Nonnull World wor @Nullable @Override - public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World worldIn, @Nonnull BlockPos pos, - @Nonnull Vec3d start, @Nonnull Vec3d end) { + public RayTraceResult collisionRayTrace(@NotNull IBlockState blockState, World worldIn, @NotNull BlockPos pos, + @NotNull Vec3d start, @NotNull Vec3d end) { if (worldIn.isRemote) { return getClientCollisionRayTrace(worldIn, pos, start, end); } @@ -533,8 +531,8 @@ public RayTraceResult collisionRayTrace(@Nonnull IBlockState blockState, World w } @SideOnly(Side.CLIENT) - public RayTraceResult getClientCollisionRayTrace(World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, - @Nonnull Vec3d end) { + public RayTraceResult getClientCollisionRayTrace(World worldIn, @NotNull BlockPos pos, @NotNull Vec3d start, + @NotNull Vec3d end) { return RayTracer.rayTraceCuboidsClosest(start, end, pos, getCollisionBox(worldIn, pos, Minecraft.getMinecraft().player)); } @@ -549,10 +547,10 @@ public CuboidRayTraceResult getServerCollisionRayTrace(EntityPlayer playerIn, Bl pos, getCollisionBox(worldIn, pos, playerIn)); } - @Nonnull + @NotNull @Override - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@NotNull IBlockAccess worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EnumFacing face) { IPipeTile pipeTile = getPipeTileEntity(worldIn, pos); if (pipeTile != null && pipeTile.getCoverableImplementation().getCoverAtSide(face) != null) { return BlockFaceShape.SOLID; @@ -561,8 +559,8 @@ public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull } @Override - public boolean recolorBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, - @Nonnull EnumDyeColor color) { + public boolean recolorBlock(World world, @NotNull BlockPos pos, @NotNull EnumFacing side, + @NotNull EnumDyeColor color) { IPipeTile tileEntityPipe = (IPipeTile) world.getTileEntity(pos); if (tileEntityPipe != null && tileEntityPipe.getPipeType() != null && tileEntityPipe.getPipeType().isPaintable() && @@ -678,20 +676,20 @@ public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, It } @Override - public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { return true; } - @Nonnull + @NotNull @Override - public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, - @Nonnull BlockPos otherPos) { + public IBlockState getFacade(@NotNull IBlockAccess world, @NotNull BlockPos pos, @Nullable EnumFacing side, + @NotNull BlockPos otherPos) { return getFacade(world, pos, side); } - @Nonnull + @NotNull @Override - public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) { + public IBlockState getFacade(@NotNull IBlockAccess world, @NotNull BlockPos pos, EnumFacing side) { IPipeTile pipeTileEntity = getPipeTileEntity(world, pos); if (pipeTileEntity != null && side != null) { Cover cover = pipeTileEntity.getCoverableImplementation().getCoverAtSide(side); @@ -702,9 +700,9 @@ public IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, return world.getBlockState(pos); } - @Nonnull + @NotNull @Override - public IBlockState getVisualState(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public IBlockState getVisualState(@NotNull IBlockAccess world, @NotNull BlockPos pos, @NotNull EnumFacing side) { return getFacade(world, pos, side); } diff --git a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java index b9984165cfa..30b283a9b3f 100644 --- a/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/ItemBlockPipe.java @@ -12,7 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ItemBlockPipe & IPipeType, NodeDataType> extends ItemBlock { @@ -31,9 +31,9 @@ public int getMetadata(int damage) { @Override @SuppressWarnings({ "rawtypes", "unchecked" }) - public boolean placeBlockAt(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull IBlockState newState) { + public boolean placeBlockAt(@NotNull ItemStack stack, @NotNull EntityPlayer player, @NotNull World world, + @NotNull BlockPos pos, @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull IBlockState newState) { boolean superVal = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState); if (superVal && !world.isRemote) { IPipeTile selfTile = (IPipeTile) world.getTileEntity(pos); diff --git a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java index 7ba754ea746..003fda2a5de 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/BlockMaterialPipe.java @@ -22,9 +22,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.Objects; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Objects; public abstract class BlockMaterialPipe< PipeType extends Enum & IPipeType & IMaterialPipeType, NodeDataType, @@ -34,7 +34,7 @@ public abstract class BlockMaterialPipe< protected final PipeType pipeType; private final MaterialRegistry registry; - public BlockMaterialPipe(@Nonnull PipeType pipeType, @Nonnull MaterialRegistry registry) { + public BlockMaterialPipe(@NotNull PipeType pipeType, @NotNull MaterialRegistry registry) { this.pipeType = pipeType; this.registry = registry; } @@ -90,13 +90,13 @@ public PipeType getItemPipeType(ItemStack is) { return pipeType; } - @Nonnull + @NotNull public MaterialRegistry getMaterialRegistry() { return registry; } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull public abstract PipeRenderer getPipeRenderer(); public void onModelRegister() { diff --git a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java index 6932ebe24ae..70467ecf809 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/material/ItemBlockMaterialPipe.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ItemBlockMaterialPipe & IMaterialPipeType, NodeDataType> extends ItemBlockPipe { @@ -14,9 +14,9 @@ public ItemBlockMaterialPipe(BlockMaterialPipe block) super(block); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { PipeType pipeType = blockPipe.getItemPipeType(stack); Material material = ((BlockMaterialPipe) blockPipe).getItemMaterial(stack); return material == null ? " " : pipeType.getOrePrefix().getLocalNameForItem(material); diff --git a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java index fd8d9d43e85..d5164c30d11 100644 --- a/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/block/material/TileEntityMaterialPipeBase.java @@ -10,7 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import static gregtech.api.capability.GregtechDataCodes.UPDATE_PIPE_MATERIAL; @@ -54,16 +54,16 @@ public void transferDataFrom(IPipeTile tileEntity) { this.pipeMaterial = ((IMaterialPipeTile) tileEntity).getPipeMaterial(); } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { super.writeToNBT(compound); compound.setString("PipeMaterial", pipeMaterial.toString()); return compound; } @Override - public void readFromNBT(@Nonnull NBTTagCompound compound) { + public void readFromNBT(@NotNull NBTTagCompound compound) { super.readFromNBT(compound); MaterialRegistry registry = getPipeBlock().getMaterialRegistry(); this.pipeMaterial = registry.getObject(compound.getString("PipeMaterial")); @@ -72,11 +72,11 @@ public void readFromNBT(@Nonnull NBTTagCompound compound) { } } - private void writePipeMaterial(@Nonnull PacketBuffer buf) { + private void writePipeMaterial(@NotNull PacketBuffer buf) { buf.writeVarInt(getPipeBlock().getMaterialRegistry().getIDForObject(pipeMaterial)); } - private void readPipeMaterial(@Nonnull PacketBuffer buf) { + private void readPipeMaterial(@NotNull PacketBuffer buf) { this.pipeMaterial = getPipeBlock().getMaterialRegistry().getObjectById(buf.readVarInt()); } diff --git a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java index 418ab91caf7..cb3a9a5abbb 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java +++ b/src/main/java/gregtech/api/pipenet/longdist/BlockLongDistancePipe.java @@ -19,14 +19,12 @@ import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class BlockLongDistancePipe extends Block implements ILDNetworkPart { private final LongDistancePipeType pipeType; @@ -40,8 +38,8 @@ public BlockLongDistancePipe(LongDistancePipeType pipeType) { } @Override - public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) { + public void onBlockPlacedBy(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityLivingBase placer, @NotNull ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (worldIn.isRemote) return; // first find all neighbouring networks @@ -92,7 +90,7 @@ public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonn } @Override - public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { super.breakBlock(worldIn, pos, state); if (worldIn.isRemote) return; LongDistanceNetwork network = LongDistanceNetwork.get(worldIn, pos); @@ -102,21 +100,21 @@ public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull I } @Override - public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { if (itemIn == GregTechAPI.TAB_GREGTECH) { items.add(new ItemStack(this)); } } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, - @Nonnull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("gregtech.block.tooltip.no_mob_spawning")); } diff --git a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java index 65da862e92f..61b3c615380 100644 --- a/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java +++ b/src/main/java/gregtech/api/pipenet/longdist/LongDistancePipeType.java @@ -7,11 +7,10 @@ import net.minecraft.world.World; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Objects; -import javax.annotation.Nonnull; - /** * This class defines a long distance pipe type. This class MUST be a singleton class! */ @@ -62,7 +61,7 @@ public boolean satisfiesMinLength(ILDEndpoint endpoint1, ILDEndpoint endpoint2) return endpoint1 != endpoint2 && endpoint1.pos().getDistance(p.getX(), p.getY(), p.getZ()) >= getMinLength(); } - @Nonnull + @NotNull public LongDistanceNetwork createNetwork(LongDistanceNetwork.WorldData worldData) { return new LongDistanceNetwork(this, worldData); } diff --git a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java index fdf40e93375..18caa16ea19 100644 --- a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java +++ b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java @@ -22,8 +22,6 @@ import java.util.EnumMap; import java.util.function.Consumer; -import javax.annotation.Nonnull; - import static gregtech.api.capability.GregtechDataCodes.*; public class PipeCoverableImplementation implements CoverHolder { @@ -200,7 +198,7 @@ public void update() { } @Override - public void writeCoverData(@Nonnull Cover cover, int discriminator, @NotNull Consumer<@NotNull PacketBuffer> buf) { + public void writeCoverData(@NotNull Cover cover, int discriminator, @NotNull Consumer<@NotNull PacketBuffer> buf) { writeCustomData(UPDATE_COVER_DATA_PIPE, buffer -> { buffer.writeByte(cover.getAttachedSide().getIndex()); buffer.writeVarInt(discriminator); diff --git a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java index 9bf3d61e2c1..a2d593bb206 100644 --- a/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java +++ b/src/main/java/gregtech/api/pipenet/tile/TileEntityPipeBase.java @@ -26,10 +26,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; -import java.util.function.Consumer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.function.Consumer; import static gregtech.api.capability.GregtechDataCodes.*; @@ -333,7 +333,7 @@ public T getCapabilityInternal(Capability capability, @Nullable EnumFacin @Nullable @Override - public final T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public final T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { boolean isCoverable = capability == GregtechTileCapabilities.CAPABILITY_COVER_HOLDER; Cover cover = facing == null ? null : coverableImplementation.getCoverAtSide(facing); T defaultValue; @@ -355,13 +355,13 @@ public final T getCapability(@Nonnull Capability capability, @Nullable En } @Override - public final boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public final boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { return getCapability(capability, facing) != null; } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { super.writeToNBT(compound); BlockPipe pipeBlock = getPipeBlock(); if (pipeBlock != null) { @@ -380,7 +380,7 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { } @Override - public void readFromNBT(@Nonnull NBTTagCompound compound) { + public void readFromNBT(@NotNull NBTTagCompound compound) { if (this.tickingPipe != null) { this.tickingPipe.readFromNBT(compound); return; @@ -534,7 +534,7 @@ public boolean isValidTile() { } @Override - public boolean shouldRefresh(@Nonnull World world, @Nonnull BlockPos pos, IBlockState oldState, + public boolean shouldRefresh(@NotNull World world, @NotNull BlockPos pos, IBlockState oldState, IBlockState newSate) { return oldState.getBlock() != newSate.getBlock(); } diff --git a/src/main/java/gregtech/api/recipes/FluidCellInput.java b/src/main/java/gregtech/api/recipes/FluidCellInput.java index 28fdcd02c48..4c856a1c7db 100644 --- a/src/main/java/gregtech/api/recipes/FluidCellInput.java +++ b/src/main/java/gregtech/api/recipes/FluidCellInput.java @@ -9,7 +9,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class FluidCellInput extends GTRecipeItemInput { diff --git a/src/main/java/gregtech/api/recipes/ModHandler.java b/src/main/java/gregtech/api/recipes/ModHandler.java index bea1f8cf14a..010d1c22346 100644 --- a/src/main/java/gregtech/api/recipes/ModHandler.java +++ b/src/main/java/gregtech/api/recipes/ModHandler.java @@ -44,15 +44,14 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public final class ModHandler { public static final boolean ERROR_ON_INVALID_RECIPE = GTValues.isDeobfEnvironment() || @@ -111,7 +110,7 @@ else if (materialStack.material == Materials.Charcoal) { * @param input the unification entry to input * @param output the output of the recipe */ - public static void addSmeltingRecipe(@Nonnull UnificationEntry input, @Nonnull ItemStack output) { + public static void addSmeltingRecipe(@NotNull UnificationEntry input, @NotNull ItemStack output) { addSmeltingRecipe(input, output, 0.0F); } @@ -119,7 +118,7 @@ public static void addSmeltingRecipe(@Nonnull UnificationEntry input, @Nonnull I * @param input the input of the recipe * @param output the output of the recipe */ - public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStack output) { + public static void addSmeltingRecipe(@NotNull ItemStack input, @NotNull ItemStack output) { addSmeltingRecipe(input, output, 0.0F); } @@ -130,7 +129,7 @@ public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStac * @param output the output of the recipe * @param experience the experience of the recipe */ - public static void addSmeltingRecipe(@Nonnull UnificationEntry input, @Nonnull ItemStack output, float experience) { + public static void addSmeltingRecipe(@NotNull UnificationEntry input, @NotNull ItemStack output, float experience) { for (ItemStack inputStack : OreDictUnifier.getAll(input)) { addSmeltingRecipe(inputStack, output, experience); } @@ -143,7 +142,7 @@ public static void addSmeltingRecipe(@Nonnull UnificationEntry input, @Nonnull I * @param output the output of the recipe * @param experience the experience of the recipe */ - public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStack output, float experience) { + public static void addSmeltingRecipe(@NotNull ItemStack input, @NotNull ItemStack output, float experience) { if (input.isEmpty() && setErroredInvalidRecipe("Furnace Recipe Input cannot be an empty ItemStack")) { return; } @@ -168,8 +167,8 @@ public static void addSmeltingRecipe(@Nonnull ItemStack input, @Nonnull ItemStac * @param input the input for the recipe * @return the output of the recipe */ - @Nonnull - public static ItemStack getSmeltingOutput(@Nonnull ItemStack input) { + @NotNull + public static ItemStack getSmeltingOutput(@NotNull ItemStack input) { if (input.isEmpty()) return ItemStack.EMPTY; return OreDictUnifier.getUnificated(FurnaceRecipes.instance().getSmeltingResult(input)); } @@ -207,7 +206,7 @@ public static ItemStack getSmeltingOutput(@Nonnull ItemStack input) { * @param result the output for the recipe * @param recipe the contents of the recipe */ - public static void addShapedRecipe(@Nonnull String regName, @Nonnull ItemStack result, @Nonnull Object... recipe) { + public static void addShapedRecipe(@NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { addShapedRecipe(false, regName, result, false, false, recipe); } @@ -256,8 +255,8 @@ public static void addMirroredShapedRecipe(String regName, ItemStack result, Obj * @param isMirrored whether the recipe should be mirrored * @see ModHandler#addShapedRecipe(String, ItemStack, Object...) */ - public static void addShapedRecipe(boolean withUnificationData, @Nonnull String regName, @Nonnull ItemStack result, - boolean isNBTClearing, boolean isMirrored, @Nonnull Object... recipe) { + public static void addShapedRecipe(boolean withUnificationData, @NotNull String regName, @NotNull ItemStack result, + boolean isNBTClearing, boolean isMirrored, @NotNull Object... recipe) { if (!validateRecipeWithOutput(regName, result, recipe)) return; addRecipe(regName, result, isNBTClearing, isMirrored, recipe); @@ -302,16 +301,16 @@ overrideCharge, transferMaxCharge, finalizeShapedRecipeInput(recipe)) } @SuppressWarnings("BooleanMethodIsAlwaysInverted") - private static boolean validateRecipeWithOutput(@Nonnull String regName, @Nonnull ItemStack result, - @Nonnull Object... recipe) { + private static boolean validateRecipeWithOutput(@NotNull String regName, @NotNull ItemStack result, + @NotNull Object... recipe) { if (result.isEmpty()) { if (setErroredInvalidRecipe("Recipe output cannot be an empty ItemStack. Recipe: " + regName)) return false; } return validateRecipe(regName, recipe); } - private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result, boolean isNBTClearing, - boolean isMirrored, @Nonnull Object... recipe) { + private static void addRecipe(@NotNull String regName, @NotNull ItemStack result, boolean isNBTClearing, + boolean isMirrored, @NotNull Object... recipe) { IRecipe shapedOreRecipe = new GTShapedOreRecipe(isNBTClearing, null, result.copy(), finalizeShapedRecipeInput(recipe)) .setMirrored(isMirrored) @@ -320,7 +319,7 @@ private static void addRecipe(@Nonnull String regName, @Nonnull ItemStack result registerRecipe(shapedOreRecipe); } - private static void registerRecipe(@Nonnull IRecipe recipe) { + private static void registerRecipe(@NotNull IRecipe recipe) { ForgeRegistries.RECIPES.register(recipe); } @@ -363,8 +362,7 @@ private static boolean validateRecipe(String regName, Object... recipe) { * @param recipe the recipe to finalize * @return the finalized recipe */ - @Nonnull - public static Object[] finalizeShapedRecipeInput(Object... recipe) { + public static Object @NotNull [] finalizeShapedRecipeInput(Object... recipe) { for (byte i = 0; i < recipe.length; i++) { recipe[i] = finalizeIngredient(recipe[i]); } @@ -390,8 +388,8 @@ public static Object[] finalizeShapedRecipeInput(Object... recipe) { * @param ingredient the ingredient to finalize * @return the finalized ingredient */ - @Nonnull - public static Object finalizeIngredient(@Nonnull Object ingredient) { + @NotNull + public static Object finalizeIngredient(@NotNull Object ingredient) { if (ingredient instanceof MetaItem.MetaValueItem metaValueItem) { ingredient = metaValueItem.getStackForm(); } else if (ingredient instanceof Enum anEnum) { @@ -422,7 +420,7 @@ public static Object finalizeIngredient(@Nonnull Object ingredient) { @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @Nullable - public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @Nonnull Object... recipe) { + public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @NotNull Object... recipe) { return RecyclingHandler.getRecyclingIngredients(outputCount, recipe); } @@ -433,8 +431,8 @@ public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @Nonnull * @param result the output of the recipe * @param recipe the recipe to add */ - public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStack result, - @Nonnull Object... recipe) { + public static void addShapelessRecipe(@NotNull String regName, @NotNull ItemStack result, + @NotNull Object... recipe) { addShapelessRecipe(regName, result, false, recipe); } @@ -443,8 +441,8 @@ public static void addShapelessRecipe(@Nonnull String regName, @Nonnull ItemStac * * @see ModHandler#addShapelessRecipe(String, ItemStack, boolean, Object...) */ - public static void addShapelessNBTClearingRecipe(@Nonnull String regName, @Nonnull ItemStack result, - @Nonnull Object... recipe) { + public static void addShapelessNBTClearingRecipe(@NotNull String regName, @NotNull ItemStack result, + @NotNull Object... recipe) { addShapelessRecipe(regName, result, true, recipe); } @@ -503,7 +501,7 @@ public static void addShapelessRecipe(String regName, ItemStack result, boolean * @return if a recipe was removed */ @SuppressWarnings("unused") - public static boolean removeFurnaceSmelting(@Nonnull UnificationEntry input) { + public static boolean removeFurnaceSmelting(@NotNull UnificationEntry input) { boolean result = false; for (ItemStack inputStack : OreDictUnifier.getAll(input)) { result = result || removeFurnaceSmelting(inputStack); @@ -517,7 +515,7 @@ public static boolean removeFurnaceSmelting(@Nonnull UnificationEntry input) { * @param input the input to remove by * @return if the recipe was removed */ - public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { + public static boolean removeFurnaceSmelting(@NotNull ItemStack input) { if (input.isEmpty()) { if (setErroredInvalidRecipe("Cannot remove furnace recipe with empty input.")) return false; } @@ -545,7 +543,7 @@ public static boolean removeFurnaceSmelting(@Nonnull ItemStack input) { * @return the amount of recipes removed */ @SuppressWarnings("UnusedReturnValue") - public static int removeRecipeByOutput(@Nonnull ItemStack output) { + public static int removeRecipeByOutput(@NotNull ItemStack output) { int recipesRemoved = removeRecipeByOutput( recipe -> ItemStack.areItemStacksEqual(recipe.getRecipeOutput(), output)); @@ -593,7 +591,7 @@ public static int removeRecipeByOutput(Predicate predicate) { * * @param location the ResourceLocation of the Recipe. */ - public static void removeRecipeByName(@Nonnull ResourceLocation location) { + public static void removeRecipeByName(@NotNull ResourceLocation location) { if (ConfigHolder.misc.debug) { String recipeName = location.toString(); if (ForgeRegistries.RECIPES.containsKey(location)) { @@ -635,7 +633,7 @@ public static void removeRecipeByName(String recipeName) { * @param endTier The ending tier index, inclusive. */ @SuppressWarnings("unused") - public static void removeTieredRecipeByName(@Nonnull String recipeName, int startTier, int endTier) { + public static void removeTieredRecipeByName(@NotNull String recipeName, int startTier, int endTier) { for (int i = startTier; i <= endTier; i++) { removeRecipeByName(String.format("%s%s", recipeName, GTValues.VN[i].toLowerCase())); } @@ -650,7 +648,7 @@ public static void removeTieredRecipeByName(@Nonnull String recipeName, int star * @param recipe the recipe to retrieve from. Must not contain null values. * @return a Pair of the recipe, and the output */ - @Nonnull + @NotNull public static Pair getRecipeOutput(@Nullable World world, @Nullable ItemStack... recipe) { if (recipe == null || recipe.length == 0) return ImmutablePair.of(null, ItemStack.EMPTY); if (world == null) world = DummyWorld.INSTANCE; @@ -748,13 +746,13 @@ public static void removeSmeltingEBFMetals() { * @return if recipe registration should continue * @throws IllegalArgumentException if a recipe was invalid and invalid recipes are not ignored */ - public static boolean setErroredInvalidRecipe(@Nonnull String message) throws IllegalArgumentException { + public static boolean setErroredInvalidRecipe(@NotNull String message) throws IllegalArgumentException { hasInvalidRecipe = true; logInvalidRecipe(message); return ERROR_ON_INVALID_RECIPE; } - public static void logInvalidRecipe(@Nonnull String message) { + public static void logInvalidRecipe(@NotNull String message) { GTLog.logger.warn("Invalid Recipe Found", new IllegalArgumentException(message)); } } diff --git a/src/main/java/gregtech/api/recipes/Recipe.java b/src/main/java/gregtech/api/recipes/Recipe.java index 79290c08806..e09519f4dde 100644 --- a/src/main/java/gregtech/api/recipes/Recipe.java +++ b/src/main/java/gregtech/api/recipes/Recipe.java @@ -27,11 +27,10 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import java.util.*; -import javax.annotation.Nonnull; - /** * Class that represent machine recipe. *

@@ -101,18 +100,18 @@ public static int getMaxChancedValue() { private final int hashCode; - public Recipe(@Nonnull List inputs, + public Recipe(@NotNull List inputs, List outputs, - @Nonnull ChancedOutputList chancedOutputs, + @NotNull ChancedOutputList chancedOutputs, List fluidInputs, List fluidOutputs, - @Nonnull ChancedOutputList chancedFluidOutputs, + @NotNull ChancedOutputList chancedFluidOutputs, int duration, int EUt, boolean hidden, boolean isCTRecipe, IRecipePropertyStorage recipePropertyStorage, - @Nonnull GTRecipeCategory recipeCategory) { + @NotNull GTRecipeCategory recipeCategory) { this.recipePropertyStorage = recipePropertyStorage == null ? EmptyRecipePropertyStorage.INSTANCE : recipePropertyStorage; this.inputs = GTRecipeInputCache.deduplicateInputs(inputs); @@ -135,7 +134,7 @@ public Recipe(@Nonnull List inputs, this.groovyRecipe = GroovyScriptModule.isCurrentlyRunning(); } - @Nonnull + @NotNull public Recipe copy() { return new Recipe(this.inputs, this.outputs, this.chancedOutputs, this.fluidInputs, this.fluidOutputs, this.chancedFluidOutputs, this.duration, @@ -356,7 +355,7 @@ private boolean hasSameInputs(Recipe otherRecipe) { return otherRecipe.matchesItems(thisStackList).getLeft(); } - public static int hashFluidList(@Nonnull List fluids) { + public static int hashFluidList(@NotNull List fluids) { int hash = 0; for (GTRecipeInput fluidInput : fluids) { hash = 31 * hash + fluidInput.hashCode(); @@ -685,7 +684,7 @@ public boolean hasValidInputsForDisplay() { return false; } - @Nonnull + @NotNull public GTRecipeCategory getRecipeCategory() { return this.recipeCategory; } diff --git a/src/main/java/gregtech/api/recipes/RecipeBuilder.java b/src/main/java/gregtech/api/recipes/RecipeBuilder.java index 703bb1a2f13..dd5fee598df 100644 --- a/src/main/java/gregtech/api/recipes/RecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/RecipeBuilder.java @@ -40,13 +40,11 @@ import crafttweaker.CraftTweakerAPI; import org.apache.commons.lang3.builder.ToStringBuilder; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @see Recipe */ @@ -138,7 +136,7 @@ public R cleanroom(@Nullable CleanroomType cleanroom) { return (R) this; } - public boolean applyProperty(@Nonnull String key, @Nullable Object value) { + public boolean applyProperty(@NotNull String key, @Nullable Object value) { if (key.equals(CleanroomProperty.KEY)) { if (value instanceof CleanroomType) { this.cleanroom((CleanroomType) value); @@ -152,7 +150,7 @@ public boolean applyProperty(@Nonnull String key, @Nullable Object value) { return false; } - public boolean applyProperty(@Nonnull RecipeProperty property, @Nullable Object value) { + public boolean applyProperty(@NotNull RecipeProperty property, @Nullable Object value) { if (value == null) { if (this.recipePropertyStorage != null) { return this.recipePropertyStorage.remove(property); @@ -783,7 +781,7 @@ public R hidden() { return (R) this; } - public R category(@Nonnull GTRecipeCategory category) { + public R category(@NotNull GTRecipeCategory category) { this.category = category; return (R) this; } @@ -875,8 +873,8 @@ protected void validateGroovy(GroovyLog.Msg errorMsg) { () -> getRequiredString(maxFluidOutput, fluidOutputs.size(), "fluid output")); } - @Nonnull - protected static String getRequiredString(int max, int actual, @Nonnull String type) { + @NotNull + protected static String getRequiredString(int max, int actual, @NotNull String type) { if (max <= 0) { return "No " + type + "s allowed, but found " + actual; } diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index eb45f147c3b..c73fc20bb74 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -49,6 +49,8 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.annotations.*; import stanhebben.zenscript.annotations.Optional; @@ -59,10 +61,6 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnegative; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.recipe.RecipeMap") @ZenRegister public class RecipeMap> { @@ -124,12 +122,9 @@ public class RecipeMap> { * @param defaultRecipeBuilder the default RecipeBuilder for the RecipeMap * @param isHidden if the RecipeMap should have a category in JEI */ - public RecipeMap(@Nonnull String unlocalizedName, - @Nonnegative int maxInputs, - @Nonnegative int maxOutputs, - @Nonnegative int maxFluidInputs, - @Nonnegative int maxFluidOutputs, - @Nonnull R defaultRecipeBuilder, + public RecipeMap(@NotNull String unlocalizedName, + int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, + @NotNull R defaultRecipeBuilder, boolean isHidden) { this(unlocalizedName, maxInputs, true, maxOutputs, true, @@ -152,12 +147,12 @@ public RecipeMap(@Nonnull String unlocalizedName, * @param defaultRecipeBuilder the default RecipeBuilder for the RecipeMap * @param isHidden if the RecipeMap should have a category in JEI */ - public RecipeMap(@Nonnull String unlocalizedName, - @Nonnegative int maxInputs, boolean modifyItemInputs, - @Nonnegative int maxOutputs, boolean modifyItemOutputs, - @Nonnegative int maxFluidInputs, boolean modifyFluidInputs, - @Nonnegative int maxFluidOutputs, boolean modifyFluidOutputs, - @Nonnull R defaultRecipeBuilder, + public RecipeMap(@NotNull String unlocalizedName, + int maxInputs, boolean modifyItemInputs, + int maxOutputs, boolean modifyItemOutputs, + int maxFluidInputs, boolean modifyFluidInputs, + int maxFluidOutputs, boolean modifyFluidOutputs, + @NotNull R defaultRecipeBuilder, boolean isHidden) { this.unlocalizedName = unlocalizedName; this.slotOverlays = new Byte2ObjectOpenHashMap<>(); @@ -237,7 +232,7 @@ public RecipeMap setSound(SoundEvent sound) { return this; } - public RecipeMap setChanceFunction(@Nonnull ChanceBoostFunction function) { + public RecipeMap setChanceFunction(@NotNull ChanceBoostFunction function) { chanceFunction = function; return this; } @@ -267,7 +262,7 @@ public RecipeMap getSmallRecipeMap() { * @param validationResult the validation result from building the recipe * @return if adding the recipe was successful */ - public boolean addRecipe(@Nonnull ValidationResult validationResult) { + public boolean addRecipe(@NotNull ValidationResult validationResult) { validationResult = postValidateRecipe(validationResult); switch (validationResult.getType()) { case SKIP -> { @@ -312,7 +307,7 @@ public boolean compileRecipe(Recipe recipe) { * @param recipe the recipe to remove * @return if removal was successful */ - public boolean removeRecipe(@Nonnull Recipe recipe) { + public boolean removeRecipe(@NotNull Recipe recipe) { List> items = fromRecipe(recipe); if (recurseIngredientTreeRemove(recipe, items, lookup, 0) != null) { if (GroovyScriptModule.isCurrentlyRunning()) { @@ -348,8 +343,8 @@ void removeAllRecipes() { * @param validationResult the current validation result * @return the new result based on validation */ - @Nonnull - protected ValidationResult postValidateRecipe(@Nonnull ValidationResult validationResult) { + @NotNull + protected ValidationResult postValidateRecipe(@NotNull ValidationResult validationResult) { EnumValidationResult recipeStatus = validationResult.getType(); Recipe recipe = validationResult.getResult(); if (recipe.isGroovyRecipe()) { @@ -492,8 +487,8 @@ public Recipe findRecipe(long voltage, final List inputs, final List< * @return a List of Lists of AbstractMapIngredients used for finding recipes */ @Nullable - protected List> prepareRecipeFind(@Nonnull Collection items, - @Nonnull Collection fluids) { + protected List> prepareRecipeFind(@NotNull Collection items, + @NotNull Collection fluids) { // First, check if items and fluids are valid. if (items.size() == Integer.MAX_VALUE || fluids.size() == Integer.MAX_VALUE) { return null; @@ -521,8 +516,8 @@ protected List> prepareRecipeFind(@Nonnull Collectio * @return the recipe found */ @Nullable - public Recipe find(@Nonnull Collection items, @Nonnull Collection fluids, - @Nonnull Predicate canHandle) { + public Recipe find(@NotNull Collection items, @NotNull Collection fluids, + @NotNull Predicate canHandle) { List> list = prepareRecipeFind(items, fluids); // couldn't build any inputs to use for search, so no recipe could be found if (list == null) return null; @@ -539,8 +534,8 @@ public Recipe find(@Nonnull Collection items, @Nonnull Collection inputs) { + @NotNull + public static ItemStack[] uniqueItems(@NotNull Collection inputs) { int index = 0; ItemStack[] uniqueItems = new ItemStack[inputs.size()]; main: @@ -573,8 +568,8 @@ else if (input.isItemEqual(unique) && ItemStack.areItemStackTagsEqual(input, uni * @param inputs The list of GTRecipeInputs. * @return The list of unique inputs. */ - @Nonnull - public static List uniqueIngredientsList(@Nonnull Collection inputs) { + @NotNull + public static List uniqueIngredientsList(@NotNull Collection inputs) { List list = new ObjectArrayList<>(inputs.size()); for (GTRecipeInput item : inputs) { boolean isEqual = false; @@ -603,8 +598,8 @@ public static List uniqueIngredientsList(@Nonnull Collection> ingredients, - @Nonnull Branch branchRoot, @Nonnull Predicate canHandle) { + private Recipe recurseIngredientTreeFindRecipe(@NotNull List> ingredients, + @NotNull Branch branchRoot, @NotNull Predicate canHandle) { // Try each ingredient as a starting point, adding it to the skip-list. // The skip-list is a packed long, where each 1 bit represents an index to skip for (int i = 0; i < ingredients.size(); i++) { @@ -628,8 +623,8 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List> ingredients, - @Nonnull Branch branchMap, @Nonnull Predicate canHandle, + private Recipe recurseIngredientTreeFindRecipe(@NotNull List> ingredients, + @NotNull Branch branchMap, @NotNull Predicate canHandle, int index, int count, long skip) { // exhausted all the ingredients, and didn't find anything if (count == ingredients.size()) return null; @@ -666,9 +661,9 @@ private Recipe recurseIngredientTreeFindRecipe(@Nonnull List> ingredients, - @Nonnull Branch map, - @Nonnull Predicate canHandle, int currentIndex, int count, + private Recipe diveIngredientTreeFindRecipe(@NotNull List> ingredients, + @NotNull Branch map, + @NotNull Predicate canHandle, int currentIndex, int count, long skip) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found @@ -712,9 +707,9 @@ public Set findRecipeCollisions(Collection items, Collection< * @param branchRoot the root branch to start searching from * @param collidingRecipes the list to store recipe collisions */ - private void recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch branchRoot, - @Nonnull Set collidingRecipes) { + private void recurseIngredientTreeFindRecipeCollisions(@NotNull List> ingredients, + @NotNull Branch branchRoot, + @NotNull Set collidingRecipes) { // Try each ingredient as a starting point, adding it to the skip-list. // The skip-list is a packed long, where each 1 bit represents an index to skip for (int i = 0; i < ingredients.size(); i++) { @@ -733,9 +728,9 @@ private void recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch branchMap, int index, int count, long skip, - @Nonnull Set collidingRecipes) { + private Recipe recurseIngredientTreeFindRecipeCollisions(@NotNull List> ingredients, + @NotNull Branch branchMap, int index, int count, long skip, + @NotNull Set collidingRecipes) { // exhausted all the ingredients, and didn't find anything if (count == ingredients.size()) return null; @@ -772,9 +767,9 @@ private Recipe recurseIngredientTreeFindRecipeCollisions(@Nonnull List> ingredients, - @Nonnull Branch map, int currentIndex, int count, long skip, - @Nonnull Set collidingRecipes) { + private Recipe diveIngredientTreeFindRecipeCollisions(@NotNull List> ingredients, + @NotNull Branch map, int currentIndex, int count, long skip, + @NotNull Set collidingRecipes) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -970,9 +965,9 @@ public int getPropertyListHeight(Recipe recipe) { * @param index where in the ingredients list we are. * @param count how many branches were added already. */ - private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, - @Nonnull List> ingredients, - @Nonnull Branch branchMap, int index, int count) { + private boolean recurseIngredientTreeAdd(@NotNull Recipe recipe, + @NotNull List> ingredients, + @NotNull Branch branchMap, int index, int count) { if (count >= ingredients.size()) return true; if (index >= ingredients.size()) { throw new RuntimeException("Index out of bounds for recurseItemTreeAdd, should not happen"); @@ -1105,9 +1100,9 @@ private boolean recurseIngredientTreeAdd(@Nonnull Recipe recipe, * @param branchMap the branch containing the nodes * @return the correct nodes for the ingredient */ - @Nonnull - protected static Map> determineRootNodes(@Nonnull AbstractMapIngredient ingredient, - @Nonnull Branch branchMap) { + @NotNull + protected static Map> determineRootNodes(@NotNull AbstractMapIngredient ingredient, + @NotNull Branch branchMap) { return ingredient.isSpecialIngredient() ? branchMap.getSpecialNodes() : branchMap.getNodes(); } @@ -1118,8 +1113,8 @@ protected static Map> determineRoo * @param list the list of MapIngredients to add to * @param fluidInputs the GTRecipeInputs to convert */ - protected void buildFromRecipeFluids(@Nonnull List> list, - @Nonnull List fluidInputs) { + protected void buildFromRecipeFluids(@NotNull List> list, + @NotNull List fluidInputs) { for (GTRecipeInput fluidInput : fluidInputs) { AbstractMapIngredient ingredient = new MapFluidIngredient(fluidInput); retrieveCachedIngredient(list, ingredient, fluidIngredientRoot); @@ -1133,9 +1128,9 @@ protected void buildFromRecipeFluids(@Nonnull List> * @param defaultIngredient the ingredient to use as a default value, if not cached * @param cache the ingredient root to retrieve from */ - protected static void retrieveCachedIngredient(@Nonnull List> list, - @Nonnull AbstractMapIngredient defaultIngredient, - @Nonnull WeakHashMap> cache) { + protected static void retrieveCachedIngredient(@NotNull List> list, + @NotNull AbstractMapIngredient defaultIngredient, + @NotNull WeakHashMap> cache) { WeakReference cached = cache.get(defaultIngredient); if (cached != null && cached.get() != null) { list.add(Collections.singletonList(cached.get())); @@ -1151,8 +1146,8 @@ protected static void retrieveCachedIngredient(@Nonnull List> list, - @Nonnull Iterable ingredients) { + protected void buildFromFluidStacks(@NotNull List> list, + @NotNull Iterable ingredients) { for (FluidStack t : ingredients) { list.add(Collections.singletonList(new MapFluidIngredient(t))); } @@ -1164,8 +1159,8 @@ protected void buildFromFluidStacks(@Nonnull List> l * @param r the recipe to use * @return a list of all the AbstractMapIngredients comprising the recipe */ - @Nonnull - protected List> fromRecipe(@Nonnull Recipe r) { + @NotNull + protected List> fromRecipe(@NotNull Recipe r) { List> list = new ObjectArrayList<>( (r.getInputs().size()) + r.getFluidInputs().size()); if (r.getInputs().size() > 0) { @@ -1184,7 +1179,7 @@ protected List> fromRecipe(@Nonnull Recipe r) { * @param list the list of MapIngredients to add to * @param inputs the GTRecipeInputs to convert */ - protected void buildFromRecipeItems(List> list, @Nonnull List inputs) { + protected void buildFromRecipeItems(List> list, @NotNull List inputs) { for (GTRecipeInput r : inputs) { if (r.isOreDict()) { AbstractMapIngredient ingredient; @@ -1230,8 +1225,8 @@ protected void buildFromRecipeItems(List> list, @Non * @param list the list to populate * @param ingredients the ingredients to convert */ - protected void buildFromItemStacks(@Nonnull List> list, - @Nonnull ItemStack[] ingredients) { + protected void buildFromItemStacks(@NotNull List> list, + @NotNull ItemStack[] ingredients) { AbstractMapIngredient ingredient; for (ItemStack stack : ingredients) { int meta = stack.getMetadata(); @@ -1332,9 +1327,9 @@ public R recipeBuilder() { * @param branchMap the current branch in the recursion. */ @Nullable - private Recipe recurseIngredientTreeRemove(@Nonnull Recipe recipeToRemove, - @Nonnull List> ingredients, - @Nonnull Branch branchMap, int depth) { + private Recipe recurseIngredientTreeRemove(@NotNull Recipe recipeToRemove, + @NotNull List> ingredients, + @NotNull Branch branchMap, int depth) { // for every ingredient for (List current : ingredients) { // for all possibilities as keys @@ -1401,7 +1396,7 @@ public int getMaxInputs() { } @ZenSetter("maxInputs") - public void setMaxInputs(@Nonnegative int maxInputs) { + public void setMaxInputs(int maxInputs) { if (modifyItemInputs) { this.maxInputs = Math.max(this.maxInputs, maxInputs); } else { @@ -1415,7 +1410,7 @@ public int getMaxOutputs() { } @ZenSetter("maxOutputs") - public void setMaxOutputs(@Nonnegative int maxOutputs) { + public void setMaxOutputs(int maxOutputs) { if (modifyItemOutputs) { this.maxOutputs = Math.max(this.maxOutputs, maxOutputs); } else { @@ -1429,7 +1424,7 @@ public int getMaxFluidInputs() { } @ZenSetter("maxFluidInputs") - public void setMaxFluidInputs(@Nonnegative int maxFluidInputs) { + public void setMaxFluidInputs(int maxFluidInputs) { if (modifyFluidInputs) { this.maxFluidInputs = Math.max(this.maxFluidInputs, maxFluidInputs); } else { @@ -1443,7 +1438,7 @@ public int getMaxFluidOutputs() { } @ZenSetter("maxFluidOutputs") - public void setMaxFluidOutputs(@Nonnegative int maxFluidOutputs) { + public void setMaxFluidOutputs(int maxFluidOutputs) { if (modifyFluidOutputs) { this.maxFluidOutputs = Math.max(this.maxFluidOutputs, maxFluidOutputs); } else { @@ -1458,7 +1453,7 @@ public void setMaxFluidOutputs(@Nonnegative int maxFluidOutputs) { * * @return the recipes stored by category. */ - @Nonnull + @NotNull public Map> getRecipesByCategory() { return Collections.unmodifiableMap(recipeByCategory); } diff --git a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java index cd43f285278..2d9d5006c1b 100644 --- a/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/AssemblyLineRecipeBuilder.java @@ -13,13 +13,13 @@ import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Collection; import java.util.function.UnaryOperator; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class AssemblyLineRecipeBuilder extends RecipeBuilder { private final Collection recipeEntries = new ArrayList<>(); @@ -33,7 +33,7 @@ public AssemblyLineRecipeBuilder(Recipe recipe, RecipeMap new ResearchRecipeBuilder.ScannerRecipeBuilder().researchStack(researchStack)); } @@ -142,7 +142,7 @@ public AssemblyLineRecipeBuilder stationResearch(UnaryOperator getRecipeEntries() { return this.recipeEntries; } @@ -167,8 +167,8 @@ public static class ResearchRecipeEntry { * @param EUt the EUt of the recipe * @param CWUt how much computation per tick this recipe needs if in Research Station */ - public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack researchStack, - @Nonnull ItemStack dataStack, int duration, int EUt, int CWUt) { + public ResearchRecipeEntry(@NotNull String researchId, @NotNull ItemStack researchStack, + @NotNull ItemStack dataStack, int duration, int EUt, int CWUt) { this.researchId = researchId; this.researchStack = researchStack; this.dataStack = dataStack; @@ -177,17 +177,17 @@ public ResearchRecipeEntry(@Nonnull String researchId, @Nonnull ItemStack resear this.CWUt = CWUt; } - @Nonnull + @NotNull public String getResearchId() { return this.researchId; } - @Nonnull + @NotNull public ItemStack getResearchStack() { return researchStack; } - @Nonnull + @NotNull public ItemStack getDataStack() { return dataStack; } diff --git a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java index c330c3fc23d..3e309d76d4b 100644 --- a/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/BlastRecipeBuilder.java @@ -8,8 +8,7 @@ import gregtech.api.util.GTLog; import org.apache.commons.lang3.builder.ToStringBuilder; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlastRecipeBuilder extends RecipeBuilder { @@ -29,7 +28,7 @@ public BlastRecipeBuilder copy() { } @Override - public boolean applyProperty(@Nonnull String key, Object value) { + public boolean applyProperty(@NotNull String key, Object value) { if (key.equals(TemperatureProperty.KEY)) { this.blastFurnaceTemp(((Number) value).intValue()); return true; diff --git a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java index f8b383a2b37..a6a4cda94d0 100644 --- a/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/CircuitAssemblerRecipeBuilder.java @@ -7,7 +7,7 @@ import gregtech.api.util.EnumValidationResult; import gregtech.api.util.GTLog; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CircuitAssemblerRecipeBuilder extends RecipeBuilder { @@ -24,7 +24,7 @@ public CircuitAssemblerRecipeBuilder(RecipeBuilder { @@ -29,7 +28,7 @@ public FusionRecipeBuilder copy() { } @Override - public boolean applyProperty(@Nonnull String key, Object value) { + public boolean applyProperty(@NotNull String key, Object value) { if (key.equals(FusionEUToStartProperty.KEY)) { this.EUToStart(((Number) value).longValue()); return true; diff --git a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java index 5bebddca8f7..fe3bb345305 100644 --- a/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/GasCollectorRecipeBuilder.java @@ -10,11 +10,10 @@ import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.apache.commons.lang3.builder.ToStringBuilder; +import org.jetbrains.annotations.NotNull; import java.util.List; -import javax.annotation.Nonnull; - public class GasCollectorRecipeBuilder extends RecipeBuilder { public GasCollectorRecipeBuilder() {} @@ -33,7 +32,7 @@ public GasCollectorRecipeBuilder copy() { } @Override - public boolean applyProperty(@Nonnull String key, Object value) { + public boolean applyProperty(@NotNull String key, Object value) { if (key.equals(GasCollectorDimensionProperty.KEY)) { if (value instanceof Integer) { this.dimension((Integer) value); diff --git a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java index a4d1b308881..b44771e8a31 100644 --- a/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ImplosionRecipeBuilder.java @@ -13,10 +13,9 @@ import net.minecraft.item.ItemStack; import org.apache.commons.lang3.builder.ToStringBuilder; +import org.jetbrains.annotations.NotNull; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; - public class ImplosionRecipeBuilder extends RecipeBuilder { public ImplosionRecipeBuilder() {} @@ -35,7 +34,7 @@ public ImplosionRecipeBuilder copy() { } @Override - public boolean applyProperty(@Nonnull String key, Object value) { + public boolean applyProperty(@NotNull String key, Object value) { if (key.equals(ImplosionExplosiveProperty.KEY)) { if (value instanceof ItemStack) { this.applyProperty(ImplosionExplosiveProperty.getInstance(), value); diff --git a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java index 3563ab3798d..bbbda50d520 100644 --- a/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/ResearchRecipeBuilder.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class ResearchRecipeBuilder> { @@ -18,14 +18,14 @@ public abstract class ResearchRecipeBuilder> protected String researchId; protected int eut; - public T researchStack(@Nonnull ItemStack researchStack) { + public T researchStack(@NotNull ItemStack researchStack) { if (!researchStack.isEmpty()) { this.researchStack = researchStack; } return (T) this; } - public T dataStack(@Nonnull ItemStack dataStack) { + public T dataStack(@NotNull ItemStack dataStack) { if (!dataStack.isEmpty()) { this.dataStack = dataStack; } diff --git a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java index 88b0549212f..36008717735 100644 --- a/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java +++ b/src/main/java/gregtech/api/recipes/builders/UniversalDistillationRecipeBuilder.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import static gregtech.api.recipes.logic.OverclockingLogic.STANDARD_OVERCLOCK_DURATION_DIVISOR; diff --git a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java index acf8057649f..d6da4e55aef 100644 --- a/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java +++ b/src/main/java/gregtech/api/recipes/category/GTRecipeCategory.java @@ -3,12 +3,11 @@ import gregtech.api.recipes.RecipeMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public final class GTRecipeCategory { private static final Map categories = new Object2ObjectOpenHashMap<>(); @@ -29,9 +28,9 @@ public final class GTRecipeCategory { * @param recipeMap the recipemap that accepts this category * @return the new category */ - @Nonnull - public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String categoryName, - @Nonnull String translationKey, @Nonnull RecipeMap recipeMap) { + @NotNull + public static GTRecipeCategory create(@NotNull String modid, @NotNull String categoryName, + @NotNull String translationKey, @NotNull RecipeMap recipeMap) { return categories.computeIfAbsent(categoryName, (k) -> new GTRecipeCategory(modid, categoryName, translationKey, recipeMap)); } @@ -41,12 +40,12 @@ public static GTRecipeCategory create(@Nonnull String modid, @Nonnull String cat * @return the category associated with the name */ @Nullable - public static GTRecipeCategory getByName(@Nonnull String categoryName) { + public static GTRecipeCategory getByName(@NotNull String categoryName) { return categories.get(categoryName); } - private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull String translationKey, - @Nonnull RecipeMap recipeMap) { + private GTRecipeCategory(@NotNull String modid, @NotNull String name, @NotNull String translationKey, + @NotNull RecipeMap recipeMap) { this.modid = modid; this.name = name; this.uniqueID = modid + ':' + this.name; @@ -54,27 +53,27 @@ private GTRecipeCategory(@Nonnull String modid, @Nonnull String name, @Nonnull S this.recipeMap = recipeMap; } - @Nonnull + @NotNull public String getName() { return this.name; } - @Nonnull + @NotNull public String getModid() { return this.modid; } - @Nonnull + @NotNull public String getUniqueID() { return this.uniqueID; } - @Nonnull + @NotNull public String getTranslationKey() { return this.translationKey; } - @Nonnull + @NotNull public RecipeMap getRecipeMap() { return this.recipeMap; } @@ -111,7 +110,7 @@ public int hashCode() { return getUniqueID().hashCode(); } - @Nonnull + @NotNull @Override public String toString() { return "GTRecipeCategory{" + uniqueID + '}'; diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java index db02945d430..989d86581f0 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeFluidInput.java @@ -3,9 +3,9 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import java.util.Objects; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Objects; public class GTRecipeFluidInput extends GTRecipeInput { diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java index 76f18cc39fc..66eb370b53e 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeInput.java @@ -12,13 +12,12 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectLists; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Comparator; import java.util.List; -import javax.annotation.Nullable; - /** * Definition of ItemStacks, Ore dicts, of ingredients for * use on RecipeMaps Recipes go here. diff --git a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java index 8596b80d955..e36d9e39370 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java +++ b/src/main/java/gregtech/api/recipes/ingredients/GTRecipeOreInput.java @@ -7,9 +7,9 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.Objects; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Objects; public class GTRecipeOreInput extends GTRecipeInput { diff --git a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java index 4181b978d03..ee259cf24f1 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java +++ b/src/main/java/gregtech/api/recipes/ingredients/IntCircuitIngredient.java @@ -9,9 +9,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import java.util.Objects; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Objects; public class IntCircuitIngredient extends GTRecipeInput { diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java index f8c5010c5a9..06298ae22ad 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTCondition.java @@ -2,9 +2,9 @@ import gregtech.api.util.GTLog; -import java.util.Objects; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Objects; /** * This class is used to check if a NBT tag matches a condition, not necessarily matching the original item tag diff --git a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java index fccda3c820d..85174d2f0a7 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java +++ b/src/main/java/gregtech/api/recipes/ingredients/nbtmatch/NBTMatcher.java @@ -5,10 +5,10 @@ import net.minecraft.nbt.NBTTagLongArray; import net.minecraftforge.fluids.FluidStack; -import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Objects; /** * This class is used to match NBT tags. Used to match a MapItemStackNBTIngredient NBT tag to a given NBT tag value. @@ -216,11 +216,11 @@ public boolean evaluate(@Nullable NBTTagCompound tag, @Nullable NBTCondition con boolean evaluate(@Nullable NBTTagCompound nbtTagCompound, @Nullable NBTCondition nbtCondition); - default boolean evaluate(@Nonnull ItemStack stack, @Nullable NBTCondition nbtCondition) { + default boolean evaluate(@NotNull ItemStack stack, @Nullable NBTCondition nbtCondition) { return evaluate(stack.getTagCompound(), nbtCondition); } - default boolean evaluate(@Nonnull FluidStack stack, @Nullable NBTCondition nbtCondition) { + default boolean evaluate(@NotNull FluidStack stack, @Nullable NBTCondition nbtCondition) { return evaluate(stack.tag, nbtCondition); } } diff --git a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java index f9c5e139222..423c1e4357d 100644 --- a/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/IParallelableRecipeLogic.java @@ -10,8 +10,8 @@ import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface IParallelableRecipeLogic { @@ -21,7 +21,7 @@ public interface IParallelableRecipeLogic { * * @param builder the recipe builder */ - default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} + default void applyParallelBonus(@NotNull RecipeBuilder builder) {} /** * Method which finds a recipe which can be parallelized, works by multiplying the recipe by the parallelization @@ -39,13 +39,13 @@ default void applyParallelBonus(@Nonnull RecipeBuilder builder) {} * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap recipeMap, - @Nonnull Recipe currentRecipe, - @Nonnull IItemHandlerModifiable inputs, - @Nonnull IMultipleTankHandler fluidInputs, - @Nonnull IItemHandlerModifiable outputs, - @Nonnull IMultipleTankHandler fluidOutputs, int parallelLimit, - long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findMultipliedParallelRecipe(@NotNull RecipeMap recipeMap, + @NotNull Recipe currentRecipe, + @NotNull IItemHandlerModifiable inputs, + @NotNull IMultipleTankHandler fluidInputs, + @NotNull IItemHandlerModifiable outputs, + @NotNull IMultipleTankHandler fluidOutputs, int parallelLimit, + long maxVoltage, @NotNull IVoidable voidable) { return ParallelLogic.doParallelRecipes( currentRecipe, recipeMap, @@ -70,10 +70,10 @@ default RecipeBuilder findMultipliedParallelRecipe(@Nonnull RecipeMap reci * @param voidable the voidable performing the parallel recipe * @return the recipe builder with the parallelized recipe. returns null the recipe can't fit */ - default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap recipeMap, - @Nonnull IItemHandlerModifiable inputs, - @Nonnull IItemHandlerModifiable outputs, int parallelLimit, - long maxVoltage, @Nonnull IVoidable voidable) { + default RecipeBuilder findAppendedParallelItemRecipe(@NotNull RecipeMap recipeMap, + @NotNull IItemHandlerModifiable inputs, + @NotNull IItemHandlerModifiable outputs, int parallelLimit, + long maxVoltage, @NotNull IVoidable voidable) { return ParallelLogic.appendItemRecipes( recipeMap, inputs, @@ -84,10 +84,10 @@ default RecipeBuilder findAppendedParallelItemRecipe(@Nonnull RecipeMap re } // Recipes passed in here should be already trimmed, if desired - default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemHandlerModifiable inputs, - @Nonnull IMultipleTankHandler fluidInputs, - @Nonnull IItemHandlerModifiable outputs, - @Nonnull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { + default Recipe findParallelRecipe(@NotNull Recipe currentRecipe, @NotNull IItemHandlerModifiable inputs, + @NotNull IMultipleTankHandler fluidInputs, + @NotNull IItemHandlerModifiable outputs, + @NotNull IMultipleTankHandler fluidOutputs, long maxVoltage, int parallelLimit) { if (parallelLimit > 1 && getRecipeMap() != null) { RecipeBuilder parallelBuilder = switch (getParallelLogicType()) { case MULTIPLY -> findMultipliedParallelRecipe(getRecipeMap(), currentRecipe, inputs, fluidInputs, @@ -116,13 +116,13 @@ default Recipe findParallelRecipe(@Nonnull Recipe currentRecipe, @Nonnull IItemH return currentRecipe; } - @Nonnull + @NotNull MetaTileEntity getMetaTileEntity(); @Nullable RecipeMap getRecipeMap(); - @Nonnull + @NotNull ParallelLogicType getParallelLogicType(); /** diff --git a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java index bb9a6787954..200eb71ed35 100644 --- a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java @@ -2,7 +2,7 @@ import gregtech.common.ConfigHolder; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * A class for holding all the various Overclocking logics @@ -26,9 +26,9 @@ public class OverclockingLogic { * @param numberOfOCs the maximum amount of overclocks allowed * @return an int array of {OverclockedEUt, OverclockedDuration} */ - @Nonnull - public static int[] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, - double durationDivisor, double voltageMultiplier) { + public static int @NotNull [] standardOverclockingLogic(int recipeEUt, long maxVoltage, int recipeDuration, + int numberOfOCs, + double durationDivisor, double voltageMultiplier) { double resultDuration = recipeDuration; double resultVoltage = recipeEUt; @@ -81,9 +81,9 @@ public static int applyCoilEUtDiscount(int recipeEUt, int providedTemp, int requ return (int) (recipeEUt * Math.min(1, Math.pow(0.95, amountEUtDiscount))); } - @Nonnull - public static int[] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, - int maxOverclocks, int currentTemp, int recipeRequiredTemp) { + public static int @NotNull [] heatingCoilOverclockingLogic(int recipeEUt, long maximumVoltage, int recipeDuration, + int maxOverclocks, int currentTemp, + int recipeRequiredTemp) { int amountPerfectOC = calculateAmountCoilEUtDiscount(currentTemp, recipeRequiredTemp) / 2; // perfect overclock for every 1800k over recipe temperature diff --git a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java index 9640df1db80..c9b688b6653 100644 --- a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java @@ -21,11 +21,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.*; -import javax.annotation.Nonnull; - public abstract class ParallelLogic { /** @@ -36,8 +35,8 @@ public abstract class ParallelLogic { * @return returns the amount of possible time a recipe can be made from a given input inventory */ - public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable inputs, - @Nonnull IMultipleTankHandler fluidInputs, int parallelAmount) { + public static int getMaxRecipeMultiplier(@NotNull Recipe recipe, @NotNull IItemHandlerModifiable inputs, + @NotNull IMultipleTankHandler fluidInputs, int parallelAmount) { // Find all the items in the combined Item Input inventories and create oversized ItemStacks Object2IntMap ingredientStacks = GTHashMaps.fromItemHandler(inputs); @@ -66,8 +65,8 @@ public static int getMaxRecipeMultiplier(@Nonnull Recipe recipe, @Nonnull IItemH * @param voidFluids If the result of the fluid parallel limiting should be ignored * @return returns the amount of recipes that can be merged successfully into a given output inventory */ - public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHandlerModifiable outputs, - @Nonnull IMultipleTankHandler fluidOutputs, int parallelAmount, + public static int limitByOutputMerging(@NotNull Recipe recipe, @NotNull IItemHandlerModifiable outputs, + @NotNull IMultipleTankHandler fluidOutputs, int parallelAmount, boolean voidItems, boolean voidFluids) { int modifiedItemParallelAmount = Integer.MAX_VALUE; int modifiedFluidParallelAmount = Integer.MAX_VALUE; @@ -120,7 +119,7 @@ public static int limitByOutputMerging(@Nonnull Recipe recipe, @Nonnull IItemHan * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without * voiding products. */ - public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull OverlayedItemHandler overlayedItemHandler, + public static int limitParallelByItems(@NotNull Recipe recipe, @NotNull OverlayedItemHandler overlayedItemHandler, int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -166,9 +165,9 @@ public static int limitParallelByItems(@Nonnull Recipe recipe, @Nonnull Overlaye * @return the amount of times a {@link Recipe} outputs can be merged into an inventory without * voiding products. */ - public static int limitParallelByItemsIncremental(@Nonnull List recipeOutputList, - @Nonnull List outputsToAppend, - @Nonnull OverlayedItemHandler overlayedItemHandler, + public static int limitParallelByItemsIncremental(@NotNull List recipeOutputList, + @NotNull List outputsToAppend, + @NotNull OverlayedItemHandler overlayedItemHandler, final int multiplier) { int minMultiplier = 0; int currentMultiplier = multiplier; @@ -229,8 +228,8 @@ public static int limitParallelByItemsIncremental(@Nonnull List recip * @return an array consisting of the last known multiplier, new multiplier to be attempted and * the last know multiplier that resulted in failure */ - @Nonnull - public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int multiplier, int maxMultiplier) { + public static int @NotNull [] adjustMultiplier(boolean mergedAll, int minMultiplier, int multiplier, + int maxMultiplier) { if (mergedAll) { minMultiplier = multiplier; int remainder = (maxMultiplier - multiplier) % 2; @@ -253,8 +252,8 @@ public static int[] adjustMultiplier(boolean mergedAll, int minMultiplier, int m * @return the amount of times a {@link Recipe} outputs can be merged into a fluid handler without * voiding products. */ - public static int limitParallelByFluids(@Nonnull Recipe recipe, - @Nonnull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { + public static int limitParallelByFluids(@NotNull Recipe recipe, + @NotNull OverlayedFluidHandler overlayedFluidHandler, int multiplier) { int minMultiplier = 0; int maxMultiplier = multiplier; @@ -299,7 +298,7 @@ public static int limitParallelByFluids(@Nonnull Recipe recipe, * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Items */ - protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngredients, @Nonnull Recipe recipe, + protected static int getMaxRatioItem(@NotNull Object2IntMap countIngredients, @NotNull Recipe recipe, int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; // map the recipe ingredients to account for duplicated and notConsumable ingredients. @@ -386,7 +385,7 @@ protected static int getMaxRatioItem(@Nonnull Object2IntMap countIngr * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of Recipes that can be performed at a single time based on the available Fluids */ - protected static int getMaxRatioFluid(@Nonnull Map countFluid, @Nonnull Recipe recipe, + protected static int getMaxRatioFluid(@NotNull Map countFluid, @NotNull Recipe recipe, int parallelAmount) { int minMultiplier = Integer.MAX_VALUE; // map the recipe input fluids to account for duplicated fluids, @@ -470,12 +469,12 @@ protected static int getMaxRatioFluid(@Nonnull Map countFluid // At this point, the recipe is already trimmed according to the item and fluid output limit, so we just need to // take care of voiding - public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, @Nonnull RecipeMap recipeMap, - @Nonnull IItemHandlerModifiable importInventory, - @Nonnull IMultipleTankHandler importFluids, - @Nonnull IItemHandlerModifiable exportInventory, - @Nonnull IMultipleTankHandler exportFluids, int parallelAmount, - long maxVoltage, @Nonnull IVoidable voidable) { + public static RecipeBuilder doParallelRecipes(@NotNull Recipe currentRecipe, @NotNull RecipeMap recipeMap, + @NotNull IItemHandlerModifiable importInventory, + @NotNull IMultipleTankHandler importFluids, + @NotNull IItemHandlerModifiable exportInventory, + @NotNull IMultipleTankHandler exportFluids, int parallelAmount, + long maxVoltage, @NotNull IVoidable voidable) { // First check if we are limited by recipe inputs. This can short circuit a lot of consecutive checking int multiplierByInputs = getMaxRecipeMultiplier(currentRecipe, importInventory, importFluids, parallelAmount); if (multiplierByInputs == 0) { @@ -526,9 +525,9 @@ public static RecipeBuilder doParallelRecipes(@Nonnull Recipe currentRecipe, * @return A {@link RecipeBuilder} containing the recipes that can be performed in parallel, limited by the * ingredients available, and the output space available. */ - public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap, - @Nonnull IItemHandlerModifiable importInventory, - @Nonnull IItemHandlerModifiable exportInventory, + public static RecipeBuilder appendItemRecipes(@NotNull RecipeMap recipeMap, + @NotNull IItemHandlerModifiable importInventory, + @NotNull IItemHandlerModifiable exportInventory, int parallelAmount, long maxVoltage, IVoidable voidable) { RecipeBuilder recipeBuilder = null; diff --git a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java index fead3278c62..97fb64c9884 100644 --- a/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/IResearchRecipeMap.java @@ -2,10 +2,10 @@ import gregtech.api.recipes.Recipe; -import java.util.Collection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Collection; public interface IResearchRecipeMap { @@ -15,14 +15,14 @@ public interface IResearchRecipeMap { * @param researchId the ID to match recipes to, typically derived from the recipe output * @param recipe the recipe to add to the registry */ - void addDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); + void addDataStickEntry(@NotNull String researchId, @NotNull Recipe recipe); /** * @param researchId the ID to match recipes to, typically derived from the recipe output * @return the set of recipes assigned to the ID */ @Nullable - Collection getDataStickEntry(@Nonnull String researchId); + Collection getDataStickEntry(@NotNull String researchId); /** * Remove a recipe from the data stick registry for the {@link gregtech.api.recipes.RecipeMap} @@ -31,5 +31,5 @@ public interface IResearchRecipeMap { * @param recipe the recipe to remove from the registry * @return true if the recipe was successfully removed, otherwise false */ - boolean removeDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe); + boolean removeDataStickEntry(@NotNull String researchId, @NotNull Recipe recipe); } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java index a3650667c9b..efd953ea099 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java @@ -15,13 +15,12 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class RecipeMapAssemblyLine> extends RecipeMap implements IResearchRecipeMap { /** Contains the recipes for each research key */ @@ -36,7 +35,7 @@ public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modi } @Override - @Nonnull + @NotNull public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 176) @@ -50,8 +49,8 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, @Nonnull IItemHandlerModifiable itemHandler, - @Nonnull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(ModularUI.Builder builder, @NotNull IItemHandlerModifiable itemHandler, + @NotNull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int startInputsX = 80 - 4 * 18; int fluidInputsCount = fluidHandler.getTanks(); int startInputsY = 37 - 2 * 18; @@ -98,7 +97,7 @@ public boolean compileRecipe(Recipe recipe) { } @Override - public boolean removeRecipe(@Nonnull Recipe recipe) { + public boolean removeRecipe(@NotNull Recipe recipe) { if (!super.removeRecipe(recipe)) return false; if (recipe.hasProperty(ResearchProperty.getInstance())) { ResearchPropertyData data = recipe.getProperty(ResearchProperty.getInstance(), null); @@ -113,19 +112,19 @@ public boolean removeRecipe(@Nonnull Recipe recipe) { } @Override - public void addDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe) { + public void addDataStickEntry(@NotNull String researchId, @NotNull Recipe recipe) { Collection collection = researchEntries.computeIfAbsent(researchId, (k) -> new ObjectOpenHashSet<>()); collection.add(recipe); } @Nullable @Override - public Collection getDataStickEntry(@Nonnull String researchId) { + public Collection getDataStickEntry(@NotNull String researchId) { return researchEntries.get(researchId); } @Override - public boolean removeDataStickEntry(@Nonnull String researchId, @Nonnull Recipe recipe) { + public boolean removeDataStickEntry(@NotNull String researchId, @NotNull Recipe recipe) { Collection collection = researchEntries.get(researchId); if (collection == null) return false; if (collection.remove(recipe)) { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 561bb506f06..9b0048e2bf7 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -10,9 +10,9 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import java.util.List; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.List; public class RecipeMapFluidCanner extends RecipeMap { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index bb44e5842d5..bbd546f7437 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -17,9 +17,9 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; -import java.util.List; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.List; public class RecipeMapFormingPress extends RecipeMap { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java index 4d27dd2bca5..cdfb13448c1 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java @@ -9,9 +9,9 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.List; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.List; public class RecipeMapFurnace extends RecipeMap { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index a0b297d8a83..472c00469a2 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -8,12 +8,11 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - public class RecipeMapScanner extends RecipeMap implements IScannerRecipeMap { private static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); diff --git a/src/main/java/gregtech/api/recipes/map/Branch.java b/src/main/java/gregtech/api/recipes/map/Branch.java index f6e61e15689..fb76521ad20 100644 --- a/src/main/java/gregtech/api/recipes/map/Branch.java +++ b/src/main/java/gregtech/api/recipes/map/Branch.java @@ -3,12 +3,11 @@ import gregtech.api.recipes.Recipe; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.stream.Stream; -import javax.annotation.Nonnull; - public class Branch { // Keys on this have *(should)* unique hashcodes. @@ -44,7 +43,7 @@ public boolean isEmptyBranch() { return (nodes == null || nodes.isEmpty()) && (specialNodes == null || specialNodes.isEmpty()); } - @Nonnull + @NotNull public Map> getNodes() { if (nodes == null) { nodes = new Object2ObjectOpenHashMap<>(2); @@ -52,7 +51,7 @@ public Map> getNodes() { return nodes; } - @Nonnull + @NotNull public Map> getSpecialNodes() { if (specialNodes == null) { specialNodes = new Object2ObjectOpenHashMap<>(2); diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java index ec9dffd4b36..d3be9c1bb7b 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackIngredient.java @@ -6,11 +6,10 @@ import net.minecraft.nbt.NBTTagCompound; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.jetbrains.annotations.NotNull; import java.util.List; -import javax.annotation.Nonnull; - public class MapItemStackIngredient extends AbstractMapIngredient { protected ItemStack stack; @@ -31,8 +30,8 @@ public MapItemStackIngredient(ItemStack stack, GTRecipeInput gtRecipeInput) { this.gtRecipeInput = gtRecipeInput; } - @Nonnull - public static List from(@Nonnull GTRecipeInput r) { + @NotNull + public static List from(@NotNull GTRecipeInput r) { ObjectArrayList list = new ObjectArrayList<>(); for (ItemStack s : r.getInputStacks()) { list.add(new MapItemStackIngredient(s, r)); diff --git a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java index 8261cb94461..c64920b0794 100644 --- a/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapItemStackNBTIngredient.java @@ -6,11 +6,10 @@ import net.minecraft.nbt.NBTTagCompound; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.jetbrains.annotations.NotNull; import java.util.List; -import javax.annotation.Nonnull; - public class MapItemStackNBTIngredient extends MapItemStackIngredient { protected GTRecipeInput gtRecipeInput = null; @@ -24,8 +23,8 @@ public MapItemStackNBTIngredient(ItemStack s, GTRecipeInput gtRecipeInput) { this.gtRecipeInput = gtRecipeInput; } - @Nonnull - public static List from(@Nonnull GTRecipeInput r) { + @NotNull + public static List from(@NotNull GTRecipeInput r) { ObjectArrayList list = new ObjectArrayList<>(); for (ItemStack s : r.getInputStacks()) { list.add(new MapItemStackNBTIngredient(s, r)); diff --git a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java index e0dc3939107..37543d0f7b5 100644 --- a/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java +++ b/src/main/java/gregtech/api/recipes/map/MapOreDictNBTIngredient.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class MapOreDictNBTIngredient extends MapOreDictIngredient { diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java index 1235a278cf7..ccbe97bdc17 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/CleanroomProperty.java @@ -5,7 +5,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CleanroomProperty extends RecipeProperty { @@ -25,15 +25,15 @@ public static CleanroomProperty getInstance() { } @Override - public void drawInfo(@Nonnull Minecraft minecraft, int x, int y, int color, Object value) { + public void drawInfo(@NotNull Minecraft minecraft, int x, int y, int color, Object value) { CleanroomType type = castValue(value); if (type == null) return; minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.cleanroom", getName(type)), x, y, color); } - @Nonnull - private static String getName(@Nonnull CleanroomType value) { + @NotNull + private static String getName(@NotNull CleanroomType value) { String name = I18n.format(value.getTranslationKey()); if (name.length() >= 20) return name.substring(0, 20) + ".."; return name; diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchProperty.java index 5ac6a8403eb..510ed5eaa71 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchProperty.java @@ -3,7 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class ResearchProperty extends RecipeProperty { @@ -15,7 +15,7 @@ private ResearchProperty() { super(KEY, ResearchPropertyData.class); } - @Nonnull + @NotNull public static ResearchProperty getInstance() { if (INSTANCE == null) { INSTANCE = new ResearchProperty(); @@ -24,7 +24,7 @@ public static ResearchProperty getInstance() { } @Override - public void drawInfo(@Nonnull Minecraft minecraft, int x, int y, int color, Object value) { + public void drawInfo(@NotNull Minecraft minecraft, int x, int y, int color, Object value) { minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.research"), x, y, color); } } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java index d69a8ec7332..4b199221d6c 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ResearchPropertyData.java @@ -2,12 +2,12 @@ import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import javax.annotation.Nonnull; - public final class ResearchPropertyData implements Iterable { private final Collection entries = new ArrayList<>(); @@ -17,11 +17,11 @@ public ResearchPropertyData() {} /** * @param entry the entry to add */ - public void add(@Nonnull ResearchEntry entry) { + public void add(@NotNull ResearchEntry entry) { this.entries.add(entry); } - @Nonnull + @NotNull @Override public Iterator iterator() { return this.entries.iterator(); @@ -41,17 +41,17 @@ public static final class ResearchEntry { * @param researchId the id of the research * @param dataItem the item allowed to contain the research */ - public ResearchEntry(@Nonnull String researchId, @Nonnull ItemStack dataItem) { + public ResearchEntry(@NotNull String researchId, @NotNull ItemStack dataItem) { this.researchId = researchId; this.dataItem = dataItem; } - @Nonnull + @NotNull public String getResearchId() { return researchId; } - @Nonnull + @NotNull public ItemStack getDataItem() { return dataItem; } diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java index fda3bf83599..3548c982fa8 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/ScanProperty.java @@ -3,7 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ScanProperty extends RecipeProperty { @@ -15,7 +15,7 @@ private ScanProperty() { super(KEY, Boolean.class); } - @Nonnull + @NotNull public static ScanProperty getInstance() { if (INSTANCE == null) { INSTANCE = new ScanProperty(); diff --git a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java index e364e5c0d7e..0b647d69523 100644 --- a/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java +++ b/src/main/java/gregtech/api/recipes/recipeproperties/TemperatureProperty.java @@ -6,12 +6,11 @@ import net.minecraft.client.resources.I18n; import org.apache.commons.lang3.Validate; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.TreeMap; -import javax.annotation.Nonnull; - public class TemperatureProperty extends RecipeProperty { public static final String KEY = "temperature"; @@ -37,7 +36,7 @@ public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) value, getMinTierForTemperature(castValue(value))), x, y, color); } - @Nonnull + @NotNull private String getMinTierForTemperature(Integer value) { String name = ""; for (Map.Entry coil : registeredCoilTypes.entrySet()) { diff --git a/src/main/java/gregtech/api/recipes/recipes/DummyRecipe.java b/src/main/java/gregtech/api/recipes/recipes/DummyRecipe.java index b87e286c364..dc835c46479 100644 --- a/src/main/java/gregtech/api/recipes/recipes/DummyRecipe.java +++ b/src/main/java/gregtech/api/recipes/recipes/DummyRecipe.java @@ -6,18 +6,18 @@ import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class DummyRecipe extends IForgeRegistryEntry.Impl implements IRecipe { @Override - public boolean matches(@Nonnull final InventoryCrafting inv, @Nonnull final World worldIn) { + public boolean matches(@NotNull final InventoryCrafting inv, @NotNull final World worldIn) { return false; } - @Nonnull + @NotNull @Override - public ItemStack getCraftingResult(@Nonnull final InventoryCrafting inv) { + public ItemStack getCraftingResult(@NotNull final InventoryCrafting inv) { return ItemStack.EMPTY; } @@ -26,7 +26,7 @@ public boolean canFit(final int width, final int height) { return false; } - @Nonnull + @NotNull @Override public ItemStack getRecipeOutput() { return ItemStack.EMPTY; diff --git a/src/main/java/gregtech/api/terminal/TerminalRegistry.java b/src/main/java/gregtech/api/terminal/TerminalRegistry.java index 7e99e758a8a..6da73912e23 100644 --- a/src/main/java/gregtech/api/terminal/TerminalRegistry.java +++ b/src/main/java/gregtech/api/terminal/TerminalRegistry.java @@ -41,12 +41,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; + import java.io.File; import java.util.*; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class TerminalRegistry { public static final Map APP_REGISTER = new LinkedHashMap<>(); @@ -191,8 +191,8 @@ public static void registerHardware(Hardware hardware) { HW_REGISTER.put(name, hardware); } - public static void registerHardwareDemand(String name, boolean isDefaultApp, @Nonnull List[] hardware, - @Nonnull List[] upgrade) { + public static void registerHardwareDemand(String name, boolean isDefaultApp, @NotNull List[] hardware, + @NotNull List[] upgrade) { if (name != null && APP_REGISTER.containsKey(name)) { if (isDefaultApp) { DEFAULT_APPS.add(name); diff --git a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java index b385e0051e8..1df64c9efc0 100644 --- a/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java +++ b/src/main/java/gregtech/api/terminal/hardware/HardwareProvider.java @@ -11,12 +11,12 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Created with IntelliJ IDEA. * @@ -110,7 +110,7 @@ public ICapabilityProvider createProvider(ItemStack itemStack) { } @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { if (providers != null) { for (Map.Entry entry : providers.entrySet()) { Hardware provider = entry.getValue(); @@ -126,7 +126,7 @@ public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFa @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { if (providers != null) { for (Map.Entry entry : providers.entrySet()) { Hardware provider = entry.getValue(); diff --git a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java index ed9a1027614..a02caa5b76f 100644 --- a/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java +++ b/src/main/java/gregtech/api/terminal/hardware/IHardwareCapability.java @@ -2,13 +2,13 @@ import net.minecraftforge.common.capabilities.Capability; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public interface IHardwareCapability { - default boolean hasCapability(@Nonnull Capability capability) { + default boolean hasCapability(@NotNull Capability capability) { return getCapability(capability) != null; } - T getCapability(@Nonnull Capability capability); + T getCapability(@NotNull Capability capability); } diff --git a/src/main/java/gregtech/api/terminal/util/SearchEngine.java b/src/main/java/gregtech/api/terminal/util/SearchEngine.java index 316aba3ce6d..deaff75d2fd 100644 --- a/src/main/java/gregtech/api/terminal/util/SearchEngine.java +++ b/src/main/java/gregtech/api/terminal/util/SearchEngine.java @@ -1,8 +1,8 @@ package gregtech.api.terminal.util; -import java.util.function.Consumer; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Consumer; public class SearchEngine { @@ -10,7 +10,7 @@ public class SearchEngine { private final Consumer result; private Thread thread; - public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result) { + public SearchEngine(@NotNull ISearch search, @NotNull Consumer result) { this.search = search; this.result = result; } diff --git a/src/main/java/gregtech/api/unification/OreDictUnifier.java b/src/main/java/gregtech/api/unification/OreDictUnifier.java index 82a63335b70..a945fe5b4f5 100644 --- a/src/main/java/gregtech/api/unification/OreDictUnifier.java +++ b/src/main/java/gregtech/api/unification/OreDictUnifier.java @@ -23,6 +23,8 @@ import com.google.common.collect.Sets; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.AbstractMap.SimpleEntry; @@ -30,9 +32,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.M; public class OreDictUnifier { @@ -170,8 +169,8 @@ public static void onItemRegistration(OreRegisterEvent event) { } } - @Nonnull - public static Set getOreDictionaryNames(@Nonnull ItemStack itemStack) { + @NotNull + public static Set getOreDictionaryNames(@NotNull ItemStack itemStack) { if (itemStack.isEmpty()) return Collections.emptySet(); ItemVariantMap> nameEntry = stackOreDictName.get(itemStack.getItem()); if (nameEntry == null) return Collections.emptySet(); @@ -188,22 +187,22 @@ public static Set getOreDictionaryNames(@Nonnull ItemStack itemStack) { } @Nullable - public static ItemVariantMap> getOreDictionaryEntry(@Nonnull Item item) { + public static ItemVariantMap> getOreDictionaryEntry(@NotNull Item item) { ItemVariantMap.Mutable> entry = stackOreDictName.get(item); return entry == null ? null : ItemVariantMap.unmodifiableSetView(entry); } - @Nonnull - public static ItemVariantMap> getOreDictionaryEntryOrEmpty(@Nonnull Item item) { + @NotNull + public static ItemVariantMap> getOreDictionaryEntryOrEmpty(@NotNull Item item) { ItemVariantMap.Mutable> entry = stackOreDictName.get(item); return entry == null ? ItemVariantMap.empty() : ItemVariantMap.unmodifiableSetView(entry); } - public static boolean hasOreDictionaryEntry(@Nonnull Item item) { + public static boolean hasOreDictionaryEntry(@NotNull Item item) { return stackOreDictName.containsKey(item); } - public static boolean hasOreDictionary(@Nonnull ItemStack itemStack, @Nonnull String oreDictName) { + public static boolean hasOreDictionary(@NotNull ItemStack itemStack, @NotNull String oreDictName) { if (itemStack.isEmpty()) return false; ItemVariantMap> nameEntry = stackOreDictName.get(itemStack.getItem()); if (nameEntry == null) return false; @@ -375,8 +374,8 @@ synchronized private static void addAndSort(List list, T itemToAdd, Compa * @return value corresponding to given key or its wildcard counterpart */ @Nullable - private static T getOrWildcard(@Nonnull Map map, - @Nonnull ItemAndMetadata key) { + private static T getOrWildcard(@NotNull Map map, + @NotNull ItemAndMetadata key) { T t = map.get(key); if (t != null) return t; if (key.isWildcard()) return null; diff --git a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java index aa5c8045a52..13762ec5f27 100644 --- a/src/main/java/gregtech/api/unification/material/MarkerMaterial.java +++ b/src/main/java/gregtech/api/unification/material/MarkerMaterial.java @@ -5,8 +5,6 @@ import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - /** * MarkerMaterial is type of material used for generic things like material re-registration and use in recipes * Marker material cannot be used to generate any meta items @@ -16,7 +14,7 @@ */ public final class MarkerMaterial extends Material { - private MarkerMaterial(@Nonnull String name) { + private MarkerMaterial(@NotNull String name) { super(GTUtility.gregtechId(name)); } diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index 3b02e0e3ddd..03609768a93 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -26,14 +26,17 @@ import com.google.common.collect.ImmutableList; import crafttweaker.annotations.ZenRegister; import org.jetbrains.annotations.ApiStatus; -import stanhebben.zenscript.annotations.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import stanhebben.zenscript.annotations.OperatorType; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenGetter; +import stanhebben.zenscript.annotations.ZenMethod; +import stanhebben.zenscript.annotations.ZenOperator; import java.util.*; import java.util.function.UnaryOperator; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.material.Material") @ZenRegister public class Material implements Comparable { @@ -43,7 +46,7 @@ public class Material implements Comparable { * * @see MaterialInfo */ - @Nonnull + @NotNull private final MaterialInfo materialInfo; /** @@ -51,7 +54,7 @@ public class Material implements Comparable { * * @see MaterialProperties */ - @Nonnull + @NotNull private final MaterialProperties properties; /** @@ -59,7 +62,7 @@ public class Material implements Comparable { * * @see MaterialFlags */ - @Nonnull + @NotNull private final MaterialFlags flags; /** @@ -67,7 +70,7 @@ public class Material implements Comparable { */ private String chemicalFormula; - @Nonnull + @NotNull private String calculateChemicalFormula() { if (chemicalFormula != null) return this.chemicalFormula; if (materialInfo.element != null) { @@ -114,8 +117,8 @@ public MaterialStack[] getMaterialComponentsCt() { return getMaterialComponents().toArray(new MaterialStack[0]); } - private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties properties, - @Nonnull MaterialFlags flags) { + private Material(@NotNull MaterialInfo materialInfo, @NotNull MaterialProperties properties, + @NotNull MaterialFlags flags) { this.materialInfo = materialInfo; this.properties = properties; this.flags = flags; @@ -124,7 +127,7 @@ private Material(@Nonnull MaterialInfo materialInfo, @Nonnull MaterialProperties } // thou shall not call - protected Material(@Nonnull ResourceLocation resourceLocation) { + protected Material(@NotNull ResourceLocation resourceLocation) { materialInfo = new MaterialInfo(0, resourceLocation); materialInfo.iconSet = MaterialIconSet.DULL; properties = new MaterialProperties(); @@ -220,7 +223,7 @@ public Fluid getFluid() { * @param key the key for the fluid * @return the fluid corresponding with the key */ - public Fluid getFluid(@Nonnull FluidStorageKey key) { + public Fluid getFluid(@NotNull FluidStorageKey key) { FluidProperty prop = getProperty(PropertyKey.FLUID); if (prop == null) { throw new IllegalArgumentException("Material " + getResourceLocation() + " does not have a Fluid!"); @@ -244,7 +247,7 @@ public FluidStack getFluid(int amount) { * @param amount the amount the FluidStack should have * @return a FluidStack with the fluid and amount */ - public FluidStack getFluid(@Nonnull FluidStorageKey key, int amount) { + public FluidStack getFluid(@NotNull FluidStorageKey key, int amount) { return new FluidStack(getFluid(key), amount); } @@ -346,17 +349,17 @@ public FluidStack getPlasma(int amount) { // TODO clean up the name-related methods @ZenGetter("name") - @Nonnull + @NotNull public String getName() { return getResourceLocation().getPath(); } - @Nonnull + @NotNull public String getModid() { return getResourceLocation().getNamespace(); } - @Nonnull + @NotNull public ResourceLocation getResourceLocation() { return materialInfo.resourceLocation; } @@ -372,7 +375,7 @@ public String getUnlocalizedName() { return location.getNamespace() + ".material." + location.getPath(); } - @Nonnull + @NotNull public String getRegistryName() { ResourceLocation location = getResourceLocation(); return location.getNamespace() + ':' + location.getPath(); @@ -404,7 +407,7 @@ public MaterialStack multiply(long amount) { return new MaterialStack(this, amount); } - @Nonnull + @NotNull public MaterialProperties getProperties() { return properties; } @@ -440,7 +443,7 @@ public void verifyMaterial() { calculateDecompositionType(); } - @Nonnull + @NotNull public MaterialRegistry getRegistry() { return GregTechAPI.materialManager.getRegistry(getModid()); } @@ -473,7 +476,7 @@ public static class Builder { * for the Translation Key. * @since GTCEu 2.0.0 */ - public Builder(int id, @Nonnull ResourceLocation resourceLocation) { + public Builder(int id, @NotNull ResourceLocation resourceLocation) { String name = resourceLocation.getPath(); if (name.charAt(name.length() - 1) == '_') { throw new IllegalArgumentException("Material name cannot end with a '_'!"); @@ -503,7 +506,7 @@ public Builder fluid() { *

* Can be called multiple times to add multiple fluids. */ - public Builder fluid(@Nonnull FluidStorageKey key, @Nonnull FluidState state) { + public Builder fluid(@NotNull FluidStorageKey key, @NotNull FluidState state) { return fluid(key, new FluidBuilder().state(state)); } @@ -512,7 +515,7 @@ public Builder fluid(@Nonnull FluidStorageKey key, @Nonnull FluidState state) { *

* Can be called multiple times to add multiple fluids. */ - public Builder fluid(@Nonnull FluidStorageKey key, @Nonnull FluidBuilder builder) { + public Builder fluid(@NotNull FluidStorageKey key, @NotNull FluidBuilder builder) { properties.ensureSet(PropertyKey.FLUID); FluidProperty property = properties.getProperty(PropertyKey.FLUID); property.getStorage().enqueueRegistration(key, builder); @@ -533,7 +536,7 @@ public Builder liquid() { * * @see #fluid(FluidStorageKey, FluidState) */ - public Builder liquid(@Nonnull FluidBuilder builder) { + public Builder liquid(@NotNull FluidBuilder builder) { return fluid(FluidStorageKeys.LIQUID, builder.state(FluidState.LIQUID)); } @@ -551,7 +554,7 @@ public Builder plasma() { * * @see #fluid(FluidStorageKey, FluidState) */ - public Builder plasma(@Nonnull FluidBuilder builder) { + public Builder plasma(@NotNull FluidBuilder builder) { return fluid(FluidStorageKeys.PLASMA, builder.state(FluidState.PLASMA)); } @@ -569,7 +572,7 @@ public Builder gas() { * * @see #fluid(FluidStorageKey, FluidState) */ - public Builder gas(@Nonnull FluidBuilder builder) { + public Builder gas(@NotNull FluidBuilder builder) { return fluid(FluidStorageKeys.GAS, builder.state(FluidState.GAS)); } @@ -1108,7 +1111,7 @@ private static class MaterialInfo { */ private Element element; - private MaterialInfo(int metaItemSubId, @Nonnull ResourceLocation resourceLocation) { + private MaterialInfo(int metaItemSubId, @NotNull ResourceLocation resourceLocation) { this.metaItemSubId = metaItemSubId; String name = resourceLocation.getPath(); if (!GTUtility.toLowerCaseUnderscore(GTUtility.lowerUnderscoreToUpperCamel(name)).equals(name)) { diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java index 7f9626e7c12..005bf8769e7 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconSet.java @@ -2,6 +2,8 @@ import com.google.common.base.Preconditions; import crafttweaker.annotations.ZenRegister; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenMethod; @@ -10,9 +12,6 @@ import java.util.Locale; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.material.MaterialIconSet") @ZenRegister public class MaterialIconSet { @@ -62,7 +61,7 @@ public class MaterialIconSet { * * @param name the name of the iconset */ - public MaterialIconSet(@Nonnull String name) { + public MaterialIconSet(@NotNull String name) { this(name, MaterialIconSet.DULL); } @@ -72,7 +71,7 @@ public MaterialIconSet(@Nonnull String name) { * @param name the name of the iconset * @param parentIconset the parent iconset */ - public MaterialIconSet(@Nonnull String name, @Nonnull MaterialIconSet parentIconset) { + public MaterialIconSet(@NotNull String name, @NotNull MaterialIconSet parentIconset) { this(name, parentIconset, false); } @@ -83,7 +82,7 @@ public MaterialIconSet(@Nonnull String name, @Nonnull MaterialIconSet parentIcon * @param parentIconset the parent iconset, should be null if this should be a root iconset * @param isRootIconset true if this should be a root iconset, otherwise false */ - public MaterialIconSet(@Nonnull String name, @Nullable MaterialIconSet parentIconset, boolean isRootIconset) { + public MaterialIconSet(@NotNull String name, @Nullable MaterialIconSet parentIconset, boolean isRootIconset) { this.name = name.toLowerCase(Locale.ENGLISH); Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), "MaterialIconSet " + this.name + " already registered!"); @@ -94,7 +93,7 @@ public MaterialIconSet(@Nonnull String name, @Nullable MaterialIconSet parentIco } @ZenMethod("get") - public static MaterialIconSet getByName(@Nonnull String name) { + public static MaterialIconSet getByName(@NotNull String name) { return ICON_SETS.get(name.toLowerCase(Locale.ENGLISH)); } diff --git a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java index 8f749b587cc..23d4589d3b5 100644 --- a/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java +++ b/src/main/java/gregtech/api/unification/material/info/MaterialIconType.java @@ -10,12 +10,11 @@ import com.google.common.base.Preconditions; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; +import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; - public class MaterialIconType { public static final Map ICON_TYPES = new HashMap<>(); @@ -129,18 +128,18 @@ public MaterialIconType(String name) { ICON_TYPES.put(this.name, this); } - @Nonnull - public ResourceLocation getBlockTexturePath(@Nonnull MaterialIconSet materialIconSet) { + @NotNull + public ResourceLocation getBlockTexturePath(@NotNull MaterialIconSet materialIconSet) { return recurseIconsetPath(materialIconSet, BLOCK_TEXTURE_CACHE, BLOCK_TEXTURE_PATH_FULL, BLOCK_TEXTURE_PATH); } - @Nonnull - public ResourceLocation getItemModelPath(@Nonnull MaterialIconSet materialIconSet) { + @NotNull + public ResourceLocation getItemModelPath(@NotNull MaterialIconSet materialIconSet) { return recurseIconsetPath(materialIconSet, ITEM_MODEL_CACHE, ITEM_MODEL_PATH_FULL, ITEM_MODEL_PATH); } - @Nonnull - public ResourceLocation getBlockModelPath(@Nonnull MaterialIconSet materialIconSet) { + @NotNull + public ResourceLocation getBlockModelPath(@NotNull MaterialIconSet materialIconSet) { return recurseIconsetPath(materialIconSet, BLOCK_MODEL_CACHE, BLOCK_MODEL_PATH_FULL, BLOCK_MODEL_PATH); } @@ -153,10 +152,10 @@ public ResourceLocation getBlockModelPath(@Nonnull MaterialIconSet materialIconS * @param path the abbreviated path to the asset with formatting (%s) for IconSet and IconType names * @return the location of the asset */ - @Nonnull - public ResourceLocation recurseIconsetPath(@Nonnull MaterialIconSet iconSet, - @Nonnull Table cache, - @Nonnull String fullPath, @Nonnull String path) { + @NotNull + public ResourceLocation recurseIconsetPath(@NotNull MaterialIconSet iconSet, + @NotNull Table cache, + @NotNull String fullPath, @NotNull String path) { if (cache.contains(this, iconSet)) { return cache.get(this, iconSet); } diff --git a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java index 74d0834eb27..172e0981ac7 100644 --- a/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/BlastProperty.java @@ -1,8 +1,7 @@ package gregtech.api.unification.material.properties; import crafttweaker.CraftTweakerAPI; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlastProperty implements IMaterialProperty { @@ -90,7 +89,7 @@ public GasTier getGasTier() { return gasTier; } - public void setGasTier(@Nonnull GasTier tier) { + public void setGasTier(@NotNull GasTier tier) { this.gasTier = tier; } diff --git a/src/main/java/gregtech/api/unification/material/properties/IngotProperty.java b/src/main/java/gregtech/api/unification/material/properties/IngotProperty.java index bfe96afb74b..79b5d09eb9e 100644 --- a/src/main/java/gregtech/api/unification/material/properties/IngotProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/IngotProperty.java @@ -2,7 +2,7 @@ import gregtech.api.unification.material.Material; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class IngotProperty implements IMaterialProperty { diff --git a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java index d48d3fd78f5..acac622967b 100644 --- a/src/main/java/gregtech/api/unification/material/properties/OreProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/OreProperty.java @@ -5,15 +5,14 @@ import net.minecraft.util.math.MathHelper; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class OreProperty implements IMaterialProperty { /** @@ -166,7 +165,7 @@ public List getSeparatedInto() { * * @param materials the materials to use as byproducts */ - public void setOreByProducts(@Nonnull Material... materials) { + public void setOreByProducts(@NotNull Material... materials) { setOreByProducts(Arrays.asList(materials)); } @@ -175,7 +174,7 @@ public void setOreByProducts(@Nonnull Material... materials) { * * @param materials the materials to use as byproducts */ - public void setOreByProducts(@Nonnull Collection materials) { + public void setOreByProducts(@NotNull Collection materials) { this.oreByProducts.clear(); this.oreByProducts.addAll(materials); } @@ -185,7 +184,7 @@ public void setOreByProducts(@Nonnull Collection materials) { * * @param materials the materials to add as byproducts */ - public void addOreByProducts(@Nonnull Material... materials) { + public void addOreByProducts(@NotNull Material... materials) { this.oreByProducts.addAll(Arrays.asList(materials)); } @@ -199,8 +198,8 @@ public final Material getOreByProduct(int index) { return this.oreByProducts.get(MathHelper.clamp(index, 0, this.oreByProducts.size() - 1)); } - @Nonnull - public final Material getOreByProduct(int index, @Nonnull Material fallback) { + @NotNull + public final Material getOreByProduct(int index, @NotNull Material fallback) { Material material = getOreByProduct(index); return material != null ? material : fallback; } diff --git a/src/main/java/gregtech/api/unification/material/properties/RotorProperty.java b/src/main/java/gregtech/api/unification/material/properties/RotorProperty.java index 32f9d738598..6864c810ca5 100644 --- a/src/main/java/gregtech/api/unification/material/properties/RotorProperty.java +++ b/src/main/java/gregtech/api/unification/material/properties/RotorProperty.java @@ -1,6 +1,6 @@ package gregtech.api.unification.material.properties; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class RotorProperty implements IMaterialProperty { @@ -59,7 +59,7 @@ public void setDurability(int durability) { } @Override - public void verifyProperty(@Nonnull MaterialProperties properties) { + public void verifyProperty(@NotNull MaterialProperties properties) { properties.ensureSet(PropertyKey.INGOT, true); } } diff --git a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java index 9ca2c54314b..0ae8c557b8f 100644 --- a/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java +++ b/src/main/java/gregtech/api/unification/material/registry/IMaterialRegistryManager.java @@ -3,9 +3,9 @@ import gregtech.api.GTValues; import gregtech.api.unification.material.Material; -import java.util.Collection; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Collection; public interface IMaterialRegistryManager { @@ -15,8 +15,8 @@ public interface IMaterialRegistryManager { * @param modid the mod id for the registry * @return the registry for the mod */ - @Nonnull - MaterialRegistry createRegistry(@Nonnull String modid); + @NotNull + MaterialRegistry createRegistry(@NotNull String modid); /** * Get a mod's registry. Accessible during all phases. @@ -24,8 +24,8 @@ public interface IMaterialRegistryManager { * @param modid the modid of the mod * @return the registry associated with the mod, or the GregTech registry if it does not have one */ - @Nonnull - MaterialRegistry getRegistry(@Nonnull String modid); + @NotNull + MaterialRegistry getRegistry(@NotNull String modid); /** * Get a mod's registry. Accessible during all phases. @@ -33,7 +33,7 @@ public interface IMaterialRegistryManager { * @param networkId the network ID of the registry * @return the registry associated with the network ID, or the GregTech registry if it does not have one */ - @Nonnull + @NotNull MaterialRegistry getRegistry(int networkId); /** @@ -46,7 +46,7 @@ public interface IMaterialRegistryManager { * * @return all the Material Registries */ - @Nonnull + @NotNull Collection getRegistries(); /** @@ -58,7 +58,7 @@ public interface IMaterialRegistryManager { * * @return all registered materials. */ - @Nonnull + @NotNull Collection getRegisteredMaterials(); /** @@ -79,7 +79,7 @@ public interface IMaterialRegistryManager { * @return the current phase in the material registration process * @see Phase */ - @Nonnull + @NotNull Phase getPhase(); default boolean canModifyMaterials() { diff --git a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java index 9f441dabea6..5aed58c764b 100644 --- a/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java +++ b/src/main/java/gregtech/api/unification/material/registry/MaterialRegistry.java @@ -3,9 +3,9 @@ import gregtech.api.unification.material.Material; import gregtech.api.util.GTControlledRegistry; -import java.util.Collection; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Collection; public abstract class MaterialRegistry extends GTControlledRegistry { @@ -15,7 +15,7 @@ public MaterialRegistry() { public abstract void register(Material material); - @Nonnull + @NotNull public abstract Collection getAllMaterials(); /** @@ -25,7 +25,7 @@ public MaterialRegistry() { * * @param material the fallback material */ - public abstract void setFallbackMaterial(@Nonnull Material material); + public abstract void setFallbackMaterial(@NotNull Material material); /** * Using {@link #getObjectById(int)} or related will still return {@code null} when an entry cannot be found. @@ -33,7 +33,7 @@ public MaterialRegistry() { * * @return the fallback material, used for when another material does not exist */ - @Nonnull + @NotNull public abstract Material getFallbackMaterial(); /** @@ -41,6 +41,6 @@ public MaterialRegistry() { */ public abstract int getNetworkId(); - @Nonnull + @NotNull public abstract String getModid(); } diff --git a/src/main/java/gregtech/api/unification/ore/StoneType.java b/src/main/java/gregtech/api/unification/ore/StoneType.java index 60751e660a9..f92bb9c68bf 100644 --- a/src/main/java/gregtech/api/unification/ore/StoneType.java +++ b/src/main/java/gregtech/api/unification/ore/StoneType.java @@ -14,12 +14,11 @@ import net.minecraftforge.fml.common.Loader; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; import java.util.function.Predicate; import java.util.function.Supplier; -import javax.annotation.Nonnull; - /** * For ore generation */ @@ -57,7 +56,7 @@ public StoneType(int id, String name, SoundType soundType, OrePrefix processingP } @Override - public int compareTo(@Nonnull StoneType stoneType) { + public int compareTo(@NotNull StoneType stoneType) { return STONE_TYPE_REGISTRY.getIDForObject(this) - STONE_TYPE_REGISTRY.getIDForObject(stoneType); } diff --git a/src/main/java/gregtech/api/unification/stack/EmptyVariantMap.java b/src/main/java/gregtech/api/unification/stack/EmptyVariantMap.java index 301810df637..dcf1c60cf65 100644 --- a/src/main/java/gregtech/api/unification/stack/EmptyVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/EmptyVariantMap.java @@ -1,6 +1,6 @@ package gregtech.api.unification.stack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * An unmodifiable {@link ItemVariantMap} instance with no elements. diff --git a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java index 287f5c42d72..d1ac6e8179e 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java +++ b/src/main/java/gregtech/api/unification/stack/ItemAndMetadata.java @@ -5,30 +5,30 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class ItemAndMetadata { - @Nonnull + @NotNull public final Item item; public final int itemDamage; - public ItemAndMetadata(@Nonnull Item item, int itemDamage) { + public ItemAndMetadata(@NotNull Item item, int itemDamage) { this.item = item; this.itemDamage = itemDamage; } - public ItemAndMetadata(@Nonnull ItemStack itemStack) { + public ItemAndMetadata(@NotNull ItemStack itemStack) { this.item = itemStack.getItem(); this.itemDamage = itemStack.getItemDamage(); } - @Nonnull + @NotNull public ItemStack toItemStack() { return new ItemStack(item, 1, itemDamage); } - @Nonnull + @NotNull public ItemStack toItemStack(int stackSize) { return new ItemStack(item, stackSize, itemDamage); } @@ -37,7 +37,7 @@ public boolean isWildcard() { return this.itemDamage == GTValues.W; } - @Nonnull + @NotNull public ItemAndMetadata toWildcard() { return this.isWildcard() ? this : new ItemAndMetadata(item, GTValues.W); } diff --git a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java index bad615f0888..394348da668 100644 --- a/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/ItemVariantMap.java @@ -4,10 +4,10 @@ import net.minecraft.item.ItemStack; -import java.util.Set; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Set; /** * An abstraction of dictionary-like collection with each item variant as keys. @@ -70,7 +70,7 @@ default boolean hasWildcardEntry() { * @return {@code true} if there's a nonnull value associated with item damage of * the item, {@code false} otherwise. */ - default boolean has(@Nonnull ItemStack stack) { + default boolean has(@NotNull ItemStack stack) { return has((short) stack.getItemDamage()); } @@ -84,7 +84,7 @@ default boolean has(@Nonnull ItemStack stack) { * no values associated. */ @Nullable - default E get(@Nonnull ItemStack stack) { + default E get(@NotNull ItemStack stack) { return get((short) stack.getItemDamage()); } @@ -96,8 +96,8 @@ default E get(@Nonnull ItemStack stack) { * @param type of the element * @return an unmodifiable view of {@code map} with {@link Set} of elements as values. */ - @Nonnull - static ItemVariantMap> unmodifiableSetView(@Nonnull ItemVariantMap> map) { + @NotNull + static ItemVariantMap> unmodifiableSetView(@NotNull ItemVariantMap> map) { return new UnmodifiableSetViewVariantMap<>(map); } @@ -105,7 +105,7 @@ static ItemVariantMap> unmodifiableSetView(@Nonnull ItemVariantMap type of the element * @return an unmodifiable instance of variant map with no entries. */ - @Nonnull + @NotNull @SuppressWarnings("unchecked") static ItemVariantMap empty() { return (ItemVariantMap) EmptyVariantMap.INSTANCE; @@ -147,7 +147,7 @@ interface Mutable extends ItemVariantMap { * there was no such value. */ @Nullable - default E put(@Nonnull ItemStack stack, @Nullable E e) { + default E put(@NotNull ItemStack stack, @Nullable E e) { return put((short) stack.getItemDamage(), e); } } diff --git a/src/main/java/gregtech/api/unification/stack/MaterialStack.java b/src/main/java/gregtech/api/unification/stack/MaterialStack.java index 8398d4361be..35584781e22 100644 --- a/src/main/java/gregtech/api/unification/stack/MaterialStack.java +++ b/src/main/java/gregtech/api/unification/stack/MaterialStack.java @@ -4,12 +4,11 @@ import gregtech.api.util.SmallDigits; import crafttweaker.annotations.ZenRegister; +import org.jetbrains.annotations.NotNull; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenProperty; -import javax.annotation.Nonnull; - @ZenClass("mods.gregtech.material.MaterialStack") @ZenRegister public class MaterialStack { @@ -52,7 +51,7 @@ public int hashCode() { } @ZenMethod("toString") - @Nonnull + @NotNull public String toFormatted() { final String chemicalFormula = material.getChemicalFormula(); diff --git a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java index 714984b0cd3..6c8c149b961 100644 --- a/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/MultiItemVariantMap.java @@ -4,8 +4,7 @@ import it.unimi.dsi.fastutil.shorts.Short2ObjectMap; import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * {@link ItemVariantMap} implementation backed by a hashmap. Each metadata is diff --git a/src/main/java/gregtech/api/unification/stack/SingleItemVariantMap.java b/src/main/java/gregtech/api/unification/stack/SingleItemVariantMap.java index a89ddcebdc1..dd0702ed084 100644 --- a/src/main/java/gregtech/api/unification/stack/SingleItemVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/SingleItemVariantMap.java @@ -1,6 +1,6 @@ package gregtech.api.unification.stack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * {@link ItemVariantMap} implementation which holds one shared value for all diff --git a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java index 70e5193490b..18f3119120f 100644 --- a/src/main/java/gregtech/api/unification/stack/UnificationEntry.java +++ b/src/main/java/gregtech/api/unification/stack/UnificationEntry.java @@ -3,9 +3,9 @@ import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; -import java.util.Objects; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Objects; public class UnificationEntry { diff --git a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java index 09f5400347b..03729e1a058 100644 --- a/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java +++ b/src/main/java/gregtech/api/unification/stack/UnmodifiableSetViewVariantMap.java @@ -1,11 +1,11 @@ package gregtech.api.unification.stack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Unmodifiable view of another {@link ItemVariantMap} with {@link Set} of elements as values. * @@ -16,7 +16,7 @@ final class UnmodifiableSetViewVariantMap implements ItemVariantMap> { private final ItemVariantMap> delegate; - UnmodifiableSetViewVariantMap(@Nonnull ItemVariantMap> delegate) { + UnmodifiableSetViewVariantMap(@NotNull ItemVariantMap> delegate) { this.delegate = delegate; } diff --git a/src/main/java/gregtech/api/util/AssemblyLineManager.java b/src/main/java/gregtech/api/util/AssemblyLineManager.java index 5275d23e690..f4f577996b2 100644 --- a/src/main/java/gregtech/api/util/AssemblyLineManager.java +++ b/src/main/java/gregtech/api/util/AssemblyLineManager.java @@ -21,24 +21,23 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public final class AssemblyLineManager { public static final String RESEARCH_NBT_TAG = "assemblylineResearch"; public static final String RESEARCH_ID_NBT_TAG = "researchId"; - @Nonnull + @NotNull public static ItemStack getDefaultScannerItem() { return MetaItems.TOOL_DATA_STICK.getStackForm(); } - @Nonnull + @NotNull public static ItemStack getDefaultResearchStationItem(int cwut) { if (cwut > 32) { return MetaItems.TOOL_DATA_MODULE.getStackForm(); @@ -57,7 +56,7 @@ public static void registerScannerLogic() { * @param stackCompound the compound contained on the ItemStack to write to * @param researchId the research id */ - public static void writeResearchToNBT(@Nonnull NBTTagCompound stackCompound, @Nonnull String researchId) { + public static void writeResearchToNBT(@NotNull NBTTagCompound stackCompound, @NotNull String researchId) { NBTTagCompound compound = new NBTTagCompound(); compound.setString(RESEARCH_ID_NBT_TAG, researchId); stackCompound.setTag(RESEARCH_NBT_TAG, compound); @@ -68,7 +67,7 @@ public static void writeResearchToNBT(@Nonnull NBTTagCompound stackCompound, @No * @return the research id */ @Nullable - public static String readResearchId(@Nonnull ItemStack stack) { + public static String readResearchId(@NotNull ItemStack stack) { NBTTagCompound compound = stack.getTagCompound(); if (!hasResearchTag(compound)) return null; @@ -82,7 +81,7 @@ public static String readResearchId(@Nonnull ItemStack stack) { * @param isDataBank if the caller is a Data Bank. Pass "true" here if your use-case does not matter for this check. * @return if the stack is a data item */ - public static boolean isStackDataItem(@Nonnull ItemStack stack, boolean isDataBank) { + public static boolean isStackDataItem(@NotNull ItemStack stack, boolean isDataBank) { if (stack.getItem() instanceof MetaItemmetaItem) { MetaItem.MetaValueItem valueItem = metaItem.getItem(stack); if (valueItem == null) return false; @@ -99,7 +98,7 @@ public static boolean isStackDataItem(@Nonnull ItemStack stack, boolean isDataBa * @param stack the stack to check * @return if the stack has the research NBTTagCompound */ - public static boolean hasResearchTag(@Nonnull ItemStack stack) { + public static boolean hasResearchTag(@NotNull ItemStack stack) { return hasResearchTag(stack.getTagCompound()); } @@ -117,7 +116,7 @@ private static boolean hasResearchTag(@Nullable NBTTagCompound compound) { * * @param builder the builder to retrieve recipe info from */ - public static void createDefaultResearchRecipe(@Nonnull AssemblyLineRecipeBuilder builder) { + public static void createDefaultResearchRecipe(@NotNull AssemblyLineRecipeBuilder builder) { if (!ConfigHolder.machines.enableResearch) return; for (AssemblyLineRecipeBuilder.ResearchRecipeEntry entry : builder.getRecipeEntries()) { @@ -126,8 +125,8 @@ public static void createDefaultResearchRecipe(@Nonnull AssemblyLineRecipeBuilde } } - public static void createDefaultResearchRecipe(@Nonnull String researchId, @Nonnull ItemStack researchItem, - @Nonnull ItemStack dataItem, int duration, int EUt, int CWUt) { + public static void createDefaultResearchRecipe(@NotNull String researchId, @NotNull ItemStack researchItem, + @NotNull ItemStack dataItem, int duration, int EUt, int CWUt) { if (!ConfigHolder.machines.enableResearch) return; NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(dataItem); @@ -173,7 +172,7 @@ public Recipe createCustomRecipe(long voltage, List inputs, List iconSupplier, boolean setBackgroundImageName("item_search.png"); } - @Nonnull + @NotNull @Override public ItemStack createIcon() { if (iconSupplier == null) { diff --git a/src/main/java/gregtech/api/util/BlockUtility.java b/src/main/java/gregtech/api/util/BlockUtility.java index 2e9854ebc42..e84e996b92d 100644 --- a/src/main/java/gregtech/api/util/BlockUtility.java +++ b/src/main/java/gregtech/api/util/BlockUtility.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockUtility { @@ -17,7 +17,7 @@ public BlockWrapper() { super(Material.AIR); } - @Nonnull + @NotNull @Override public NonNullList captureDrops(boolean start) { return super.captureDrops(start); diff --git a/src/main/java/gregtech/api/util/DummyContainer.java b/src/main/java/gregtech/api/util/DummyContainer.java index 5b523937c90..0b60dbc4af3 100644 --- a/src/main/java/gregtech/api/util/DummyContainer.java +++ b/src/main/java/gregtech/api/util/DummyContainer.java @@ -3,7 +3,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class DummyContainer extends Container { @@ -13,7 +13,7 @@ public DummyContainer() {} public void detectAndSendChanges() {} @Override - public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { + public boolean canInteractWith(@NotNull EntityPlayer playerIn) { return true; } } diff --git a/src/main/java/gregtech/api/util/DyeUtil.java b/src/main/java/gregtech/api/util/DyeUtil.java index 372ef625b18..093d7fdbc4d 100644 --- a/src/main/java/gregtech/api/util/DyeUtil.java +++ b/src/main/java/gregtech/api/util/DyeUtil.java @@ -2,14 +2,14 @@ import net.minecraft.item.EnumDyeColor; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class DyeUtil { /** * Determines dye color nearest to specified RGB color */ - @Nonnull + @NotNull public static EnumDyeColor determineDyeColor(int rgbColor) { int r1 = rgbColor >> 16 & 0xFF; int g1 = rgbColor >> 8 & 0xFF; @@ -33,8 +33,8 @@ public static EnumDyeColor determineDyeColor(int rgbColor) { return dye; } - @Nonnull - public static String getOredictColorName(@Nonnull EnumDyeColor dyeColor) { + @NotNull + public static String getOredictColorName(@NotNull EnumDyeColor dyeColor) { switch (dyeColor) { case WHITE: return "dyeWhite"; diff --git a/src/main/java/gregtech/api/util/EntityDamageUtil.java b/src/main/java/gregtech/api/util/EntityDamageUtil.java index 48322611ece..9809db70598 100644 --- a/src/main/java/gregtech/api/util/EntityDamageUtil.java +++ b/src/main/java/gregtech/api/util/EntityDamageUtil.java @@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class EntityDamageUtil { @@ -26,7 +26,7 @@ public class EntityDamageUtil { * @param multiplier the multiplier on the damage taken * @param maximum the maximum damage to apply to the entity, use -1 for no maximum */ - public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int temperature, float multiplier, + public static void applyTemperatureDamage(@NotNull EntityLivingBase entity, int temperature, float multiplier, int maximum) { if (temperature > 320) { int damage = (int) ((multiplier * (temperature - 300)) / 50.0F); @@ -47,7 +47,7 @@ public static void applyTemperatureDamage(@Nonnull EntityLivingBase entity, int * @param entity the entity to damage * @param damage the damage to apply */ - public static void applyHeatDamage(@Nonnull EntityLivingBase entity, int damage) { + public static void applyHeatDamage(@NotNull EntityLivingBase entity, int damage) { // do not attempt to damage by 0 if (damage <= 0) return; if (!entity.isEntityAlive()) return; @@ -67,7 +67,7 @@ public static void applyHeatDamage(@Nonnull EntityLivingBase entity, int damage) * @param entity the entity to damage * @param damage the damage to apply */ - public static void applyFrostDamage(@Nonnull EntityLivingBase entity, int damage) { + public static void applyFrostDamage(@NotNull EntityLivingBase entity, int damage) { // do not attempt to damage by 0 if (damage <= 0) return; if (!entity.isEntityAlive()) return; @@ -97,7 +97,7 @@ public static void applyFrostDamage(@Nonnull EntityLivingBase entity, int damage * @param entity the entity to damage * @param damage the damage to apply */ - public static void applyChemicalDamage(@Nonnull EntityLivingBase entity, int damage) { + public static void applyChemicalDamage(@NotNull EntityLivingBase entity, int damage) { // do not attempt to damage by 0 if (damage <= 0) return; if (!entity.isEntityAlive()) return; diff --git a/src/main/java/gregtech/api/util/FluidTankSwitchShim.java b/src/main/java/gregtech/api/util/FluidTankSwitchShim.java index 22d482f0601..e0210eee145 100644 --- a/src/main/java/gregtech/api/util/FluidTankSwitchShim.java +++ b/src/main/java/gregtech/api/util/FluidTankSwitchShim.java @@ -6,7 +6,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; // probably causes problems public class FluidTankSwitchShim implements IFluidTank, IFluidHandler { diff --git a/src/main/java/gregtech/api/util/GTControlledRegistry.java b/src/main/java/gregtech/api/util/GTControlledRegistry.java index 5c605758e97..8ae00d93cbf 100644 --- a/src/main/java/gregtech/api/util/GTControlledRegistry.java +++ b/src/main/java/gregtech/api/util/GTControlledRegistry.java @@ -6,7 +6,7 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class GTControlledRegistry extends RegistryNamespaced { @@ -50,7 +50,7 @@ private static boolean checkActiveModContainerIsGregtech() { return container != null && container.getModId().equals(GTValues.MODID); } - public void register(int id, @Nonnull K key, @Nonnull V value) { + public void register(int id, @NotNull K key, @NotNull V value) { if (id < 0 || id >= maxId) { throw new IndexOutOfBoundsException("Id is out of range: " + id); } @@ -67,7 +67,7 @@ public void register(int id, @Nonnull K key, @Nonnull V value) { } @Override - public void putObject(@Nonnull K key, @Nonnull V value) { + public void putObject(@NotNull K key, @NotNull V value) { throw new UnsupportedOperationException("Use #register(int, String, T)"); } diff --git a/src/main/java/gregtech/api/util/GTHashMaps.java b/src/main/java/gregtech/api/util/GTHashMaps.java index 32f4a49185c..9df09cd6368 100644 --- a/src/main/java/gregtech/api/util/GTHashMaps.java +++ b/src/main/java/gregtech/api/util/GTHashMaps.java @@ -11,13 +11,12 @@ import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; - public final class GTHashMaps { private GTHashMaps() {} @@ -28,8 +27,8 @@ private GTHashMaps() {} * @param inputs The inventory handler of the inventory * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ - @Nonnull - public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inputs) { + @NotNull + public static Object2IntMap fromItemHandler(@NotNull IItemHandler inputs) { return fromItemHandler(inputs, false); } @@ -40,8 +39,8 @@ public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inp * @param linked If the Map should be a Linked Map to preserve insertion order * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ - @Nonnull - public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inputs, boolean linked) { + @NotNull + public static Object2IntMap fromItemHandler(@NotNull IItemHandler inputs, boolean linked) { final Object2IntMap map = createItemStackMap(linked); // Create a single stack of the combined count for each item @@ -63,8 +62,8 @@ public static Object2IntMap fromItemHandler(@Nonnull IItemHandler inp * @param inputs The inventory handler of the inventory * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ - @Nonnull - public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs) { + @NotNull + public static Object2IntMap fromItemStackCollection(@NotNull Iterable inputs) { return fromItemStackCollection(inputs, false); } @@ -76,8 +75,8 @@ public static Object2IntMap fromItemStackCollection(@Nonnull Iterable * @param linked If the Map should be a Linked Map to preserve insertion order * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ - @Nonnull - public static Object2IntMap fromItemStackCollection(@Nonnull Iterable inputs, + @NotNull + public static Object2IntMap fromItemStackCollection(@NotNull Iterable inputs, boolean linked) { final Object2IntMap map = createItemStackMap(linked); @@ -92,7 +91,7 @@ public static Object2IntMap fromItemStackCollection(@Nonnull Iterable return map; } - @Nonnull + @NotNull private static Object2IntMap createItemStackMap(boolean linked) { ItemStackHashStrategy strategy = ItemStackHashStrategy.comparingAllButCount(); return linked ? new Object2IntLinkedOpenCustomHashMap<>(strategy) : new Object2IntOpenCustomHashMap<>(strategy); diff --git a/src/main/java/gregtech/api/util/GTStringUtils.java b/src/main/java/gregtech/api/util/GTStringUtils.java index 615bd9704c5..fdfbe1a999e 100644 --- a/src/main/java/gregtech/api/util/GTStringUtils.java +++ b/src/main/java/gregtech/api/util/GTStringUtils.java @@ -16,14 +16,14 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class GTStringUtils { private GTStringUtils() {/**/} - @Nonnull - public static String prettyPrintItemStack(@Nonnull ItemStack stack) { + @NotNull + public static String prettyPrintItemStack(@NotNull ItemStack stack) { if (stack.getItem() instanceof MetaItem) { MetaItem metaItem = (MetaItem) stack.getItem(); MetaItem.MetaValueItem metaValueItem = metaItem.getItem(stack); @@ -75,8 +75,8 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { * @param stack the stack to convert * @return the string form of the stack */ - @Nonnull - public static String itemStackToString(@Nonnull ItemStack stack) { + @NotNull + public static String itemStackToString(@NotNull ItemStack stack) { return stack.getCount() + "x" + stack.getItem().getTranslationKey(stack) + "@" + stack.getItemDamage(); } @@ -87,7 +87,7 @@ public static String itemStackToString(@Nonnull ItemStack stack) { * @param ticks the amount of ticks to convert * @return the time elapsed for the given number of ticks, in "mm:ss" format. */ - @Nonnull + @NotNull public static String ticksToElapsedTime(int ticks) { int seconds = ticks / 20; int minutes = seconds / 60; diff --git a/src/main/java/gregtech/api/util/GTTransferUtils.java b/src/main/java/gregtech/api/util/GTTransferUtils.java index cc5fc6b8b10..2e3c3655a49 100644 --- a/src/main/java/gregtech/api/util/GTTransferUtils.java +++ b/src/main/java/gregtech/api/util/GTTransferUtils.java @@ -15,25 +15,24 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.function.Predicate; -import javax.annotation.Nonnull; - public class GTTransferUtils { - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler) { + public static int transferFluids(@NotNull IFluidHandler sourceHandler, @NotNull IFluidHandler destHandler) { return transferFluids(sourceHandler, destHandler, Integer.MAX_VALUE, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, + public static int transferFluids(@NotNull IFluidHandler sourceHandler, @NotNull IFluidHandler destHandler, int transferLimit) { return transferFluids(sourceHandler, destHandler, transferLimit, fluidStack -> true); } - public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull IFluidHandler destHandler, - int transferLimit, @Nonnull Predicate fluidFilter) { + public static int transferFluids(@NotNull IFluidHandler sourceHandler, @NotNull IFluidHandler destHandler, + int transferLimit, @NotNull Predicate fluidFilter) { int fluidLeftToTransfer = transferLimit; for (IFluidTankProperties tankProperties : sourceHandler.getTankProperties()) { @@ -65,8 +64,8 @@ public static int transferFluids(@Nonnull IFluidHandler sourceHandler, @Nonnull return transferLimit - fluidLeftToTransfer; } - public static boolean transferExactFluidStack(@Nonnull IFluidHandler sourceHandler, - @Nonnull IFluidHandler destHandler, FluidStack fluidStack) { + public static boolean transferExactFluidStack(@NotNull IFluidHandler sourceHandler, + @NotNull IFluidHandler destHandler, FluidStack fluidStack) { int amount = fluidStack.amount; FluidStack sourceFluid = sourceHandler.drain(fluidStack, false); if (sourceFluid == null || sourceFluid.amount != amount) { diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index 2db721ce4af..bf88330a68b 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -57,6 +57,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; @@ -64,9 +65,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.V; public class GTUtility { @@ -208,7 +206,7 @@ public static void readItems(IItemHandlerModifiable handler, String tagName, NBT * @return Index of the nearest value lesser or equal than {@code value}, * or {@code -1} if there's no entry matching the condition */ - public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { + public static int nearestLesserOrEqual(@NotNull long[] array, long value) { int low = 0, high = array.length - 1; while (true) { int median = (low + high) / 2; @@ -228,7 +226,7 @@ public static int nearestLesserOrEqual(@Nonnull long[] array, long value) { * @return Index of the nearest value lesser than {@code value}, * or {@code -1} if there's no entry matching the condition */ - public static int nearestLesser(@Nonnull long[] array, long value) { + public static int nearestLesser(@NotNull long[] array, long value) { int low = 0, high = array.length - 1; while (true) { int median = (low + high) / 2; @@ -458,8 +456,8 @@ public static List copyFluidList(List fluidStacks) { * @param stack item stack for copying * @return a copy of ItemStack, or {@link ItemStack#EMPTY} if the stack is empty */ - @Nonnull - public static ItemStack copy(@Nonnull ItemStack stack) { + @NotNull + public static ItemStack copy(@NotNull ItemStack stack) { return stack.isEmpty() ? ItemStack.EMPTY : stack.copy(); } @@ -469,8 +467,8 @@ public static ItemStack copy(@Nonnull ItemStack stack) { * @param stack item stack for copying * @return a copy of ItemStack, or {@link ItemStack#EMPTY} if the stack is empty */ - @Nonnull - public static ItemStack copy(int newCount, @Nonnull ItemStack stack) { + @NotNull + public static ItemStack copy(int newCount, @NotNull ItemStack stack) { if (stack.isEmpty()) return ItemStack.EMPTY; ItemStack copy = stack.copy(); copy.setCount(newCount); @@ -484,8 +482,8 @@ public static ItemStack copy(int newCount, @Nonnull ItemStack stack) { * @return a copy of ItemStack, or {@link ItemStack#EMPTY} if all the candidates are empty * @throws IllegalArgumentException if {@code stacks} is empty */ - @Nonnull - public static ItemStack copyFirst(@Nonnull ItemStack... stacks) { + @NotNull + public static ItemStack copyFirst(@NotNull ItemStack... stacks) { if (stacks.length == 0) { throw new IllegalArgumentException("Empty ItemStack candidates"); } @@ -504,8 +502,8 @@ public static ItemStack copyFirst(@Nonnull ItemStack... stacks) { * @return a copy of ItemStack, or {@link ItemStack#EMPTY} if all the candidates are empty * @throws IllegalArgumentException if {@code stacks} is empty */ - @Nonnull - public static ItemStack copyFirst(int newCount, @Nonnull ItemStack... stacks) { + @NotNull + public static ItemStack copyFirst(int newCount, @NotNull ItemStack... stacks) { if (stacks.length == 0) { throw new IllegalArgumentException("Empty ItemStack candidates"); } @@ -753,7 +751,7 @@ public static MapColor getMapColor(int rgb) { * @param blockState the blockstate to check * @return if the block is a snow layer or snow block */ - public static boolean isBlockSnow(@Nonnull IBlockState blockState) { + public static boolean isBlockSnow(@NotNull IBlockState blockState) { return blockState.getBlock() == Blocks.SNOW_LAYER || blockState.getBlock() == Blocks.SNOW; } @@ -763,7 +761,7 @@ public static boolean isBlockSnow(@Nonnull IBlockState blockState) { * * @return true if the passed IBlockState was valid snow block */ - public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, + public static boolean tryBreakSnow(@NotNull World world, @NotNull BlockPos pos, @NotNull IBlockState state, boolean playSound) { boolean success = false; if (state.getBlock() == Blocks.SNOW) { @@ -799,8 +797,8 @@ public static boolean tryBreakSnow(@Nonnull World world, @Nonnull BlockPos pos, * @param item item * @return all the sub-items of an item */ - @Nonnull - public static Set getAllSubItems(@Nonnull Item item) { + @NotNull + public static Set getAllSubItems(@NotNull Item item) { NonNullList subItems = NonNullList.create(); for (CreativeTabs tab : item.getCreativeTabs()) { if (tab == null || tab == CreativeTabs.SEARCH) continue; @@ -837,8 +835,8 @@ public static FluidStack getFluidFromContainer(Object ingredient) { * @param path the path in the location * @return the new location */ - @Nonnull - public static ResourceLocation gregtechId(@Nonnull String path) { + @NotNull + public static ResourceLocation gregtechId(@NotNull String path) { return new ResourceLocation(GTValues.MODID, path); } diff --git a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java index ab6e355007f..5158b38ae87 100644 --- a/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java +++ b/src/main/java/gregtech/api/util/IFluidTankPropertiesHashStrategy.java @@ -3,14 +3,13 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import it.unimi.dsi.fastutil.Hash; +import org.jetbrains.annotations.NotNull; import java.util.Objects; -import javax.annotation.Nonnull; - public interface IFluidTankPropertiesHashStrategy extends Hash.Strategy { - @Nonnull + @NotNull static IFluidTankPropertiesHashStrategy create() { return new IFluidTankPropertiesHashStrategy() { diff --git a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java index 69adc4575a3..fb68bc99112 100644 --- a/src/main/java/gregtech/api/util/ItemStackHashStrategy.java +++ b/src/main/java/gregtech/api/util/ItemStackHashStrategy.java @@ -3,11 +3,10 @@ import net.minecraft.item.ItemStack; import it.unimi.dsi.fastutil.Hash; +import org.jetbrains.annotations.Nullable; import java.util.Objects; -import javax.annotation.Nullable; - /** * A configurable generator of hashing strategies, allowing for consideration of select properties of ItemStacks when * considering equality. diff --git a/src/main/java/gregtech/api/util/LocalizationUtils.java b/src/main/java/gregtech/api/util/LocalizationUtils.java index b4fd853c813..a1c8eb75fd3 100644 --- a/src/main/java/gregtech/api/util/LocalizationUtils.java +++ b/src/main/java/gregtech/api/util/LocalizationUtils.java @@ -3,9 +3,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import java.util.regex.Pattern; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.regex.Pattern; @SuppressWarnings("deprecation") public class LocalizationUtils { @@ -69,7 +69,7 @@ public static boolean hasKey(String key) { * @param args substitutions * @return translated text split with text {@code '\n'} */ - @Nonnull + @NotNull public static String[] formatLines(String key, Object... args) { return NEW_LINE_PATTERN.split(format(key, args)); } diff --git a/src/main/java/gregtech/api/util/MCGuiUtil.java b/src/main/java/gregtech/api/util/MCGuiUtil.java index 5a7e53549b2..5a88f293363 100644 --- a/src/main/java/gregtech/api/util/MCGuiUtil.java +++ b/src/main/java/gregtech/api/util/MCGuiUtil.java @@ -2,9 +2,9 @@ import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; -import java.util.function.Consumer; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Consumer; /** * This class exists to avoid java always trying to load client classes when loading @@ -23,7 +23,7 @@ public void setEntryValue(int id, boolean value) {} public void setEntryValue(int id, float value) {} @Override - public void setEntryValue(int id, @Nonnull String value) { + public void setEntryValue(int id, @NotNull String value) { onChanged.accept(value); } }; diff --git a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java index 408117c3740..ece86333d65 100644 --- a/src/main/java/gregtech/api/util/OverlayedFluidHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedFluidHandler.java @@ -6,13 +6,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Simulates consecutive fills to {@link IMultipleTankHandler} instance. */ @@ -20,7 +20,7 @@ public class OverlayedFluidHandler { private final List overlayedTanks; - public OverlayedFluidHandler(@Nonnull IMultipleTankHandler tank) { + public OverlayedFluidHandler(@NotNull IMultipleTankHandler tank) { this.overlayedTanks = new ArrayList<>(); MultiFluidTankEntry[] entries = tank.getFluidTanks().toArray(new MultiFluidTankEntry[0]); Arrays.sort(entries, IMultipleTankHandler.ENTRY_COMPARATOR); @@ -48,7 +48,7 @@ public void reset() { * @param amountToInsert Amount of the fluid to insert * @return Amount of fluid inserted into tanks */ - public int insertFluid(@Nonnull FluidStack fluid, int amountToInsert) { + public int insertFluid(@NotNull FluidStack fluid, int amountToInsert) { if (amountToInsert <= 0) { return 0; } @@ -132,7 +132,7 @@ private static class OverlayedTank { @Nullable private FluidStack fluid; - OverlayedTank(@Nonnull IFluidTankProperties property, boolean allowSameFluidFill) { + OverlayedTank(@NotNull IFluidTankProperties property, boolean allowSameFluidFill) { this.property = property; this.allowSameFluidFill = allowSameFluidFill; reset(); @@ -152,7 +152,7 @@ public boolean isEmpty() { * @param amount Amount of the fluid to insert * @return Amount of fluid inserted into this tank */ - public int tryInsert(@Nonnull FluidStack fluid, int amount) { + public int tryInsert(@NotNull FluidStack fluid, int amount) { if (this.fluid == null) { this.fluid = fluid.copy(); return this.fluid.amount = Math.min(this.property.getCapacity(), amount); diff --git a/src/main/java/gregtech/api/util/OverlayedItemHandler.java b/src/main/java/gregtech/api/util/OverlayedItemHandler.java index af322e9bcf3..83c63422930 100644 --- a/src/main/java/gregtech/api/util/OverlayedItemHandler.java +++ b/src/main/java/gregtech/api/util/OverlayedItemHandler.java @@ -3,7 +3,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class OverlayedItemHandler { @@ -11,7 +11,7 @@ public class OverlayedItemHandler { private final OverlayedItemHandlerSlot[] slots; private final IItemHandler overlayedHandler; - public OverlayedItemHandler(@Nonnull IItemHandler toOverlay) { + public OverlayedItemHandler(@NotNull IItemHandler toOverlay) { this.slots = new OverlayedItemHandlerSlot[toOverlay.getSlots()]; this.originalSlots = new OverlayedItemHandlerSlot[toOverlay.getSlots()]; this.overlayedHandler = toOverlay; @@ -48,7 +48,7 @@ private void initSlot(int slot) { } } - public int insertStackedItemStack(@Nonnull ItemStack stack, int amountToInsert) { + public int insertStackedItemStack(@NotNull ItemStack stack, int amountToInsert) { int lastKnownPopulatedSlot = 0; // loop through all slots, looking for ones matching the key for (int i = 0; i < this.slots.length; i++) { @@ -104,7 +104,7 @@ private static class OverlayedItemHandlerSlot { private int count = 0; private int slotLimit; - protected OverlayedItemHandlerSlot(@Nonnull ItemStack stackToMirror, int slotLimit) { + protected OverlayedItemHandlerSlot(@NotNull ItemStack stackToMirror, int slotLimit) { if (!stackToMirror.isEmpty()) { this.itemStack = stackToMirror.copy(); this.count = stackToMirror.getCount(); @@ -114,7 +114,7 @@ protected OverlayedItemHandlerSlot(@Nonnull ItemStack stackToMirror, int slotLim } } - protected OverlayedItemHandlerSlot(@Nonnull ItemStack itemStack, int slotLimit, int count) { + protected OverlayedItemHandlerSlot(@NotNull ItemStack itemStack, int slotLimit, int count) { this.itemStack = itemStack; this.count = count; this.slotLimit = slotLimit; @@ -133,12 +133,12 @@ public int getCount() { * * @return the stored ItemStack */ - @Nonnull + @NotNull public ItemStack getItemStack() { return this.itemStack; } - public void setItemStack(@Nonnull ItemStack itemStack) { + public void setItemStack(@NotNull ItemStack itemStack) { if (!ItemStackHashStrategy.comparingAllButCount().equals(this.itemStack, itemStack)) { this.itemStack = itemStack; this.slotLimit = Math.min(itemStack.getMaxStackSize(), slotLimit); @@ -149,7 +149,7 @@ public void setCount(int count) { this.count = count; } - @Nonnull + @NotNull OverlayedItemHandlerSlot copy() { return new OverlayedItemHandlerSlot(this.itemStack, this.slotLimit, this.count); } diff --git a/src/main/java/gregtech/api/util/SlotDelegate.java b/src/main/java/gregtech/api/util/SlotDelegate.java index 9dd8df62ceb..cf5891ec2db 100644 --- a/src/main/java/gregtech/api/util/SlotDelegate.java +++ b/src/main/java/gregtech/api/util/SlotDelegate.java @@ -6,8 +6,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class SlotDelegate extends Slot { @@ -19,22 +19,22 @@ public SlotDelegate(Slot delegate) { } @Override - public void onSlotChange(@Nonnull ItemStack p_75220_1_, @Nonnull ItemStack p_75220_2_) { + public void onSlotChange(@NotNull ItemStack p_75220_1_, @NotNull ItemStack p_75220_2_) { this.delegate.onSlotChange(p_75220_1_, p_75220_2_); } - @Nonnull + @NotNull @Override - public ItemStack onTake(@Nonnull EntityPlayer thePlayer, @Nonnull ItemStack stack) { + public ItemStack onTake(@NotNull EntityPlayer thePlayer, @NotNull ItemStack stack) { return this.delegate.onTake(thePlayer, stack); } @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean isItemValid(@NotNull ItemStack stack) { return this.delegate.isItemValid(stack); } - @Nonnull + @NotNull @Override public ItemStack getStack() { return this.delegate.getStack(); @@ -46,7 +46,7 @@ public boolean getHasStack() { } @Override - public void putStack(@Nonnull ItemStack stack) { + public void putStack(@NotNull ItemStack stack) { this.delegate.putStack(stack); } @@ -61,18 +61,18 @@ public int getSlotStackLimit() { } @Override - public int getItemStackLimit(@Nonnull ItemStack stack) { + public int getItemStackLimit(@NotNull ItemStack stack) { return this.delegate.getItemStackLimit(stack); } - @Nonnull + @NotNull @Override public ItemStack decrStackSize(int amount) { return this.delegate.decrStackSize(amount); } @Override - public boolean canTakeStack(@Nonnull EntityPlayer playerIn) { + public boolean canTakeStack(@NotNull EntityPlayer playerIn) { return this.delegate.canTakeStack(playerIn); } @@ -87,7 +87,7 @@ public TextureAtlasSprite getBackgroundSprite() { return this.delegate.getBackgroundSprite(); } - @Nonnull + @NotNull @Override public ResourceLocation getBackgroundLocation() { return this.delegate.getBackgroundLocation(); @@ -100,7 +100,7 @@ public String getSlotTexture() { } @Override - public void setBackgroundLocation(@Nonnull ResourceLocation texture) { + public void setBackgroundLocation(@NotNull ResourceLocation texture) { this.delegate.setBackgroundLocation(texture); } diff --git a/src/main/java/gregtech/api/util/SmallDigits.java b/src/main/java/gregtech/api/util/SmallDigits.java index efc276a3dc7..6ced3b93375 100644 --- a/src/main/java/gregtech/api/util/SmallDigits.java +++ b/src/main/java/gregtech/api/util/SmallDigits.java @@ -1,6 +1,6 @@ package gregtech.api.util; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class SmallDigits { @@ -12,18 +12,18 @@ public final class SmallDigits { private SmallDigits() {} - @Nonnull + @NotNull public static String toSmallUpNumbers(String string) { return convert(string, SMALL_UP_NUMBER_BASE); } - @Nonnull + @NotNull public static String toSmallDownNumbers(String string) { return convert(string, SMALL_DOWN_NUMBER_BASE); } - @Nonnull - private static String convert(@Nonnull String string, int base) { + @NotNull + private static String convert(@NotNull String string, int base) { boolean hasPrecedingDash = false; char[] charArray = string.toCharArray(); for (int i = 0; i < charArray.length; i++) { diff --git a/src/main/java/gregtech/api/util/TaskScheduler.java b/src/main/java/gregtech/api/util/TaskScheduler.java index dfd28cf120d..6cf63029be5 100644 --- a/src/main/java/gregtech/api/util/TaskScheduler.java +++ b/src/main/java/gregtech/api/util/TaskScheduler.java @@ -9,13 +9,13 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; - @EventBusSubscriber(modid = GTValues.MODID) public class TaskScheduler { diff --git a/src/main/java/gregtech/api/util/VirtualTankRegistry.java b/src/main/java/gregtech/api/util/VirtualTankRegistry.java index 5fb7b52f6b0..f43809d7eb3 100644 --- a/src/main/java/gregtech/api/util/VirtualTankRegistry.java +++ b/src/main/java/gregtech/api/util/VirtualTankRegistry.java @@ -12,13 +12,13 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.Map; import java.util.UUID; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class VirtualTankRegistry extends WorldSavedData { private static final int DEFAULT_CAPACITY = 64000; // 64B @@ -166,7 +166,7 @@ public void readFromNBT(NBTTagCompound nbt) { } } - @Nonnull + @NotNull @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setTag("Private", new NBTTagCompound()); diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlob.java b/src/main/java/gregtech/api/util/oreglob/OreGlob.java index d9138e18da8..072e4959eeb 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlob.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlob.java @@ -5,13 +5,12 @@ import net.minecraft.item.ItemStack; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.Set; import java.util.function.Function; -import javax.annotation.Nonnull; - /** * Glob-like string matcher language designed for ore dictionary matching. *

@@ -31,14 +30,14 @@ public abstract class OreGlob { * @return Compilation result * @throws IllegalStateException If compiler is not provided yet */ - @Nonnull - public static OreGlobCompileResult compile(@Nonnull String expression) { + @NotNull + public static OreGlobCompileResult compile(@NotNull String expression) { if (compiler == null) throw new IllegalStateException("Compiler unavailable"); return compiler.apply(expression); } @ApiStatus.Internal - public static void setCompiler(@Nonnull Function compiler) { + public static void setCompiler(@NotNull Function compiler) { OreGlob.compiler = compiler; } @@ -49,8 +48,8 @@ public static void setCompiler(@Nonnull Function c * @param Type of visualizer * @return Visualizer */ - @Nonnull - public abstract V visualize(@Nonnull V visualizer); + @NotNull + public abstract V visualize(@NotNull V visualizer); /** * Tries to match the given input. @@ -58,7 +57,7 @@ public static void setCompiler(@Nonnull Function c * @param input String input * @return Whether this instance matches the input */ - public abstract boolean matches(@Nonnull String input); + public abstract boolean matches(@NotNull String input); /** * Tries to match each ore dictionary entries associated with given item. @@ -70,7 +69,7 @@ public static void setCompiler(@Nonnull Function c * @param stack Item input * @return Whether this instance matches the input */ - public final boolean matches(@Nonnull ItemStack stack) { + public final boolean matches(@NotNull ItemStack stack) { Set oreDicts = OreDictUnifier.getOreDictionaryNames(stack); if (oreDicts.isEmpty()) { return matches(""); @@ -89,7 +88,7 @@ public final boolean matches(@Nonnull ItemStack stack) { * @return Formatted visualization * @see OreGlob#toFormattedString(String) */ - @Nonnull + @NotNull public final List toFormattedString() { return visualize(new OreGlobTextBuilder(OreGlobTextFormatting.DEFAULT_FORMATTING)).getLines(); } @@ -100,8 +99,8 @@ public final List toFormattedString() { * @return Formatted visualization * @see OreGlob#toFormattedString() */ - @Nonnull - public final List toFormattedString(@Nonnull String indent) { + @NotNull + public final List toFormattedString(@NotNull String indent) { return visualize(new OreGlobTextBuilder(OreGlobTextFormatting.DEFAULT_FORMATTING, indent)).getLines(); } diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java index bd617fa541b..48256bad6f2 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextBuilder.java @@ -1,12 +1,12 @@ package gregtech.api.util.oreglob; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; - /** * Builder for OreGlob instance visualization. */ @@ -17,11 +17,11 @@ public class OreGlobTextBuilder { private final OreGlobTextFormatting formatting; private final String indent; - public OreGlobTextBuilder(@Nonnull OreGlobTextFormatting formatting) { + public OreGlobTextBuilder(@NotNull OreGlobTextFormatting formatting) { this(formatting, " "); } - public OreGlobTextBuilder(@Nonnull OreGlobTextFormatting formatting, @Nonnull String indent) { + public OreGlobTextBuilder(@NotNull OreGlobTextFormatting formatting, @NotNull String indent) { this.formatting = Objects.requireNonNull(formatting, "formatting == null"); this.indent = Objects.requireNonNull(indent, "indent == null"); } @@ -35,7 +35,7 @@ public void newLine(int indents) { } } - @Nonnull + @NotNull public StringBuilder getStringBuilder() { return this.builder; } @@ -45,12 +45,12 @@ private void finishLine() { this.builder.delete(0, this.builder.length()); } - @Nonnull + @NotNull public OreGlobTextFormatting getFormatting() { return formatting; } - @Nonnull + @NotNull public List getLines() { finishLine(); return Collections.unmodifiableList(finishedLines); diff --git a/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java b/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java index 87fbb395e93..f657392efd9 100644 --- a/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java +++ b/src/main/java/gregtech/api/util/oreglob/OreGlobTextFormatting.java @@ -2,8 +2,8 @@ import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Formatting function for OreGlob visualization. @@ -27,5 +27,5 @@ public interface OreGlobTextFormatting { }; @Nullable - TextFormatting getFormat(@Nonnull VisualizationHint hint); + TextFormatting getFormat(@NotNull VisualizationHint hint); } diff --git a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java index 71497bb8892..1a0b928b97e 100644 --- a/src/main/java/gregtech/api/util/world/DummyChunkProvider.java +++ b/src/main/java/gregtech/api/util/world/DummyChunkProvider.java @@ -7,9 +7,8 @@ import io.netty.util.collection.LongObjectHashMap; import io.netty.util.collection.LongObjectMap; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class DummyChunkProvider implements IChunkProvider { @@ -26,7 +25,7 @@ public Chunk getLoadedChunk(int x, int z) { return loadedChunks.get(ChunkPos.asLong(x, z)); } - @Nonnull + @NotNull @Override public Chunk provideChunk(int x, int z) { long chunkKey = ChunkPos.asLong(x, z); @@ -45,7 +44,7 @@ public boolean tick() { return loadedChunks.size() > 0; } - @Nonnull + @NotNull @Override public String makeString() { return "Dummy"; diff --git a/src/main/java/gregtech/api/util/world/DummySaveHandler.java b/src/main/java/gregtech/api/util/world/DummySaveHandler.java index f4090b7b4ec..6798866549b 100644 --- a/src/main/java/gregtech/api/util/world/DummySaveHandler.java +++ b/src/main/java/gregtech/api/util/world/DummySaveHandler.java @@ -12,10 +12,10 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; -import java.io.File; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.io.File; public class DummySaveHandler implements ISaveHandler, IPlayerFileData, IChunkLoader { @@ -28,53 +28,53 @@ public WorldInfo loadWorldInfo() { @Override public void checkSessionLock() {} - @Nonnull + @NotNull @Override - public IChunkLoader getChunkLoader(@Nonnull WorldProvider provider) { + public IChunkLoader getChunkLoader(@NotNull WorldProvider provider) { return this; } - @Nonnull + @NotNull @Override public IPlayerFileData getPlayerNBTManager() { return this; } - @Nonnull + @NotNull @Override public TemplateManager getStructureTemplateManager() { return new TemplateManager("", new DataFixer(0)); } @Override - public void saveWorldInfoWithPlayer(@Nonnull WorldInfo worldInformation, @Nonnull NBTTagCompound tagCompound) {} + public void saveWorldInfoWithPlayer(@NotNull WorldInfo worldInformation, @NotNull NBTTagCompound tagCompound) {} @Override - public void saveWorldInfo(@Nonnull WorldInfo worldInformation) {} + public void saveWorldInfo(@NotNull WorldInfo worldInformation) {} - @Nonnull + @NotNull @Override public File getWorldDirectory() { return null; } - @Nonnull + @NotNull @Override - public File getMapFileFromName(@Nonnull String mapName) { + public File getMapFileFromName(@NotNull String mapName) { return null; } @Nullable @Override - public Chunk loadChunk(@Nonnull World worldIn, int x, int z) { + public Chunk loadChunk(@NotNull World worldIn, int x, int z) { return null; } @Override - public void saveChunk(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} + public void saveChunk(@NotNull World worldIn, @NotNull Chunk chunkIn) {} @Override - public void saveExtraChunkData(@Nonnull World worldIn, @Nonnull Chunk chunkIn) {} + public void saveExtraChunkData(@NotNull World worldIn, @NotNull Chunk chunkIn) {} @Override public void chunkTick() {} @@ -88,15 +88,15 @@ public boolean isChunkGeneratedAt(int x, int z) { } @Override - public void writePlayerData(@Nonnull EntityPlayer player) {} + public void writePlayerData(@NotNull EntityPlayer player) {} @Nullable @Override - public NBTTagCompound readPlayerData(@Nonnull EntityPlayer player) { + public NBTTagCompound readPlayerData(@NotNull EntityPlayer player) { return null; } - @Nonnull + @NotNull @Override public String[] getAvailablePlayerDat() { return new String[0]; diff --git a/src/main/java/gregtech/api/util/world/DummyWorld.java b/src/main/java/gregtech/api/util/world/DummyWorld.java index c59234e5141..858a27138bb 100644 --- a/src/main/java/gregtech/api/util/world/DummyWorld.java +++ b/src/main/java/gregtech/api/util/world/DummyWorld.java @@ -12,8 +12,8 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class DummyWorld extends World { @@ -40,41 +40,41 @@ public DummyWorld() { } @Override - public void notifyNeighborsRespectDebug(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean p_175722_3_) { + public void notifyNeighborsRespectDebug(@NotNull BlockPos pos, @NotNull Block blockType, boolean p_175722_3_) { // NOOP - do not trigger forge events } @Override - public void notifyNeighborsOfStateChange(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean updateObservers) { + public void notifyNeighborsOfStateChange(@NotNull BlockPos pos, @NotNull Block blockType, boolean updateObservers) { // NOOP - do not trigger forge events } @Override - public void notifyNeighborsOfStateExcept(@Nonnull BlockPos pos, @Nonnull Block blockType, - @Nonnull EnumFacing skipSide) { + public void notifyNeighborsOfStateExcept(@NotNull BlockPos pos, @NotNull Block blockType, + @NotNull EnumFacing skipSide) { // NOOP - do not trigger forge events } @Override - public void markAndNotifyBlock(@Nonnull BlockPos pos, @Nullable Chunk chunk, @Nonnull IBlockState iblockstate, - @Nonnull IBlockState newState, int flags) { + public void markAndNotifyBlock(@NotNull BlockPos pos, @Nullable Chunk chunk, @NotNull IBlockState iblockstate, + @NotNull IBlockState newState, int flags) { // NOOP - do not trigger forge events } @Override - public void notifyBlockUpdate(@Nonnull BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState, + public void notifyBlockUpdate(@NotNull BlockPos pos, @NotNull IBlockState oldState, @NotNull IBlockState newState, int flags) {} @Override - public void markBlockRangeForRenderUpdate(@Nonnull BlockPos rangeMin, @Nonnull BlockPos rangeMax) {} + public void markBlockRangeForRenderUpdate(@NotNull BlockPos rangeMin, @NotNull BlockPos rangeMax) {} @Override public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {} @Override - public void updateObservingBlocksAt(@Nonnull BlockPos pos, @Nonnull Block blockType) {} + public void updateObservingBlocksAt(@NotNull BlockPos pos, @NotNull Block blockType) {} - @Nonnull + @NotNull @Override protected IChunkProvider createChunkProvider() { return new DummyChunkProvider(this); @@ -87,7 +87,7 @@ protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { @Override // De-allocated lightUpdateBlockList, default return - public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos) { + public boolean checkLightFor(@NotNull EnumSkyBlock lightType, @NotNull BlockPos pos) { return true; } } diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java index 377838891ef..b858b02c94b 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinHandler.java @@ -17,14 +17,14 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class BedrockFluidVeinHandler { public final static LinkedHashMap veinList = new LinkedHashMap<>(); @@ -53,7 +53,7 @@ public class BedrockFluidVeinHandler { * @return The FluidVeinWorldInfo corresponding with the given chunk */ @Nullable - public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, int chunkX, int chunkZ) { + public static FluidVeinWorldEntry getFluidVeinWorldEntry(@NotNull World world, int chunkX, int chunkZ) { if (world.isRemote) return null; @@ -108,7 +108,7 @@ public static FluidVeinWorldEntry getFluidVeinWorldEntry(@Nonnull World world, i * @param biome The biome type to check * @return The total weight associated with the dimension/biome pair */ - public static int getTotalWeight(@Nonnull WorldProvider provider, Biome biome) { + public static int getTotalWeight(@NotNull WorldProvider provider, Biome biome) { int dim = provider.getDimension(); if (!totalWeightMap.containsKey(dim)) { totalWeightMap.put(dim, new HashMap<>()); @@ -298,8 +298,8 @@ public NBTTagCompound writeToNBT() { return tag; } - @Nonnull - public static FluidVeinWorldEntry readFromNBT(@Nonnull NBTTagCompound tag) { + @NotNull + public static FluidVeinWorldEntry readFromNBT(@NotNull NBTTagCompound tag) { FluidVeinWorldEntry info = new FluidVeinWorldEntry(); info.fluidYield = tag.getInteger("fluidYield"); info.operationsRemaining = tag.getInteger("operationsRemaining"); diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java index 40d1e7539d2..bb5ead588ec 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/BedrockFluidVeinSaveData.java @@ -8,9 +8,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; -import java.util.Map; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Map; public class BedrockFluidVeinSaveData extends WorldSavedData { @@ -47,7 +47,7 @@ public void readFromNBT(NBTTagCompound nbt) { } @Override - public @Nonnull NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) { + public @NotNull NBTTagCompound writeToNBT(@NotNull NBTTagCompound nbt) { NBTTagList oilList = new NBTTagList(); for (Map.Entry e : BedrockFluidVeinHandler.veinCache .entrySet()) { diff --git a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java index 2527ede40bb..f40d9eec657 100644 --- a/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java +++ b/src/main/java/gregtech/api/worldgen/bedrockFluids/ChunkPosDimension.java @@ -3,7 +3,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.ChunkPos; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ChunkPosDimension extends ChunkPos { @@ -31,7 +31,7 @@ public int hashCode() { return super.hashCode() ^ (31 + dimension); } - @Nonnull + @NotNull @Override public String toString() { return "[dim:" + this.dimension + "; " + this.x + ", " + this.z + "]"; diff --git a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java index e7e199e4c9e..7b6378aba7b 100644 --- a/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/BedrockFluidDepositDefinition.java @@ -10,12 +10,11 @@ import net.minecraftforge.fluids.FluidRegistry; import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.Nonnull; - public class BedrockFluidDepositDefinition implements IWorldgenDefinition { private final String depositName; @@ -40,7 +39,7 @@ public BedrockFluidDepositDefinition(String depositName) { } @Override - public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { + public boolean initializeFromConfig(@NotNull JsonObject configRoot) { // the weight value for determining which vein will appear this.weight = configRoot.get("weight").getAsInt(); // the [minimum, maximum) yield of the vein diff --git a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java index b401ae97d34..0bb9fd32ee9 100644 --- a/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/IWorldgenDefinition.java @@ -1,8 +1,7 @@ package gregtech.api.worldgen.config; import com.google.gson.JsonObject; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public interface IWorldgenDefinition { @@ -13,5 +12,5 @@ public interface IWorldgenDefinition { */ String getDepositName(); - boolean initializeFromConfig(@Nonnull JsonObject configRoot); + boolean initializeFromConfig(@NotNull JsonObject configRoot); } diff --git a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java index 7e604d891e6..13a9a86b459 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java +++ b/src/main/java/gregtech/api/worldgen/config/OreConfigUtils.java @@ -18,6 +18,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -25,8 +26,6 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class OreConfigUtils { @SuppressWarnings("deprecation") @@ -58,7 +57,7 @@ public static Map getOreStateMap(String stringDeclaratio return getOreForMaterial(material); } - @Nonnull + @NotNull public static Map getOreForMaterial(Material material) { List oreBlocks = MetaBlocks.ORES.stream() .filter(ore -> ore.material == material) diff --git a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java index efdc8e8f8ee..1792557ecd8 100644 --- a/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java +++ b/src/main/java/gregtech/api/worldgen/config/OreDepositDefinition.java @@ -11,12 +11,11 @@ import net.minecraft.world.biome.Biome; import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.Nonnull; - public class OreDepositDefinition implements IWorldgenDefinition { public static final Function NO_BIOME_INFLUENCE = biome -> 0; @@ -47,7 +46,7 @@ public OreDepositDefinition(String depositName) { } @Override - public boolean initializeFromConfig(@Nonnull JsonObject configRoot) { + public boolean initializeFromConfig(@NotNull JsonObject configRoot) { this.weight = configRoot.get("weight").getAsInt(); this.density = configRoot.get("density").getAsFloat(); if (configRoot.has("name")) { diff --git a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java index 5c324f8598b..2a30f9e1eeb 100644 --- a/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java +++ b/src/main/java/gregtech/api/worldgen/config/WorldGenRegistry.java @@ -29,6 +29,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.NotNull; import java.io.FileNotFoundException; import java.io.IOException; @@ -44,8 +45,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; - public class WorldGenRegistry { public static final WorldGenRegistry INSTANCE = new WorldGenRegistry(); @@ -444,7 +443,7 @@ else if (targetPath.compareTo(extractLockPath) == 0) { } } - private static void removeExistingFiles(Path root, @Nonnull List definitions) { + private static void removeExistingFiles(Path root, @NotNull List definitions) { for (IWorldgenDefinition definition : definitions) { Path filePath = root.resolve(Paths.get(FileUtility.slashToNativeSep(definition.getDepositName()))); @@ -459,8 +458,8 @@ private static void removeExistingFiles(Path root, @Nonnull List void addAddonFiles(Path root, @Nonnull List definitions, - @Nonnull List registeredDefinitions) { + private static void addAddonFiles(Path root, @NotNull List definitions, + @NotNull List registeredDefinitions) { Iterator it = definitions.iterator(); while (it.hasNext()) { T definition = it.next(); diff --git a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java index d541a31b1fd..cdc2df94dc3 100644 --- a/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java +++ b/src/main/java/gregtech/api/worldgen/generator/GTWorldGenCapability.java @@ -16,10 +16,10 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.concurrent.Callable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.concurrent.Callable; @EventBusSubscriber public class GTWorldGenCapability { @@ -86,13 +86,13 @@ private static class WorldGenCapabilityProvider implements ICapabilityProvider, private final GTWorldGenCapability capabilityInstance = new GTWorldGenCapability(); @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { return capability == CAPABILITY; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@NotNull Capability capability, @Nullable EnumFacing facing) { if (capability == CAPABILITY) { return CAPABILITY.cast(capabilityInstance); } diff --git a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java index 795e02e9244..b1e461c7954 100644 --- a/src/main/java/gregtech/asm/GregTechLoadingPlugin.java +++ b/src/main/java/gregtech/asm/GregTechLoadingPlugin.java @@ -7,9 +7,9 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; -import java.util.Map; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Map; @Name("GregTechLoadingPlugin") @MCVersion(ForgeVersion.mcVersion) diff --git a/src/main/java/gregtech/asm/hooks/BlockHooks.java b/src/main/java/gregtech/asm/hooks/BlockHooks.java index 8297a923613..dfc04afa483 100644 --- a/src/main/java/gregtech/asm/hooks/BlockHooks.java +++ b/src/main/java/gregtech/asm/hooks/BlockHooks.java @@ -8,14 +8,14 @@ import net.minecraft.client.renderer.block.model.WeightedBakedModel; import net.minecraft.util.BlockRenderLayer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; @SuppressWarnings("unused") public class BlockHooks { public static boolean ENABLE = true; - public static Boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public static Boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { if (ENABLE) { IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); if (model instanceof WeightedBakedModel) { diff --git a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java index 89cadb67e6e..2f9cd50d88c 100644 --- a/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderChunkHooks.java @@ -6,7 +6,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("unused") public class RenderChunkHooks { diff --git a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java index fa65ac31edd..0eb7b9c708d 100644 --- a/src/main/java/gregtech/asm/hooks/RenderItemHooks.java +++ b/src/main/java/gregtech/asm/hooks/RenderItemHooks.java @@ -7,12 +7,12 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; @SuppressWarnings("unused") public class RenderItemHooks { - public static void renderElectricBar(@Nonnull ItemStack stack, int xPosition, int yPosition) { + public static void renderElectricBar(@NotNull ItemStack stack, int xPosition, int yPosition) { if (stack.getItem() instanceof IGTTool) { ToolChargeBarRenderer.renderBarsTool((IGTTool) stack.getItem(), stack, xPosition, yPosition); } else if (stack.getItem() instanceof MetaItem) { @@ -20,7 +20,7 @@ public static void renderElectricBar(@Nonnull ItemStack stack, int xPosition, in } } - public static void renderLampOverlay(@Nonnull ItemStack stack, int xPosition, int yPosition) { + public static void renderLampOverlay(@NotNull ItemStack stack, int xPosition, int yPosition) { LampItemOverlayRenderer.OverlayType overlayType = LampItemOverlayRenderer.getOverlayType(stack); if (overlayType != LampItemOverlayRenderer.OverlayType.NONE) { LampItemOverlayRenderer.renderOverlay(overlayType, xPosition, yPosition); diff --git a/src/main/java/gregtech/asm/util/ObfMapping.java b/src/main/java/gregtech/asm/util/ObfMapping.java index 194d379ee3a..b788ccb3d24 100644 --- a/src/main/java/gregtech/asm/util/ObfMapping.java +++ b/src/main/java/gregtech/asm/util/ObfMapping.java @@ -8,6 +8,7 @@ import com.google.common.base.Objects; import com.google.common.io.LineProcessor; import com.google.common.io.Resources; +import org.jetbrains.annotations.NotNull; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; @@ -22,8 +23,6 @@ import java.util.Map; import java.util.Map.Entry; -import javax.annotation.Nonnull; - /** * @apiNote codechicken.asm.ObfMapping */ @@ -354,7 +353,7 @@ public String mapFieldName(String owner, String name, String desc) { } @Override - public boolean processLine(@Nonnull String line) { + public boolean processLine(@NotNull String line) { int i = line.indexOf(','); String srg = line.substring(0, i); int i2 = i + 1; diff --git a/src/main/java/gregtech/client/ClientProxy.java b/src/main/java/gregtech/client/ClientProxy.java index 5da0e9f243b..0210563b18c 100644 --- a/src/main/java/gregtech/client/ClientProxy.java +++ b/src/main/java/gregtech/client/ClientProxy.java @@ -56,14 +56,13 @@ import net.minecraftforge.oredict.OreDictionary; import codechicken.lib.texture.TextureUtils; +import org.jetbrains.annotations.NotNull; import paulscode.sound.SoundSystemConfig; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import javax.annotation.Nonnull; - @SideOnly(Side.CLIENT) @Mod.EventBusSubscriber(Side.CLIENT) public class ClientProxy extends CommonProxy { @@ -121,7 +120,7 @@ public static void registerModels(ModelRegistryEvent event) { } @SubscribeEvent - public static void addMaterialFormulaHandler(@Nonnull ItemTooltipEvent event) { + public static void addMaterialFormulaHandler(@NotNull ItemTooltipEvent event) { ItemStack itemStack = event.getItemStack(); if (itemStack.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) itemStack.getItem()).getBlock(); diff --git a/src/main/java/gregtech/client/event/ClientEventHandler.java b/src/main/java/gregtech/client/event/ClientEventHandler.java index f8c3b3467ad..c83851d8e34 100644 --- a/src/main/java/gregtech/client/event/ClientEventHandler.java +++ b/src/main/java/gregtech/client/event/ClientEventHandler.java @@ -34,12 +34,11 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.UUID; -import javax.annotation.Nonnull; - import static gregtech.api.GTValues.CLIENT_TIME; @SideOnly(Side.CLIENT) @@ -137,7 +136,7 @@ public static void onRenderArmorHUD(TickEvent.RenderTickEvent event) { } } - private static void renderHUDMetaArmor(@Nonnull ItemStack stack) { + private static void renderHUDMetaArmor(@NotNull ItemStack stack) { if (stack.getItem() instanceof ArmorMetaItem) { ArmorMetaItem.ArmorMetaValueItem valueItem = ((ArmorMetaItem) stack.getItem()).getItem(stack); if (valueItem == null) return; @@ -147,7 +146,7 @@ private static void renderHUDMetaArmor(@Nonnull ItemStack stack) { } } - private static void renderHUDMetaItem(@Nonnull ItemStack stack) { + private static void renderHUDMetaItem(@NotNull ItemStack stack) { if (stack.getItem() instanceof MetaItem) { MetaItem.MetaValueItem valueItem = ((MetaItem) stack.getItem()).getItem(stack); if (valueItem == null) return; diff --git a/src/main/java/gregtech/client/event/FluidVisualHandler.java b/src/main/java/gregtech/client/event/FluidVisualHandler.java index 01d398c1186..839ab3dc5bb 100644 --- a/src/main/java/gregtech/client/event/FluidVisualHandler.java +++ b/src/main/java/gregtech/client/event/FluidVisualHandler.java @@ -26,7 +26,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Handles the rendering when a player is submerged in a GT fluid block @@ -46,7 +46,7 @@ public class FluidVisualHandler { .gregtechId("textures/blocks/fluids/submerged_fluid_overlay.png"); @SubscribeEvent - public static void onFOVModifier(@Nonnull EntityViewRenderEvent.FOVModifier event) { + public static void onFOVModifier(@NotNull EntityViewRenderEvent.FOVModifier event) { if (event.getState().getBlock() instanceof GTFluidBlock && ((GTFluidBlock) event.getState().getBlock()).isSticky()) { event.setFOV(event.getFOV() * 60.0F / 70.0F); @@ -54,7 +54,7 @@ public static void onFOVModifier(@Nonnull EntityViewRenderEvent.FOVModifier even } @SubscribeEvent - public static void onBlockOverlayRender(@Nonnull RenderBlockOverlayEvent event) { + public static void onBlockOverlayRender(@NotNull RenderBlockOverlayEvent event) { if (event.getOverlayType() != RenderBlockOverlayEvent.OverlayType.WATER) return; final EntityPlayer player = event.getPlayer(); @@ -99,7 +99,7 @@ public static void onBlockOverlayRender(@Nonnull RenderBlockOverlayEvent event) } @SubscribeEvent - public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { + public static void onFogColor(@NotNull EntityViewRenderEvent.FogColors event) { if (!(event.getState().getBlock() instanceof GTFluidBlock fluidBlock)) return; int color = fluidBlock.getFluid().getColor(); @@ -199,7 +199,7 @@ public static void onFogColor(@Nonnull EntityViewRenderEvent.FogColors event) { } @SubscribeEvent - public static void onFogDensity(@Nonnull EntityViewRenderEvent.FogDensity event) { + public static void onFogDensity(@NotNull EntityViewRenderEvent.FogDensity event) { if (!(event.getState().getBlock() instanceof GTFluidBlock)) return; final EntityRenderer renderer = event.getRenderer(); diff --git a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java index 99e2a367fde..8a17399f9a0 100644 --- a/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java +++ b/src/main/java/gregtech/client/model/ActiveVariantBlockBakedModel.java @@ -24,6 +24,8 @@ import net.minecraftforge.fml.relauncher.Side; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; @@ -31,9 +33,6 @@ import java.util.Map; import java.util.function.BooleanSupplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class ActiveVariantBlockBakedModel implements IBakedModel { @@ -79,7 +78,7 @@ protected IBakedModel getModel(boolean active) { .getModel(active ? activeModelLocation : inactiveModelLocation); } - @Nonnull + @NotNull @Override public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { if (state == null) return Collections.emptyList(); @@ -126,7 +125,7 @@ public boolean isAmbientOcclusion() { } @Override - public boolean isAmbientOcclusion(@Nonnull IBlockState state) { + public boolean isAmbientOcclusion(@NotNull IBlockState state) { return getModel(state).isAmbientOcclusion(); } @@ -140,13 +139,13 @@ public boolean isBuiltInRenderer() { return false; } - @Nonnull + @NotNull @Override public TextureAtlasSprite getParticleTexture() { return getModel(false).getParticleTexture(); } - @Nonnull + @NotNull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; diff --git a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java index d8f61654659..22f3fee3cab 100644 --- a/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java +++ b/src/main/java/gregtech/client/model/BorderlessLampBakedModel.java @@ -9,11 +9,11 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - public class BorderlessLampBakedModel extends LampBakedModel { // for each 6 side plus "no face" quads diff --git a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java index 4f00143fdd3..4c3b05c42aa 100644 --- a/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java +++ b/src/main/java/gregtech/client/model/EmissiveOreBakedModel.java @@ -12,12 +12,12 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.MinecraftForgeClient; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; - public class EmissiveOreBakedModel extends OreBakedModel { @SuppressWarnings("unchecked") diff --git a/src/main/java/gregtech/client/model/OreBakedModel.java b/src/main/java/gregtech/client/model/OreBakedModel.java index 20573332ba1..81019852a40 100644 --- a/src/main/java/gregtech/client/model/OreBakedModel.java +++ b/src/main/java/gregtech/client/model/OreBakedModel.java @@ -21,14 +21,14 @@ import net.minecraftforge.fml.relauncher.Side; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import javax.annotation.Nullable; - @Mod.EventBusSubscriber(modid = GTValues.MODID, value = Side.CLIENT) public class OreBakedModel implements IBakedModel { @@ -83,24 +83,27 @@ public boolean isBuiltInRenderer() { return false; } + @NotNull @Override public TextureAtlasSprite getParticleTexture() { return getBaseModel().getParticleTexture(); } + @NotNull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } @SuppressWarnings("deprecation") + @NotNull @Override public ItemCameraTransforms getItemCameraTransforms() { return getBaseModel().getItemCameraTransforms(); } @Override - public boolean isAmbientOcclusion(IBlockState state) { + public boolean isAmbientOcclusion(@NotNull IBlockState state) { return getBaseModel().isAmbientOcclusion(state); } diff --git a/src/main/java/gregtech/client/model/SimpleStateMapper.java b/src/main/java/gregtech/client/model/SimpleStateMapper.java index c46e8774d4e..4a9e9e97c1e 100644 --- a/src/main/java/gregtech/client/model/SimpleStateMapper.java +++ b/src/main/java/gregtech/client/model/SimpleStateMapper.java @@ -8,11 +8,10 @@ import net.minecraftforge.fml.relauncher.SideOnly; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Map; -import javax.annotation.Nonnull; - @SideOnly(Side.CLIENT) public class SimpleStateMapper implements IStateMapper { @@ -23,7 +22,7 @@ public SimpleStateMapper(ModelResourceLocation mrl) { } @Override - @Nonnull + @NotNull public Map putStateModelLocations(Block block) { Map map = new Object2ObjectOpenHashMap<>( block.getBlockState().getValidStates().size()); diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java index 9221007b552..e575136e273 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTexture.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTexture.java @@ -15,15 +15,14 @@ import com.google.common.collect.ListMultimap; import com.google.common.collect.MultimapBuilder; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.util.vector.Vector; import org.lwjgl.util.vector.Vector2f; import org.lwjgl.util.vector.Vector3f; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @SideOnly(Side.CLIENT) public class CustomTexture { @@ -133,7 +132,7 @@ private static T[] fromData(List data, int size) { return (T[]) ret; } - @Nonnull + @NotNull @Override public VertexFormat getVertexFormat() { return vertexFormat; diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java index 4549eec1590..26974bdd1ae 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureBakedModel.java @@ -17,6 +17,8 @@ import com.google.common.cache.CacheBuilder; import com.google.common.collect.*; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.concurrent.ExecutionException; @@ -24,8 +26,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import javax.vecmath.Matrix4f; @SideOnly(Side.CLIENT) @@ -129,7 +129,7 @@ protected CustomTextureBakedModel createModel(@Nullable IBlockState state, Custo } @Override - @Nonnull + @NotNull public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { IBakedModel parent = getParent(rand); @@ -182,20 +182,20 @@ public boolean isBuiltInRenderer() { } @Override - @Nonnull + @NotNull public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); } @Override - @Nonnull + @NotNull public ItemOverrideList getOverrides() { return parent.getOverrides(); } @Override - @Nonnull - public Pair handlePerspective(@Nonnull ItemCameraTransforms.TransformType cameraTransformType) { + @NotNull + public Pair handlePerspective(@NotNull ItemCameraTransforms.TransformType cameraTransformType) { return parent.handlePerspective(cameraTransformType); } diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java index 64048153d08..3d168c6fa58 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModel.java @@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.invoke.MethodHandle; @@ -28,9 +29,6 @@ import java.util.*; import java.util.function.Function; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; - @SideOnly(Side.CLIENT) public class CustomTextureModel implements IModel { @@ -61,10 +59,9 @@ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { } @Override - @ParametersAreNonnullByDefault - @Nonnull - public IBakedModel bake(IModelState state, VertexFormat format, - Function bakedTextureGetter) { + @NotNull + public IBakedModel bake(@NotNull IModelState state, @NotNull VertexFormat format, + @NotNull Function bakedTextureGetter) { IBakedModel parent = vanillaModel.bake(state, format, rl -> { TextureAtlasSprite sprite = bakedTextureGetter.apply(rl); MetadataSectionCTM meta = null; @@ -83,37 +80,37 @@ public IBakedModel bake(IModelState state, VertexFormat format, } @Override - @Nonnull + @NotNull public Collection getDependencies() { return Collections.emptySet(); } @Override - @Nonnull + @NotNull public Collection getTextures() { return textureDependencies; } @Override - @Nonnull + @NotNull public IModelState getDefaultState() { return getVanillaParent().getDefaultState(); } @Override - @Nonnull - public Optional getClip(@Nonnull String name) { + @NotNull + public Optional getClip(@NotNull String name) { return getVanillaParent().getClip(name); } @Override - @Nonnull - public IModel process(@Nonnull ImmutableMap customData) { + @NotNull + public IModel process(@NotNull ImmutableMap customData) { return deepCopyOrMissing(getVanillaParent().process(customData), null, null); } @Override - @Nonnull + @NotNull public IModel smoothLighting(boolean value) { if (modelInfo.isAmbientOcclusion() != value) { return deepCopyOrMissing(getVanillaParent().smoothLighting(value), value, null); @@ -126,7 +123,7 @@ public CustomTexture getTexture(String iconName) { } @Override - @Nonnull + @NotNull public IModel gui3d(boolean value) { if (modelInfo.isGui3d() != value) { return deepCopyOrMissing(getVanillaParent().gui3d(value), null, value); @@ -135,7 +132,7 @@ public IModel gui3d(boolean value) { } @Override - @Nonnull + @NotNull public IModel uvlock(boolean value) { if (uvLock == null || uvLock != value) { IModel newParent = getVanillaParent().uvlock(value); @@ -151,8 +148,8 @@ public IModel uvlock(boolean value) { } @Override - @Nonnull - public IModel retexture(@Nonnull ImmutableMap textures) { + @NotNull + public IModel retexture(@NotNull ImmutableMap textures) { try { CustomTextureModel ret = deepCopy(getVanillaParent().retexture(textures), null, null); ret.modelInfo.textures.putAll(textures); @@ -175,7 +172,7 @@ public IModel retexture(@Nonnull ImmutableMap textures) { } @Override - @Nonnull + @NotNull public Optional asVanillaModel() { return Optional.ofNullable(_asVanillaModel) .>map(mh -> { diff --git a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java index 170e8b02802..6f4a1581804 100644 --- a/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java +++ b/src/main/java/gregtech/client/model/customtexture/CustomTextureModelHandler.java @@ -21,6 +21,8 @@ import com.google.common.collect.Sets; import com.google.gson.JsonParseException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.FileNotFoundException; import java.io.IOException; @@ -28,9 +30,6 @@ import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Copyright CTM. */ @@ -67,7 +66,7 @@ public void onModelBake(ModelBakeEvent event) { } } - @Nonnull + @NotNull private static IBakedModel wrap(IModel model, IBakedModel object) { CustomTextureModel ctm = new CustomTextureModel(null, model); ctm.bake(TRSRTransformation.identity(), DefaultVertexFormats.ITEM, @@ -110,7 +109,7 @@ public static MetadataSectionCTM getMetadata(TextureAtlasSprite sprite) throws I } @Override - public void onResourceManagerReload(IResourceManager resourceManager) { + public void onResourceManagerReload(@NotNull IResourceManager resourceManager) { METADATA_CACHE.clear(); CustomTextureBakedModel.MODEL_CACHE.cleanUp(); wrappedModels.clear(); diff --git a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java index c903cc12401..aeaabb25c6c 100644 --- a/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java +++ b/src/main/java/gregtech/client/model/customtexture/MetadataSectionCTM.java @@ -7,12 +7,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.google.gson.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.lang.reflect.Type; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @SideOnly(Side.CLIENT) public class MetadataSectionCTM implements IMetadataSection { @@ -79,7 +78,7 @@ public static class Serializer implements IMetadataSectionSerializer getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { return Collections.emptyList(); @@ -119,21 +119,21 @@ public boolean isBuiltInRenderer() { return true; } - @Nonnull + @NotNull @Override public TextureAtlasSprite getParticleTexture() { return TextureUtils.getBlockTexture(particleTexture); } - @Nonnull + @NotNull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } - @Nonnull + @NotNull @Override - public Pair handlePerspective(@Nonnull TransformType cameraTransformType) { + public Pair handlePerspective(@NotNull TransformType cameraTransformType) { CCRenderItem.notifyTransform(cameraTransformType); return PerspectiveMapWrapper.handlePerspective(this, TransformUtils.DEFAULT_BLOCK, cameraTransformType); } diff --git a/src/main/java/gregtech/client/particle/GTBloomParticle.java b/src/main/java/gregtech/client/particle/GTBloomParticle.java index e674d796a21..da807b47be4 100644 --- a/src/main/java/gregtech/client/particle/GTBloomParticle.java +++ b/src/main/java/gregtech/client/particle/GTBloomParticle.java @@ -5,8 +5,8 @@ import gregtech.client.utils.BloomEffectUtil; import gregtech.client.utils.IBloomEffect; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public abstract class GTBloomParticle extends GTParticle implements IBloomEffect { @@ -21,7 +21,7 @@ public GTBloomParticle(double posX, double posY, double posZ) { @Nullable protected abstract IRenderSetup getBloomRenderSetup(); - @Nonnull + @NotNull protected abstract BloomType getBloomType(); @Override diff --git a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java index a8ef7460fff..d57f40af1df 100644 --- a/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java +++ b/src/main/java/gregtech/client/particle/GTLaserBeamParticle.java @@ -16,9 +16,8 @@ import net.minecraft.util.math.Vec3d; import codechicken.lib.vec.Vector3; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class GTLaserBeamParticle extends GTParticle { @@ -35,7 +34,7 @@ public class GTLaserBeamParticle extends GTParticle { private float emit; private boolean doubleVertical; - public GTLaserBeamParticle(@Nullable MetaTileEntity mte, @Nonnull Vector3 startPos, @Nonnull Vector3 endPos) { + public GTLaserBeamParticle(@Nullable MetaTileEntity mte, @NotNull Vector3 startPos, @NotNull Vector3 endPos) { super(startPos.x, startPos.y, startPos.z); this.mte = mte; this.direction = endPos.copy().subtract(startPos); @@ -43,7 +42,7 @@ public GTLaserBeamParticle(@Nullable MetaTileEntity mte, @Nonnull Vector3 startP } @Override - public boolean shouldRender(@Nonnull EffectRenderContext context) { + public boolean shouldRender(@NotNull EffectRenderContext context) { double renderRange = getSquaredRenderRange(); if (renderRange < 0) return true; Vec3d eyePos = context.renderViewEntity().getPositionEyes(context.partialTicks()); @@ -71,12 +70,12 @@ public GTLaserBeamParticle setHead(@Nullable ResourceLocation head) { return this; } - public GTLaserBeamParticle setStartPos(@Nonnull Vector3 startPos) { + public GTLaserBeamParticle setStartPos(@NotNull Vector3 startPos) { this.direction.add(posX, posY, posZ).subtract(startPos); return this; } - public GTLaserBeamParticle setEndPos(@Nonnull Vector3 endPos) { + public GTLaserBeamParticle setEndPos(@NotNull Vector3 endPos) { this.direction = endPos.copy().subtract(posX, posY, posZ); return this; } @@ -138,7 +137,7 @@ public void onUpdate() { } @Override - public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + public void renderParticle(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) { GlStateManager.translate(posX - context.cameraX(), posY - context.cameraY(), posZ - context.cameraZ()); Vector3 cameraDirection = null; @@ -204,7 +203,7 @@ public String toString() { float lastBrightnessY; @Override - public void preDraw(@Nonnull BufferBuilder buffer) { + public void preDraw(@NotNull BufferBuilder buffer) { GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); lastBrightnessX = OpenGlHelper.lastBrightnessX; lastBrightnessY = OpenGlHelper.lastBrightnessY; @@ -214,7 +213,7 @@ public void preDraw(@Nonnull BufferBuilder buffer) { } @Override - public void postDraw(@Nonnull BufferBuilder buffer) { + public void postDraw(@NotNull BufferBuilder buffer) { GlStateManager.enableCull(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); diff --git a/src/main/java/gregtech/client/particle/GTNameTagParticle.java b/src/main/java/gregtech/client/particle/GTNameTagParticle.java index 2c4e5251f7c..5f219f5d5dc 100644 --- a/src/main/java/gregtech/client/particle/GTNameTagParticle.java +++ b/src/main/java/gregtech/client/particle/GTNameTagParticle.java @@ -10,15 +10,15 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; -import java.util.Objects; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Objects; public class GTNameTagParticle extends GTParticle { private final MetaTileEntityHolder metaTileEntityHolder; - public GTNameTagParticle(@Nonnull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, + public GTNameTagParticle(@NotNull MetaTileEntityHolder metaTileEntityHolder, double posX, double posY, double posZ) { super(posX, posY, posZ); this.metaTileEntityHolder = Objects.requireNonNull(metaTileEntityHolder); @@ -35,7 +35,7 @@ public void onUpdate() { } @Override - public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + public void renderParticle(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) { String name = this.metaTileEntityHolder.getName(); if (name.isEmpty()) return; diff --git a/src/main/java/gregtech/client/particle/GTOverheatParticle.java b/src/main/java/gregtech/client/particle/GTOverheatParticle.java index 2eb0f55aa9a..d017af7b3a0 100644 --- a/src/main/java/gregtech/client/particle/GTOverheatParticle.java +++ b/src/main/java/gregtech/client/particle/GTOverheatParticle.java @@ -21,13 +21,12 @@ import net.minecraftforge.fml.relauncher.SideOnly; import codechicken.lib.vec.Cuboid6; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @author brachy84 */ @@ -156,7 +155,7 @@ public static int getBlackBodyColor(int temperature) { protected float alpha = 0; protected int color = blackBodyColors[0]; - public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @Nonnull List pipeBoxes, + public GTOverheatParticle(@NotNull TileEntityCable tileEntity, int meltTemp, @NotNull List pipeBoxes, boolean insulated) { super(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()); this.tileEntity = tileEntity; @@ -166,7 +165,7 @@ public GTOverheatParticle(@Nonnull TileEntityCable tileEntity, int meltTemp, @No this.insulated = insulated; } - public void updatePipeBoxes(@Nonnull List pipeBoxes) { + public void updatePipeBoxes(@NotNull List pipeBoxes) { this.pipeBoxes = pipeBoxes; for (Cuboid6 cuboid : this.pipeBoxes) { cuboid.expand(0.001); @@ -231,7 +230,7 @@ protected IRenderSetup getBloomRenderSetup() { return SETUP; } - @Nonnull + @NotNull @Override protected BloomType getBloomType() { ConfigHolder.HeatEffectBloom heatEffectBloom = ConfigHolder.client.shader.heatEffectBloom; @@ -239,7 +238,7 @@ protected BloomType getBloomType() { } @Override - public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + public void renderBloomEffect(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) { float red = ((color >> 16) & 0xFF) / 255f; float green = ((color >> 8) & 0xFF) / 255f; float blue = (color & 0xFF) / 255f; @@ -251,7 +250,7 @@ public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRend } @Override - public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + public boolean shouldRenderBloomEffect(@NotNull EffectRenderContext context) { return !this.insulated; } @@ -262,7 +261,7 @@ public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { @Override @SideOnly(Side.CLIENT) - public void preDraw(@Nonnull BufferBuilder buffer) { + public void preDraw(@NotNull BufferBuilder buffer) { BloomEffect.strength = (float) ConfigHolder.client.shader.heatEffectBloom.strength; BloomEffect.baseBrightness = (float) ConfigHolder.client.shader.heatEffectBloom.baseBrightness; BloomEffect.highBrightnessThreshold = (float) ConfigHolder.client.shader.heatEffectBloom.highBrightnessThreshold; @@ -280,7 +279,7 @@ public void preDraw(@Nonnull BufferBuilder buffer) { @Override @SideOnly(Side.CLIENT) - public void postDraw(@Nonnull BufferBuilder buffer) { + public void postDraw(@NotNull BufferBuilder buffer) { buffer.setTranslation(0, 0, 0); Tessellator.getInstance().draw(); GlStateManager.enableTexture2D(); diff --git a/src/main/java/gregtech/client/particle/GTParticle.java b/src/main/java/gregtech/client/particle/GTParticle.java index 031daaaa7ac..a1c8d0377f0 100644 --- a/src/main/java/gregtech/client/particle/GTParticle.java +++ b/src/main/java/gregtech/client/particle/GTParticle.java @@ -7,8 +7,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A custom particle implementation with framework for more advanced rendering capabilities. @@ -34,7 +34,7 @@ protected GTParticle(double posX, double posY, double posZ) { this.posZ = posZ; } - public boolean shouldRender(@Nonnull EffectRenderContext context) { + public boolean shouldRender(@NotNull EffectRenderContext context) { if (squaredRenderRange < 0) return true; return context.renderViewEntity().getPositionEyes(context.partialTicks()) .squareDistanceTo(posX, posY, posZ) <= squaredRenderRange; @@ -112,7 +112,7 @@ protected void onExpired() {} * @param buffer buffer builder * @param context render context */ - public void renderParticle(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) {} + public void renderParticle(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) {} /** * @return Render setup for this particle, if exists diff --git a/src/main/java/gregtech/client/particle/GTParticleManager.java b/src/main/java/gregtech/client/particle/GTParticleManager.java index cda4ef65828..d9e6b127f1b 100644 --- a/src/main/java/gregtech/client/particle/GTParticleManager.java +++ b/src/main/java/gregtech/client/particle/GTParticleManager.java @@ -19,13 +19,12 @@ import net.minecraftforge.fml.relauncher.SideOnly; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.*; -import javax.annotation.Nonnull; - /** * Singleton class responsible for managing, updating and rendering {@link GTParticle} instances. */ @@ -42,7 +41,7 @@ public class GTParticleManager { private final List newParticleQueue = new ArrayList<>(); - public void addEffect(@Nonnull GTParticle particles) { + public void addEffect(@NotNull GTParticle particles) { newParticleQueue.add(particles); } @@ -116,7 +115,7 @@ public void clearAllEffects(boolean cleanNewQueue) { depthDisabledParticles.clear(); } - public void renderParticles(@Nonnull Entity renderViewEntity, float partialTicks) { + public void renderParticles(@NotNull Entity renderViewEntity, float partialTicks) { if (depthEnabledParticles.isEmpty() && depthDisabledParticles.isEmpty()) return; EffectRenderContext instance = EffectRenderContext.getInstance().update(renderViewEntity, partialTicks); @@ -141,8 +140,8 @@ public void renderParticles(@Nonnull Entity renderViewEntity, float partialTicks GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); } - private static void renderGlParticlesInLayer(@Nonnull Map<@Nullable IRenderSetup, ArrayDeque> renderQueue, - @Nonnull EffectRenderContext context) { + private static void renderGlParticlesInLayer(@NotNull Map<@Nullable IRenderSetup, ArrayDeque> renderQueue, + @NotNull EffectRenderContext context) { for (var e : renderQueue.entrySet()) { @Nullable IRenderSetup handler = e.getKey(); diff --git a/src/main/java/gregtech/client/renderer/ICubeRenderer.java b/src/main/java/gregtech/client/renderer/ICubeRenderer.java index becc55f7f72..5fb0a866a42 100644 --- a/src/main/java/gregtech/client/renderer/ICubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/ICubeRenderer.java @@ -14,9 +14,8 @@ import codechicken.lib.texture.TextureUtils.IIconRegister; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface ICubeRenderer extends IIconRegister { @@ -73,7 +72,7 @@ default void renderOrientedState(CCRenderState renderState, Matrix4 translation, @Nullable @SideOnly(Side.CLIENT) - static TextureAtlasSprite getResource(@Nonnull TextureMap textureMap, @Nonnull String modid, @Nonnull String name) { + static TextureAtlasSprite getResource(@NotNull TextureMap textureMap, @NotNull String modid, @NotNull String name) { if (ResourceHelper.doResourcepacksHaveTexture(modid, name, true)) { return textureMap.registerSprite(new ResourceLocation(modid, name)); } diff --git a/src/main/java/gregtech/client/renderer/IRenderSetup.java b/src/main/java/gregtech/client/renderer/IRenderSetup.java index 48e43d7b142..98eeb07c61a 100644 --- a/src/main/java/gregtech/client/renderer/IRenderSetup.java +++ b/src/main/java/gregtech/client/renderer/IRenderSetup.java @@ -4,7 +4,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** *

@@ -24,12 +24,12 @@ public interface IRenderSetup { * * @param buffer Buffer builder */ - void preDraw(@Nonnull BufferBuilder buffer); + void preDraw(@NotNull BufferBuilder buffer); /** * Run any post render gl code here. * * @param buffer Buffer builder */ - void postDraw(@Nonnull BufferBuilder buffer); + void postDraw(@NotNull BufferBuilder buffer); } diff --git a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java index c6052d576cd..ddcfbaca5f6 100644 --- a/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/DynamiteRenderer.java @@ -10,7 +10,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; @SideOnly(Side.CLIENT) public class DynamiteRenderer extends RenderSnowball { @@ -19,8 +19,8 @@ public DynamiteRenderer(RenderManager renderManagerIn, RenderItem itemRendererIn super(renderManagerIn, MetaItems.DYNAMITE.getMetaItem(), itemRendererIn); } - @Nonnull - public ItemStack getStackToRender(@Nonnull DynamiteEntity entityIn) { + @NotNull + public ItemStack getStackToRender(@NotNull DynamiteEntity entityIn) { return MetaItems.DYNAMITE.getStackForm(); } } diff --git a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java index 98cf6433124..c22b454748a 100644 --- a/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java +++ b/src/main/java/gregtech/client/renderer/handler/MetaTileEntityTESR.java @@ -19,15 +19,15 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL11; -import javax.annotation.Nonnull; - @SideOnly(Side.CLIENT) public class MetaTileEntityTESR extends TileEntitySpecialRenderer { @Override - public void render(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, + public void render(@NotNull MetaTileEntityHolder te, double x, double y, double z, float partialTicks, + int destroyStage, float alpha) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); @@ -87,7 +87,7 @@ public void render(MetaTileEntityHolder te, double x, double y, double z, float @Override public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, - int destroyStage, float alpha, @Nonnull BufferBuilder buffer) { + int destroyStage, float alpha, @NotNull BufferBuilder buffer) { MetaTileEntity metaTileEntity = te.getMetaTileEntity(); if (metaTileEntity instanceof IFastRenderMetaTileEntity) { CCRenderState renderState = CCRenderState.instance(); @@ -114,7 +114,7 @@ public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, do } @Override - public boolean isGlobalRenderer(@Nonnull MetaTileEntityHolder te) { + public boolean isGlobalRenderer(@NotNull MetaTileEntityHolder te) { if (te.getMetaTileEntity() instanceof IFastRenderMetaTileEntity) { return ((IFastRenderMetaTileEntity) te.getMetaTileEntity()).isGlobalRenderer(); } diff --git a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java index aa2ce4c40e2..f94f2a53398 100644 --- a/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java +++ b/src/main/java/gregtech/client/renderer/handler/PortalRenderer.java @@ -11,7 +11,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; @SideOnly(Side.CLIENT) public class PortalRenderer extends Render { @@ -25,12 +26,13 @@ public PortalRenderer(RenderManager renderManagerIn) { @Nullable @Override - protected ResourceLocation getEntityTexture(PortalEntity entity) { + protected ResourceLocation getEntityTexture(@NotNull PortalEntity entity) { return texture; } @Override - public void doRender(PortalEntity entity, double x, double y, double z, float entityYaw, float partialTicks) { + public void doRender(@NotNull PortalEntity entity, double x, double y, double z, float entityYaw, + float partialTicks) { GlStateManager.pushMatrix(); PortalRenderer.setupTranslation(x, y, z); this.bindEntityTexture(entity); diff --git a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java index 1f111d2c0a2..17edbcd501d 100644 --- a/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/CableRenderer.java @@ -17,8 +17,7 @@ import codechicken.lib.texture.TextureUtils; import codechicken.lib.vec.uv.IconTransformation; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class CableRenderer extends PipeRenderer { diff --git a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java index b43c6f5755f..f729afb3b57 100644 --- a/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/FluidPipeRenderer.java @@ -13,11 +13,10 @@ import net.minecraft.client.renderer.texture.TextureMap; import codechicken.lib.vec.uv.IconTransformation; +import org.jetbrains.annotations.Nullable; import java.util.EnumMap; -import javax.annotation.Nullable; - public class FluidPipeRenderer extends PipeRenderer { public static final FluidPipeRenderer INSTANCE = new FluidPipeRenderer(); diff --git a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java index 90961bb1bfe..e6d7604b3b4 100644 --- a/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/ItemPipeRenderer.java @@ -12,11 +12,10 @@ import net.minecraft.client.renderer.texture.TextureMap; import codechicken.lib.vec.uv.IconTransformation; +import org.jetbrains.annotations.Nullable; import java.util.EnumMap; -import javax.annotation.Nullable; - public class ItemPipeRenderer extends PipeRenderer { public static final ItemPipeRenderer INSTANCE = new ItemPipeRenderer(); diff --git a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java index dd4513708cf..ab63a9560a4 100644 --- a/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/OpticalPipeRenderer.java @@ -14,11 +14,10 @@ import net.minecraft.client.renderer.texture.TextureMap; import codechicken.lib.vec.uv.IconTransformation; +import org.jetbrains.annotations.Nullable; import java.util.EnumMap; -import javax.annotation.Nullable; - public final class OpticalPipeRenderer extends PipeRenderer { public static final OpticalPipeRenderer INSTANCE = new OpticalPipeRenderer(); diff --git a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java index d7ba5027c3a..841d230d0f5 100644 --- a/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java +++ b/src/main/java/gregtech/client/renderer/pipe/PipeRenderer.java @@ -59,14 +59,13 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; -import javax.annotation.Nullable; - @SideOnly(Side.CLIENT) public abstract class PipeRenderer implements ICCBlockRenderer, IItemRenderer { diff --git a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java index 3c5f4ab4163..79515bd93c2 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/AlignedOrientedOverlayRenderer.java @@ -4,14 +4,13 @@ import codechicken.lib.vec.Matrix4; import codechicken.lib.vec.Rotation; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class AlignedOrientedOverlayRenderer extends OrientedOverlayRenderer { private static final Rotation DEF_ROT = new Rotation(0, 0, 0, 0); - public AlignedOrientedOverlayRenderer(@Nonnull String basePath) { + public AlignedOrientedOverlayRenderer(@NotNull String basePath) { super(basePath); } diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java index ab6407baa06..768933b0da9 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOverlayRenderer.java @@ -21,8 +21,7 @@ import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class SimpleOverlayRenderer implements ICubeRenderer { diff --git a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java index 2ba0c084fb4..59b42bc5dcf 100644 --- a/src/main/java/gregtech/client/shader/postprocessing/BloomType.java +++ b/src/main/java/gregtech/client/shader/postprocessing/BloomType.java @@ -1,6 +1,6 @@ package gregtech.client.shader.postprocessing; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum BloomType { @@ -30,7 +30,7 @@ public int getValue() { }; } - @Nonnull + @NotNull public static BloomType fromValue(int value) { return switch (value) { case 0 -> GAUSSIAN; diff --git a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java index be6ba9e0ce5..8d4021cf19e 100644 --- a/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java +++ b/src/main/java/gregtech/client/utils/AdvCCRSConsumer.java @@ -11,8 +11,7 @@ import codechicken.lib.colour.Colour; import codechicken.lib.render.CCRenderState; import codechicken.lib.vec.Matrix4; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; @SideOnly(Side.CLIENT) public class AdvCCRSConsumer implements IVertexConsumer { @@ -24,19 +23,19 @@ public AdvCCRSConsumer(CCRenderState ccrs) { this.ccrs = ccrs; } - @Nonnull + @NotNull @Override public VertexFormat getVertexFormat() { return ccrs.getVertexFormat(); } @Override - public void setTexture(@Nonnull TextureAtlasSprite texture) { + public void setTexture(@NotNull TextureAtlasSprite texture) { ccrs.sprite = texture; } @Override - public void put(int e, @Nonnull float... data) { + public void put(int e, float @NotNull... data) { VertexFormat format = getVertexFormat(); VertexFormatElement fmte = format.getElement(e); @@ -75,7 +74,7 @@ public void setTranslation(Matrix4 translation) { public void setQuadTint(int tint) {} @Override - public void setQuadOrientation(@Nonnull EnumFacing orientation) {} + public void setQuadOrientation(@NotNull EnumFacing orientation) {} @Override public void setApplyDiffuseLighting(boolean diffuse) {} diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index d893799d2c5..1b9df83803d 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -24,7 +24,10 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.CheckReturnValue; import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.lang.reflect.Field; @@ -34,10 +37,6 @@ import java.util.Objects; import java.util.function.Consumer; -import javax.annotation.CheckReturnValue; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @SideOnly(Side.CLIENT) public class BloomEffectUtil { @@ -60,7 +59,7 @@ public class BloomEffectUtil { /** * @return {@link BlockRenderLayer} instance for the bloom render layer. */ - @Nonnull + @NotNull public static BlockRenderLayer getBloomLayer() { return Objects.requireNonNull(bloom, "Bloom effect is not initialized yet"); } @@ -68,7 +67,7 @@ public static BlockRenderLayer getBloomLayer() { /** * @deprecated renamed for clarity; use {@link #getEffectiveBloomLayer()}. */ - @Nonnull + @NotNull @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static BlockRenderLayer getRealBloomLayer() { @@ -84,7 +83,7 @@ public static BlockRenderLayer getRealBloomLayer() { * bloom layer is disabled * @see #getEffectiveBloomLayer(BlockRenderLayer) */ - @Nonnull + @NotNull public static BlockRenderLayer getEffectiveBloomLayer() { return getEffectiveBloomLayer(BlockRenderLayer.CUTOUT); } @@ -115,7 +114,7 @@ public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) * bloom layer is disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ - @Nonnull + @NotNull public static BlockRenderLayer getEffectiveBloomLayer(boolean isBloomActive) { return getEffectiveBloomLayer(isBloomActive, BlockRenderLayer.CUTOUT); } @@ -159,11 +158,11 @@ public static Framebuffer getBloomFBO() { * @return Ticket for the registered bloom render callback * @throws NullPointerException if {@code bloomType == null || render == null} */ - @Nonnull + @NotNull @CheckReturnValue public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup, - @Nonnull BloomType bloomType, - @Nonnull IBloomEffect render) { + @NotNull BloomType bloomType, + @NotNull IBloomEffect render) { BloomRenderTicket ticket = new BloomRenderTicket(setup, bloomType, render); if (Shaders.isOptiFineShaderPackLoaded()) { ticket.invalidate(); @@ -376,8 +375,8 @@ public static int renderBloomBlockLayer(RenderGlobal renderGlobal, return result; } - private static void draw(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context, - @Nonnull List tickets) { + private static void draw(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context, + @NotNull List tickets) { boolean initialized = false; @Nullable IRenderSetup renderSetup = null; @@ -437,7 +436,7 @@ private static void postDraw() { } @Desugar - private record BloomRenderKey(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType) {} + private record BloomRenderKey(@Nullable IRenderSetup renderSetup, @NotNull BloomType bloomType) {} public static final class BloomRenderTicket { @@ -453,8 +452,8 @@ public static final class BloomRenderTicket { */ private boolean legacy; - BloomRenderTicket(@Nullable IRenderSetup renderSetup, @Nonnull BloomType bloomType, - @Nonnull IBloomEffect render) { + BloomRenderTicket(@Nullable IRenderSetup renderSetup, @NotNull BloomType bloomType, + @NotNull IBloomEffect render) { this.renderSetup = renderSetup; this.bloomType = Objects.requireNonNull(bloomType, "bloomType == null"); this.render = Objects.requireNonNull(render, "render == null"); @@ -465,7 +464,7 @@ public IRenderSetup getRenderSetup() { return this.renderSetup; } - @Nonnull + @NotNull public BloomType getBloomType() { return this.bloomType; } diff --git a/src/main/java/gregtech/client/utils/EffectRenderContext.java b/src/main/java/gregtech/client/utils/EffectRenderContext.java index b1a6793396a..e5b63b69feb 100644 --- a/src/main/java/gregtech/client/utils/EffectRenderContext.java +++ b/src/main/java/gregtech/client/utils/EffectRenderContext.java @@ -4,10 +4,10 @@ import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; -import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Objects; /** * Collection of various information for rendering purposes. @@ -26,7 +26,7 @@ public static EffectRenderContext getInstance() { private double cameraX; private double cameraY; private double cameraZ; - @Nonnull + @NotNull private Vec3d cameraViewDir = Vec3d.ZERO; private float rotationX; private float rotationZ; @@ -34,8 +34,8 @@ public static EffectRenderContext getInstance() { private float rotationXY; private float rotationXZ; - @Nonnull - public EffectRenderContext update(@Nonnull Entity renderViewEntity, float partialTicks) { + @NotNull + public EffectRenderContext update(@NotNull Entity renderViewEntity, float partialTicks) { this.renderViewEntity = renderViewEntity; this.partialTicks = partialTicks; @@ -59,7 +59,7 @@ public EffectRenderContext update(@Nonnull Entity renderViewEntity, float partia /** * @return render view entity */ - @Nonnull + @NotNull public Entity renderViewEntity() { return Objects.requireNonNull(renderViewEntity, "renderViewEntity not available yet"); } @@ -95,7 +95,7 @@ public double cameraZ() { /** * @return view direction of the camera */ - @Nonnull + @NotNull public Vec3d cameraViewDir() { return cameraViewDir; } diff --git a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java index 084e1b46101..8aea61ce848 100644 --- a/src/main/java/gregtech/client/utils/FacadeBlockAccess.java +++ b/src/main/java/gregtech/client/utils/FacadeBlockAccess.java @@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import static net.minecraft.util.EnumFacing.*; @@ -71,9 +71,9 @@ public Result getAction(BlockPos pos) { } } - @Nonnull + @NotNull @Override - public IBlockState getBlockState(@Nonnull BlockPos pos) { + public IBlockState getBlockState(@NotNull BlockPos pos) { IBlockState ret; Result action = getAction(pos); if (action == Result.ORIGINAL) { @@ -91,13 +91,13 @@ public IBlockState getBlockState(@Nonnull BlockPos pos) { } @Override - public TileEntity getTileEntity(@Nonnull BlockPos pos) { + public TileEntity getTileEntity(@NotNull BlockPos pos) { return getAction(pos) == Result.ORIGINAL ? world.getTileEntity(pos) : null; } @Override @SideOnly(Side.CLIENT) - public int getCombinedLight(@Nonnull BlockPos pos, int t) { + public int getCombinedLight(@NotNull BlockPos pos, int t) { if (((side == DOWN && pos.getY() > this.pos.getY()) || (side == UP && pos.getY() < this.pos.getY()) || (side == NORTH && pos.getZ() > this.pos.getZ()) || @@ -110,33 +110,33 @@ public int getCombinedLight(@Nonnull BlockPos pos, int t) { } @Override - public int getStrongPower(@Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public int getStrongPower(@NotNull BlockPos pos, @NotNull EnumFacing side) { return world.getStrongPower(pos, side); } - @Nonnull + @NotNull @Override public WorldType getWorldType() { return world.getWorldType(); } @Override - public boolean isAirBlock(@Nonnull BlockPos pos) { + public boolean isAirBlock(@NotNull BlockPos pos) { Result action = getAction(pos); return action == Result.AIR || (action == Result.ORIGINAL && world.isAirBlock(pos)) || (action == Result.COVER && getBlockState(pos).getBlock().isAir(getBlockState(pos), this, pos)); } - @Nonnull + @NotNull @Override @SideOnly(Side.CLIENT) - public Biome getBiome(@Nonnull BlockPos pos) { + public Biome getBiome(@NotNull BlockPos pos) { return world.getBiome(pos); } @Override - public boolean isSideSolid(BlockPos pos, @Nonnull EnumFacing side, boolean _default) { + public boolean isSideSolid(BlockPos pos, @NotNull EnumFacing side, boolean _default) { if (pos.getX() < -30000000 || pos.getZ() < -30000000 || pos.getX() >= 30000000 || diff --git a/src/main/java/gregtech/client/utils/IBloomEffect.java b/src/main/java/gregtech/client/utils/IBloomEffect.java index 984acd91aa8..2d3052ce09d 100644 --- a/src/main/java/gregtech/client/utils/IBloomEffect.java +++ b/src/main/java/gregtech/client/utils/IBloomEffect.java @@ -7,7 +7,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Render callback interface for {@link BloomEffectUtil#registerBloomRender(IRenderSetup, BloomType, IBloomEffect)}. @@ -22,7 +22,7 @@ public interface IBloomEffect { * @param context render context */ @SideOnly(Side.CLIENT) - void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context); + void renderBloomEffect(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context); /** * @param context render context @@ -30,7 +30,7 @@ public interface IBloomEffect { * EffectRenderContext)} call. */ @SideOnly(Side.CLIENT) - default boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + default boolean shouldRenderBloomEffect(@NotNull EffectRenderContext context) { return true; } } diff --git a/src/main/java/gregtech/client/utils/RenderUtil.java b/src/main/java/gregtech/client/utils/RenderUtil.java index 20d46b9e509..ed91be4e57e 100644 --- a/src/main/java/gregtech/client/utils/RenderUtil.java +++ b/src/main/java/gregtech/client/utils/RenderUtil.java @@ -27,15 +27,14 @@ import codechicken.lib.texture.TextureUtils; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL30; import java.awt.image.BufferedImage; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @SideOnly(Side.CLIENT) public class RenderUtil { @@ -655,7 +654,7 @@ public static BakedQuad makeEmissive(BakedQuad quad) { UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format) { @Override - public void put(int element, @Nonnull float... data) { + public void put(int element, float @NotNull... data) { if (this.getVertexFormat().getElement(element) == DefaultVertexFormats.TEX_2S) super.put(element, 480.0f / 0xFFFF, 480.0f / 0xFFFF); else super.put(element, data); diff --git a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java index 9e1a0c3bfcf..939233d0b1e 100644 --- a/src/main/java/gregtech/client/utils/TrackedDummyWorld.java +++ b/src/main/java/gregtech/client/utils/TrackedDummyWorld.java @@ -11,12 +11,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; + import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.function.Predicate; -import javax.annotation.Nonnull; import javax.vecmath.Vector3f; /** @@ -60,22 +61,22 @@ public void addBlock(BlockPos pos, BlockInfo blockInfo) { } @Override - public TileEntity getTileEntity(@Nonnull BlockPos pos) { + public TileEntity getTileEntity(@NotNull BlockPos pos) { if (renderFilter != null && !renderFilter.test(pos)) return null; return proxyWorld != null ? proxyWorld.getTileEntity(pos) : super.getTileEntity(pos); } - @Nonnull + @NotNull @Override - public IBlockState getBlockState(@Nonnull BlockPos pos) { + public IBlockState getBlockState(@NotNull BlockPos pos) { if (renderFilter != null && !renderFilter.test(pos)) return Blocks.AIR.getDefaultState(); // return air if not rendering this block return proxyWorld != null ? proxyWorld.getBlockState(pos) : super.getBlockState(pos); } @Override - public boolean setBlockState(@Nonnull BlockPos pos, IBlockState newState, int flags) { + public boolean setBlockState(@NotNull BlockPos pos, @NotNull IBlockState newState, int flags) { minPos.setX(Math.min(minPos.getX(), pos.getX())); minPos.setY(Math.min(minPos.getY(), pos.getY())); minPos.setZ(Math.min(minPos.getZ(), pos.getZ())); diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index 95731245465..65d407e9635 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -57,6 +57,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; import codechicken.lib.vec.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.Iterator; @@ -64,9 +66,6 @@ import java.util.function.BooleanSupplier; import java.util.function.Predicate; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @Mod.EventBusSubscriber(modid = GTValues.MODID) public class ToolEventHandlers { @@ -74,7 +73,7 @@ public class ToolEventHandlers { * Handles returning broken stacks for tools */ @SubscribeEvent - public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { + public static void onPlayerDestroyItem(@NotNull PlayerDestroyItemEvent event) { ItemStack original = event.getOriginal(); Item item = original.getItem(); if (item instanceof IGTTool) { @@ -109,7 +108,7 @@ public static void onPlayerDestroyItem(@Nonnull PlayerDestroyItemEvent event) { } @SubscribeEvent - public static void onPlayerEntityInteract(@Nonnull PlayerInteractEvent.EntityInteract event) { + public static void onPlayerEntityInteract(@NotNull PlayerInteractEvent.EntityInteract event) { ItemStack itemStack = event.getItemStack(); Item item = itemStack.getItem(); @@ -138,7 +137,7 @@ public static void onPlayerEntityInteract(@Nonnull PlayerInteractEvent.EntityInt * Handles drop conversion when a hammer tool (or tool with hard hammer enchantment) is used */ @SubscribeEvent(priority = EventPriority.LOWEST) - public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) { + public static void onHarvestDrops(@NotNull BlockEvent.HarvestDropsEvent event) { EntityPlayer player = event.getHarvester(); if (player != null) { ItemStack stack = player.getHeldItemMainhand(); @@ -210,7 +209,7 @@ public static void onAnvilUpdateEvent(AnvilUpdateEvent event) { */ @SubscribeEvent @SideOnly(Side.CLIENT) - public static void onDrawHighlightEvent(@Nonnull DrawBlockHighlightEvent event) { + public static void onDrawHighlightEvent(@NotNull DrawBlockHighlightEvent event) { // noinspection ConstantConditions if (event.getTarget().getBlockPos() == null) return; @@ -302,7 +301,7 @@ private static void postRenderDamagedBlocks() { } @SideOnly(Side.CLIENT) - private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nullable TileEntity tile, + private static boolean shouldRenderGridOverlays(@NotNull IBlockState state, @Nullable TileEntity tile, ItemStack mainHand, ItemStack offHand, boolean isSneaking) { if (state.getBlock() instanceof BlockPipepipe) { if (isSneaking && @@ -366,7 +365,7 @@ private static boolean shouldRenderGridOverlays(@Nonnull IBlockState state, @Nul private static float bColour; @SideOnly(Side.CLIENT) - private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos pos, IBlockState state, + private static boolean renderGridOverlays(@NotNull EntityPlayer player, BlockPos pos, IBlockState state, EnumFacing facing, TileEntity tile, float partialTicks) { if (player.world.getWorldBorder().contains(pos)) { GlStateManager.enableBlend(); @@ -435,7 +434,7 @@ private static boolean renderGridOverlays(@Nonnull EntityPlayer player, BlockPos } @SideOnly(Side.CLIENT) - private static void drawGridOverlays(@Nonnull AxisAlignedBB box) { + private static void drawGridOverlays(@NotNull AxisAlignedBB box) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, DefaultVertexFormats.POSITION_COLOR); diff --git a/src/main/java/gregtech/common/blocks/BlockAsphalt.java b/src/main/java/gregtech/common/blocks/BlockAsphalt.java index c5c9b5b28ac..2b27036768e 100644 --- a/src/main/java/gregtech/common/blocks/BlockAsphalt.java +++ b/src/main/java/gregtech/common/blocks/BlockAsphalt.java @@ -12,7 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockAsphalt extends VariantBlock { @@ -27,8 +27,8 @@ public BlockAsphalt() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @@ -54,7 +54,7 @@ public enum BlockType implements IStringSerializable, IStateHarvestLevel { this.harvestLevel = harvestLevel; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java index 5ba9ef69c02..ce6f51f39d9 100644 --- a/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockBoilerCasing.java @@ -12,7 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockBoilerCasing extends VariantBlock { @@ -26,8 +26,8 @@ public BlockBoilerCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -47,7 +47,7 @@ public enum BoilerCasingType implements IStringSerializable, IStateHarvestLevel this.harvestLevel = harvestLevel; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java index f8e5d91cc33..0c8d7e0e860 100644 --- a/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java +++ b/src/main/java/gregtech/common/blocks/BlockBrittleCharcoal.java @@ -16,10 +16,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class BlockBrittleCharcoal extends Block { @@ -33,14 +33,14 @@ public BlockBrittleCharcoal() { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull IBlockState state, int fortune) { + public void getDrops(@NotNull NonNullList drops, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull IBlockState state, int fortune) { drops.add(new ItemStack(Items.COAL, 1 + GTValues.RNG.nextInt(2), 1)); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, - @Nonnull ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.1")); tooltip.add(I18n.format("tile.brittle_charcoal.tooltip.2")); diff --git a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java index 59828acd886..f21a5f29089 100644 --- a/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockCleanroomCasing.java @@ -16,13 +16,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; +import java.util.List; -@ParametersAreNonnullByDefault public class BlockCleanroomCasing extends VariantBlock implements IStateHarvestLevel { public BlockCleanroomCasing() { @@ -35,8 +33,8 @@ public BlockCleanroomCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, - EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @@ -52,13 +50,13 @@ public enum CasingType implements IStringSerializable { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; } - @Nonnull + @NotNull @Override public String toString() { return getName(); @@ -66,19 +64,19 @@ public String toString() { } @Override - public int getHarvestLevel(IBlockState state) { + public int getHarvestLevel(@NotNull IBlockState state) { return state == getState(CasingType.PLASCRETE) ? 2 : 1; } @Nullable @Override - public String getHarvestTool(IBlockState state) { + public String getHarvestTool(@NotNull IBlockState state) { return state == getState(CasingType.PLASCRETE) ? ToolClasses.PICKAXE : ToolClasses.WRENCH; } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World player, @Nonnull List tooltip, - @Nonnull ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World player, @NotNull List tooltip, + @NotNull ITooltipFlag advanced) { super.addInformation(stack, player, tooltip, advanced); if (stack.isItemEqual(getItemVariant(CasingType.FILTER_CASING))) tooltip.add(I18n.format("tile.cleanroom_casing.filter.tooltip")); diff --git a/src/main/java/gregtech/common/blocks/BlockCompressed.java b/src/main/java/gregtech/common/blocks/BlockCompressed.java index 5ebc94cfda2..18b71b293d6 100644 --- a/src/main/java/gregtech/common/blocks/BlockCompressed.java +++ b/src/main/java/gregtech/common/blocks/BlockCompressed.java @@ -22,10 +22,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public abstract class BlockCompressed extends BlockMaterialBase { @@ -33,7 +33,7 @@ public static BlockCompressed create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockCompressed() { - @Nonnull + @NotNull @Override public PropertyMaterial getVariantProperty() { return property; @@ -50,9 +50,9 @@ private BlockCompressed() { } @Override - @Nonnull + @NotNull @SuppressWarnings("deprecation") - public net.minecraft.block.material.Material getMaterial(IBlockState state) { + public net.minecraft.block.material.Material getMaterial(@NotNull IBlockState state) { Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { return net.minecraft.block.material.Material.ROCK; @@ -64,9 +64,9 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { return net.minecraft.block.material.Material.ROCK; } - @Nonnull + @NotNull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + public SoundType getSoundType(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, @Nullable Entity entity) { Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { @@ -80,7 +80,7 @@ public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull } @Override - public String getHarvestTool(IBlockState state) { + public String getHarvestTool(@NotNull IBlockState state) { Material material = getGtMaterial(state); if (material.isSolid()) { return ToolClasses.PICKAXE; @@ -91,7 +91,7 @@ public String getHarvestTool(IBlockState state) { } @Override - public int getHarvestLevel(IBlockState state) { + public int getHarvestLevel(@NotNull IBlockState state) { Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.DUST)) { return material.getBlockHarvestLevel(); @@ -100,7 +100,8 @@ public int getHarvestLevel(IBlockState state) { } @Override - public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List tooltip, + @NotNull ITooltipFlag flagIn) { if (ConfigHolder.misc.debug) { tooltip.add("MetaItem Id: block" + getGtMaterial(stack).toCamelCaseString()); } diff --git a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java index 250ca9dda00..f469e476772 100644 --- a/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFireboxCasing.java @@ -13,7 +13,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockFireboxCasing extends VariantActiveBlock { @@ -27,8 +27,8 @@ public BlockFireboxCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -47,7 +47,7 @@ public enum FireboxCasingType implements IStringSerializable, IStateHarvestLevel this.harvestLevel = harvestLevel; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockFrame.java b/src/main/java/gregtech/common/blocks/BlockFrame.java index 170c123a7e3..f4bb81f675d 100644 --- a/src/main/java/gregtech/common/blocks/BlockFrame.java +++ b/src/main/java/gregtech/common/blocks/BlockFrame.java @@ -42,10 +42,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public abstract class BlockFrame extends BlockMaterialBase { @@ -55,7 +55,7 @@ public static BlockFrame create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockFrame() { - @Nonnull + @NotNull @Override public PropertyMaterial getVariantProperty() { return property; @@ -72,7 +72,7 @@ private BlockFrame() { } @Override - public String getHarvestTool(IBlockState state) { + public String getHarvestTool(@NotNull IBlockState state) { Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return ToolClasses.AXE; @@ -80,9 +80,9 @@ public String getHarvestTool(IBlockState state) { return ToolClasses.WRENCH; } - @Nonnull + @NotNull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + public SoundType getSoundType(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, @Nullable Entity entity) { Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { @@ -100,14 +100,14 @@ public SoundType getSoundType(ItemStack stack) { } @Override - public int getHarvestLevel(@Nonnull IBlockState state) { + public int getHarvestLevel(@NotNull IBlockState state) { return 1; } @Override - @Nonnull + @NotNull @SuppressWarnings("deprecation") - public net.minecraft.block.material.Material getMaterial(IBlockState state) { + public net.minecraft.block.material.Material getMaterial(@NotNull IBlockState state) { Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return net.minecraft.block.material.Material.WOOD; @@ -116,8 +116,8 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -164,8 +164,8 @@ public boolean removeFrame(World world, BlockPos pos, EntityPlayer player, ItemS } @Override - public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + public boolean onBlockActivated(@NotNull World world, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull EntityPlayer player, @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (stack.isEmpty()) { @@ -226,7 +226,7 @@ public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @No } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, + public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, Entity entityIn) { entityIn.motionX = MathHelper.clamp(entityIn.motionX, -0.15, 0.15); entityIn.motionZ = MathHelper.clamp(entityIn.motionZ, -0.15, 0.15); @@ -242,21 +242,21 @@ public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @No } } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { + public EnumPushReaction getPushReaction(@NotNull IBlockState state) { return EnumPushReaction.DESTROY; } @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, - @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@NotNull IBlockState blockState, @NotNull IBlockAccess worldIn, + @NotNull BlockPos pos) { return COLLISION_BOX; } - @Nonnull + @NotNull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT_MIPPED; @@ -264,20 +264,21 @@ public BlockRenderLayer getRenderLayer() { @Override @SuppressWarnings("deprecation") - public boolean isOpaqueCube(@Nonnull IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@NotNull IBlockAccess worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EnumFacing face) { return BlockFaceShape.UNDEFINED; } @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { if (ConfigHolder.misc.debug) { tooltip.add("MetaItem Id: frame" + getGtMaterial(stack).toCamelCaseString()); } diff --git a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java index 06ab2ece46b..555261dc2d4 100644 --- a/src/main/java/gregtech/common/blocks/BlockFusionCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockFusionCasing.java @@ -11,7 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockFusionCasing extends VariantActiveBlock { @@ -25,8 +25,8 @@ public BlockFusionCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @@ -46,7 +46,7 @@ public enum CasingType implements IStringSerializable, IStateHarvestLevel { this.harvestLevel = harvestLevel; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java index a5812dd9348..536bf7d43cb 100644 --- a/src/main/java/gregtech/common/blocks/BlockGlassCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockGlassCasing.java @@ -15,10 +15,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.NotNull; -@ParametersAreNonnullByDefault public class BlockGlassCasing extends VariantActiveBlock { public BlockGlassCasing() { @@ -33,39 +31,40 @@ public BlockGlassCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, - EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @Override - @Nonnull + @NotNull public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { return getState(state) == CasingType.TEMPERED_GLASS ? layer == BlockRenderLayer.TRANSLUCENT : super.canRenderInLayer(state, layer); } @Override @SuppressWarnings("deprecation") - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(@NotNull IBlockState state) { return false; } @Override @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean shouldSideBeRendered(@NotNull IBlockState state, IBlockAccess world, BlockPos pos, + @NotNull EnumFacing side) { IBlockState sideState = world.getBlockState(pos.offset(side)); return sideState.getBlock() == this ? @@ -87,7 +86,7 @@ public enum CasingType implements IStringSerializable { } @Override - @Nonnull + @NotNull public String getName() { return this.name; } diff --git a/src/main/java/gregtech/common/blocks/BlockGregStairs.java b/src/main/java/gregtech/common/blocks/BlockGregStairs.java index 88bc3490190..f04cddbe6df 100644 --- a/src/main/java/gregtech/common/blocks/BlockGregStairs.java +++ b/src/main/java/gregtech/common/blocks/BlockGregStairs.java @@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockGregStairs extends BlockStairs { @@ -21,8 +21,8 @@ public BlockGregStairs(IBlockState state) { } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@NotNull IBlockState blockState, @NotNull IBlockAccess world, + @NotNull BlockPos pos, @NotNull EnumFacing side) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java index a94715647bd..a9a713365da 100644 --- a/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockHermeticCasing.java @@ -12,10 +12,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.NotNull; -@ParametersAreNonnullByDefault public class BlockHermeticCasing extends VariantBlock { public BlockHermeticCasing() { @@ -29,12 +27,12 @@ public BlockHermeticCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, - EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } - @Nonnull + @NotNull @Override public BlockRenderLayer getRenderLayer() { // cutout is needed for the top (outer) layer/overlay to render properly in world @@ -60,7 +58,7 @@ public enum HermeticCasingsType implements IStringSerializable { } @Override - @Nonnull + @NotNull public String getName() { return this.name; } diff --git a/src/main/java/gregtech/common/blocks/BlockLamp.java b/src/main/java/gregtech/common/blocks/BlockLamp.java index bb37e097a7d..3cc7c273ddc 100644 --- a/src/main/java/gregtech/common/blocks/BlockLamp.java +++ b/src/main/java/gregtech/common/blocks/BlockLamp.java @@ -31,16 +31,14 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -@ParametersAreNonnullByDefault public class BlockLamp extends Block { public static final PropertyBool BLOOM = PropertyBool.create("bloom"); @@ -95,18 +93,18 @@ public int getItemMetadataStates() { return 8; } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, INVERTED, BLOOM, LIGHT, POWERED); } @Override - public int damageDropped(@Nonnull IBlockState state) { + public int damageDropped(@NotNull IBlockState state) { return getMetaFromState(state) & ITEM_FLAGS; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { @@ -134,7 +132,7 @@ public int getLightValue(IBlockState state) { } @Override - public void onBlockAdded(World world, BlockPos pos, IBlockState state) { + public void onBlockAdded(World world, @NotNull BlockPos pos, @NotNull IBlockState state) { if (!world.isRemote) { boolean powered = state.getValue(POWERED); if (powered != world.isBlockPowered(pos)) { @@ -145,7 +143,8 @@ public void onBlockAdded(World world, BlockPos pos, IBlockState state) { @Override @SuppressWarnings("deprecation") - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) { + public void neighborChanged(@NotNull IBlockState state, World world, @NotNull BlockPos pos, @NotNull Block block, + @NotNull BlockPos fromPos) { if (!world.isRemote) { if (state.getValue(POWERED)) { if (!world.isBlockPowered(pos)) { @@ -158,21 +157,22 @@ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block } @Override - public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World world, @NotNull BlockPos pos, @NotNull IBlockState state, @NotNull Random rand) { if (!world.isRemote && state.getValue(POWERED) && !world.isBlockPowered(pos)) { world.setBlockState(pos, state.withProperty(POWERED, false), state.getValue(LIGHT) ? 2 | 8 : 2); } } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList list) { for (int meta = 0; meta < getItemMetadataStates(); meta++) { list.add(new ItemStack(this, 1, meta)); } } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World player, @NotNull List tooltip, + @NotNull ITooltipFlag advanced) { IBlockState state = getStateFromMeta(stack.getMetadata()); if (state.getValue(INVERTED)) tooltip.add(I18n.format("tile.gregtech_lamp.tooltip.inverted")); if (!state.getValue(BLOOM)) tooltip.add(I18n.format("tile.gregtech_lamp.tooltip.no_bloom")); @@ -180,7 +180,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List } @Override - public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { if (layer == BlockRenderLayer.SOLID) return true; return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM)); } @@ -200,7 +200,7 @@ public void onModelRegister() { ModelLoader.setCustomStateMapper(this, b -> models); } - @Nonnull + @NotNull @SideOnly(Side.CLIENT) protected LampModelType getModelType() { return LampModelType.LAMP; diff --git a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java index 3f54c3c426e..102e05bb5a0 100644 --- a/src/main/java/gregtech/common/blocks/BlockLampBorderless.java +++ b/src/main/java/gregtech/common/blocks/BlockLampBorderless.java @@ -7,7 +7,7 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.util.BlockRenderLayer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockLampBorderless extends BlockLamp { @@ -16,12 +16,12 @@ public BlockLampBorderless(EnumDyeColor color) { } @Override - public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { return layer == BloomEffectUtil.getEffectiveBloomLayer(isLightActive(state) && state.getValue(BLOOM), BlockRenderLayer.SOLID); } - @Nonnull + @NotNull @Override protected LampModelType getModelType() { return LampModelType.BORDERLESS_LAMP; diff --git a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java index 46f313e64a9..c3ae31d7ec3 100644 --- a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java @@ -16,14 +16,12 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import java.util.Locale; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Locale; import static gregtech.api.GTValues.VOLTAGE_NAMES; -@ParametersAreNonnullByDefault public class BlockMachineCasing extends VariantBlock { public BlockMachineCasing() { @@ -37,12 +35,13 @@ public BlockMachineCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @Override - public void getSubBlocks(CreativeTabs tab, NonNullList list) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList list) { for (MachineCasingType variant : VALUES) { if (variant.ordinal() <= MachineCasingType.UHV.ordinal() || GregTechAPI.isHighTier()) { list.add(getItemVariant(variant)); @@ -76,7 +75,7 @@ public enum MachineCasingType implements IStringSerializable { } @Override - @Nonnull + @NotNull public String getName() { return this.name; } diff --git a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java index ff551e6bd6a..24ec73eabfd 100644 --- a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java +++ b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java @@ -17,7 +17,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class BlockMaterialBase extends Block { @@ -25,12 +25,12 @@ public BlockMaterialBase(net.minecraft.block.material.Material material) { super(material); } - @Nonnull - public ItemStack getItem(@Nonnull Material material) { + @NotNull + public ItemStack getItem(@NotNull Material material) { return GTUtility.toItem(getDefaultState().withProperty(getVariantProperty(), material)); } - @Nonnull + @NotNull public Material getGtMaterial(int meta) { if (meta >= getVariantProperty().getAllowedValues().size()) { meta = 0; @@ -38,31 +38,31 @@ public Material getGtMaterial(int meta) { return getVariantProperty().getAllowedValues().get(meta); } - @Nonnull - public Material getGtMaterial(@Nonnull ItemStack stack) { + @NotNull + public Material getGtMaterial(@NotNull ItemStack stack) { return getGtMaterial(stack.getMetadata()); } - @Nonnull - public Material getGtMaterial(@Nonnull IBlockState state) { + @NotNull + public Material getGtMaterial(@NotNull IBlockState state) { return state.getValue(getVariantProperty()); } - @Nonnull - public IBlockState getBlock(@Nonnull Material material) { + @NotNull + public IBlockState getBlock(@NotNull Material material) { return getDefaultState().withProperty(getVariantProperty(), material); } - @Nonnull + @NotNull public abstract PropertyMaterial getVariantProperty(); - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, getVariantProperty()); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { @@ -70,17 +70,17 @@ public IBlockState getStateFromMeta(int meta) { } @Override - public int getMetaFromState(@Nonnull IBlockState state) { + public int getMetaFromState(@NotNull IBlockState state) { return getVariantProperty().getAllowedValues().indexOf(state.getValue(getVariantProperty())); } @Override - public int damageDropped(@Nonnull IBlockState state) { + public int damageDropped(@NotNull IBlockState state) { return getMetaFromState(state); } @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList list) { for (IBlockState state : blockState.getValidStates()) { if (getGtMaterial(state) != Materials.NULL) { list.add(GTUtility.toItem(state)); @@ -88,15 +88,15 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList { @@ -26,8 +26,8 @@ public BlockMetalCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -54,7 +54,7 @@ public enum MetalCasingType implements IStringSerializable, IStateHarvestLevel { this.harvestLevel = harvestLevel; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java index 92848f68cf0..06033540756 100644 --- a/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMultiblockCasing.java @@ -11,7 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockMultiblockCasing extends VariantActiveBlock { @@ -26,8 +26,8 @@ public BlockMultiblockCasing() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -45,7 +45,7 @@ public enum MultiblockCasingType implements IStringSerializable { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockOre.java b/src/main/java/gregtech/common/blocks/BlockOre.java index b91135bc0d1..c0fc037097b 100644 --- a/src/main/java/gregtech/common/blocks/BlockOre.java +++ b/src/main/java/gregtech/common/blocks/BlockOre.java @@ -33,13 +33,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Objects; import java.util.Random; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class BlockOre extends Block implements IBlockOre { public final PropertyStoneType STONE_TYPE; @@ -57,10 +57,10 @@ public BlockOre(Material material, StoneType[] allowedValues) { setCreativeTab(GregTechAPI.TAB_GREGTECH_ORES); } - @Nonnull + @NotNull @SuppressWarnings("deprecation") @Override - public net.minecraft.block.material.Material getMaterial(@Nonnull IBlockState state) { + public net.minecraft.block.material.Material getMaterial(@NotNull IBlockState state) { String harvestTool = getHarvestTool(state); if (harvestTool != null && harvestTool.equals(ToolClasses.SHOVEL)) { return net.minecraft.block.material.Material.GROUND; @@ -68,7 +68,7 @@ public net.minecraft.block.material.Material getMaterial(@Nonnull IBlockState st return net.minecraft.block.material.Material.ROCK; } - @Nonnull + @NotNull @Override protected final BlockStateContainer createBlockState() { return new BlockStateContainer(this); @@ -80,9 +80,9 @@ protected void initBlockState() { setDefaultState(stateContainer.getBaseState()); } - @Nonnull + @NotNull @Override - public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune) { + public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int fortune) { StoneType stoneType = state.getValue(STONE_TYPE); // if the stone type should be dropped as an item, or if it is within the first 16 block states // don't do any special handling @@ -98,7 +98,7 @@ public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int } @Override - public int damageDropped(@Nonnull IBlockState state) { + public int damageDropped(@NotNull IBlockState state) { StoneType stoneType = state.getValue(STONE_TYPE); if (stoneType.shouldBeDroppedAsItem) { return getMetaFromState(state); @@ -107,9 +107,9 @@ public int damageDropped(@Nonnull IBlockState state) { } } - @Nonnull + @NotNull @Override - public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + public SoundType getSoundType(IBlockState state, @NotNull World world, @NotNull BlockPos pos, @Nullable Entity entity) { StoneType stoneType = state.getValue(STONE_TYPE); return stoneType.soundType; @@ -129,7 +129,7 @@ public int getHarvestLevel(IBlockState state) { material.getBlockHarvestLevel()); } - @Nonnull + @NotNull @Override protected ItemStack getSilkTouchDrop(IBlockState state) { StoneType stoneType = state.getValue(STONE_TYPE); @@ -139,7 +139,7 @@ protected ItemStack getSilkTouchDrop(IBlockState state) { return super.getSilkTouchDrop(this.getDefaultState()); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { @@ -154,16 +154,16 @@ public int getMetaFromState(IBlockState state) { return STONE_TYPE.getAllowedValues().indexOf(state.getValue(STONE_TYPE)); } - @Nonnull + @NotNull @Override - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + public ItemStack getPickBlock(@NotNull IBlockState state, @NotNull RayTraceResult target, @NotNull World world, + @NotNull BlockPos pos, @NotNull EntityPlayer player) { // Still get correct block even if shouldBeDroppedAsItem is false return GTUtility.toItem(state); } @Override - public boolean isFireSource(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean isFireSource(@NotNull World world, @NotNull BlockPos pos, @NotNull EnumFacing side) { if (side != EnumFacing.UP) return false; // if the stone type of the ore block is flammable, it will burn forever like Netherrack @@ -172,7 +172,7 @@ public boolean isFireSource(@Nonnull World world, @Nonnull BlockPos pos, @Nonnul } @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList list) { if (tab == CreativeTabs.SEARCH || tab == GregTechAPI.TAB_GREGTECH_ORES) { blockState.getValidStates().stream() .filter(state -> state.getValue(STONE_TYPE).shouldBeDroppedAsItem) @@ -181,7 +181,7 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList { public BlockSteamCasing() { @@ -35,13 +33,14 @@ public BlockSteamCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, - EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, ITooltipFlag advanced) { + public void addInformation(@NotNull ItemStack stack, @Nullable World player, List tooltip, + @NotNull ITooltipFlag advanced) { int ordinal = getState(stack).ordinal(); if (ordinal < 2) { tooltip.add(I18n.format("tile.steam_casing.bronze.tooltip")); @@ -70,7 +69,7 @@ public enum SteamCasingType implements IStringSerializable, IStateHarvestLevel { } @Override - @Nonnull + @NotNull public String getName() { return name; } diff --git a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java index dc06466524e..8d98ee3b007 100755 --- a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java +++ b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java @@ -25,8 +25,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("deprecation") public abstract class BlockSurfaceRock extends BlockMaterialBase { @@ -40,7 +40,7 @@ public static BlockSurfaceRock create(Material[] materials) { PropertyMaterial property = PropertyMaterial.create("variant", materials); return new BlockSurfaceRock() { - @Nonnull + @NotNull @Override public PropertyMaterial getVariantProperty() { return property; @@ -56,13 +56,13 @@ private BlockSurfaceRock() { @Nullable @Override - public String getHarvestTool(@Nonnull IBlockState state) { + public String getHarvestTool(@NotNull IBlockState state) { return ToolClasses.SHOVEL; } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + public boolean onBlockActivated(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { dropBlockAsItem(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); @@ -70,17 +70,17 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ return true; } - @Nonnull + @NotNull @Override - public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, + public SoundType getSoundType(@NotNull IBlockState state, @NotNull World world, @NotNull BlockPos pos, @Nullable Entity entity) { return SoundType.GROUND; } @Override - @Nonnull - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, - @Nonnull BlockPos pos) { + @NotNull + public AxisAlignedBB getBoundingBox(@NotNull IBlockState state, @NotNull IBlockAccess source, + @NotNull BlockPos pos) { return STONE_AABB; } @@ -89,32 +89,32 @@ private ItemStack getDropStack(IBlockState state, int amount) { } @Override - @Nonnull - public ItemStack getPickBlock(@Nonnull IBlockState state, @Nonnull RayTraceResult target, @Nonnull World world, - @Nonnull BlockPos pos, @Nonnull EntityPlayer player) { + @NotNull + public ItemStack getPickBlock(@NotNull IBlockState state, @NotNull RayTraceResult target, @NotNull World world, + @NotNull BlockPos pos, @NotNull EntityPlayer player) { return getDropStack(state, 1); } @Override - public void getDrops(NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull IBlockState state, int fortune) { + public void getDrops(NonNullList drops, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull IBlockState state, int fortune) { int amount = 3 + GTValues.RNG.nextInt((int) (2 + fortune * 1.5)); drops.add(getDropStack(state, amount)); } @Override - public boolean isFullCube(@Nonnull IBlockState state) { + public boolean isFullCube(@NotNull IBlockState state) { return false; } @Override - public boolean isOpaqueCube(@Nonnull IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } @Override - public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, - @Nonnull Block blockIn, BlockPos fromPos) { + public void neighborChanged(@NotNull IBlockState state, @NotNull World worldIn, @NotNull BlockPos pos, + @NotNull Block blockIn, BlockPos fromPos) { if (fromPos.up().equals(pos)) { if (worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != BlockFaceShape.SOLID) { @@ -124,9 +124,9 @@ public void neighborChanged(@Nonnull IBlockState state, @Nonnull World worldIn, } @Override - @Nonnull - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + @NotNull + public BlockFaceShape getBlockFaceShape(@NotNull IBlockAccess worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java index 984b4869533..d5293494178 100644 --- a/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockTurbineCasing.java @@ -12,10 +12,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.NotNull; -@ParametersAreNonnullByDefault public class BlockTurbineCasing extends VariantBlock { public BlockTurbineCasing() { @@ -28,7 +26,8 @@ public BlockTurbineCasing() { } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -54,7 +53,7 @@ public enum TurbineCasingType implements IStringSerializable, IStateHarvestLevel } @Override - @Nonnull + @NotNull public String getName() { return this.name; } diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign.java b/src/main/java/gregtech/common/blocks/BlockWarningSign.java index d35241a8699..a3e02d7b657 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign.java @@ -8,7 +8,7 @@ import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockWarningSign extends VariantBlock { @@ -48,7 +48,7 @@ public enum SignType implements IStringSerializable { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java index bb03ca19a3a..2119c55ad83 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java @@ -8,7 +8,7 @@ import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockWarningSign1 extends VariantBlock { @@ -41,7 +41,7 @@ public enum SignType implements IStringSerializable { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 8587e149364..312e8e4d9c0 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -24,10 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class BlockWireCoil extends VariantActiveBlock { @@ -41,6 +41,7 @@ public BlockWireCoil() { setDefaultState(getState(CoilType.CUPRONICKEL)); } + @NotNull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.SOLID; @@ -48,8 +49,8 @@ public BlockRenderLayer getRenderLayer() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn, List lines, - @Nonnull ITooltipFlag tooltipFlag) { + public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn, List lines, + @NotNull ITooltipFlag tooltipFlag) { super.addInformation(itemStack, worldIn, lines, tooltipFlag); // noinspection rawtypes, unchecked @@ -76,8 +77,8 @@ public void addInformation(@Nonnull ItemStack itemStack, @Nullable World worldIn } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } @@ -113,7 +114,7 @@ public enum CoilType implements IStringSerializable, IHeatingCoilBlockStats { this.material = material; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -145,7 +146,7 @@ public Material getMaterial() { return material; } - @Nonnull + @NotNull @Override public String toString() { return getName(); diff --git a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java index b8ac343fe6d..e1d7be0e39d 100644 --- a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java +++ b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MaterialItemBlock extends ItemBlock { @@ -19,6 +19,7 @@ public MaterialItemBlock(BlockMaterialBase block, OrePrefix prefix) { setHasSubtypes(true); } + @NotNull @Override public BlockMaterialBase getBlock() { return block; @@ -29,9 +30,9 @@ public int getMetadata(int damage) { return damage; } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { return this.prefix.getLocalNameForItem(this.block.getGtMaterial(stack)); } } diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index 64e5fd1abf4..9395fdec645 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -71,14 +71,13 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.Map.Entry; import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - import static gregtech.api.unification.material.info.MaterialFlags.FORCE_GENERATE_BLOCK; import static gregtech.api.unification.material.info.MaterialFlags.GENERATE_FRAME; import static gregtech.api.util.GTUtility.gregtechId; @@ -534,9 +533,9 @@ public static void registerStateMappers() { normalStateMapper = new StateMapperBase() { - @Nonnull + @NotNull @Override - protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { + protected ModelResourceLocation getModelResourceLocation(@NotNull IBlockState state) { return new ModelResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()), "normal"); } }; diff --git a/src/main/java/gregtech/common/blocks/OreItemBlock.java b/src/main/java/gregtech/common/blocks/OreItemBlock.java index 1e2b569c801..2a703c5d157 100644 --- a/src/main/java/gregtech/common/blocks/OreItemBlock.java +++ b/src/main/java/gregtech/common/blocks/OreItemBlock.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class OreItemBlock extends ItemBlock { @@ -27,9 +27,9 @@ protected IBlockState getBlockState(ItemStack stack) { return oreBlock.getStateFromMeta(getMetadata(stack.getItemDamage())); } - @Nonnull + @NotNull @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { + public String getItemStackDisplayName(@NotNull ItemStack stack) { IBlockState blockState = getBlockState(stack); StoneType stoneType = blockState.getValue(oreBlock.STONE_TYPE); return stoneType.processingPrefix.getLocalNameForItem(oreBlock.material); diff --git a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java index c532c1700dc..aac7f85a066 100644 --- a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java +++ b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java @@ -18,9 +18,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import java.util.Random; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Random; @SuppressWarnings("deprecation") public class StoneVariantBlock extends VariantBlock { @@ -30,7 +30,7 @@ public class StoneVariantBlock extends VariantBlock private final StoneVariant stoneVariant; - public StoneVariantBlock(@Nonnull StoneVariant stoneVariant) { + public StoneVariantBlock(@NotNull StoneVariant stoneVariant) { super(net.minecraft.block.material.Material.ROCK); this.stoneVariant = stoneVariant; setRegistryName(stoneVariant.id); @@ -43,7 +43,7 @@ public StoneVariantBlock(@Nonnull StoneVariant stoneVariant) { setCreativeTab(GregTechAPI.TAB_GREGTECH_DECORATIONS); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { this.VARIANT = PROPERTY; @@ -52,8 +52,8 @@ protected BlockStateContainer createBlockState() { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @@ -63,7 +63,7 @@ public double getWalkingSpeedBonus() { } @Override - public boolean checkApplicableBlocks(@Nonnull IBlockState state) { + public boolean checkApplicableBlocks(@NotNull IBlockState state) { return state == getState(StoneType.CONCRETE_DARK) || state == getState(StoneType.CONCRETE_LIGHT); } @@ -72,8 +72,9 @@ protected boolean canSilkHarvest() { return this.stoneVariant == StoneVariant.SMOOTH; } + @NotNull @Override - public Item getItemDropped(IBlockState state, Random rand, int fortune) { + public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int fortune) { return Item.getItemFromBlock(this.stoneVariant == StoneVariant.SMOOTH ? MetaBlocks.STONE_BLOCKS.get(StoneVariant.COBBLE) : this); } @@ -90,12 +91,12 @@ public enum StoneType implements IStringSerializable { private final String name; public final MapColor mapColor; - StoneType(@Nonnull String name, @Nonnull MapColor mapColor) { + StoneType(@NotNull String name, @NotNull MapColor mapColor) { this.name = name; this.mapColor = mapColor; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -157,19 +158,19 @@ public enum StoneVariant { public final float hardness; public final float resistance; - StoneVariant(@Nonnull String id) { + StoneVariant(@NotNull String id) { this(id, id); } - StoneVariant(@Nonnull String id, @Nonnull String translationKey) { + StoneVariant(@NotNull String id, @NotNull String translationKey) { this(id, translationKey, 1.5f, 10.0f); // vanilla stone stats } - StoneVariant(@Nonnull String id, float hardness, float resistance) { + StoneVariant(@NotNull String id, float hardness, float resistance) { this(id, id, hardness, resistance); } - StoneVariant(@Nonnull String id, @Nonnull String translationKey, float hardness, float resistance) { + StoneVariant(@NotNull String id, @NotNull String translationKey, float hardness, float resistance) { this.id = id; this.translationKey = translationKey; this.hardness = hardness; diff --git a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java index 426701f2682..5e51d40c731 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockFoam.java @@ -24,10 +24,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Random; public class BlockFoam extends BlockColored { @@ -45,8 +45,8 @@ public BlockFoam(boolean isReinforced) { } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + public boolean onBlockActivated(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + EntityPlayer playerIn, @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stackInHand = playerIn.getHeldItem(hand); if (!stackInHand.isEmpty() && OreDictUnifier.hasOreDictionary(stackInHand, "sand")) { @@ -60,7 +60,7 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ } @Override - public void randomTick(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, Random random) { + public void randomTick(World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, Random random) { int lightLevel = (worldIn.canSeeSky(pos) && worldIn.isDaytime()) ? 16 : worldIn.getLight(pos); if (random.nextInt(20 - lightLevel) == 0) { worldIn.setBlockState(pos, getPetrifiedBlock(state)); @@ -72,28 +72,28 @@ private IBlockState getPetrifiedBlock(IBlockState state) { return block.getDefaultState().withProperty(COLOR, state.getValue(COLOR)); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public EnumPushReaction getPushReaction(@Nonnull IBlockState state) { + public EnumPushReaction getPushReaction(@NotNull IBlockState state) { return EnumPushReaction.DESTROY; } @Nullable @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getCollisionBoundingBox(@Nonnull IBlockState blockState, @Nonnull IBlockAccess worldIn, - @Nonnull BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(@NotNull IBlockState blockState, @NotNull IBlockAccess worldIn, + @NotNull BlockPos pos) { return null; } - @Nonnull + @NotNull @Override - public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune) { + public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int fortune) { return Items.AIR; } - @Nonnull + @NotNull @Override public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT_MIPPED; @@ -101,21 +101,21 @@ public BlockRenderLayer getRenderLayer() { @Override @SuppressWarnings("deprecation") - public boolean isOpaqueCube(@Nonnull IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") - public boolean isFullCube(@Nonnull IBlockState state) { + public boolean isFullCube(@NotNull IBlockState state) { return false; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, - @Nonnull BlockPos pos, @Nonnull EnumFacing face) { + public BlockFaceShape getBlockFaceShape(@NotNull IBlockAccess worldIn, @NotNull IBlockState state, + @NotNull BlockPos pos, @NotNull EnumFacing face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java index 769eaef2194..1665b172ce4 100644 --- a/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java +++ b/src/main/java/gregtech/common/blocks/foam/BlockPetrifiedFoam.java @@ -10,7 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockPetrifiedFoam extends BlockColored { @@ -24,8 +24,8 @@ public BlockPetrifiedFoam(boolean isReinforced) { } @Override - public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, - @Nonnull SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull SpawnPlacementType type) { return false; } } diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java index 64c176b21b8..c204526ef90 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyMaterial.java @@ -8,12 +8,11 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Collection; -import javax.annotation.Nonnull; - public class PropertyMaterial extends PropertyHelper { private final ImmutableList allowedValues; @@ -31,15 +30,15 @@ public static PropertyMaterial create(String name, Material[] allowedValues) { return new PropertyMaterial(name, Arrays.asList(allowedValues)); } - @Nonnull + @NotNull @Override public ImmutableList getAllowedValues() { return allowedValues; } - @Nonnull + @NotNull @Override - public Optional parseValue(@Nonnull String value) { + public Optional parseValue(@NotNull String value) { int index = value.indexOf("__"); String materialName = index < 0 ? value : value.substring(0, index) + ':' + value.substring(index + 2); Material material = GregTechAPI.materialManager.getMaterial(materialName); @@ -49,9 +48,9 @@ public Optional parseValue(@Nonnull String value) { return Optional.of(Materials.NULL); } - @Nonnull + @NotNull @Override - public String getName(@Nonnull Material material) { + public String getName(@NotNull Material material) { // Use double underscore to prevent ${modid}_${material_name} being ambiguous with ${material_name} when parsing return material.getModid() + "__" + material.getName(); } diff --git a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java index 771c045b3da..8a8b1eebb02 100644 --- a/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java +++ b/src/main/java/gregtech/common/blocks/properties/PropertyStoneType.java @@ -6,12 +6,11 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Collection; -import javax.annotation.Nonnull; - public class PropertyStoneType extends PropertyHelper { private final ImmutableList allowedValues; @@ -29,15 +28,15 @@ public static PropertyStoneType create(String name, StoneType[] allowedValues) { return new PropertyStoneType(name, Arrays.asList(allowedValues)); } - @Nonnull + @NotNull @Override public ImmutableList getAllowedValues() { return allowedValues; } - @Nonnull + @NotNull @Override - public Optional parseValue(@Nonnull String value) { + public Optional parseValue(@NotNull String value) { StoneType stoneType = StoneType.STONE_TYPE_REGISTRY.getObject(value); if (stoneType != null && this.allowedValues.contains(stoneType)) { return Optional.of(stoneType); @@ -45,7 +44,7 @@ public Optional parseValue(@Nonnull String value) { return Optional.absent(); } - @Nonnull + @NotNull @Override public String getName(StoneType stoneType) { return stoneType.name; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java index 9333e23a8bc..6d43ee9ab07 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregPlanks.java @@ -7,7 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class BlockGregPlanks extends VariantBlock { @@ -32,7 +32,7 @@ public enum BlockType implements IStringSerializable { this.name = name; } - @Nonnull + @NotNull @Override public String getName() { return this.name; diff --git a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java index 6fd4f614b81..acab4c9dd43 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockGregWoodSlab.java @@ -19,9 +19,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import java.util.Random; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Random; public abstract class BlockGregWoodSlab extends BlockSlab { @@ -39,7 +39,7 @@ public BlockGregWoodSlab() { this.useNeighborBrightness = true; } - @Nonnull + @NotNull @Override public IProperty getVariantProperty() { return VARIANT; @@ -50,26 +50,26 @@ public int damageDropped(IBlockState state) { return state.getValue(VARIANT).ordinal(); } - @Nonnull + @NotNull @Override - public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune) { + public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int fortune) { return Item.getItemFromBlock(MetaBlocks.WOOD_SLAB); } - @Nonnull + @NotNull @Override public String getTranslationKey(int meta) { return super.getTranslationKey() + "." + blockTypeFromMeta(meta).getName(); } - @Nonnull + @NotNull @Override public BlockGregPlanks.BlockType getTypeForItem(ItemStack stack) { return blockTypeFromMeta(stack.getMetadata()); } @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList items) { for (BlockGregPlanks.BlockType type : BlockGregPlanks.BlockType.values()) { items.add(new ItemStack(this, 1, type.ordinal())); } @@ -92,7 +92,7 @@ public boolean isDouble() { return false; } - @Nonnull + @NotNull @SuppressWarnings("deprecation") @Override public IBlockState getStateFromMeta(int meta) { @@ -110,15 +110,15 @@ public int getMetaFromState(IBlockState state) { return i; } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, HALF, VARIANT); } @Override - public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean doesSideBlockChestOpening(@NotNull IBlockState blockState, @NotNull IBlockAccess world, + @NotNull BlockPos pos, @NotNull EnumFacing side) { return false; } } @@ -135,7 +135,7 @@ public boolean isDouble() { return true; } - @Nonnull + @NotNull @SuppressWarnings("deprecation") @Override public IBlockState getStateFromMeta(int meta) { @@ -147,7 +147,7 @@ public int getMetaFromState(IBlockState state) { return state.getValue(VARIANT).ordinal(); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, VARIANT); diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java index 7c351a19ee5..533cf4249d2 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLeaves.java @@ -19,12 +19,11 @@ import net.minecraft.world.World; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.Random; -import javax.annotation.Nonnull; - public class BlockRubberLeaves extends BlockLeaves { public BlockRubberLeaves() { @@ -41,20 +40,22 @@ public EnumType getWoodType(int meta) { return null; } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, CHECK_DECAY, DECAYABLE); } @SuppressWarnings("deprecation") + @NotNull @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, - float hitZ, int meta, EntityLivingBase placer) { + public IBlockState getStateForPlacement(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull EnumFacing facing, + float hitX, float hitY, + float hitZ, int meta, @NotNull EntityLivingBase placer) { return this.getDefaultState().withProperty(DECAYABLE, false).withProperty(CHECK_DECAY, false); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { @@ -75,20 +76,20 @@ public int getMetaFromState(IBlockState state) { return meta; } - @Nonnull + @NotNull @Override - public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune) { + public Item getItemDropped(@NotNull IBlockState state, @NotNull Random rand, int fortune) { return Item.getItemFromBlock(MetaBlocks.RUBBER_SAPLING); } - @Nonnull + @NotNull @Override - public List onSheared(@Nonnull ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { + public List onSheared(@NotNull ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { return Lists.newArrayList(new ItemStack(this, 1, 0)); } @Override - @Nonnull + @NotNull public BlockRenderLayer getRenderLayer() { if (!fancyLeaves()) { return super.getRenderLayer(); @@ -97,7 +98,7 @@ public BlockRenderLayer getRenderLayer() { } @Override - public boolean isOpaqueCube(@Nonnull IBlockState state) { + public boolean isOpaqueCube(@NotNull IBlockState state) { if (!fancyLeaves()) { return super.isOpaqueCube(state); } @@ -105,8 +106,8 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) { } @Override - public boolean shouldSideBeRendered(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, - @Nonnull BlockPos pos, @Nonnull EnumFacing side) { + public boolean shouldSideBeRendered(@NotNull IBlockState blockState, @NotNull IBlockAccess blockAccess, + @NotNull BlockPos pos, @NotNull EnumFacing side) { if (!fancyLeaves()) { return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java index 60a17930696..bd89801a699 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberLog.java @@ -14,9 +14,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Random; public class BlockRubberLog extends BlockLog { @@ -31,13 +31,13 @@ public BlockRubberLog() { setHarvestLevel(ToolClasses.AXE, 0); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, LOG_AXIS, NATURAL); } - @Nonnull + @NotNull @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState() @@ -51,7 +51,7 @@ public int getMetaFromState(IBlockState state) { } @Override - public void getDrops(@Nonnull NonNullList drops, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, + public void getDrops(@NotNull NonNullList drops, @NotNull IBlockAccess world, @NotNull BlockPos pos, IBlockState state, int fortune) { Random rand = world instanceof World ? ((World) world).rand : RANDOM; if (state.getValue(NATURAL)) { diff --git a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java index 2c17b442f62..cd9b35d8232 100644 --- a/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java +++ b/src/main/java/gregtech/common/blocks/wood/BlockRubberSapling.java @@ -14,9 +14,9 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; -import java.util.Random; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Random; import static net.minecraft.block.BlockSapling.STAGE; @@ -33,14 +33,14 @@ public BlockRubberSapling() { setSoundType(SoundType.PLANT); } - @Nonnull + @NotNull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, STAGE); } @Override - public void updateTick(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) { + public void updateTick(World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, @NotNull Random rand) { if (!worldIn.isRemote) { super.updateTick(worldIn, pos, state, rand); if (!worldIn.isAreaLoaded(pos, 1)) @@ -52,7 +52,7 @@ public void updateTick(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockStat } @Override - @Nonnull + @NotNull @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(STAGE, (meta & 8) >> 3); @@ -65,40 +65,40 @@ public int getMetaFromState(IBlockState state) { return i; } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockAccess source, - @Nonnull BlockPos pos) { + public AxisAlignedBB getBoundingBox(@NotNull IBlockState state, @NotNull IBlockAccess source, + @NotNull BlockPos pos) { return SAPLING_AABB; } @Override - public boolean canGrow(@Nonnull World world, @Nonnull BlockPos blockPos, @Nonnull IBlockState iBlockState, + public boolean canGrow(@NotNull World world, @NotNull BlockPos blockPos, @NotNull IBlockState iBlockState, boolean b) { return true; } @Override - public boolean canUseBonemeal(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos blockPos, - @Nonnull IBlockState iBlockState) { + public boolean canUseBonemeal(@NotNull World world, @NotNull Random random, @NotNull BlockPos blockPos, + @NotNull IBlockState iBlockState) { return true; } @Override - public boolean canBeReplacedByLeaves(@Nonnull IBlockState state, @Nonnull IBlockAccess world, - @Nonnull BlockPos pos) { + public boolean canBeReplacedByLeaves(@NotNull IBlockState state, @NotNull IBlockAccess world, + @NotNull BlockPos pos) { return true; } @Override - public void grow(@Nonnull World worldIn, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void grow(@NotNull World worldIn, @NotNull Random rand, @NotNull BlockPos pos, @NotNull IBlockState state) { WorldGenRubberTree.TREE_GROW_INSTANCE.grow(worldIn, pos, rand); } @Override - @Nonnull - public EnumPlantType getPlantType(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) { + @NotNull + public EnumPlantType getPlantType(@NotNull IBlockAccess world, @NotNull BlockPos pos) { return EnumPlantType.Plains; } } diff --git a/src/main/java/gregtech/common/command/CommandHand.java b/src/main/java/gregtech/common/command/CommandHand.java index 8a847ef8be2..2469856d0cc 100644 --- a/src/main/java/gregtech/common/command/CommandHand.java +++ b/src/main/java/gregtech/common/command/CommandHand.java @@ -28,27 +28,27 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import java.util.Set; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Set; public class CommandHand extends CommandBase { - @Nonnull + @NotNull @Override public String getName() { return "hand"; } - @Nonnull + @NotNull @Override - public String getUsage(@Nonnull ICommandSender sender) { + public String getUsage(@NotNull ICommandSender sender) { return "gregtech.command.hand.usage"; } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, - @Nonnull String[] args) throws CommandException { + public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, + @NotNull String[] args) throws CommandException { if (sender instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) sender; ItemStack stackInHand = player.getHeldItemMainhand(); diff --git a/src/main/java/gregtech/common/command/CommandRecipeCheck.java b/src/main/java/gregtech/common/command/CommandRecipeCheck.java index 68f6d17f513..5ca03112db5 100644 --- a/src/main/java/gregtech/common/command/CommandRecipeCheck.java +++ b/src/main/java/gregtech/common/command/CommandRecipeCheck.java @@ -35,6 +35,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -42,24 +43,22 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class CommandRecipeCheck extends CommandBase { - @Nonnull + @NotNull @Override public String getName() { return "recipecheck"; } - @Nonnull + @NotNull @Override - public String getUsage(@Nonnull ICommandSender sender) { + public String getUsage(@NotNull ICommandSender sender) { return "gregtech.command.util.recipecheck.usage"; } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) { + public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, @NotNull String[] args) { sender.sendMessage(new TextComponentTranslation("gregtech.command.recipecheck.begin")); Object2ObjectOpenHashMap, Object2ObjectOpenHashMap>> mismatchedRecipes = new Object2ObjectOpenHashMap<>(); diff --git a/src/main/java/gregtech/common/command/CommandShaders.java b/src/main/java/gregtech/common/command/CommandShaders.java index ced67002537..a877a50f5b3 100644 --- a/src/main/java/gregtech/common/command/CommandShaders.java +++ b/src/main/java/gregtech/common/command/CommandShaders.java @@ -9,25 +9,25 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentString; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CommandShaders extends CommandBase { @Override - @Nonnull + @NotNull public String getName() { return "reloadshaders"; } @Override - @Nonnull - public String getUsage(@Nonnull ICommandSender iCommandSender) { + @NotNull + public String getUsage(@NotNull ICommandSender iCommandSender) { return "Reload GTCEu Shaders"; } @Override - public void execute(@Nonnull MinecraftServer minecraftServer, @Nonnull ICommandSender iCommandSender, - @Nonnull String[] strings) { + public void execute(@NotNull MinecraftServer minecraftServer, @NotNull ICommandSender iCommandSender, + String @NotNull [] strings) { if (iCommandSender instanceof EntityPlayerMP) { GregTechAPI.networkHandler.sendTo(new PacketReloadShaders(), (EntityPlayerMP) iCommandSender); iCommandSender.sendMessage(new TextComponentString("Reloaded Shaders")); diff --git a/src/main/java/gregtech/common/command/worldgen/CommandWorldgen.java b/src/main/java/gregtech/common/command/worldgen/CommandWorldgen.java index 6fa770fd613..5f38a54e9c2 100644 --- a/src/main/java/gregtech/common/command/worldgen/CommandWorldgen.java +++ b/src/main/java/gregtech/common/command/worldgen/CommandWorldgen.java @@ -3,7 +3,7 @@ import net.minecraft.command.ICommandSender; import net.minecraftforge.server.command.CommandTreeBase; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CommandWorldgen extends CommandTreeBase { @@ -11,7 +11,7 @@ public CommandWorldgen() { addSubcommand(new CommandWorldgenReload()); } - @Nonnull + @NotNull @Override public String getName() { return "worldgen"; @@ -22,9 +22,9 @@ public int getRequiredPermissionLevel() { return 3; } - @Nonnull + @NotNull @Override - public String getUsage(@Nonnull ICommandSender sender) { + public String getUsage(@NotNull ICommandSender sender) { return "gregtech.command.worldgen.usage"; } } diff --git a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java index db35254e038..d8021ad42a6 100644 --- a/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java +++ b/src/main/java/gregtech/common/command/worldgen/CommandWorldgenReload.java @@ -10,26 +10,26 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import java.io.IOException; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.io.IOException; public class CommandWorldgenReload extends CommandBase { - @Nonnull + @NotNull @Override public String getName() { return "reload"; } - @Nonnull + @NotNull @Override - public String getUsage(@Nonnull ICommandSender sender) { + public String getUsage(@NotNull ICommandSender sender) { return "gregtech.command.worldgen.reload.usage"; } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) { + public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, String @NotNull [] args) { try { WorldGenRegistry.INSTANCE.reinitializeRegisteredVeins(); sender.sendMessage(new TextComponentTranslation("gregtech.command.worldgen.reload.success") diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index c92346bafcc..1408ae77c56 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -50,8 +50,6 @@ import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; - public class CoverConveyor extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -368,8 +366,8 @@ public GroupItemInfo(Object filterSlot, Set itemStackTypes, int total } } - @Nonnull - protected Map countInventoryItemsByType(@Nonnull IItemHandler inventory) { + @NotNull + protected Map countInventoryItemsByType(@NotNull IItemHandler inventory) { Map result = new Object2ObjectOpenCustomHashMap<>( ItemStackHashStrategy.comparingAllButCount()); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { @@ -395,8 +393,8 @@ protected Map countInventoryItemsByType(@Nonnull IItemH return result; } - @Nonnull - protected Map countInventoryItemsByMatchSlot(@Nonnull IItemHandler inventory) { + @NotNull + protected Map countInventoryItemsByMatchSlot(@NotNull IItemHandler inventory) { Map result = new Object2ObjectOpenHashMap<>(); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { ItemStack itemStack = inventory.getStackInSlot(srcIndex); @@ -600,7 +598,7 @@ public enum ConveyorMode implements IStringSerializable, IIOMode { this.localeName = localeName; } - @Nonnull + @NotNull @Override public String getName() { return localeName; @@ -618,9 +616,9 @@ public CoverableItemHandlerWrapper(IItemHandler delegate) { super(delegate); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (conveyorMode == ConveyorMode.EXPORT && manualImportExportMode == ManualImportExportMode.DISABLED) { return stack; } @@ -631,7 +629,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate return super.insertItem(slot, stack, simulate); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (conveyorMode == ConveyorMode.IMPORT && manualImportExportMode == ManualImportExportMode.DISABLED) { diff --git a/src/main/java/gregtech/common/covers/CoverFluidFilter.java b/src/main/java/gregtech/common/covers/CoverFluidFilter.java index 0e8fa374c0a..c746215c983 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidFilter.java +++ b/src/main/java/gregtech/common/covers/CoverFluidFilter.java @@ -33,8 +33,7 @@ import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class CoverFluidFilter extends CoverBase implements CoverWithUI { @@ -123,7 +122,7 @@ public T getCapability(@NotNull Capability capability, T defaultValue) { } @Override - public void writeToNBT(NBTTagCompound tagCompound) { + public void writeToNBT(@NotNull NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setInteger("FilterMode", this.filterMode.ordinal()); tagCompound.setBoolean("IsBlacklist", this.fluidFilter.isBlacklistFilter()); @@ -133,7 +132,7 @@ public void writeToNBT(NBTTagCompound tagCompound) { } @Override - public void readFromNBT(NBTTagCompound tagCompound) { + public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.filterMode = FluidFilterMode.values()[tagCompound.getInteger("FilterMode")]; this.fluidFilter.setBlacklistFilter(tagCompound.getBoolean("IsBlacklist")); diff --git a/src/main/java/gregtech/common/covers/CoverItemFilter.java b/src/main/java/gregtech/common/covers/CoverItemFilter.java index b427397432f..656fe17f5d8 100644 --- a/src/main/java/gregtech/common/covers/CoverItemFilter.java +++ b/src/main/java/gregtech/common/covers/CoverItemFilter.java @@ -34,8 +34,6 @@ import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - public class CoverItemFilter extends CoverBase implements CoverWithUI { protected final String titleLocale; @@ -151,16 +149,16 @@ public ItemHandlerFiltered(IItemHandler delegate) { super(delegate); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (getFilterMode() == ItemFilterMode.FILTER_EXTRACT || !itemFilter.testItemStack(stack)) { return stack; } return super.insertItem(slot, stack, simulate); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (getFilterMode() != ItemFilterMode.FILTER_INSERT) { diff --git a/src/main/java/gregtech/common/covers/CoverItemVoiding.java b/src/main/java/gregtech/common/covers/CoverItemVoiding.java index d0119f6939f..9a515b670d3 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoiding.java @@ -28,8 +28,6 @@ import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - public class CoverItemVoiding extends CoverConveyor { protected final NullItemHandler nullItemHandler = new NullItemHandler(); @@ -130,22 +128,22 @@ public int getSlots() { return 9; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (!itemFilterContainer.testItemStack(stack)) { return stack; } return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; diff --git a/src/main/java/gregtech/common/covers/CoverMachineController.java b/src/main/java/gregtech/common/covers/CoverMachineController.java index 58532319279..8814da16ca4 100644 --- a/src/main/java/gregtech/common/covers/CoverMachineController.java +++ b/src/main/java/gregtech/common/covers/CoverMachineController.java @@ -26,8 +26,6 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public class CoverMachineController extends CoverBase implements CoverWithUI { private int minRedstoneStrength; @@ -261,7 +259,7 @@ public enum ControllerMode implements IStringSerializable { this.side = side; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index b0e9018f396..ebd53eefe50 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -39,13 +39,11 @@ import codechicken.lib.vec.Matrix4; import com.google.common.math.IntMath; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.Function; import java.util.function.IntSupplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class CoverPump extends CoverBase implements CoverWithUI, ITickable, IControllable { public final int tier; @@ -367,7 +365,7 @@ public enum PumpMode implements IStringSerializable, IIOMode { this.localeName = localeName; } - @Nonnull + @NotNull @Override public String getName() { return localeName; @@ -390,7 +388,7 @@ public enum BucketMode implements IStringSerializable { this.localeName = localeName; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/DistributionMode.java b/src/main/java/gregtech/common/covers/DistributionMode.java index 0372f3c1540..24268bdc6a0 100644 --- a/src/main/java/gregtech/common/covers/DistributionMode.java +++ b/src/main/java/gregtech/common/covers/DistributionMode.java @@ -2,7 +2,7 @@ import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum DistributionMode implements IStringSerializable { @@ -16,7 +16,7 @@ public enum DistributionMode implements IStringSerializable { this.localeName = localeName; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/ManualImportExportMode.java b/src/main/java/gregtech/common/covers/ManualImportExportMode.java index 6c7218f62b3..d044322425c 100644 --- a/src/main/java/gregtech/common/covers/ManualImportExportMode.java +++ b/src/main/java/gregtech/common/covers/ManualImportExportMode.java @@ -2,7 +2,7 @@ import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum ManualImportExportMode implements IStringSerializable { @@ -16,7 +16,7 @@ public enum ManualImportExportMode implements IStringSerializable { this.localeName = localeName; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/TransferMode.java b/src/main/java/gregtech/common/covers/TransferMode.java index 69e47b0e2cc..ebf708dfdf4 100644 --- a/src/main/java/gregtech/common/covers/TransferMode.java +++ b/src/main/java/gregtech/common/covers/TransferMode.java @@ -2,7 +2,7 @@ import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum TransferMode implements IStringSerializable { @@ -18,7 +18,7 @@ public enum TransferMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/VoidingMode.java b/src/main/java/gregtech/common/covers/VoidingMode.java index 7049f0031c6..48aa9d0b8de 100644 --- a/src/main/java/gregtech/common/covers/VoidingMode.java +++ b/src/main/java/gregtech/common/covers/VoidingMode.java @@ -2,7 +2,7 @@ import net.minecraft.util.IStringSerializable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum VoidingMode implements IStringSerializable { @@ -17,7 +17,7 @@ public enum VoidingMode implements IStringSerializable { this.maxStackSize = maxStackSize; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java index bae050fd172..95ebec138aa 100644 --- a/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java +++ b/src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java @@ -26,8 +26,6 @@ import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - public class CoverDetectorEnergyAdvanced extends CoverDetectorEnergy implements CoverWithUI { private static final int PADDING = 5, SIZE = 18; @@ -193,7 +191,7 @@ private int getLength() { } @Override - public void writeToNBT(@Nonnull NBTTagCompound tagCompound) { + public void writeToNBT(@NotNull NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setLong("maxEU", this.maxValue); tagCompound.setLong("minEU", this.minValue); @@ -202,7 +200,7 @@ public void writeToNBT(@Nonnull NBTTagCompound tagCompound) { } @Override - public void readFromNBT(@Nonnull NBTTagCompound tagCompound) { + public void readFromNBT(@NotNull NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); this.minValue = tagCompound.getLong("minEU"); this.maxValue = tagCompound.getLong("maxEU"); @@ -213,7 +211,7 @@ public void readFromNBT(@Nonnull NBTTagCompound tagCompound) { } // inverted here was saved using different key, now it is normalized but construction is for compatibility - private void readDeprecatedInvertedKeyFromNBT(@Nonnull NBTTagCompound tagCompound) { + private void readDeprecatedInvertedKeyFromNBT(@NotNull NBTTagCompound tagCompound) { String oldInvertedKey = "inverted"; if (!tagCompound.hasKey(NBT_KEY_IS_INVERTED) && tagCompound.hasKey(oldInvertedKey)) { setInverted(tagCompound.getBoolean(oldInvertedKey)); @@ -221,7 +219,7 @@ private void readDeprecatedInvertedKeyFromNBT(@Nonnull NBTTagCompound tagCompoun } @Override - public void writeInitialSyncData(@Nonnull PacketBuffer packetBuffer) { + public void writeInitialSyncData(@NotNull PacketBuffer packetBuffer) { super.writeInitialSyncData(packetBuffer); packetBuffer.writeLong(this.minValue); packetBuffer.writeLong(this.maxValue); @@ -230,7 +228,7 @@ public void writeInitialSyncData(@Nonnull PacketBuffer packetBuffer) { } @Override - public void readInitialSyncData(@Nonnull PacketBuffer packetBuffer) { + public void readInitialSyncData(@NotNull PacketBuffer packetBuffer) { super.readInitialSyncData(packetBuffer); this.minValue = packetBuffer.readLong(); this.maxValue = packetBuffer.readLong(); diff --git a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java index 85f663561a6..41beb67b6d6 100644 --- a/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/FluidFilterContainer.java @@ -12,11 +12,11 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.ItemStackHandler; +import org.jetbrains.annotations.NotNull; + import java.util.function.Consumer; import java.util.function.Supplier; -import javax.annotation.Nonnull; - public class FluidFilterContainer implements INBTSerializable { private final ItemStackHandler filterInventory; @@ -27,7 +27,7 @@ public FluidFilterContainer(IDirtyNotifiable dirtyNotifiable, int capacity) { this.filterInventory = new ItemStackHandler(1) { @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return FilterTypeRegistry.getFluidFilterForStack(stack) != null; } diff --git a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java index 21aaaa56b01..71be9ff14d3 100644 --- a/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/ItemFilterContainer.java @@ -12,9 +12,9 @@ import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.ItemStackHandler; -import java.util.function.Consumer; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.function.Consumer; public class ItemFilterContainer implements INBTSerializable { @@ -29,7 +29,7 @@ public ItemFilterContainer(IDirtyNotifiable dirtyNotifiable) { this.filterInventory = new ItemStackHandler(1) { @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return FilterTypeRegistry.getItemFilterForStack(stack) != null; } diff --git a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java index 16a62e6821e..c3abb86898e 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleFluidFilter.java @@ -10,9 +10,9 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import java.util.function.Consumer; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.function.Consumer; public class SimpleFluidFilter extends FluidFilter { diff --git a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java index df44ad98b78..a655d22f732 100644 --- a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java @@ -13,13 +13,12 @@ import net.minecraft.util.IStringSerializable; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.Map; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public class SmartItemFilter extends ItemFilter { private SmartFilteringMode filteringMode = SmartFilteringMode.ELECTROLYZER; @@ -132,7 +131,7 @@ public enum SmartFilteringMode implements IStringSerializable { this.recipeMap = recipeMap; } - @Nonnull + @NotNull @Override public String getName() { return localeName; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java index ac8b668d1d4..e9f9e0d625b 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/ImpossibleOreGlob.java @@ -3,7 +3,7 @@ import gregtech.api.util.oreglob.OreGlob; import gregtech.api.util.oreglob.OreGlobTextBuilder; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Simple implementation of oreglob that doesn't match anything. @@ -16,15 +16,15 @@ public static ImpossibleOreGlob getInstance() { return INSTANCE; } - @Nonnull + @NotNull @Override - public V visualize(@Nonnull V visualizer) { + public V visualize(@NotNull V visualizer) { NodeVisualizer.impossible(visualizer); return visualizer; } @Override - public boolean matches(@Nonnull String input) { + public boolean matches(@NotNull String input) { return false; } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java index 4d6fe44298d..5c7410b78e8 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeOreGlob.java @@ -5,8 +5,7 @@ import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import com.google.common.annotations.VisibleForTesting; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Node-based implementation of oreglob. @@ -15,7 +14,7 @@ public final class NodeOreGlob extends OreGlob { private final OreGlobNode root; - public NodeOreGlob(@Nonnull OreGlobNode root) { + public NodeOreGlob(@NotNull OreGlobNode root) { this.root = root; } @@ -24,15 +23,15 @@ public OreGlobNode getRoot() { return root; } - @Nonnull + @NotNull @Override - public V visualize(@Nonnull V visualizer) { + public V visualize(@NotNull V visualizer) { new NodeVisualizer(visualizer).visit(this.root); return visualizer; } @Override - public boolean matches(@Nonnull String input) { + public boolean matches(@NotNull String input) { return new NodeInterpreter(input).evaluate(this.root).isMatch(); } } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java index f779cc94429..0e114d0d48f 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualXMLHandler.java @@ -5,15 +5,14 @@ import net.minecraft.util.text.TextFormatting; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - final class NodeVisualXMLHandler extends DefaultHandler { private final OreGlobTextBuilder builder; @@ -22,7 +21,7 @@ final class NodeVisualXMLHandler extends DefaultHandler { @Nullable private Formatting lastAppliedFormatting; - NodeVisualXMLHandler(@Nonnull OreGlobTextBuilder builder) { + NodeVisualXMLHandler(@NotNull OreGlobTextBuilder builder) { this.builder = builder; } @@ -76,7 +75,7 @@ private Formatting getActiveFormatting() { return this.formatStack.isEmpty() ? null : this.formatStack.get(this.formatStack.size() - 1); } - private void pushFormatting(@Nonnull VisualizationHint hint) { + private void pushFormatting(@NotNull VisualizationHint hint) { Formatting prev = getActiveFormatting(); TextFormatting color = this.builder.getFormatting().getFormat(hint); @@ -109,7 +108,7 @@ private void applyFormatting() { this.lastAppliedFormatting = formatting; } - private void appendXmlError(@Nonnull String text) { + private void appendXmlError(@NotNull String text) { pushFormatting(VisualizationHint.ERROR); applyFormatting(); this.builder.getStringBuilder().append("** ").append(text).append(" **"); @@ -129,7 +128,7 @@ private Formatting(@Nullable VisualizationHint visualizationHint, @Nullable Text this.format = format; } - public void apply(@Nonnull StringBuilder stringBuilder) { + public void apply(@NotNull StringBuilder stringBuilder) { stringBuilder.append(format); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java index 448ebc176ff..f608a6bb3b3 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/NodeVisualizer.java @@ -7,6 +7,7 @@ import gregtech.common.covers.filter.oreglob.node.NodeVisitor; import gregtech.common.covers.filter.oreglob.node.OreGlobNode; +import org.jetbrains.annotations.Nullable; import org.xml.sax.SAXException; import java.io.ByteArrayInputStream; @@ -14,7 +15,6 @@ import java.nio.charset.StandardCharsets; import java.util.List; -import javax.annotation.Nullable; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java index 602cde45011..0bc564d69db 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/impl/OreGlobParser.java @@ -5,11 +5,11 @@ import gregtech.common.covers.filter.oreglob.node.OreGlobNode; import gregtech.common.covers.filter.oreglob.node.OreGlobNodes; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.common.covers.filter.oreglob.impl.OreGlobParser.TokenType.*; /** diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java index 173153d242d..db7b11f49a8 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/AnyCharNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class AnyCharNode extends OreGlobNode { @@ -22,7 +22,7 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof AnyCharNode o && this.amount == o.amount && this.more == o.more; } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java index b7b856756f2..3671380a198 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/BranchNode.java @@ -1,8 +1,8 @@ package gregtech.common.covers.filter.oreglob.node; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; class BranchNode extends OreGlobNode { @@ -56,7 +56,7 @@ protected MatchDescription getIndividualNodeMatchDescription() { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { if (!(node instanceof BranchNode br)) return false; if (this.type != br.type) return false; if (this.expressions.size() != br.expressions.size()) return false; diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java index 0e230a89fbf..1413354365a 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/EmptyNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class EmptyNode extends OreGlobNode { @@ -11,7 +11,7 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof EmptyNode; } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java index 9512c963b3a..7bd2396dfd0 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/ErrorNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class ErrorNode extends OreGlobNode { @@ -10,12 +10,12 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isStructurallyEqualTo(@Nonnull OreGlobNode node) { // removed inverted flag check + public boolean isStructurallyEqualTo(@NotNull OreGlobNode node) { // removed inverted flag check return this == node || node instanceof ErrorNode && isStructurallyEqualTo(this.getNext(), node.getNext()); } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof ErrorNode; } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java index eb82a23d985..a34d0c1bff7 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/EverythingNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class EverythingNode extends OreGlobNode { @@ -11,7 +11,7 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof EverythingNode; } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java index 096d864e8e2..76062821691 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/GroupNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class GroupNode extends OreGlobNode { @@ -16,7 +16,7 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof GroupNode groupNode && this.node.isStructurallyEqualTo(groupNode.node); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java index a507466f9aa..a331ac631ec 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/MatchNode.java @@ -1,6 +1,6 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; class MatchNode extends OreGlobNode { @@ -18,7 +18,7 @@ public void visit(NodeVisitor visitor) { } @Override - public boolean isPropertyEqualTo(@Nonnull OreGlobNode node) { + public boolean isPropertyEqualTo(@NotNull OreGlobNode node) { return node instanceof MatchNode match && (this.ignoreCase ? this.match.equalsIgnoreCase(match.match) : this.match.equals(match.match)); } diff --git a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java index 886fef9a830..6df91dc5a53 100644 --- a/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java +++ b/src/main/java/gregtech/common/covers/filter/oreglob/node/OreGlobNode.java @@ -1,7 +1,7 @@ package gregtech.common.covers.filter.oreglob.node; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Syntax tree representation of ore expression. @@ -63,7 +63,7 @@ final void setNegated(boolean negated) { * @param node The node to check * @return Whether this node shares same structure and content with given node */ - public boolean isStructurallyEqualTo(@Nonnull OreGlobNode node) { + public boolean isStructurallyEqualTo(@NotNull OreGlobNode node) { if (this == node) return true; if (this.isNegated() != node.isNegated()) return false; return isPropertyEqualTo(node) && isStructurallyEqualTo(this.getNext(), node.getNext()); @@ -90,7 +90,7 @@ public final boolean is(MatchDescription description) { * @param node The node to check * @return Whether this node has same type and property with given node */ - public abstract boolean isPropertyEqualTo(@Nonnull OreGlobNode node); + public abstract boolean isPropertyEqualTo(@NotNull OreGlobNode node); /** * @return Match type of this specific node diff --git a/src/main/java/gregtech/common/crafting/FacadeRecipe.java b/src/main/java/gregtech/common/crafting/FacadeRecipe.java index ec4d0ca26d9..2e514e93d7f 100644 --- a/src/main/java/gregtech/common/crafting/FacadeRecipe.java +++ b/src/main/java/gregtech/common/crafting/FacadeRecipe.java @@ -13,8 +13,8 @@ import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class FacadeRecipe extends IForgeRegistryEntry.Impl implements IRecipe { @@ -29,7 +29,7 @@ public FacadeRecipe(ResourceLocation group, Ingredient plateIngredient, int faca } @Override - public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { + public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { boolean[] matched = new boolean[ingredients.size()]; mainLoop: for (int i = 0; i < inv.getSizeInventory(); i++) { @@ -50,9 +50,9 @@ public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { return true; } - @Nonnull + @NotNull @Override - public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { + public ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { ItemStack resultStack = getRecipeOutput(); ItemStack facadeStack = ItemStack.EMPTY; for (int i = 0; i < inv.getSizeInventory(); i++) { @@ -67,13 +67,13 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { return resultStack; } - @Nonnull + @NotNull @Override public ItemStack getRecipeOutput() { return resultStack.copy(); } - @Nonnull + @NotNull @Override public NonNullList getIngredients() { return this.ingredients; @@ -89,7 +89,7 @@ public boolean isDynamic() { return true; } - @Nonnull + @NotNull @Override public String getGroup() { return group == null ? "" : group.toString(); diff --git a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java index 4a25c6e238d..f3addd44339 100644 --- a/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/FluidReplaceRecipe.java @@ -14,20 +14,20 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * A recipe which inputs a single Fluid Container, and outputs the same Fluid Container with a new contained Fluid */ public class FluidReplaceRecipe extends GTShapedOreRecipe { - public FluidReplaceRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { + public FluidReplaceRecipe(boolean isClearing, ResourceLocation group, @NotNull ItemStack result, Object... recipe) { super(isClearing, group, result, recipe); } - @Nonnull + @NotNull @Override - public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { + public NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { if (isClearing) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); } else { @@ -44,9 +44,9 @@ public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) } } - @Nonnull + @NotNull @Override - public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { + public ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { IFluidHandlerItem recipeCap = output.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (recipeCap == null) throw new IllegalStateException("FluidReplaceRecipe output did not have an IFluidHandlerItem capability"); @@ -101,7 +101,7 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { return ItemStack.EMPTY; } - private static boolean isBucket(@Nonnull Item item) { + private static boolean isBucket(@NotNull Item item) { return item == Items.WATER_BUCKET || item == Items.LAVA_BUCKET || item == Items.MILK_BUCKET || item == ForgeModContainer.getInstance().universalBucket; } diff --git a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java index dcfdd434abf..8e60e1bd36c 100644 --- a/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java +++ b/src/main/java/gregtech/common/crafting/GTFluidCraftingIngredient.java @@ -6,7 +6,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class GTFluidCraftingIngredient extends Ingredient { diff --git a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java index c69e7c66b2b..a014bd89292 100644 --- a/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapedOreRecipe.java @@ -24,21 +24,20 @@ import com.google.common.collect.Sets; import com.google.gson.JsonElement; import com.google.gson.JsonSyntaxException; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Set; -import javax.annotation.Nonnull; - public class GTShapedOreRecipe extends ShapedOreRecipe { boolean isClearing; public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); - public GTShapedOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, Object... recipe) { + public GTShapedOreRecipe(boolean isClearing, ResourceLocation group, @NotNull ItemStack result, Object... recipe) { super(group, result, parseShaped(isClearing, recipe)); this.isClearing = isClearing; } @@ -165,7 +164,7 @@ else if (obj instanceof JsonElement) } @Override - public @Nonnull NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { + public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { if (isClearing) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); } else { diff --git a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java index 758976fd20d..6d0ee689b32 100644 --- a/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java +++ b/src/main/java/gregtech/common/crafting/GTShapelessOreRecipe.java @@ -20,19 +20,18 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import com.google.gson.JsonElement; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import javax.annotation.Nonnull; - public class GTShapelessOreRecipe extends ShapelessOreRecipe { boolean isClearing; public static Constructor ingredientNBT = ReflectionHelper.findConstructor(IngredientNBT.class, ItemStack.class); - public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @Nonnull ItemStack result, + public GTShapelessOreRecipe(boolean isClearing, ResourceLocation group, @NotNull ItemStack result, Object... recipe) { super(group, result); this.isClearing = isClearing; @@ -90,7 +89,7 @@ else if (obj instanceof JsonElement) } @Override - public @Nonnull NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { + public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { if (isClearing) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); } else { diff --git a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java index 535da4bc35d..90f1a36e43c 100644 --- a/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java +++ b/src/main/java/gregtech/common/crafting/ShapedOreEnergyTransferRecipe.java @@ -12,18 +12,18 @@ import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.oredict.ShapedOreRecipe; +import org.jetbrains.annotations.NotNull; + import java.util.Arrays; import java.util.Objects; import java.util.function.Predicate; -import javax.annotation.Nonnull; - public class ShapedOreEnergyTransferRecipe extends ShapedOreRecipe { private final Predicate chargePredicate; private final boolean transferMaxCharge; - public ShapedOreEnergyTransferRecipe(ResourceLocation group, @Nonnull ItemStack result, + public ShapedOreEnergyTransferRecipe(ResourceLocation group, @NotNull ItemStack result, Predicate chargePredicate, boolean overrideCharge, boolean transferMaxCharge, Object... recipe) { super(group, result, CraftingHelper.parseShaped(recipe)); @@ -50,9 +50,9 @@ private void fixOutputItemMaxCharge() { } } - @Nonnull + @NotNull @Override - public ItemStack getCraftingResult(@Nonnull InventoryCrafting inventoryCrafting) { + public ItemStack getCraftingResult(@NotNull InventoryCrafting inventoryCrafting) { ItemStack resultStack = super.getCraftingResult(inventoryCrafting); chargeStackFromComponents(resultStack, inventoryCrafting, chargePredicate, transferMaxCharge); return resultStack; diff --git a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java index 2bc3a7c9b86..617b549394b 100644 --- a/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java +++ b/src/main/java/gregtech/common/crafting/ToolHeadReplaceRecipe.java @@ -13,13 +13,13 @@ import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; - // basically a modified RecipeRepairItem public class ToolHeadReplaceRecipe extends IForgeRegistryEntry.Impl implements IRecipe { @@ -31,7 +31,7 @@ public static void setToolHeadForTool(OrePrefix toolHead, IGTTool tool) { } @Override - public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { + public boolean matches(@NotNull InventoryCrafting inv, @NotNull World world) { List list = new ArrayList<>(); for (int i = 0; i < inv.getSizeInventory(); i++) { @@ -66,9 +66,9 @@ public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { return false; } - @Nonnull + @NotNull @Override - public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { + public ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { List list = new ArrayList<>(); for (int i = 0; i < inv.getSizeInventory(); i++) { @@ -107,15 +107,15 @@ public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override public ItemStack getRecipeOutput() { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override - public NonNullList getRemainingItems(@Nonnull InventoryCrafting inv) { + public NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); } diff --git a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java index cb34ca111e2..8acea5527f7 100644 --- a/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java +++ b/src/main/java/gregtech/common/gui/widget/HighlightedTextField.java @@ -6,12 +6,11 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; +import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; import java.util.function.Supplier; -import javax.annotation.Nullable; - public class HighlightedTextField extends TextFieldWidget2 { @Nullable diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java index d21bc00b38f..b4ab7e87beb 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEFluidConfigSlot.java @@ -23,6 +23,7 @@ import appeng.api.storage.data.IAEFluidStack; import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.io.IOException; @@ -30,8 +31,6 @@ import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - import static gregtech.api.capability.GregtechDataCodes.LOAD_PHANTOM_FLUID_STACK_FROM_NBT; import static gregtech.api.util.GTUtility.getFluidFromContainer; @@ -208,14 +207,14 @@ public List> getPhantomTargets(Object ingredie rectangle.height /= 2; return Lists.newArrayList(new IGhostIngredientHandler.Target<>() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { FluidStack stack = getFluidFromContainer(ingredient); if (stack != null) { diff --git a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java index 7fba8bf1eae..02cad40272b 100644 --- a/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java +++ b/src/main/java/gregtech/common/gui/widget/appeng/slot/AEItemConfigSlot.java @@ -17,14 +17,13 @@ import appeng.api.storage.data.IAEItemStack; import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.io.IOException; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - /** * @Author GlodBlock * @Description A configurable slot for {@link IAEItemStack} @@ -167,14 +166,14 @@ public List> getPhantomTargets(Object ingredie rectangle.height /= 2; return Lists.newArrayList(new IGhostIngredientHandler.Target<>() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { if (ingredient instanceof ItemStack) { writeClientAction(UPDATE_ID, buf -> buf.writeItemStack((ItemStack) ingredient)); } diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java index ed75af27bd4..3dc7f19a512 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListGridWidget.java @@ -15,12 +15,11 @@ import net.minecraft.network.PacketBuffer; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.*; -import javax.annotation.Nullable; - public class ItemListGridWidget extends ScrollableListWidget { private static final Comparator COMPARATOR = Comparator.comparing( diff --git a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java index aeb7cb80ba7..f087b3d0708 100644 --- a/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java +++ b/src/main/java/gregtech/common/gui/widget/craftingstation/ItemListSlotWidget.java @@ -16,12 +16,12 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.text.TextFormatting; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.io.IOException; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ItemListSlotWidget extends Widget { private final ItemListGridWidget gridWidget; @@ -75,7 +75,7 @@ public void drawInForeground(int mouseX, int mouseY) { } } - private void setCreativeHeldItem(@Nonnull ItemStack itemStack) { + private void setCreativeHeldItem(@NotNull ItemStack itemStack) { InventoryPlayer inventory = gui.entityPlayer.inventory; if (!itemStack.isEmpty() && inventory.getItemStack().isEmpty()) { itemStack.setCount(itemStack.getMaxStackSize()); @@ -83,7 +83,7 @@ private void setCreativeHeldItem(@Nonnull ItemStack itemStack) { } } - private static int getAmountToTake(@Nonnull ItemStack itemStack, int maxAmount, int button) { + private static int getAmountToTake(@NotNull ItemStack itemStack, int maxAmount, int button) { int maxStackSize = Math.min(itemStack.getMaxStackSize(), maxAmount); return button == 0 ? maxStackSize : (maxStackSize >= 2 ? maxStackSize / 2 : 1); } @@ -153,7 +153,7 @@ private void handleMouseClick(@Nullable IItemInfo itemInfo, int button, boolean } } - private void handleSelfShiftClick(@Nonnull IItemInfo itemInfo) { + private void handleSelfShiftClick(@NotNull IItemInfo itemInfo) { ItemStack itemStack = itemInfo.getItemStack().copy(); itemStack.setCount(itemStack.getMaxStackSize()); int currentStackSize = itemStack.getCount(); diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java index ff2481feb9b..b30a48cd25d 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/ItemOreFilterTestSlot.java @@ -16,30 +16,29 @@ import com.google.common.collect.Lists; import mezz.jei.api.gui.IGhostIngredientHandler; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ItemOreFilterTestSlot extends OreFilterTestSlot implements IGhostIngredientTarget { - @Nonnull + @NotNull private ItemStack testStack = ItemStack.EMPTY; public ItemOreFilterTestSlot(int xPosition, int yPosition) { super(xPosition, yPosition); } - @Nonnull + @NotNull public ItemStack getTestStack() { return testStack; } - public void setTestStack(@Nonnull ItemStack testStack) { + public void setTestStack(@NotNull ItemStack testStack) { this.testStack = testStack; updatePreview(); } @@ -95,14 +94,14 @@ public List> getPhantomTargets(Object ingredie Rectangle rectangle = toRectangleBox(); return Lists.newArrayList(new IGhostIngredientHandler.Target() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { if (ingredient instanceof ItemStack) { putItem((ItemStack) ingredient); } diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java index b8a276ed17d..6bde8f6cb5b 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreFilterTestSlot.java @@ -19,6 +19,7 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.Collections; @@ -26,8 +27,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nullable; - /** * @author brachy84 */ diff --git a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java index 730ef11b13f..5edfff516f3 100644 --- a/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java +++ b/src/main/java/gregtech/common/gui/widget/orefilter/OreGlobCompileStatusWidget.java @@ -11,11 +11,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - public class OreGlobCompileStatusWidget extends Widget { @Nullable diff --git a/src/main/java/gregtech/common/inventory/IItemList.java b/src/main/java/gregtech/common/inventory/IItemList.java index 037db382c43..308d6478804 100644 --- a/src/main/java/gregtech/common/inventory/IItemList.java +++ b/src/main/java/gregtech/common/inventory/IItemList.java @@ -2,9 +2,9 @@ import net.minecraft.item.ItemStack; -import java.util.Set; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; +import java.util.Set; public interface IItemList { diff --git a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java index e47157302c0..2e6ac5ca429 100644 --- a/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java +++ b/src/main/java/gregtech/common/inventory/appeng/SerializableFluidList.java @@ -14,13 +14,12 @@ import appeng.fluids.util.MeaningfulFluidIterator; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; import java.util.Iterator; -import javax.annotation.Nonnull; - /** * @Author GlodBlock * @Description A serializable {@link IItemList} from AE2, specially improved for fluid. @@ -59,12 +58,12 @@ public boolean isEmpty() { return !this.iterator().hasNext(); } - private IAEFluidStack getOrCreateRecord(@Nonnull IAEFluidStack fluid) { + private IAEFluidStack getOrCreateRecord(@NotNull IAEFluidStack fluid) { return this.records.computeIfAbsent(fluid.getFluid(), key -> AEFluidStack.fromFluidStack(new FluidStack(key, 0))); } - private IAEFluidStack getRecord(@Nonnull IAEFluidStack fluid) { + private IAEFluidStack getRecord(@NotNull IAEFluidStack fluid) { return this.records.get(fluid.getFluid()); } diff --git a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java index e8eb21d9e3f..7fdd5a754ff 100644 --- a/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/CycleItemStackHandler.java @@ -4,7 +4,7 @@ import net.minecraft.util.NonNullList; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class CycleItemStackHandler extends ItemStackHandler { @@ -12,7 +12,7 @@ public CycleItemStackHandler(NonNullList stacks) { super(stacks); } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { return stacks.isEmpty() ? ItemStack.EMPTY : diff --git a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java index 22a0569b87a..4fd4729126b 100644 --- a/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/TapeItemStackHandler.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class TapeItemStackHandler extends GTItemStackHandler { @@ -15,8 +15,8 @@ public TapeItemStackHandler(MetaTileEntity metaTileEntity, int size) { } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (!stack.isEmpty() && stack.isItemEqual(MetaItems.DUCT_TAPE.getStackForm())) { return super.insertItem(slot, stack, simulate); } diff --git a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java index ab9191f8bfc..54a2d048ee1 100644 --- a/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java +++ b/src/main/java/gregtech/common/inventory/handlers/ToolItemStackHandler.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ToolItemStackHandler extends SingleItemStackHandler { @@ -14,8 +14,8 @@ public ToolItemStackHandler(int size) { } @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + @NotNull + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.getItem().getToolClasses(stack).isEmpty()) return stack; if (stack.getItem() instanceof IGTTool && ((IGTTool) stack.getItem()).getToolStats().isSuitableForCrafting(stack)) { diff --git a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java index 5c9d512059d..2119cefc655 100644 --- a/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java +++ b/src/main/java/gregtech/common/inventory/itemsource/ItemSources.java @@ -10,11 +10,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenCustomHashMap; +import org.jetbrains.annotations.Nullable; import java.util.*; -import javax.annotation.Nullable; - public class ItemSources implements IItemList { protected final World world; diff --git a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java index e2c8cadd6b5..d1044f3cbe8 100644 --- a/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java +++ b/src/main/java/gregtech/common/items/EnchantmentTableTweaks.java @@ -22,7 +22,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; @EventBusSubscriber(modid = GTValues.MODID) public class EnchantmentTableTweaks { @@ -88,7 +88,7 @@ public EnchantmentLapisSlot(Slot delegate) { } @Override - public boolean isItemValid(@Nonnull ItemStack stack) { + public boolean isItemValid(@NotNull ItemStack stack) { return super.isItemValid(stack) || isValidForEnchantment(stack); } } diff --git a/src/main/java/gregtech/common/items/ToolItems.java b/src/main/java/gregtech/common/items/ToolItems.java index f967aefd6e4..05e2453846b 100644 --- a/src/main/java/gregtech/common/items/ToolItems.java +++ b/src/main/java/gregtech/common/items/ToolItems.java @@ -16,11 +16,11 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public final class ToolItems { private static final List TOOLS = new ArrayList<>(); @@ -321,13 +321,13 @@ public static void init() { .markerItem(() -> ToolHelper.getAndSetToolData(PLUNGER, Materials.Rubber, 255, 1, 4F, 0F))); } - public static IGTTool register(@Nonnull ToolBuilder builder) { + public static IGTTool register(@NotNull ToolBuilder builder) { IGTTool tool = builder.build(); TOOLS.add(tool); return tool; } - public static IGTTool register(@Nonnull IGTTool tool) { + public static IGTTool register(@NotNull IGTTool tool) { TOOLS.add(tool); return tool; } diff --git a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java index ff3634b2110..2b54aa3f9b3 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedJetpack.java @@ -14,7 +14,7 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class AdvancedJetpack extends Jetpack { @@ -23,7 +23,7 @@ public AdvancedJetpack(int energyPerUse, long capacity, int tier) { } @Override - public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack item) { + public void onArmorTick(World world, EntityPlayer player, @NotNull ItemStack item) { IElectricItem cont = item.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (cont == null) { return; diff --git a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java index fae06b7281f..74c256262e8 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedNanoMuscleSuite.java @@ -20,12 +20,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; - public class AdvancedNanoMuscleSuite extends NanoMuscleSuite implements IJetpack { // A replacement for checking the current world time, to get around the gamerule that stops it @@ -37,7 +36,7 @@ public AdvancedNanoMuscleSuite(int energyPerUse, long capacity, int tier) { } @Override - public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack item) { + public void onArmorTick(World world, EntityPlayer player, @NotNull ItemStack item) { IElectricItem cont = item.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (cont == null) { return; @@ -158,7 +157,7 @@ public void addInfo(ItemStack itemStack, List lines) { } @Override - public ActionResult onRightClick(World world, @Nonnull EntityPlayer player, EnumHand hand) { + public ActionResult onRightClick(World world, @NotNull EntityPlayer player, EnumHand hand) { ItemStack armor = player.getHeldItem(hand); if (armor.getItem() instanceof ArmorMetaItem && player.isSneaking()) { @@ -220,7 +219,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo } @Override - public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { + public boolean canUseEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; @@ -228,7 +227,7 @@ public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public void drainEnergy(@Nonnull ItemStack stack, int amount) { + public void drainEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return; @@ -236,14 +235,14 @@ public void drainEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public boolean hasEnergy(@Nonnull ItemStack stack) { + public boolean hasEnergy(@NotNull ItemStack stack) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; return container.getCharge() > 0; } - private static IElectricItem getIElectricItem(@Nonnull ItemStack stack) { + private static IElectricItem getIElectricItem(@NotNull ItemStack stack) { return stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); } diff --git a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java index 755a1802b59..a0607a6e825 100644 --- a/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/AdvancedQuarkTechSuite.java @@ -22,12 +22,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; - public class AdvancedQuarkTechSuite extends QuarkTechSuite implements IJetpack { // A replacement for checking the current world time, to get around the gamerule that stops it @@ -217,7 +216,7 @@ public void drawHUD(ItemStack item) { } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); @@ -231,7 +230,7 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE; } @@ -247,7 +246,7 @@ public double getDamageAbsorption() { } @Override - public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { + public boolean canUseEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; @@ -255,7 +254,7 @@ public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public void drainEnergy(@Nonnull ItemStack stack, int amount) { + public void drainEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return; @@ -263,14 +262,14 @@ public void drainEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public boolean hasEnergy(@Nonnull ItemStack stack) { + public boolean hasEnergy(@NotNull ItemStack stack) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; return container.getCharge() > 0; } - private static IElectricItem getIElectricItem(@Nonnull ItemStack stack) { + private static IElectricItem getIElectricItem(@NotNull ItemStack stack) { return stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); } diff --git a/src/main/java/gregtech/common/items/armor/IJetpack.java b/src/main/java/gregtech/common/items/armor/IJetpack.java index eeb33f98260..1043a159db7 100644 --- a/src/main/java/gregtech/common/items/armor/IJetpack.java +++ b/src/main/java/gregtech/common/items/armor/IJetpack.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Logic from SimplyJetpacks2: @@ -59,7 +59,7 @@ default float getFallDamageReduction() { boolean hasEnergy(ItemStack stack); - default void performFlying(@Nonnull EntityPlayer player, boolean hover, ItemStack stack) { + default void performFlying(@NotNull EntityPlayer player, boolean hover, ItemStack stack) { double currentAccel = getVerticalAcceleration() * (player.motionY < 0.3D ? 2.5D : 1.0D); double currentSpeedVertical = getVerticalSpeed() * (player.isInWater() ? 0.4D : 1.0D); boolean flyKeyDown = KeyBind.VANILLA_JUMP.isKeyDown(player); diff --git a/src/main/java/gregtech/common/items/armor/IStepAssist.java b/src/main/java/gregtech/common/items/armor/IStepAssist.java index 9b4f57f9604..944c125737e 100644 --- a/src/main/java/gregtech/common/items/armor/IStepAssist.java +++ b/src/main/java/gregtech/common/items/armor/IStepAssist.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Logic from EnderIO: @@ -12,7 +12,7 @@ public interface IStepAssist { float MAGIC_STEP_HEIGHT = 1.0023f; - default void updateStepHeight(@Nonnull EntityPlayer player) { + default void updateStepHeight(@NotNull EntityPlayer player) { if (!player.isSneaking()) { if (player.stepHeight < MAGIC_STEP_HEIGHT) { player.stepHeight = MAGIC_STEP_HEIGHT; diff --git a/src/main/java/gregtech/common/items/armor/Jetpack.java b/src/main/java/gregtech/common/items/armor/Jetpack.java index de30fdda203..ec15c14df85 100644 --- a/src/main/java/gregtech/common/items/armor/Jetpack.java +++ b/src/main/java/gregtech/common/items/armor/Jetpack.java @@ -22,9 +22,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class Jetpack extends ArmorLogicSuite implements IJetpack { @@ -40,7 +40,7 @@ public Jetpack(int energyPerUse, long capacity, int tier) { } @Override - public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack stack) { + public void onArmorTick(World world, EntityPlayer player, @NotNull ItemStack stack) { NBTTagCompound data = GTUtility.getOrCreateNbtCompound(stack); byte toggleTimer = 0; boolean hover = false; @@ -69,7 +69,7 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack sta } @Override - public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { + public boolean canUseEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; @@ -77,7 +77,7 @@ public boolean canUseEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public void drainEnergy(@Nonnull ItemStack stack, int amount) { + public void drainEnergy(@NotNull ItemStack stack, int amount) { IElectricItem container = getIElectricItem(stack); if (container == null) return; @@ -85,14 +85,14 @@ public void drainEnergy(@Nonnull ItemStack stack, int amount) { } @Override - public boolean hasEnergy(@Nonnull ItemStack stack) { + public boolean hasEnergy(@NotNull ItemStack stack) { IElectricItem container = getIElectricItem(stack); if (container == null) return false; return container.getCharge() > 0; } - private static IElectricItem getIElectricItem(@Nonnull ItemStack stack) { + private static IElectricItem getIElectricItem(@NotNull ItemStack stack) { return stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); } @@ -102,7 +102,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { return new ArmorProperties(0, 0, 0); } diff --git a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java index a0c0f48d769..57be7d1acd4 100644 --- a/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java +++ b/src/main/java/gregtech/common/items/armor/NanoMuscleSuite.java @@ -25,9 +25,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { @@ -43,7 +43,7 @@ public NanoMuscleSuite(EntityEquipmentSlot slot, int energyPerUse, long maxCapac } @Override - public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack itemStack) { + public void onArmorTick(World world, EntityPlayer player, @NotNull ItemStack itemStack) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { return; @@ -89,7 +89,7 @@ public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack ite player.inventoryContainer.detectAndSendChanges(); } - public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { + public static void disableNightVision(@NotNull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); if (sendMsg) @@ -97,13 +97,13 @@ public static void disableNightVision(@Nonnull World world, EntityPlayer player, } } - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { return source == DamageSource.FALL; } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { IElectricItem container = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); int damageLimit = Integer.MAX_VALUE; diff --git a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java index 73597d10a39..d32d2b0c663 100644 --- a/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java +++ b/src/main/java/gregtech/common/items/armor/NightvisionGoggles.java @@ -17,9 +17,9 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class NightvisionGoggles extends ArmorLogicSuite { @@ -28,7 +28,7 @@ public NightvisionGoggles(int energyPerUse, long capacity, int voltageTier, Enti } @Override - public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull ItemStack itemStack) { + public void onArmorTick(World world, @NotNull EntityPlayer player, @NotNull ItemStack itemStack) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { return; @@ -75,7 +75,7 @@ public void onArmorTick(World world, @Nonnull EntityPlayer player, @Nonnull Item player.inventoryContainer.detectAndSendChanges(); } - public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { + public static void disableNightVision(@NotNull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); if (sendMsg) diff --git a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java index 51c089dece1..0f9e2867193 100644 --- a/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java +++ b/src/main/java/gregtech/common/items/armor/PowerlessJetpack.java @@ -35,15 +35,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.Collections; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class PowerlessJetpack implements ISpecialArmorLogic, IJetpack, IItemHUDProvider { public static final int tankCapacity = 16000; @@ -62,7 +61,7 @@ public PowerlessJetpack() { } @Override - public void onArmorTick(World world, EntityPlayer player, @Nonnull ItemStack stack) { + public void onArmorTick(World world, EntityPlayer player, @NotNull ItemStack stack) { IFluidHandlerItem internalTank = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (internalTank == null) @@ -110,7 +109,7 @@ public EntityEquipmentSlot getEquipmentSlot(ItemStack itemStack) { } @Override - public void addToolComponents(@Nonnull ArmorMetaValueItem mvi) { + public void addToolComponents(@NotNull ArmorMetaValueItem mvi) { mvi.addComponents(new Behaviour(tankCapacity)); } @@ -121,7 +120,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo @SideOnly(Side.CLIENT) @Override - public void drawHUD(@Nonnull ItemStack item) { + public void drawHUD(@NotNull ItemStack item) { IFluidHandlerItem tank = item.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (tank != null) { IFluidTankProperties[] prop = tank.getTankProperties(); @@ -187,11 +186,11 @@ public boolean hasEnergy(ItemStack stack) { return burnTimer > 0 || currentRecipe != null; } - private static IFluidHandlerItem getIFluidHandlerItem(@Nonnull ItemStack stack) { + private static IFluidHandlerItem getIFluidHandlerItem(@NotNull ItemStack stack) { return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); } - public void findNewRecipe(@Nonnull ItemStack stack) { + public void findNewRecipe(@NotNull ItemStack stack) { IFluidHandlerItem internalTank = getIFluidHandlerItem(stack); if (internalTank != null) { FluidStack fluidStack = internalTank.drain(1, false); @@ -243,8 +242,8 @@ public ActionResult onRightClick(World world, EntityPlayer player, En } @Override - public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, - @Nonnull DamageSource source, double damage, + public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, + @NotNull DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = (int) Math.min(Integer.MAX_VALUE, burnTimer * 1.0 / 32 * 25.0); if (source.isUnblockable()) return new ISpecialArmor.ArmorProperties(0, 0.0, 0); @@ -252,7 +251,7 @@ public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @Non } @Override - public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) { + public int getArmorDisplay(EntityPlayer player, @NotNull ItemStack armor, int slot) { return 0; } @@ -261,7 +260,7 @@ public class Behaviour implements IItemDurabilityManager, IItemCapabilityProvide private static final IFilter JETPACK_FUEL_FILTER = new IFilter<>() { @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { return RecipeMaps.COMBUSTION_GENERATOR_FUELS.find(Collections.emptyList(), Collections.singletonList(fluidStack), (Objects::nonNull)) != null; } @@ -281,7 +280,7 @@ public Behaviour(int internalCapacity) { } @Override - public double getDurabilityForDisplay(@Nonnull ItemStack itemStack) { + public double getDurabilityForDisplay(@NotNull ItemStack itemStack) { IFluidHandlerItem fluidHandlerItem = itemStack .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); if (fluidHandlerItem == null) return 0; diff --git a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java index 93b914363ce..c485f9b3e00 100644 --- a/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java +++ b/src/main/java/gregtech/common/items/armor/QuarkTechSuite.java @@ -29,13 +29,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; + import java.util.IdentityHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; - public class QuarkTechSuite extends ArmorLogicSuite implements IStepAssist { protected static final Map potionRemovalCost = new IdentityHashMap<>(); @@ -228,7 +228,7 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { } } - public static void disableNightVision(@Nonnull World world, EntityPlayer player, boolean sendMsg) { + public static void disableNightVision(@NotNull World world, EntityPlayer player, boolean sendMsg) { if (!world.isRemote) { player.removePotionEffect(MobEffects.NIGHT_VISION); if (sendMsg) @@ -237,7 +237,7 @@ public static void disableNightVision(@Nonnull World world, EntityPlayer player, } @Override - public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, + public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { int damageLimit = Integer.MAX_VALUE; IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); @@ -261,14 +261,14 @@ public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack } @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, + public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, double damage, EntityEquipmentSlot equipmentSlot) { return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && source != DamageSource.OUT_OF_WORLD; } @Override - public void damageArmor(EntityLivingBase entity, @Nonnull ItemStack itemStack, DamageSource source, int damage, + public void damageArmor(EntityLivingBase entity, @NotNull ItemStack itemStack, DamageSource source, int damage, EntityEquipmentSlot equipmentSlot) { IElectricItem item = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (item == null) { diff --git a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java index 9e110edccb3..a4abe287529 100644 --- a/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/AbstractMaterialPartBehavior.java @@ -15,9 +15,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants.NBT; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public abstract class AbstractMaterialPartBehavior implements IItemBehaviour, IItemDurabilityManager, IItemColorProvider, IItemNameProvider { @@ -44,7 +44,7 @@ public static Material getPartMaterial(ItemStack itemStack) { return material; } - public static void setPartMaterial(ItemStack itemStack, @Nonnull Material material) { + public static void setPartMaterial(ItemStack itemStack, @NotNull Material material) { if (!material.hasProperty(PropertyKey.INGOT)) throw new IllegalArgumentException("Part material must have an Ingot!"); NBTTagCompound compound = getOrCreatePartStatsTag(itemStack); diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index a3b48ebc133..6cda26f8ce5 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -28,12 +28,11 @@ import appeng.api.util.AEColor; import appeng.tile.networking.TileCableBus; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.List; -import javax.annotation.Nullable; - public class ColorSprayBehaviour extends AbstractUsableBehaviour implements IItemDurabilityManager { private final ItemStack empty; diff --git a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java index 04532515be4..7be90f4d9ff 100644 --- a/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/DataItemBehavior.java @@ -11,12 +11,11 @@ import net.minecraft.item.ItemStack; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; - public class DataItemBehavior implements IItemBehaviour, IDataItem { private final boolean requireDataBank; @@ -35,7 +34,7 @@ public boolean requireDataBank() { } @Override - public void addInformation(@Nonnull ItemStack itemStack, List lines) { + public void addInformation(@NotNull ItemStack itemStack, List lines) { String researchId = AssemblyLineManager.readResearchId(itemStack); if (researchId == null) return; Collection recipes = ((IResearchRecipeMap) RecipeMaps.ASSEMBLY_LINE_RECIPES) diff --git a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java index 8d8d7541a25..7a059220e34 100644 --- a/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/FoamSprayerBehavior.java @@ -28,6 +28,7 @@ import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.ArrayList; @@ -35,8 +36,6 @@ import java.util.List; import java.util.Set; -import javax.annotation.Nullable; - public class FoamSprayerBehavior implements IItemCapabilityProvider, IItemDurabilityManager, IItemBehaviour, ISubItemHandler { diff --git a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java index 8d12bdc0f9b..15a3ebc2599 100644 --- a/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java @@ -29,9 +29,9 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class ItemMagnetBehavior implements IItemBehaviour { @@ -45,7 +45,7 @@ public ItemMagnetBehavior(int range) { } @Override - public ActionResult onItemRightClick(World world, @Nonnull EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, @NotNull EntityPlayer player, EnumHand hand) { if (!player.world.isRemote && player.isSneaking()) { player.sendStatusMessage(new TextComponentTranslation(toggleActive(player.getHeldItem(hand)) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); @@ -158,7 +158,7 @@ public void onUpdate(ItemStack stack, Entity entity) { } @SubscribeEvent - public void onItemToss(@Nonnull ItemTossEvent event) { + public void onItemToss(@NotNull ItemTossEvent event) { if (event.getPlayer() == null) return; IInventory inventory = event.getPlayer().inventory; @@ -175,7 +175,7 @@ public void onItemToss(@Nonnull ItemTossEvent event) { } } - private boolean isMagnet(@Nonnull ItemStack stack) { + private boolean isMagnet(@NotNull ItemStack stack) { if (stack.getItem() instanceof MetaItemmetaItem) { for (var behavior : metaItem.getBehaviours(stack)) { if (behavior instanceof ItemMagnetBehavior) { @@ -186,7 +186,7 @@ private boolean isMagnet(@Nonnull ItemStack stack) { return false; } - private static boolean drainEnergy(boolean simulate, @Nonnull ItemStack stack, long amount) { + private static boolean drainEnergy(boolean simulate, @NotNull ItemStack stack, long amount) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem == null) return false; diff --git a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java index 807453d3333..4e1f14cfa61 100644 --- a/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/LighterBehaviour.java @@ -33,13 +33,12 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class LighterBehaviour implements IItemBehaviour, IItemDurabilityManager, ISubItemHandler { private static final String LIGHTER_OPEN = "lighterOpen"; @@ -90,7 +89,7 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity en } @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, BlockPos pos, + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound compound = GTUtility.getOrCreateNbtCompound(stack); @@ -126,7 +125,7 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(ItemStack itemStack, @Nonnull List lines) { + public void addInformation(ItemStack itemStack, @NotNull List lines) { lines.add(I18n.format(usesFluid ? "behaviour.lighter.fluid.tooltip" : "behaviour.lighter.tooltip")); if (hasMultipleUses && !usesFluid) { lines.add(I18n.format("behaviour.lighter.uses", getUsesLeft(itemStack))); @@ -147,7 +146,7 @@ public boolean consumeFuel(EntityPlayer entity, ItemStack stack) { return false; } - private int getUsesLeft(@Nonnull ItemStack stack) { + private int getUsesLeft(@NotNull ItemStack stack) { if (usesFluid) { IFluidHandlerItem fluidHandlerItem = stack .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); @@ -169,7 +168,7 @@ private int getUsesLeft(@Nonnull ItemStack stack) { return stack.getCount(); } - private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int usesLeft) { + private void setUsesLeft(EntityPlayer entity, @NotNull ItemStack stack, int usesLeft) { if (usesFluid) { IFluidHandlerItem fluidHandlerItem = stack .getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); @@ -192,7 +191,7 @@ private void setUsesLeft(EntityPlayer entity, @Nonnull ItemStack stack, int uses } @Override - public void addPropertyOverride(@Nonnull Item item) { + public void addPropertyOverride(@NotNull Item item) { if (overrideLocation != null) { item.addPropertyOverride(overrideLocation, (stack, world, entity) -> GTUtility.getOrCreateNbtCompound(stack).getBoolean(LIGHTER_OPEN) ? 1.0F : diff --git a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java index 2473d00ae53..c1148f5453b 100644 --- a/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/MultiblockBuilderBehavior.java @@ -22,9 +22,9 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class MultiblockBuilderBehavior implements IItemBehaviour { @@ -66,7 +66,7 @@ public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPo } @Override - public void addPropertyOverride(@Nonnull Item item) { + public void addPropertyOverride(@NotNull Item item) { item.addPropertyOverride(GTUtility.gregtechId("auto_mode"), (stack, world, entity) -> (entity != null && entity.isSneaking()) ? 1.0F : 0.0F); } diff --git a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java index 6e2360254b2..ac1e91f3615 100644 --- a/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/ProspectorScannerBehavior.java @@ -28,13 +28,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; +import org.jetbrains.annotations.NotNull; + import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public class ProspectorScannerBehavior implements IItemBehaviour, ItemUIFactory, SearchComponent.IWidgetSearch { private static final long VOLTAGE_FACTOR = 16L; @@ -51,7 +51,7 @@ public ProspectorScannerBehavior(int radius, int tier) { } @Override - public ActionResult onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(@NotNull World world, @NotNull EntityPlayer player, EnumHand hand) { ItemStack heldItem = player.getHeldItem(hand); if (!world.isRemote) { if (player.isSneaking()) { @@ -76,7 +76,7 @@ public ActionResult onItemRightClick(@Nonnull World world, @Nonnull E return ActionResult.newResult(EnumActionResult.SUCCESS, heldItem); } - @Nonnull + @NotNull private static ProspectorMode getMode(ItemStack stack) { if (stack == ItemStack.EMPTY) { return ProspectorMode.ORE; @@ -91,16 +91,16 @@ private static ProspectorMode getMode(ItemStack stack) { return ProspectorMode.ORE; } - private static void setMode(ItemStack stack, @Nonnull ProspectorMode mode) { + private static void setMode(ItemStack stack, @NotNull ProspectorMode mode) { NBTTagCompound tagCompound = GTUtility.getOrCreateNbtCompound(stack); tagCompound.setInteger("Mode", mode.ordinal()); } - private boolean checkCanUseScanner(ItemStack stack, @Nonnull EntityPlayer player, boolean simulate) { + private boolean checkCanUseScanner(ItemStack stack, @NotNull EntityPlayer player, boolean simulate) { return player.isCreative() || drainEnergy(stack, GTValues.V[tier] / VOLTAGE_FACTOR, simulate); } - private static boolean drainEnergy(@Nonnull ItemStack stack, long amount, boolean simulate) { + private static boolean drainEnergy(@NotNull ItemStack stack, long amount, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem == null) return false; @@ -108,7 +108,7 @@ private static boolean drainEnergy(@Nonnull ItemStack stack, long amount, boolea } @Override - public ModularUI createUI(PlayerInventoryHolder holder, @Nonnull EntityPlayer entityPlayer) { + public ModularUI createUI(PlayerInventoryHolder holder, @NotNull EntityPlayer entityPlayer) { ProspectorMode mode = getMode(entityPlayer.getHeldItem(EnumHand.MAIN_HAND)); ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 332, 200); this.widgetOreList = new WidgetOreList(32 * radius - 6, 18, 332 - 32 * radius, 176); diff --git a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java index 3f2b455aa90..2eb6847a46e 100644 --- a/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TooltipBehavior.java @@ -4,11 +4,11 @@ import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.NotNull; + import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; - /** * Adds tooltips with multiple translation keys */ @@ -19,12 +19,12 @@ public class TooltipBehavior implements IItemBehaviour { /** * @param tooltips a consumer adding translated tooltips to the tooltip list */ - public TooltipBehavior(@Nonnull Consumer> tooltips) { + public TooltipBehavior(@NotNull Consumer> tooltips) { this.tooltips = tooltips; } @Override - public void addInformation(ItemStack itemStack, @Nonnull List lines) { + public void addInformation(ItemStack itemStack, @NotNull List lines) { tooltips.accept(lines); } } diff --git a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java index 9a33d1cfa1d..344b97231d3 100644 --- a/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TricorderBehavior.java @@ -40,13 +40,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; -import javax.annotation.Nonnull; - public class TricorderBehavior implements IItemBehaviour { private final int debugLevel; @@ -349,7 +349,7 @@ else if (metaTileEntity instanceof IDataInfoProvider) return list; } - private boolean drainEnergy(@Nonnull ItemStack stack, long amount, boolean simulate) { + private boolean drainEnergy(@NotNull ItemStack stack, long amount, boolean simulate) { if (debugLevel > 2) return true; diff --git a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java index 3b181f12548..8cd4a809741 100644 --- a/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java +++ b/src/main/java/gregtech/common/items/behaviors/TurbineRotorBehavior.java @@ -10,10 +10,10 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class TurbineRotorBehavior extends AbstractMaterialPartBehavior implements IItemMaxStackSizeProvider { @@ -64,7 +64,7 @@ public void addInformation(ItemStack stack, List lines) { } @Nullable - public static TurbineRotorBehavior getInstanceFor(@Nonnull ItemStack itemStack) { + public static TurbineRotorBehavior getInstanceFor(@NotNull ItemStack itemStack) { if (!(itemStack.getItem() instanceof MetaItem)) return null; MetaItem.MetaValueItem valueItem = ((MetaItem) itemStack.getItem()).getItem(itemStack); diff --git a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java index 3bacf7994a8..acd60d1324a 100644 --- a/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/BlockRotatingBehavior.java @@ -21,12 +21,11 @@ import net.minecraft.world.World; import codechicken.lib.raytracer.RayTracer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class BlockRotatingBehavior implements IToolBehavior { public static final BlockRotatingBehavior INSTANCE = new BlockRotatingBehavior(); @@ -34,9 +33,9 @@ public class BlockRotatingBehavior implements IToolBehavior { protected BlockRotatingBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing side, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { TileEntity te = world.getTileEntity(pos); // MTEs have special handling on rotation if (te instanceof IGregTechTileEntity) { @@ -67,8 +66,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.block_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java index bd58c22f24c..71d45619f2a 100644 --- a/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java +++ b/src/main/java/gregtech/common/items/tool/DisableShieldBehavior.java @@ -10,10 +10,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class DisableShieldBehavior implements IToolBehavior { @@ -28,13 +28,13 @@ public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingB } @Override - public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { + public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull NBTTagCompound tag) { tag.setBoolean(ToolHelper.DISABLE_SHIELDS_KEY, true); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.shield_disable")); } } diff --git a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java index 3a2c446df87..e7ddee040cc 100644 --- a/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java +++ b/src/main/java/gregtech/common/items/tool/EntityDamageBehavior.java @@ -11,14 +11,14 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.Function; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Add to tools to have them deal bonus damage to specific mobs. * Pass null for the mobType parameter to ignore the tooltip. @@ -53,8 +53,8 @@ public EntityDamageBehavior(String mobType, Map, Float> entities) { } @Override - public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target, - @Nonnull EntityLivingBase attacker) { + public void hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target, + @NotNull EntityLivingBase attacker) { float damageBonus = shouldDoBonusList.stream().map(func -> func.apply(target)).filter(f -> f > 0).findFirst() .orElse(0f); if (damageBonus != 0f) { @@ -65,8 +65,8 @@ public void hitEntity(@Nonnull ItemStack stack, @Nonnull EntityLivingBase target } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { if (mobType != null && !mobType.isEmpty()) { tooltip.add(I18n.format("item.gt.tool.behavior.damage_boost", I18n.format("item.gt.tool.behavior.damage_boost_" + mobType))); diff --git a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java index ad4a2dee266..4dc960a6a3f 100644 --- a/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java +++ b/src/main/java/gregtech/common/items/tool/GrassPathBehavior.java @@ -20,23 +20,22 @@ import net.minecraft.world.World; import com.google.common.collect.ImmutableSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class GrassPathBehavior implements IToolBehavior { public static final GrassPathBehavior INSTANCE = new GrassPathBehavior(); protected GrassPathBehavior() {/**/} - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; @@ -93,8 +92,8 @@ private static boolean isBlockPathConvertible(ItemStack stack, World world, Enti } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.grass_path")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java index 94c665d5dcc..d1ac7a4be93 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestCropsBehavior.java @@ -22,23 +22,22 @@ import net.minecraft.world.World; import com.google.common.collect.ImmutableSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class HarvestCropsBehavior implements IToolBehavior { public static final HarvestCropsBehavior INSTANCE = new HarvestCropsBehavior(); protected HarvestCropsBehavior() {/**/} - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { if (world.isRemote) { return EnumActionResult.PASS; @@ -117,8 +116,8 @@ private static void dropListOfItems(World world, BlockPos pos, List d } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.crop_harvesting")); } } diff --git a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java index aa31daa3138..04a5756df9c 100644 --- a/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HarvestIceBehavior.java @@ -10,10 +10,10 @@ import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; /** * @see gregtech.common.ToolEventHandlers#onHarvestDrops(BlockEvent.HarvestDropsEvent) @@ -27,13 +27,13 @@ protected HarvestIceBehavior() {/**/} // ice harvesting is handled in an event elsewhere @Override - public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { + public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull NBTTagCompound tag) { tag.setBoolean(ToolHelper.HARVEST_ICE_KEY, true); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.silk_ice")); } } diff --git a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java index c771191d1cf..36477d16801 100644 --- a/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java +++ b/src/main/java/gregtech/common/items/tool/HoeGroundBehavior.java @@ -23,13 +23,12 @@ import net.minecraftforge.event.ForgeEventFactory; import com.google.common.collect.ImmutableSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Used to allow a tool to hoe the ground, only if it cannot extend the {@link gregtech.api.items.toolitem.ItemGTHoe} * class. @@ -40,10 +39,10 @@ public class HoeGroundBehavior implements IToolBehavior { protected HoeGroundBehavior() {/**/} - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { if (facing == EnumFacing.DOWN) return EnumActionResult.PASS; @@ -121,7 +120,7 @@ private static boolean isBlockTillable(ItemStack stack, World world, EntityPlaye return false; } - private static void tillGround(@Nonnull World world, EntityPlayer player, ItemStack stack, BlockPos pos, + private static void tillGround(@NotNull World world, EntityPlayer player, ItemStack stack, BlockPos pos, IBlockState state) { world.setBlockState(pos, state, 11); if (!player.isCreative()) { @@ -130,8 +129,8 @@ private static void tillGround(@Nonnull World world, EntityPlayer player, ItemSt } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.ground_tilling")); } } diff --git a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java index ed75344db98..609e429e0c0 100644 --- a/src/main/java/gregtech/common/items/tool/PlungerBehavior.java +++ b/src/main/java/gregtech/common/items/tool/PlungerBehavior.java @@ -20,10 +20,10 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class PlungerBehavior implements IToolBehavior { @@ -32,9 +32,9 @@ public class PlungerBehavior implements IToolBehavior { protected PlungerBehavior() {/**/} @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing facing, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(world, pos, facing); if (fluidHandler == null) { return EnumActionResult.PASS; @@ -67,8 +67,8 @@ public int fill(FluidStack resource, boolean doFill) { } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.plunger")); } } diff --git a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java index 262007f9643..19985d1459e 100644 --- a/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java +++ b/src/main/java/gregtech/common/items/tool/RotateRailBehavior.java @@ -16,10 +16,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class RotateRailBehavior implements IToolBehavior { @@ -27,11 +27,11 @@ public class RotateRailBehavior implements IToolBehavior { protected RotateRailBehavior() {/**/} - @Nonnull + @NotNull @Override - public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, - @Nonnull EnumHand hand) { + public EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumFacing facing, float hitX, float hitY, float hitZ, + @NotNull EnumHand hand) { IBlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockRailBase) { if (world.setBlockState(pos, state.withRotation(Rotation.CLOCKWISE_90))) { @@ -43,8 +43,8 @@ public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull Wo } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.rail_rotation")); } } diff --git a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java index 59cd4a2d44f..d9d5f86ef69 100644 --- a/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TorchPlaceBehavior.java @@ -22,10 +22,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; import static gregtech.api.items.toolitem.ToolHelper.TORCH_PLACING_KEY; @@ -35,10 +35,10 @@ public class TorchPlaceBehavior implements IToolBehavior { protected TorchPlaceBehavior() {/**/} - @Nonnull + @NotNull @Override - public EnumActionResult onItemUse(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, - @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, + public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World world, @NotNull BlockPos pos, + @NotNull EnumHand hand, @NotNull EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); NBTTagCompound behaviourTag = ToolHelper.getBehaviorsTag(stack); @@ -111,13 +111,13 @@ private static boolean checkAndPlaceTorch(ItemStack slotStack, EntityPlayer play } @Override - public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { + public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull NBTTagCompound tag) { tag.setBoolean(TORCH_PLACING_KEY, true); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.torch_place")); } } diff --git a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java index 06046b9c447..a9db1dc5315 100644 --- a/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java +++ b/src/main/java/gregtech/common/items/tool/TreeFellingBehavior.java @@ -12,10 +12,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; /** * The Tree Felling Behavior must be handled in a special way in @@ -30,13 +30,13 @@ public class TreeFellingBehavior implements IToolBehavior { protected TreeFellingBehavior() {/**/} @Override - public void addBehaviorNBT(@Nonnull ItemStack stack, @Nonnull NBTTagCompound tag) { + public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull NBTTagCompound tag) { tag.setBoolean(ToolHelper.TREE_FELLING_KEY, true); } @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World world, @Nonnull List tooltip, - @Nonnull ITooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, + @NotNull ITooltipFlag flag) { tooltip.add(I18n.format("item.gt.tool.behavior.tree_felling")); } } diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java index 99619665b4f..64ea0d7ffcf 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntityClipboard.java @@ -52,14 +52,12 @@ import io.netty.buffer.Unpooled; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static codechicken.lib.raytracer.RayTracer.*; import static gregtech.api.capability.GregtechDataCodes.*; import static gregtech.client.renderer.texture.Textures.CLIPBOARD_RENDERER; @@ -529,7 +527,7 @@ public boolean canPlaceCoverOnSide(@NotNull EnumFacing side) { } @Override - public boolean canRenderMachineGrid(@Nonnull ItemStack mainHandStack, @Nonnull ItemStack offHandStack) { + public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { return false; } diff --git a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java index 7d49388a390..82521725571 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java +++ b/src/main/java/gregtech/common/metatileentities/converter/ConverterTrait.java @@ -15,7 +15,7 @@ import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ConverterTrait extends MTETrait { @@ -69,7 +69,7 @@ public long getVoltage() { return voltage; } - @Nonnull + @NotNull @Override public String getName() { return GregtechDataCodes.ENERGY_CONVERTER_TRAIT; @@ -87,7 +87,7 @@ private long extractInternal(long amount) { return change; } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); @@ -97,7 +97,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound nbt) { + public void deserializeNBT(@NotNull NBTTagCompound nbt) { this.storedEU = nbt.getLong("StoredEU"); this.feToEu = nbt.getBoolean("feToEu"); } diff --git a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java index 1aa2d2b0142..c19166ac6ef 100644 --- a/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java +++ b/src/main/java/gregtech/common/metatileentities/converter/MetaTileEntityConverter.java @@ -34,11 +34,10 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.SYNC_TILE_MODE; public class MetaTileEntityConverter extends TieredMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index 6c80ade0ec9..8a56af22c35 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -37,13 +37,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityBatteryBuffer extends TieredMetaTileEntity implements IControllable, IDataInfoProvider { private final int inventorySize; @@ -112,9 +111,9 @@ protected void onContentsChanged(int slot) { MetaTileEntityBatteryBuffer.this.markDirty(); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || (ConfigHolder.compat.energy.nativeEUToFE && @@ -194,7 +193,7 @@ public void readFromNBT(NBTTagCompound data) { } } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index a8527b1eb99..b88ca1418d3 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -38,12 +38,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.UPDATE_OUTPUT_FACING; public class MetaTileEntityBlockBreaker extends TieredMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java index ffc8841a9fe..b5fef8cc815 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityCharger.java @@ -22,10 +22,10 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntityCharger extends TieredMetaTileEntity { @@ -57,9 +57,9 @@ protected void onContentsChanged(int slot) { MetaTileEntityCharger.this.markDirty(); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { IElectricItem electricItem = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if ((electricItem != null && getTier() >= electricItem.getTier()) || (ConfigHolder.compat.energy.nativeEUToFE && diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java index ce97300700e..61b53052962 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityDiode.java @@ -28,13 +28,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.AMP_INDEX; public class MetaTileEntityDiode extends MetaTileEntityMultiblockPart @@ -149,7 +148,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.diode.tooltip_general")); tooltip.add(I18n.format("gregtech.machine.diode.tooltip_starts_at")); @@ -172,11 +171,11 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } - @Nonnull + @NotNull @Override public Class getPassthroughType() { return IEnergyContainer.class; diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index 3ea24fabe41..2b8aa936f42 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -31,12 +31,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityFisher extends TieredMetaTileEntity { private static final int WATER_CHECK_SIZE = 25; @@ -118,9 +117,9 @@ public void update() { protected IItemHandlerModifiable createImportItemHandler() { return new GTItemStackHandler(this, 1) { - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (OreDictUnifier.hasOreDictionary(stack, "string")) { return super.insertItem(slot, stack, simulate); } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java index e545c53df54..77bdd3b0485 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityGasCollector.java @@ -15,12 +15,11 @@ import net.minecraft.util.ResourceLocation; import it.unimi.dsi.fastutil.ints.IntLists; +import org.jetbrains.annotations.NotNull; import java.util.function.Function; import java.util.function.Supplier; -import javax.annotation.Nonnull; - public class MetaTileEntityGasCollector extends SimpleMachineMetaTileEntity { public MetaTileEntityGasCollector(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, @@ -40,7 +39,7 @@ protected RecipeLogicEnergy createWorkable(RecipeMap recipeMap) { return new GasCollectorRecipeLogic(this, recipeMap, () -> energyContainer); } - protected boolean checkRecipe(@Nonnull Recipe recipe) { + protected boolean checkRecipe(@NotNull Recipe recipe) { for (int dimension : recipe.getProperty(GasCollectorDimensionProperty.getInstance(), IntLists.EMPTY_LIST)) { if (dimension == this.getWorld().provider.getDimension()) { return true; @@ -57,7 +56,7 @@ public GasCollectorRecipeLogic(MetaTileEntity metaTileEntity, RecipeMap recip } @Override - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { return ((MetaTileEntityGasCollector) metaTileEntity).checkRecipe(recipe) && super.checkRecipe(recipe); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java index ed7065e1a15..926f7386174 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityHull.java @@ -28,12 +28,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityHull extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { @@ -95,10 +94,10 @@ public void update() { } } - @Nonnull + @NotNull @Override @Optional.Method(modid = GTValues.MODID_APPENG) - public AECableType getCableConnectionType(@Nonnull AEPartLocation part) { + public AECableType getCableConnectionType(@NotNull AEPartLocation part) { return AECableType.SMART; } @@ -118,11 +117,11 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } - @Nonnull + @NotNull @Override public Class getPassthroughType() { return IEnergyContainer.class; diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java index 25a87803c16..d49fb520bf1 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityItemCollector.java @@ -38,11 +38,10 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityItemCollector extends TieredMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java index 08784ed26b2..80d49f2219e 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMagicEnergyAbsorber.java @@ -41,13 +41,12 @@ import it.unimi.dsi.fastutil.ints.IntList; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public class MetaTileEntityMagicEnergyAbsorber extends TieredMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java index 6bea4afcdbf..91fd07df207 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java @@ -40,13 +40,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityMiner extends TieredMetaTileEntity implements IMiner, IControllable, IDataInfoProvider { private final ItemStackHandler chargerInventory; @@ -97,7 +96,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - protected ModularUI createUI(@Nonnull EntityPlayer entityPlayer) { + protected ModularUI createUI(@NotNull EntityPlayer entityPlayer) { int rowSize = (int) Math.sqrt(inventorySize); ModularUI.Builder builder = new ModularUI.Builder(GuiTextures.BACKGROUND, 195, 176); builder.bindPlayerInventory(entityPlayer.inventory, 94); @@ -134,7 +133,7 @@ protected ModularUI createUI(@Nonnull EntityPlayer entityPlayer) { return builder.build(getHolder(), entityPlayer); } - private void addDisplayText(@Nonnull List textList) { + private void addDisplayText(@NotNull List textList) { int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); textList.add(new TextComponentTranslation("gregtech.machine.miner.startx", this.minerLogic.getX().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.starty", this.minerLogic.getY().get())); @@ -156,14 +155,14 @@ else if (!this.isWorkingEnabled()) .setStyle(new Style().setColor(TextFormatting.RED))); } - private void addDisplayText2(@Nonnull List textList) { + private void addDisplayText2(@NotNull List textList) { textList.add(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())); textList.add(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { int currentArea = getWorkingArea(minerLogic.getCurrentRadius()); tooltip.add(I18n.format("gregtech.machine.miner.tooltip", currentArea, currentArea)); @@ -314,7 +313,7 @@ public boolean isActive() { return minerLogic.isActive() && isWorkingEnabled(); } - @Nonnull + @NotNull @Override public List getDataInfo() { int workingArea = getWorkingArea(minerLogic.getCurrentRadius()); diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java index acd9ac62b93..454c29bb848 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityPump.java @@ -45,14 +45,13 @@ import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.Nullable; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.PUMP_HEAD_LEVEL; public class MetaTileEntityPump extends TieredMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index f0b9743edeb..8d54fc54adb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -34,8 +34,7 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaTileEntityCokeOven extends RecipeMapPrimitiveMultiblockController { @@ -80,7 +79,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.COKE_OVEN_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java index 2983dde660f..4484f5b9840 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOvenHatch.java @@ -31,11 +31,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityCokeOvenHatch extends MetaTileEntityMultiblockPart { public MetaTileEntityCokeOvenHatch(ResourceLocation metaTileEntityId) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index f15008bab2e..6921ca44d5f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -42,13 +42,11 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IProgressBarMultiblock { public final BoilerType boilerType; @@ -211,7 +209,8 @@ public String[] getDescription() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.large_boiler.rate_tooltip", (int) (boilerType.steamPerTick() * 20 * boilerType.runtimeBoost(20) / 20.0))); @@ -229,7 +228,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return boilerType.frontOverlay; diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 17ffe999651..5e6736a21ac 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -35,12 +35,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityMultiblockTank extends MultiblockWithDisplayBase { private final boolean isMetal; @@ -79,7 +78,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { protected void updateFormedValid() {} @Override - @Nonnull + @NotNull protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() .aisle("XXX", "XXX", "XXX") @@ -106,7 +105,7 @@ private MetaTileEntity getValve() { @SideOnly(Side.CLIENT) @Override - @Nonnull + @NotNull public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { if (isMetal) return Textures.SOLID_STEEL_CASING; @@ -127,7 +126,7 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } @Override - protected ModularUI.Builder createUITemplate(@Nonnull EntityPlayer entityPlayer) { + protected ModularUI.Builder createUITemplate(@NotNull EntityPlayer entityPlayer) { return ModularUI.defaultBuilder() .widget(new LabelWidget(6, 6, getMetaFullName())) .widget(new TankWidget(importFluids.getTankAt(0), 52, 18, 72, 61) @@ -143,14 +142,14 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.MULTIBLOCK_TANK_OVERLAY; } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.tank.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java index f8ea376d87f..0dad1c14ee1 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java @@ -42,8 +42,7 @@ import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaTileEntityPrimitiveBlastFurnace extends RecipeMapPrimitiveMultiblockController { @@ -121,7 +120,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.PRIMITIVE_BLAST_FURNACE_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java index d1c13cadedb..43cee2ccb2f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveWaterPump.java @@ -33,14 +33,13 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; - public class MetaTileEntityPrimitiveWaterPump extends MultiblockControllerBase implements IPrimitivePump { private IFluidTank waterTank; @@ -161,7 +160,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.PRIMITIVE_PUMP_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java index e257f788f2d..dc158cd074a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java @@ -32,11 +32,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityPumpHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java index f4a242788cd..a645fc753e1 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityTankValve.java @@ -26,12 +26,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityTankValve extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { @@ -130,7 +129,7 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this.getImportFluids()); } @@ -140,7 +139,7 @@ protected boolean shouldSerializeInventories() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.tank_valve.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java index eb6bfff35b7..4432cd61a21 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityAssemblyLine.java @@ -48,13 +48,12 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import codechicken.lib.vec.Vector3; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Function; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityAssemblyLine extends RecipeMapMultiblockController { @@ -76,7 +75,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityAssemblyLine(metaTileEntityId); } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { FactoryBlockPattern pattern = FactoryBlockPattern.start(FRONT, UP, RIGHT) @@ -107,17 +106,17 @@ protected BlockPattern createStructurePattern() { return pattern.build(); } - @Nonnull + @NotNull protected static IBlockState getCasingState() { return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID); } - @Nonnull + @NotNull protected static IBlockState getGrateState() { return MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.GRATE_CASING); } - @Nonnull + @NotNull protected static TraceabilityPredicate fluidInputPredicate() { // block multi-fluid hatches if ordered fluids is enabled if (ConfigHolder.machines.orderedFluidAssembly) { @@ -129,7 +128,7 @@ protected static TraceabilityPredicate fluidInputPredicate() { return abilities(MultiblockAbility.IMPORT_FLUIDS); } - @Nonnull + @NotNull protected static TraceabilityPredicate dataHatchPredicate() { // if research is enabled, require the data hatch, otherwise use a grate instead if (ConfigHolder.machines.enableResearch) { @@ -238,12 +237,12 @@ public void onRemoval() { } } - private void writeParticles(@Nonnull PacketBuffer buf) { + private void writeParticles(@NotNull PacketBuffer buf) { buf.writeVarInt(beamCount); } @SideOnly(Side.CLIENT) - private void readParticles(@Nonnull PacketBuffer buf) { + private void readParticles(@NotNull PacketBuffer buf) { beamCount = buf.readVarInt(); if (beamParticles == null) { beamParticles = new GTLaserBeamParticle[17][2]; @@ -304,7 +303,7 @@ private void readParticles(@Nonnull PacketBuffer buf) { } } - @Nonnull + @NotNull @SideOnly(Side.CLIENT) private GTLaserBeamParticle createALParticles(Vector3 startPos, Vector3 endPos) { return new GTLaserBeamParticle(this, startPos, endPos) @@ -318,7 +317,7 @@ private GTLaserBeamParticle createALParticles(Vector3 startPos, Vector3 endPos) } @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { if (consumeIfSuccess) return true; // don't check twice // check ordered items if (ConfigHolder.machines.orderedAssembly) { @@ -358,8 +357,8 @@ public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { isRecipeAvailable(getAbilities(MultiblockAbility.OPTICAL_DATA_RECEPTION), recipe); } - private static boolean isRecipeAvailable(@Nonnull Iterable hatches, - @Nonnull Recipe recipe) { + private static boolean isRecipeAvailable(@NotNull Iterable hatches, + @NotNull Recipe recipe) { for (IDataAccessHatch hatch : hatches) { // creative hatches do not need to check, they always have the recipe if (hatch.isCreative()) return true; @@ -371,7 +370,7 @@ private static boolean isRecipeAvailable(@Nonnull Iterable tooltip, + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { if (ConfigHolder.machines.orderedAssembly && ConfigHolder.machines.orderedFluidAssembly) { tooltip.add(I18n.format("gregtech.machine.assembly_line.tooltip_ordered_both")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java index 4ce376d8597..b9fd8ebf60c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCleanroom.java @@ -58,12 +58,11 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityCleanroom extends MultiblockWithDisplayBase implements ICleanroomProvider, IWorkable, IDataInfoProvider { @@ -232,8 +231,8 @@ public boolean updateStructureDimensions() { * @param direction the direction to move * @return if a block is a valid wall block at pos moved in direction */ - public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, - @Nonnull EnumFacing direction) { + public boolean isBlockEdge(@NotNull World world, @NotNull BlockPos.MutableBlockPos pos, + @NotNull EnumFacing direction) { return world.getBlockState(pos.move(direction)) == MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); } @@ -244,13 +243,13 @@ public boolean isBlockEdge(@Nonnull World world, @Nonnull BlockPos.MutableBlockP * @param direction the direction to move * @return if a block is a valid floor block at pos moved in direction */ - public boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, - @Nonnull EnumFacing direction) { + public boolean isBlockFloor(@NotNull World world, @NotNull BlockPos.MutableBlockPos pos, + @NotNull EnumFacing direction) { return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { // return the default structure, even if there is no valid size found @@ -365,7 +364,7 @@ protected BlockPattern createStructurePattern() { .build(); } - @Nonnull + @NotNull protected TraceabilityPredicate filterPredicate() { return new TraceabilityPredicate(blockWorldState -> { IBlockState blockState = blockWorldState.getBlockState(); @@ -399,23 +398,23 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } // protected to allow easy addition of addon "cleanrooms" - @Nonnull + @NotNull protected IBlockState getCasingState() { return MetaBlocks.CLEANROOM_CASING.getState(BlockCleanroomCasing.CasingType.PLASCRETE); } - @Nonnull + @NotNull protected IBlockState getGlassState() { return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.CLEANROOM_GLASS); } - @Nonnull + @NotNull protected static TraceabilityPredicate doorPredicate() { return new TraceabilityPredicate( blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof BlockDoor); } - @Nonnull + @NotNull protected TraceabilityPredicate innerPredicate() { return new TraceabilityPredicate(blockWorldState -> { // all non-MetaTileEntities are allowed inside by default @@ -541,14 +540,14 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.CLEANROOM_OVERLAY; } @Override - public boolean checkCleanroomType(@Nonnull CleanroomType type) { + public boolean checkCleanroomType(@NotNull CleanroomType type) { return type == this.cleanroomType; } @@ -568,7 +567,7 @@ public boolean isClean() { return this.cleanAmount >= CLEAN_AMOUNT_THRESHOLD; } - @Nonnull + @NotNull @Override public List getDataInfo() { return Collections.singletonList(new TextComponentTranslation( @@ -655,7 +654,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { } @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound data) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound data) { super.writeToNBT(data); data.setInteger("lDist", this.lDist); data.setInteger("rDist", this.rDist); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java index c4a3c65ca5e..64c441fac4d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityCrackingUnit.java @@ -31,10 +31,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntityCrackingUnit extends RecipeMapMultiblockController { @@ -114,7 +114,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.CRACKING_UNIT_OVERLAY; @@ -149,7 +149,7 @@ public CrackingUnitWorkableHandler(RecipeMapMultiblockController tileEntity) { } @Override - protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPost(int[] resultOverclock, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPost(resultOverclock, storage); int coilTier = ((MetaTileEntityCrackingUnit) metaTileEntity).getCoilTier(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java index ed12643fe4a..5b52829f001 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDataBank.java @@ -37,13 +37,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityDataBank extends MultiblockWithDisplayBase implements IControllable { private static final int EUT_PER_HATCH = GTValues.VA[GTValues.EV]; @@ -155,7 +154,7 @@ public void setWorkingEnabled(boolean isWorkingAllowed) { } } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -178,12 +177,12 @@ protected BlockPattern createStructurePattern() { .build(); } - @Nonnull + @NotNull private static IBlockState getOuterState() { return MetaBlocks.COMPUTER_CASING.getState(BlockComputerCasing.CasingType.COMPUTER_HEAT_VENT); } - @Nonnull + @NotNull private static IBlockState getInnerState() { return MetaBlocks.COMPUTER_CASING.getState(BlockComputerCasing.CasingType.COMPUTER_CASING); } @@ -220,7 +219,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.DATA_BANK_OVERLAY; @@ -238,7 +237,7 @@ public SoundEvent getSound() { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_bank.tooltip.1")); @@ -299,7 +298,7 @@ public void receiveInitialSyncData(PacketBuffer buf) { } @Override - public void receiveCustomData(int dataId, @Nonnull PacketBuffer buf) { + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == GregtechDataCodes.WORKABLE_ACTIVE) { this.isActive = buf.readBoolean(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java index 4918d203a08..553dae63de4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityDistillationTower.java @@ -29,11 +29,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; + import java.util.List; import java.util.function.Function; -import javax.annotation.Nonnull; - import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityDistillationTower extends RecipeMapMultiblockController { @@ -116,7 +116,7 @@ public SoundEvent getBreakdownSound() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.DISTILLATION_TOWER_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java index 51ba3cdb73a..5e2714e2b98 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityElectricBlastFurnace.java @@ -45,13 +45,13 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityElectricBlastFurnace extends RecipeMapMultiblockController implements IHeatingCoil { private int blastFurnaceTemperature; @@ -111,7 +111,7 @@ public void invalidateStructure() { } @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return this.blastFurnaceTemperature >= recipe.getProperty(TemperatureProperty.getInstance(), 0); } @@ -141,7 +141,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.1")); @@ -155,7 +155,7 @@ public int getCurrentTemperature() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.BLAST_FURNACE_OVERLAY; @@ -200,7 +200,7 @@ public List getMatchingShapes() { return shapeInfo; } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = super.getDataInfo(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java index d7955df7bdb..a1501dd6f65 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java @@ -49,13 +49,12 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityFluidDrill extends MultiblockWithDisplayBase implements ITieredMetaTileEntity, IWorkable, IProgressBarMultiblock { @@ -136,7 +135,7 @@ private IBlockState getCasingState() { return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID); } - @Nonnull + @NotNull private TraceabilityPredicate getFramePredicate() { if (tier == GTValues.MV) return frames(Materials.Steel); @@ -264,7 +263,7 @@ public int getDepletionChance() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.FLUID_RIG_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index 8de28fd4ae8..f3ab155bac6 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -61,6 +61,8 @@ import com.google.common.collect.Lists; import com.google.common.util.concurrent.AtomicDouble; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -69,9 +71,6 @@ import java.util.Objects; import java.util.function.DoubleSupplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity, IBloomEffect { @@ -91,7 +90,7 @@ public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) this.tier = tier; this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { - @Nonnull + @NotNull @Override public String getName() { return GregtechDataCodes.FUSION_REACTOR_ENERGY_CONTAINER_TRAIT; @@ -105,7 +104,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityFusionReactor(metaTileEntityId, tier); } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -229,7 +228,7 @@ public void invalidateStructure() { super.invalidateStructure(); this.energyContainer = new EnergyContainerHandler(this, 0, 0, 0, 0, 0) { - @Nonnull + @NotNull @Override public String getName() { return GregtechDataCodes.FUSION_REACTOR_ENERGY_CONTAINER_TRAIT; @@ -250,7 +249,7 @@ protected void initializeAbilities() { long euCapacity = calculateEnergyStorageFactor(energyInputs.size()); this.energyContainer = new EnergyContainerHandler(this, euCapacity, GTValues.V[tier], 0, 0, 0) { - @Nonnull + @NotNull @Override public String getName() { return GregtechDataCodes.FUSION_REACTOR_ENERGY_CONTAINER_TRAIT; @@ -317,7 +316,7 @@ private void writeColor(PacketBuffer buf) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add( @@ -326,7 +325,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @Nonnull Lis } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.FUSION_REACTOR_OVERLAY; @@ -594,7 +593,7 @@ public void updateWorkable() { } @Override - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { if (!super.checkRecipe(recipe)) return false; @@ -618,7 +617,7 @@ public boolean checkRecipe(@Nonnull Recipe recipe) { return true; } - @Nonnull + @NotNull @Override public NBTTagCompound serializeNBT() { NBTTagCompound tag = super.serializeNBT(); @@ -627,7 +626,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void deserializeNBT(@Nonnull NBTTagCompound compound) { + public void deserializeNBT(@NotNull NBTTagCompound compound) { super.deserializeNBT(compound); heat = compound.getLong("Heat"); } @@ -652,7 +651,7 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick @Override @SideOnly(Side.CLIENT) - public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRenderContext context) { + public void renderBloomEffect(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) { Integer c = color; if (c == null) return; int color = RenderUtil.interpolateColor(c, -1, Eases.QUAD_IN.getInterpolation( @@ -676,7 +675,7 @@ public void renderBloomEffect(@Nonnull BufferBuilder buffer, @Nonnull EffectRend @Override @SideOnly(Side.CLIENT) - public boolean shouldRenderBloomEffect(@Nonnull EffectRenderContext context) { + public boolean shouldRenderBloomEffect(@NotNull EffectRenderContext context) { return this.color != null; } @@ -716,7 +715,7 @@ private static final class FusionBloomSetup implements IRenderSetup { float lastBrightnessY; @Override - public void preDraw(@Nonnull BufferBuilder buffer) { + public void preDraw(@NotNull BufferBuilder buffer) { BloomEffect.strength = (float) ConfigHolder.client.shader.fusionBloom.strength; BloomEffect.baseBrightness = (float) ConfigHolder.client.shader.fusionBloom.baseBrightness; BloomEffect.highBrightnessThreshold = (float) ConfigHolder.client.shader.fusionBloom.highBrightnessThreshold; @@ -733,7 +732,7 @@ public void preDraw(@Nonnull BufferBuilder buffer) { } @Override - public void postDraw(@Nonnull BufferBuilder buffer) { + public void postDraw(@NotNull BufferBuilder buffer) { Tessellator.getInstance().draw(); GlStateManager.enableTexture2D(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java index a3fc6af4dbf..705e38a459c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityImplosionCompressor.java @@ -19,7 +19,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaTileEntityImplosionCompressor extends RecipeMapMultiblockController { @@ -55,7 +55,7 @@ protected IBlockState getCasingState() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.IMPLOSION_COMPRESSOR_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java index 2f755707636..cb12da25e2b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeChemicalReactor.java @@ -31,12 +31,12 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityLargeChemicalReactor extends RecipeMapMultiblockController { public MetaTileEntityLargeChemicalReactor(ResourceLocation metaTileEntityId) { @@ -139,7 +139,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.LARGE_CHEMICAL_REACTOR_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index 166073d5cec..cc2b78fa6ba 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -59,13 +59,11 @@ import codechicken.lib.vec.Matrix4; import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.unification.material.Materials.DrillingFluid; public class MetaTileEntityLargeMiner extends MultiblockWithDisplayBase @@ -210,7 +208,7 @@ public String[] getDescription() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { int workingAreaChunks = this.minerLogic.getCurrentRadius() * 2 / CHUNK_LENGTH; tooltip.add(I18n.format("gregtech.machine.miner.multi.modes")); @@ -317,7 +315,7 @@ public IBlockState getCasingState() { return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STEEL_SOLID); } - @Nonnull + @NotNull private TraceabilityPredicate getFramePredicate() { if (this.material.equals(Materials.Titanium)) return frames(Materials.Titanium); @@ -371,7 +369,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { if (this.tier == 5) @@ -543,7 +541,7 @@ public boolean isActive() { return minerLogic.isActive() && isWorkingEnabled(); } - @Nonnull + @NotNull @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java index 831012eac9f..f9936dd4b31 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityMultiSmelter.java @@ -28,9 +28,9 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.List; public class MetaTileEntityMultiSmelter extends RecipeMapMultiblockController { @@ -114,7 +114,7 @@ public void invalidateStructure() { this.heatingCoilDiscount = 0; } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -147,7 +147,7 @@ public SoundEvent getBreakdownSound() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.MULTI_FURNACE_OVERLAY; @@ -190,14 +190,14 @@ public MultiSmelterWorkable(RecipeMapMultiblockController tileEntity) { super(tileEntity); } - @Nonnull + @NotNull @Override public ParallelLogicType getParallelLogicType() { return ParallelLogicType.APPEND_ITEMS; } @Override - public void applyParallelBonus(@Nonnull RecipeBuilder builder) { + public void applyParallelBonus(@NotNull RecipeBuilder builder) { builder.EUt(getEUtForParallel(builder.getParallel(), heatingCoilDiscount)) .duration(getDurationForParallel(builder.getParallel(), getParallelLimit())); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java index 41cce088abd..be56f1b4170 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityProcessingArray.java @@ -41,12 +41,11 @@ import net.minecraftforge.items.IItemHandlerModifiable; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.ULV; public class MetaTileEntityProcessingArray extends RecipeMapMultiblockController implements IMachineHatchMultiblock { @@ -76,7 +75,7 @@ public int getMachineLimit() { return tier == 0 ? 16 : 64; } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -166,7 +165,7 @@ protected void addDisplayText(List textList) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected OrientedOverlayRenderer getFrontOverlay() { return tier == 0 ? Textures.PROCESSING_ARRAY_OVERLAY : Textures.ADVANCED_PROCESSING_ARRAY_OVERLAY; @@ -273,7 +272,7 @@ public void invalidate() { * @return {@code true} if the provided recipeMap is valid for use */ @Override - public boolean isRecipeMapValid(@Nonnull RecipeMap recipeMap) { + public boolean isRecipeMapValid(@NotNull RecipeMap recipeMap) { if (ArrayUtils.contains(((IMachineHatchMultiblock) metaTileEntity).getBlacklist(), recipeMap.getUnlocalizedName())) { return false; @@ -345,7 +344,7 @@ public void findMachineStack() { } @Override - public boolean checkRecipe(@Nonnull Recipe recipe) { + public boolean checkRecipe(@NotNull Recipe recipe) { if (mte == null) return false; AbstractRecipeLogic arl = mte.getRecipeLogic(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java index 5528e207359..15c3f450c0a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityPyrolyseOven.java @@ -31,10 +31,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntityPyrolyseOven extends RecipeMapMultiblockController { @@ -80,7 +80,7 @@ public SoundEvent getBreakdownSound() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.PYROLYSE_OVEN_OVERLAY; @@ -172,7 +172,7 @@ public PyrolyseOvenWorkableHandler(RecipeMapMultiblockController tileEntity) { } @Override - protected void modifyOverclockPost(int[] resultOverclock, @Nonnull IRecipePropertyStorage storage) { + protected void modifyOverclockPost(int[] resultOverclock, @NotNull IRecipePropertyStorage storage) { super.modifyOverclockPost(resultOverclock, storage); int coilTier = ((MetaTileEntityPyrolyseOven) metaTileEntity).getCoilTier(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java index d2d7af8a7b9..41c2a1ea1f1 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityVacuumFreezer.java @@ -19,7 +19,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaTileEntityVacuumFreezer extends RecipeMapMultiblockController { @@ -60,7 +60,7 @@ public SoundEvent getBreakdownSound() { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.VACUUM_FREEZER_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java index 5146f61dcc3..4deeabb9a9f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityCentralMonitor.java @@ -60,13 +60,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.lang.ref.WeakReference; import java.util.*; -import javax.annotation.Nullable; - import static gregtech.api.util.RelativeDirection.*; public class MetaTileEntityCentralMonitor extends MultiblockWithDisplayBase implements IFastRenderMetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java index bd18ff1df86..a5d37f33c41 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/centralmonitor/MetaTileEntityMonitorScreen.java @@ -57,13 +57,11 @@ import codechicken.lib.raytracer.CuboidRayTraceResult; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityMonitorScreen extends MetaTileEntityMultiblockPart { // run-time data @@ -423,12 +421,12 @@ public int getSlotLimit(int slot) { } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { MonitorPluginBaseBehavior behavior = MonitorPluginBaseBehavior.getBehavior(stack); return behavior != null; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (!getWorld().isRemote && !getStackInSlot(slot).isEmpty() && !simulate) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index a5a2a51ae86..5fad60478ff 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -38,10 +38,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntityLargeCombustionEngine extends FuelMultiblockController implements IProgressBarMultiblock { @@ -168,7 +168,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return isExtreme ? Textures.EXTREME_COMBUSTION_ENGINE_OVERLAY : Textures.LARGE_COMBUSTION_ENGINE_OVERLAY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index 105a5c3db29..b647de173ae 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -30,10 +30,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntityLargeTurbine extends FuelMultiblockController implements ITieredMetaTileEntity, IProgressBarMultiblock { @@ -224,7 +224,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return frontOverlay; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java index 4f6c8eeff2b..7743303c4ec 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityAutoMaintenanceHatch.java @@ -22,11 +22,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityAutoMaintenanceHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IMaintenanceHatch { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java index 716fef7515d..c7e24cb6649 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityCleaningMaintenanceHatch.java @@ -23,13 +23,12 @@ import com.google.common.collect.ImmutableSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityCleaningMaintenanceHatch extends MetaTileEntityAutoMaintenanceHatch { protected static final Set CLEANED_TYPES = new ObjectOpenHashSet<>(); @@ -108,7 +107,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List * @param type the type to add */ @SuppressWarnings("unused") - public static void addCleanroomType(@Nonnull CleanroomType type) { + public static void addCleanroomType(@NotNull CleanroomType type) { CLEANED_TYPES.add(type); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java index 5787bfaae36..850ea3730be 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityComputationHatch.java @@ -22,13 +22,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityComputationHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IOpticalComputationHatch { @@ -50,7 +49,7 @@ public boolean isTransmitter() { } @Override - public int requestCWUt(int cwut, boolean simulate, @Nonnull Collection seen) { + public int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { seen.add(this); var controller = getController(); if (controller == null || !controller.isStructureFormed()) return 0; @@ -71,7 +70,7 @@ public int requestCWUt(int cwut, boolean simulate, @Nonnull Collection seen) { + public int getMaxCWUt(@NotNull Collection seen) { seen.add(this); var controller = getController(); if (controller == null || !controller.isStructureFormed()) return 0; @@ -92,7 +91,7 @@ public int getMaxCWUt(@Nonnull Collection seen) { } @Override - public boolean canBridge(@Nonnull Collection seen) { + public boolean canBridge(@NotNull Collection seen) { seen.add(this); var controller = getController(); // return true here so that unlinked hatches don't cause problems in multis like the Network Switch diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java index ea812b787c3..c925716144e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityDataAccessHatch.java @@ -40,12 +40,11 @@ import codechicken.lib.vec.Matrix4; import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityDataAccessHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IDataAccessHatch, IDataInfoProvider { @@ -76,9 +75,9 @@ public void onContentsChanged(int slot) { rebuildData(getController() instanceof MetaTileEntityDataBank); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { var controller = MetaTileEntityDataAccessHatch.this.getController(); boolean isDataBank = controller instanceof MetaTileEntityDataBank; if (AssemblyLineManager.isStackDataItem(stack, isDataBank) && @@ -148,7 +147,7 @@ private void rebuildData(boolean isDataBank) { } @Override - public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { + public boolean isRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen) { seen.add(this); return recipes.contains(recipe); } @@ -166,7 +165,7 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.data_access_hatch.tooltip.1")); @@ -178,7 +177,7 @@ public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List } } - @Nonnull + @NotNull @Override public List getDataInfo() { if (recipes.isEmpty()) return Collections.emptyList(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java index 34c53e7a0cb..1440514f90e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityEnergyHatch.java @@ -24,12 +24,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityEnergyHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { @@ -71,7 +70,7 @@ public void update() { checkWeatherOrTerrainExplosion(getTier(), getTier() * 10, energyContainer); } - @Nonnull + @NotNull private SimpleOverlayRenderer getOverlay() { if (isExportHatch) { if (amperage <= 2) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java index 6d23c88bd56..8eca7ca9111 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java @@ -38,13 +38,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { @@ -303,7 +302,7 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); @@ -375,7 +374,7 @@ public IFilter getFilter() { } @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { if (!isExportHatch) return true; return !locked || lockedFluid == null || fluidStack.isFluidEqual(lockedFluid); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index db97935abe0..e44a0953d4e 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -39,14 +39,13 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityItemBus extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable, IGhostSlotConfigurable { @@ -301,7 +300,7 @@ protected TextureArea getCircuitSlotOverlay() { } // Method provided to override - protected void getCircuitSlotTooltip(@Nonnull SlotWidget widget) { + protected void getCircuitSlotTooltip(@NotNull SlotWidget widget) { String configString; if (circuitInventory == null || circuitInventory.getCircuitValue() == GhostCircuitItemStackHandler.NO_CONFIG) { configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText(); @@ -406,7 +405,7 @@ public void setGhostCircuitConfig(int config) { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { if (this.isExportHatch) tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java index f6897f1144b..47b88bb6ef0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java @@ -25,12 +25,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityMachineHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { @@ -120,10 +119,10 @@ public LimitedImportHandler(MetaTileEntity metaTileEntity) { super(metaTileEntity, 1, null, false); } - @Nonnull + @NotNull @Override // Insert item returns the remainder stack that was not inserted - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { // If the item was not valid, nothing from the stack can be inserted if (!isItemValid(slot, stack)) { return stack; @@ -177,7 +176,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { boolean slotMatches = this.getStackInSlot(slot).isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(this.getStackInSlot(slot), stack); @@ -190,7 +189,7 @@ public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return slotMatches; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (isSlotBlocked()) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java index 8a9445d70fd..dda660e024f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMaintenanceHatch.java @@ -45,6 +45,8 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.math.BigDecimal; import java.math.RoundingMode; @@ -55,9 +57,6 @@ import java.util.function.Function; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; public class MetaTileEntityMaintenanceHatch extends MetaTileEntityMultiblockPart @@ -516,7 +515,7 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList subItem } @Override - public void addInformation(ItemStack stack, @Nullable World world, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, world, tooltip, advanced); tooltip.add(I18n.format("gregtech.universal.disabled")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java index 6f8088743c7..fd934d13813 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java @@ -33,11 +33,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, ITieredMetaTileEntity, IMufflerHatch { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java index 2c6c4fcf309..cf77abc3bb6 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java @@ -31,11 +31,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityMultiFluidHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IControllable { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java index 497b36e22f7..ca4d8d8000c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityOpticalDataHatch.java @@ -23,12 +23,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; - public class MetaTileEntityOpticalDataHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IOpticalDataAccessHatch { @@ -67,7 +66,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { + public boolean isRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen) { seen.add(this); if (isAttachedToMultiBlock()) { if (isTransmitter()) { @@ -91,9 +90,9 @@ public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection hatches, - @Nonnull Collection seen, - @Nonnull Recipe recipe) { + private static boolean isRecipeAvailable(@NotNull Iterable hatches, + @NotNull Collection seen, + @NotNull Recipe recipe) { for (IDataAccessHatch hatch : hatches) { if (seen.contains(hatch)) continue; if (hatch.isRecipeAvailable(recipe, seen)) { @@ -132,7 +131,7 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java index b07c575060b..84c388dece1 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java @@ -29,12 +29,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityPassthroughHatchFluid extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { @@ -156,11 +155,11 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } - @Nonnull + @NotNull @Override public Class getPassthroughType() { return IFluidHandler.class; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java index 64baf3c2d36..b60a9781bed 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java @@ -30,12 +30,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityPassthroughHatchItem extends MetaTileEntityMultiblockPart implements IPassthroughHatch, IMultiblockAbilityPart { @@ -159,11 +158,11 @@ public MultiblockAbility getAbility() { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } - @Nonnull + @NotNull @Override public Class getPassthroughType() { return IItemHandlerModifiable.class; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java index d8f4e9ae716..85c52302c24 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -33,13 +33,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { @@ -164,7 +163,7 @@ private Consumer> getFluidAmountText(TankWidget tankWidget) } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.universal.enabled")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java index df13c768d74..a1f3ad2074b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java @@ -34,12 +34,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart, IRotorHolder { @@ -66,7 +65,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { } @Override - protected ModularUI createUI(@Nonnull EntityPlayer entityPlayer) { + protected ModularUI createUI(@NotNull EntityPlayer entityPlayer) { return ModularUI.defaultBuilder() .label(6, 6, getMetaFullName()) .slot(inventory, 0, 79, 36, GuiTextures.SLOT, GuiTextures.TURBINE_OVERLAY) @@ -139,7 +138,7 @@ void setRotorSpinning(boolean spinning) { } @Override - public void registerAbilities(@Nonnull List abilityList) { + public void registerAbilities(@NotNull List abilityList) { abilityList.add(this); } @@ -171,7 +170,7 @@ private boolean checkTurbineFaceFree() { return true; } - private boolean onRotorHolderInteract(@Nonnull EntityPlayer player) { + private boolean onRotorHolderInteract(@NotNull EntityPlayer player) { if (player.isCreative()) return false; if (!getWorld().isRemote && isRotorSpinning) { @@ -421,11 +420,11 @@ private void damageRotor(int damageAmount) { } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { return TurbineRotorBehavior.getInstanceFor(stack) != null && super.isItemValid(slot, stack); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { ItemStack itemStack = super.extractItem(slot, amount, simulate); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java index e6a01b5e09f..8d5027add51 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/ExportOnlyAESlot.java @@ -4,8 +4,7 @@ import net.minecraftforge.common.util.INBTSerializable; import appeng.api.storage.data.IAEStack; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * @author GlodBlock diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java index 7d6866b2a6f..7f470e4d0ff 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java @@ -30,13 +30,12 @@ import appeng.me.helpers.BaseActionSource; import appeng.me.helpers.IGridProxyable; import appeng.me.helpers.MachineSource; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.EnumSet; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @Author GlodBlock * @Description It can connect to ME network. @@ -136,9 +135,9 @@ public ICubeRenderer getBaseTexture() { } } - @Nonnull + @NotNull @Override - public AECableType getCableConnectionType(@Nonnull AEPartLocation part) { + public AECableType getCableConnectionType(@NotNull AEPartLocation part) { if (part.getFacing() != this.frontFacing) { return AECableType.NONE; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java index 67e0a12fdcd..18a81b7df3d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java @@ -34,13 +34,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @Author GlodBlock * @Description The Input Bus that can auto fetch item ME storage network. @@ -227,7 +226,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.import.tooltip")); @@ -281,7 +280,7 @@ public NBTTagCompound serializeNBT() { } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { // NO-OP } @@ -290,7 +289,7 @@ public int getSlots() { return MetaTileEntityMEInputBus.CONFIG_SIZE; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { if (slot >= 0 && slot < CONFIG_SIZE) { @@ -299,13 +298,13 @@ public ItemStack getStackInSlot(int slot) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return stack; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot >= 0 && slot < CONFIG_SIZE) { @@ -320,7 +319,7 @@ public int getSlotLimit(int slot) { } @Override - protected int getStackLimit(int slot, @Nonnull ItemStack stack) { + protected int getStackLimit(int slot, @NotNull ItemStack stack) { return Integer.MAX_VALUE; } } @@ -355,7 +354,7 @@ public ExportOnlyAEItem copy() { } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { // NO-OP } @@ -364,7 +363,7 @@ public int getSlots() { return 1; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { if (slot == 0 && this.stock != null) { @@ -373,13 +372,13 @@ public ItemStack getStackInSlot(int slot) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return stack; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot == 0 && this.stock != null) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java index 0ce47737b7d..9a6dfa4f6aa 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java @@ -40,14 +40,13 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @Author GlodBlock * @Description The Input Hatch that can auto fetch fluid ME storage network. @@ -232,7 +231,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.import.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java index 8f84d35c711..92277985603 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputBus.java @@ -37,13 +37,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @Author GlodBlock * @Description The Output Bus that can directly send its contents to ME storage network. @@ -186,7 +185,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.item_bus.export.tooltip")); @@ -227,7 +226,7 @@ public InaccessibleInfiniteSlot(MetaTileEntity holder, IItemList i } @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + public void setStackInSlot(int slot, @NotNull ItemStack stack) { this.internalBuffer.add(AEItemStack.fromItemStack(stack)); this.holder.markDirty(); this.trigger(); @@ -238,15 +237,15 @@ public int getSlots() { return 1; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.isEmpty()) { return ItemStack.EMPTY; } @@ -258,7 +257,7 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java index 8eb67f78225..c19e7e1bb51 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEOutputHatch.java @@ -39,13 +39,12 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @Author GlodBlock * @Description The Output Hatch that can directly send its contents to ME storage network. @@ -188,7 +187,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.fluid_hatch.export.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java index 06aa7a5a41c..be685df3fd3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedFluidStack.java @@ -13,21 +13,20 @@ import appeng.api.storage.data.IAEFluidStack; import appeng.fluids.util.AEFluidStack; import io.netty.buffer.ByteBuf; +import org.jetbrains.annotations.NotNull; import java.nio.charset.StandardCharsets; -import javax.annotation.Nonnull; - /** * @Author GlodBlock * @Date 2023/4/22-19:25 */ public class WrappedFluidStack implements IAEFluidStack { - @Nonnull + @NotNull FluidStack delegate; - private WrappedFluidStack(@Nonnull FluidStack stack) { + private WrappedFluidStack(@NotNull FluidStack stack) { this.delegate = stack; } @@ -53,7 +52,7 @@ public AEFluidStack getAEStack() { return AEFluidStack.fromFluidStack(this.delegate); } - @Nonnull + @NotNull public FluidStack getDelegate() { return this.delegate; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java index 14efe091f7d..854996b0db4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java @@ -12,9 +12,8 @@ import appeng.core.Api; import appeng.util.item.AEItemStack; import io.netty.buffer.ByteBuf; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @Author GlodBlock @@ -22,15 +21,15 @@ */ public class WrappedItemStack implements IAEItemStack { - @Nonnull + @NotNull ItemStack delegate; - private WrappedItemStack(@Nonnull ItemStack itemStack) { + private WrappedItemStack(@NotNull ItemStack itemStack) { this.delegate = itemStack; } @Nullable - public static WrappedItemStack fromItemStack(@Nonnull ItemStack stack) { + public static WrappedItemStack fromItemStack(@NotNull ItemStack stack) { return stack.isEmpty() ? null : new WrappedItemStack(stack); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java index 97fae542c2d..2707e903afa 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java @@ -23,10 +23,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; import static gregtech.client.renderer.texture.Textures.BRONZE_PLATED_BRICKS; import static gregtech.client.renderer.texture.Textures.SOLID_STEEL_CASING; @@ -71,7 +71,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.ROCK_BREAKER_OVERLAY; @@ -88,7 +88,8 @@ public int getItemOutputLimit() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.steam_.duration_modifier")); tooltip.add(I18n.format("gregtech.universal.tooltip.parallel", PARALLEL_LIMIT)); diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java index 5fb3ee75612..c800f3d1a54 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java @@ -24,10 +24,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.List; public class MetaTileEntitySteamOven extends RecipeMapSteamMultiblockController { @@ -94,7 +94,7 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override protected ICubeRenderer getFrontOverlay() { return Textures.ELECTRIC_FURNACE_OVERLAY; @@ -111,7 +111,8 @@ public int getItemOutputLimit() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, + boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.multiblock.steam_.duration_modifier")); tooltip.add(I18n.format("gregtech.universal.tooltip.parallel", MAX_PARALLELS)); diff --git a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java index 051db7649d3..56a96fb43ca 100644 --- a/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java +++ b/src/main/java/gregtech/common/metatileentities/primitive/MetaTileEntityCharcoalPileIgniter.java @@ -50,6 +50,8 @@ import crafttweaker.api.minecraft.CraftTweakerMC; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -58,9 +60,6 @@ import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.machines.CharcoalPileIgniter") @ZenRegister public class MetaTileEntityCharcoalPileIgniter extends MultiblockControllerBase implements IWorkable { @@ -119,7 +118,7 @@ protected void formStructure(PatternMatchContext context) { updateMaxProgressTime(); } - @Nonnull + @NotNull @Override protected BlockPattern createStructurePattern() { // update the structure's dimensions just before we create it @@ -219,7 +218,7 @@ protected BlockPattern createStructurePattern() { .build(); } - @Nonnull + @NotNull private TraceabilityPredicate logPredicate() { return new TraceabilityPredicate(blockWorldState -> { if (blockWorldState.getBlockState().getBlock().isWood(blockWorldState.getWorld(), @@ -274,12 +273,12 @@ private boolean updateStructureDimensions() { return true; } - private static boolean isBlockWall(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos, - @Nonnull EnumFacing direction) { + private static boolean isBlockWall(@NotNull World world, @NotNull BlockPos.MutableBlockPos pos, + @NotNull EnumFacing direction) { return WALL_BLOCKS.contains(world.getBlockState(pos.move(direction)).getBlock()); } - private static boolean isBlockFloor(@Nonnull World world, @Nonnull BlockPos.MutableBlockPos pos) { + private static boolean isBlockFloor(@NotNull World world, @NotNull BlockPos.MutableBlockPos pos) { return world.getBlockState(pos.move(EnumFacing.DOWN)).getBlock() == Blocks.BRICK_BLOCK; } @@ -348,7 +347,7 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(I18n.format("gregtech.machine.charcoal_pile.tooltip.1")); @@ -445,14 +444,14 @@ public void receiveCustomData(int dataId, PacketBuffer buf) { * @param block the block to add */ @SuppressWarnings("unused") - public static void addWallBlock(@Nonnull Block block) { + public static void addWallBlock(@NotNull Block block) { WALL_BLOCKS.add(block); } @ZenMethod("addWallBlock") @Optional.Method(modid = GTValues.MODID_CT) @SuppressWarnings("unused") - public static void addWallBlockCT(@Nonnull IBlock block) { + public static void addWallBlockCT(@NotNull IBlock block) { WALL_BLOCKS.add(CraftTweakerMC.getBlock(block)); } @@ -489,7 +488,7 @@ public T getCapability(Capability capability, EnumFacing side) { } @SubscribeEvent - public static void onItemUse(@Nonnull PlayerInteractEvent.RightClickBlock event) { + public static void onItemUse(@NotNull PlayerInteractEvent.RightClickBlock event) { TileEntity tileEntity = event.getWorld().getTileEntity(event.getPos()); MetaTileEntity mte = null; if (tileEntity instanceof IGregTechTileEntity) { diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java index 50f298cb4e8..e3d3c75cb12 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java @@ -50,13 +50,12 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class SteamMiner extends MetaTileEntity implements IMiner, IControllable, IVentable, IDataInfoProvider { private boolean needsVenting = false; @@ -347,7 +346,7 @@ public boolean isVentingStuck() { return ventingStuck; } - @Nonnull + @NotNull @Override public List getDataInfo() { int workingArea = getWorkingArea(this.minerLogic.getCurrentRadius()); diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index 9c564c1fa78..cd9356f0825 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -48,15 +48,14 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; public abstract class SteamBoiler extends MetaTileEntity implements IDataInfoProvider { @@ -376,7 +375,7 @@ public void clearMachineInventory(NonNullList itemBuffer) { clearInventory(itemBuffer, containerInventory); } - @Nonnull + @NotNull @Override public List getDataInfo() { return Collections.singletonList(new TextComponentTranslation("gregtech.machine.steam_boiler.heat_amount", diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java index 9159b29cbaa..0411582217a 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamCoalBoiler.java @@ -16,7 +16,7 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.items.IItemHandlerModifiable; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class SteamCoalBoiler extends SteamBoiler { @@ -71,9 +71,9 @@ public IItemHandlerModifiable createExportItemHandler() { public IItemHandlerModifiable createImportItemHandler() { return new GTItemStackHandler(this, 1) { - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (TileEntityFurnace.getItemBurnTime(stack) <= 0) return stack; return super.insertItem(slot, stack, simulate); diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java index 9d9511d1fd7..421cc9843df 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java @@ -25,11 +25,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.Objects; -import javax.annotation.Nonnull; - public class SteamLavaBoiler extends SteamBoiler { private static final Object2IntMap BOILER_FUEL_TO_CONSUMPTION = new Object2IntOpenHashMap<>(); @@ -38,7 +37,7 @@ public class SteamLavaBoiler extends SteamBoiler { private static final IFilter FUEL_FILTER = new IFilter<>() { @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { for (Fluid fluid : getBoilerFuelToConsumption().keySet()) { if (CommonFluidFilters.matchesFluid(fluidStack, fluid)) return true; } @@ -56,7 +55,7 @@ private static void init() { setBoilerFuelToConsumption(Materials.Creosote.getFluid(), 250); } - @Nonnull + @NotNull public static Object2IntMap getBoilerFuelToConsumption() { if (!initialized) { initialized = true; @@ -65,7 +64,7 @@ public static Object2IntMap getBoilerFuelToConsumption() { return Object2IntMaps.unmodifiable(BOILER_FUEL_TO_CONSUMPTION); } - public static void setBoilerFuelToConsumption(@Nonnull Fluid fluid, int amount) { + public static void setBoilerFuelToConsumption(@NotNull Fluid fluid, int amount) { Objects.requireNonNull(fluid, "fluid == null"); if (amount <= 0) throw new IllegalArgumentException("amount <= 0"); BOILER_FUEL_TO_CONSUMPTION.put(fluid, amount); diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java index d03a6ac6e75..abccdb7183a 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java @@ -36,11 +36,10 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntitySteamHatch extends MetaTileEntityMultiblockPart implements IMultiblockAbilityPart { diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java index 19bca0ef1e5..37159f0c00d 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java @@ -23,12 +23,11 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntitySteamItemBus extends MetaTileEntityItemBus { private static final boolean IS_STEEL = ConfigHolder.machines.steelSteamMultiblocks; @@ -63,7 +62,7 @@ public ICubeRenderer getBaseTexture() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { super.addInformation(stack, player, tooltip, advanced); tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("gregtech.machine.steam_bus.tooltip")); diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java index 17a26c15475..daa4ff85b3c 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeMemory.java @@ -8,7 +8,7 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class CraftingRecipeMemory { diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java index 2b1264ae613..a7fa403e9db 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java @@ -29,11 +29,10 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityBuffer extends MetaTileEntity implements ITieredMetaTileEntity { private static final int TANK_SIZE = 64000; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index ba35f958fd3..1a7d5c00752 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -34,11 +34,10 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.IS_TAPED; import static gregtech.api.capability.GregtechDataCodes.TAG_KEY_PAINTING_COLOR; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java index d30b53f5242..50dd8dc5cbe 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java @@ -33,11 +33,10 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityCreativeChest extends MetaTileEntityQuantumChest { private int itemsPerCycle = 1; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java index eb62f8c1fe2..7b76fa8e57f 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java @@ -35,12 +35,11 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Function; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.MAX; import static gregtech.api.GTValues.V; import static gregtech.api.capability.GregtechDataCodes.UPDATE_IO_SPEED; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java index 8a006937579..1f35630af35 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java @@ -32,11 +32,10 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.Nullable; import java.util.List; -import javax.annotation.Nullable; - public class MetaTileEntityCreativeTank extends MetaTileEntityQuantumTank { private int mBPerCycle = 1; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java index 0ab8ba0093d..ae83ad54a49 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityDrum.java @@ -44,12 +44,11 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.UPDATE_AUTO_OUTPUT; public class MetaTileEntityDrum extends MetaTileEntity { diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java index 8c9bb85a6f9..d8230181390 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java @@ -52,8 +52,6 @@ import java.util.Random; import java.util.function.DoubleSupplier; -import javax.annotation.Nonnull; - import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONTENTS_SEED; import static gregtech.api.capability.GregtechDataCodes.UPDATE_LOCKED_STATE; @@ -72,9 +70,9 @@ public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRen private final ItemStackHandler unlockComponents = new GTItemStackHandler(this, 2); private final ItemStackHandler unlockInventory = new GTItemStackHandler(this, 2) { - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { int maxStackSize = canPutUnlockItemInSlot(slot, stack); if (maxStackSize == 0) return stack; int maxAmount = Math.min(maxStackSize, stack.getCount()); @@ -423,7 +421,7 @@ public boolean canPlaceCoverOnSide(@NotNull EnumFacing side) { } @Override - public boolean canRenderMachineGrid(@Nonnull ItemStack mainHandStack, @Nonnull ItemStack offHandStack) { + public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { return false; } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java index 81ed97cf149..600092ddb2b 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLongDistanceEndpoint.java @@ -21,14 +21,12 @@ import codechicken.lib.raytracer.CuboidRayTraceResult; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public abstract class MetaTileEntityLongDistanceEndpoint extends MetaTileEntity implements ILDEndpoint, IDataInfoProvider { @@ -213,7 +211,7 @@ protected boolean openGUIOnRightClick() { } @Override - public void addInformation(ItemStack stack, @Nullable World player, @Nonnull List tooltip, + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.1")); tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.2")); @@ -227,13 +225,13 @@ public void addInformation(ItemStack stack, @Nullable World player, @Nonnull Lis } @Override - public void addToolUsages(ItemStack stack, @Nullable World world, @Nonnull List tooltip, boolean advanced) { + public void addToolUsages(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing")); super.addToolUsages(stack, world, tooltip, advanced); } - @Nonnull + @NotNull @Override public List getDataInfo() { List textComponents = new ArrayList<>(); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java index ae6cfd69a76..be6c63f5dec 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java @@ -51,14 +51,13 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; public class MetaTileEntityQuantumChest extends MetaTileEntity @@ -231,15 +230,15 @@ protected void initializeInventory() { protected IItemHandlerModifiable createImportItemHandler() { return new GTItemStackHandler(this, 1) { - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (!isItemValid(slot, stack)) return stack; return GTTransferUtils.insertItem(getCombinedInventory(), stack, simulate); } @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + public boolean isItemValid(int slot, @NotNull ItemStack stack) { NBTTagCompound compound = stack.getTagCompound(); ItemStack outStack = getExportItems().getStackInSlot(0); boolean outStackMatch = true; @@ -559,7 +558,7 @@ public int getSlots() { return 1; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int slot) { ItemStack itemStack = MetaTileEntityQuantumChest.this.virtualItemStack; @@ -579,7 +578,7 @@ public int getSlotLimit(int slot) { return (int) MetaTileEntityQuantumChest.this.maxStoredItems; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { int extractedAmount = (int) Math.min(amount, itemsStoredInside); @@ -599,9 +598,9 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { return extractedStack; } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack insertedStack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack insertedStack, boolean simulate) { if (insertedStack.isEmpty()) { return ItemStack.EMPTY; } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java index 27f523a1b23..6e27064a4e3 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java @@ -53,14 +53,13 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.List; import java.util.function.Consumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.*; import static net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack.FLUID_NBT_KEY; @@ -682,7 +681,7 @@ public IFilter getFilter() { } @Override - public boolean test(@Nonnull FluidStack fluidStack) { + public boolean test(@NotNull FluidStack fluidStack) { return !locked || lockedFluid == null || fluidStack.isFluidEqual(lockedFluid); } diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java index e46c10cef79..93dc559bb11 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java @@ -44,15 +44,13 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MetaTileEntityWorkbench extends MetaTileEntity implements ICraftingStorage { private final ItemStackHandler internalInventory = new GTItemStackHandler(this, 18); @@ -255,7 +253,7 @@ public boolean canPlaceCoverOnSide(@NotNull EnumFacing side) { } @Override - public boolean canRenderMachineGrid(@Nonnull ItemStack mainHandStack, @Nonnull ItemStack offHandStack) { + public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { return false; } diff --git a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java index 70e789cec47..d384e22e608 100644 --- a/src/main/java/gregtech/common/pipelike/cable/BlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/BlockCable.java @@ -40,14 +40,13 @@ import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.TreeMap; -import javax.annotation.Nonnull; - public class BlockCable extends BlockMaterialPipe implements ITileEntityProvider { @@ -84,7 +83,7 @@ protected WireProperties createProperties(Insulation insulation, Material materi } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override public PipeRenderer getPipeRenderer() { return CableRenderer.INSTANCE; @@ -101,19 +100,19 @@ public WorldENet getWorldPipeNet(World world) { } @Override - public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { for (Material material : enabledMaterials.keySet()) { items.add(getItem(material)); } } @Override - protected boolean isPipeTool(@Nonnull ItemStack stack) { + protected boolean isPipeTool(@NotNull ItemStack stack) { return ToolHelper.isTool(stack, ToolClasses.WIRE_CUTTER); } @Override - public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { + public int getLightValue(@NotNull IBlockState state, IBlockAccess world, @NotNull BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityCable) { TileEntityCable cable = (TileEntityCable) tile; @@ -131,7 +130,7 @@ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { } @Override - public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { if (worldIn.isRemote) { TileEntityCable cable = (TileEntityCable) getPipeTileEntity(worldIn, pos); cable.killParticle(); @@ -162,8 +161,8 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull Entity entityIn) { + public void onEntityCollision(World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull Entity entityIn) { if (worldIn.isRemote) return; Insulation insulation = getPipeTileEntity(worldIn, pos).getPipeType(); if (insulation.insulationLevel == -1 && entityIn instanceof EntityLivingBase) { @@ -183,11 +182,11 @@ public void onEntityCollision(World worldIn, @Nonnull BlockPos pos, @Nonnull IBl } } - @Nonnull + @NotNull @Override @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return CableRenderer.INSTANCE.getBlockRenderType(); } diff --git a/src/main/java/gregtech/common/pipelike/cable/Insulation.java b/src/main/java/gregtech/common/pipelike/cable/Insulation.java index 6587144ce8a..c1312db34de 100644 --- a/src/main/java/gregtech/common/pipelike/cable/Insulation.java +++ b/src/main/java/gregtech/common/pipelike/cable/Insulation.java @@ -4,7 +4,7 @@ import gregtech.api.unification.material.properties.WireProperties; import gregtech.api.unification.ore.OrePrefix; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum Insulation implements IMaterialPipeType { @@ -38,7 +38,7 @@ public enum Insulation implements IMaterialPipeType { this.lossMultiplier = lossMultiplier; } - @Nonnull + @NotNull @Override public String getName() { return name; diff --git a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java index 96aee6229b8..9a251b4411f 100644 --- a/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/cable/net/EnergyNetWalker.java @@ -11,12 +11,11 @@ import net.minecraft.world.World; import org.apache.commons.lang3.ArrayUtils; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - public class EnergyNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe) { diff --git a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java index 5550648cd14..d54d160e525 100644 --- a/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/tile/TileEntityCable.java @@ -31,15 +31,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import codechicken.lib.vec.Cuboid6; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.capability.GregtechDataCodes.CABLE_TEMPERATURE; import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONNECTIONS; @@ -329,21 +328,21 @@ protected List getPipeBoxes() { return pipeBoxes; } - @Nonnull + @NotNull @Override - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) { + public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("Temp", temperature); return compound; } @Override - public void readFromNBT(@Nonnull NBTTagCompound compound) { + public void readFromNBT(@NotNull NBTTagCompound compound) { super.readFromNBT(compound); temperature = compound.getInteger("Temp"); } - @Nonnull + @NotNull @Override public List getDataInfo() { List list = new ArrayList<>(); diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java index 71c10eed334..f4e4975fa6c 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/BlockFluidPipe.java @@ -35,14 +35,13 @@ import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; import java.util.SortedMap; import java.util.TreeMap; -import javax.annotation.Nonnull; - public class BlockFluidPipe extends BlockMaterialPipe { private final SortedMap enabledMaterials = new TreeMap<>(); @@ -81,7 +80,7 @@ protected FluidPipeProperties createProperties(FluidPipeType fluidPipeType, Mate } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override public PipeRenderer getPipeRenderer() { return FluidPipeRenderer.INSTANCE; @@ -93,14 +92,14 @@ protected FluidPipeProperties getFallbackType() { } @Override - public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { for (Material material : enabledMaterials.keySet()) { items.add(getItem(material)); } } @Override - public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { + public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state) { super.breakBlock(worldIn, pos, state); // TODO insert to neighbours } @@ -128,8 +127,8 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - public void onEntityCollision(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, - @Nonnull Entity entityIn) { + public void onEntityCollision(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull IBlockState state, + @NotNull Entity entityIn) { if (worldIn.isRemote) return; TileEntityFluidPipe pipe = (TileEntityFluidPipe) getPipeTileEntity(worldIn, pos); if (pipe instanceof TileEntityFluidPipeTickable && pipe.getFrameMaterial() == null && @@ -171,10 +170,10 @@ public TileEntityPipeBase createNewTileEntit } @Override - @Nonnull + @NotNull @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return FluidPipeRenderer.INSTANCE.getBlockRenderType(); } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java index bbb3339a507..2a99c200680 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/FluidPipeType.java @@ -4,7 +4,7 @@ import gregtech.api.unification.material.properties.FluidPipeProperties; import gregtech.api.unification.ore.OrePrefix; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum FluidPipeType implements IMaterialPipeType { @@ -40,7 +40,7 @@ public enum FluidPipeType implements IMaterialPipeType { this.channels = channels; } - @Nonnull + @NotNull @Override public String getName() { return name; diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java index ecca27a4c52..3602e89f3f8 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java @@ -27,8 +27,7 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class MetaTileEntityLDFluidEndpoint extends MetaTileEntityLongDistanceEndpoint { diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java index 5309c429bd0..b9b695026b8 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/PipeTankList.java @@ -10,12 +10,12 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Arrays; import java.util.Iterator; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class PipeTankList implements IFluidHandler, Iterable { private final TileEntityFluidPipeTickable pipe; @@ -122,7 +122,7 @@ public FluidStack drain(FluidStack fluidStack, boolean doDrain) { } @Override - @Nonnull + @NotNull public Iterator iterator() { return Arrays.stream(tanks).iterator(); } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java index 975aeac1701..e06a3d27d59 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/BlockItemPipe.java @@ -31,14 +31,13 @@ import com.google.common.base.Preconditions; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; - public class BlockItemPipe extends BlockMaterialPipe { private final Map enabledMaterials = new HashMap<>(); @@ -88,7 +87,7 @@ protected ItemPipeProperties createProperties(ItemPipeType itemPipeType, Materia } @SideOnly(Side.CLIENT) - @Nonnull + @NotNull @Override public PipeRenderer getPipeRenderer() { return ItemPipeRenderer.INSTANCE; @@ -99,7 +98,7 @@ public Collection getEnabledMaterials() { } @Override - public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { for (Material material : enabledMaterials.keySet()) { items.add(getItem(material)); } @@ -128,10 +127,10 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - @Nonnull + @NotNull @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return ItemPipeRenderer.INSTANCE.getBlockRenderType(); } } diff --git a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java index d13e338c4e8..cfbdcecb3f3 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/ItemPipeType.java @@ -4,7 +4,7 @@ import gregtech.api.unification.material.properties.ItemPipeProperties; import gregtech.api.unification.ore.OrePrefix; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum ItemPipeType implements IMaterialPipeType { @@ -66,7 +66,7 @@ public boolean isPaintable() { return true; } - @Nonnull + @NotNull @Override public String getName() { return name; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java index 706c5ef4f07..e062224904b 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/longdistance/MetaTileEntityLDItemEndpoint.java @@ -27,20 +27,19 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaTileEntityLDItemEndpoint extends MetaTileEntityLongDistanceEndpoint { private static final ItemStackHandler DEFAULT_INVENTORY = new ItemStackHandler(1) { - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { return stack; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; @@ -108,7 +107,7 @@ public ItemHandlerWrapper(IItemHandler delegate) { super(delegate); } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java index 8590e1b2254..a2313f82398 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetHandler.java @@ -20,14 +20,13 @@ import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; -import javax.annotation.Nonnull; - public class ItemNetHandler implements IItemHandler { private ItemPipeNet net; @@ -65,9 +64,9 @@ private void copyTransferred() { simulatedTransfersGlobalRoundRobin.putAll(pipe.getTransferred()); } - @Nonnull + @NotNull @Override - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { if (stack.isEmpty()) return stack; if (net == null || pipe == null || pipe.isInvalid() || pipe.isFaceBlocked(facing)) { @@ -433,13 +432,13 @@ public int getSlots() { return 1; } - @Nonnull + @NotNull @Override public ItemStack getStackInSlot(int i) { return ItemStack.EMPTY; } - @Nonnull + @NotNull @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { return ItemStack.EMPTY; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java index 56b5af5ba7d..1ba92d3845e 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemNetWalker.java @@ -17,13 +17,13 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.EnumMap; import java.util.List; import java.util.function.Predicate; -import javax.annotation.Nullable; - public class ItemNetWalker extends PipeNetWalker { public static List createNetData(World world, BlockPos sourcePipe, EnumFacing faceToSourceHandler) { diff --git a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java index ccafca7be9a..518ffad8802 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/net/ItemRoutePath.java @@ -10,11 +10,11 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import org.jetbrains.annotations.NotNull; + import java.util.List; import java.util.function.Predicate; -import javax.annotation.Nonnull; - public class ItemRoutePath implements IRoutePath { private final TileEntityItemPipe targetPipe; @@ -36,13 +36,13 @@ public ItemRoutePath(TileEntityItemPipe targetPipe, EnumFacing facing, int dista }; } - @Nonnull + @NotNull @Override public TileEntityItemPipe getTargetPipe() { return targetPipe; } - @Nonnull + @NotNull @Override public EnumFacing getTargetFacing() { return faceToHandler; diff --git a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java index d6c5362f2ed..5880f375964 100644 --- a/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java +++ b/src/main/java/gregtech/common/pipelike/itempipe/tile/TileEntityItemPipe.java @@ -17,12 +17,11 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.Nullable; import java.lang.ref.WeakReference; import java.util.EnumMap; -import javax.annotation.Nullable; - public class TileEntityItemPipe extends TileEntityMaterialPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); diff --git a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java index 5c6b3075e41..c7adec7b706 100644 --- a/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/BlockLaserPipe.java @@ -28,16 +28,15 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class BlockLaserPipe extends BlockPipe { private final LaserPipeType pipeType; private final LaserPipeProperties properties; - public BlockLaserPipe(@Nonnull LaserPipeType pipeType) { + public BlockLaserPipe(@NotNull LaserPipeType pipeType) { this.pipeType = pipeType; this.properties = LaserPipeProperties.INSTANCE; setCreativeTab(GregTechAPI.TAB_GREGTECH_PIPES); @@ -104,12 +103,12 @@ public void setTileEntityData(TileEntityPipeBase items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { items.add(new ItemStack(this, 1, this.pipeType.ordinal())); } @Override - protected boolean isPipeTool(@Nonnull ItemStack stack) { + protected boolean isPipeTool(@NotNull ItemStack stack) { return ToolHelper.isTool(stack, ToolClasses.WIRE_CUTTER); } @@ -136,15 +135,15 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - @Nonnull + @NotNull @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return LaserPipeRenderer.INSTANCE.getBlockRenderType(); } @Override - public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) { + public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) { if (layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.CUTOUT) return true; return layer == BloomEffectUtil.getEffectiveBloomLayer(); } diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java index 71d1829287d..d930abaa64e 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserNetHandler.java @@ -6,8 +6,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class LaserNetHandler implements ILaserContainer { @@ -15,7 +15,7 @@ public class LaserNetHandler implements ILaserContainer { private final TileEntityLaserPipe pipe; private final EnumFacing facing; - public LaserNetHandler(LaserPipeNet net, @Nonnull TileEntityLaserPipe pipe, @Nullable EnumFacing facing) { + public LaserNetHandler(LaserPipeNet net, @NotNull TileEntityLaserPipe pipe, @Nullable EnumFacing facing) { this.net = net; this.pipe = pipe; this.facing = facing; diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java index cff94155e38..02781ae8ce8 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserPipeNet.java @@ -10,11 +10,10 @@ import net.minecraft.util.math.BlockPos; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.Nullable; import java.util.Map; -import javax.annotation.Nullable; - public class LaserPipeNet extends PipeNet { private final Map netData = new Object2ObjectOpenHashMap<>(); diff --git a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java index 8e72484bf40..7e85964662a 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/LaserRoutePath.java @@ -7,8 +7,8 @@ import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; // jabel moment public class LaserRoutePath implements IRoutePath { @@ -28,18 +28,18 @@ public LaserRoutePath(TileEntityLaserPipe targetPipe, EnumFacing faceToHandler, * * @return The face to handler */ - @Nonnull + @NotNull public EnumFacing getFaceToHandler() { return faceToHandler; } - @Nonnull + @NotNull @Override public TileEntityLaserPipe getTargetPipe() { return targetPipe; } - @Nonnull + @NotNull @Override public EnumFacing getTargetFacing() { return faceToHandler; diff --git a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java index 23c165a1df7..69545318d36 100644 --- a/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/laser/net/WorldLaserPipeNet.java @@ -5,7 +5,7 @@ import net.minecraft.world.World; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class WorldLaserPipeNet extends WorldPipeNet { @@ -15,8 +15,8 @@ public WorldLaserPipeNet(String name) { super(name); } - @Nonnull - public static WorldLaserPipeNet getWorldPipeNet(@Nonnull World world) { + @NotNull + public static WorldLaserPipeNet getWorldPipeNet(@NotNull World world) { WorldLaserPipeNet netWorldData = (WorldLaserPipeNet) world.loadData(WorldLaserPipeNet.class, DATA_ID); if (netWorldData == null) { netWorldData = new WorldLaserPipeNet(DATA_ID); diff --git a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java index 6b82c9e28bb..87426fb81de 100644 --- a/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/BlockOpticalPipe.java @@ -26,16 +26,15 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class BlockOpticalPipe extends BlockPipe { private final OpticalPipeType pipeType; private final OpticalPipeProperties properties; - public BlockOpticalPipe(@Nonnull OpticalPipeType pipeType) { + public BlockOpticalPipe(@NotNull OpticalPipeType pipeType) { this.pipeType = pipeType; this.properties = OpticalPipeProperties.INSTANCE; setCreativeTab(GregTechAPI.TAB_GREGTECH_PIPES); @@ -43,7 +42,7 @@ public BlockOpticalPipe(@Nonnull OpticalPipeType pipeType) { } @Override - protected Pair getParticleTexture(@Nonnull World world, BlockPos blockPos) { + protected Pair getParticleTexture(@NotNull World world, BlockPos blockPos) { return OpticalPipeRenderer.INSTANCE.getParticleTexture((TileEntityOpticalPipe) world.getTileEntity(blockPos)); } @@ -63,14 +62,14 @@ public TileEntityPipeBase createNewTileE } @Override - public OpticalPipeProperties createProperties(@Nonnull IPipeTile pipeTile) { + public OpticalPipeProperties createProperties(@NotNull IPipeTile pipeTile) { OpticalPipeType pipeType = pipeTile.getPipeType(); if (pipeType == null) return getFallbackType(); return this.pipeType.modifyProperties(properties); } @Override - public OpticalPipeProperties createItemProperties(@Nonnull ItemStack itemStack) { + public OpticalPipeProperties createItemProperties(@NotNull ItemStack itemStack) { if (itemStack.getItem() instanceof ItemBlockOpticalPipe pipe) { return ((BlockOpticalPipe) pipe.getBlock()).properties; } @@ -88,7 +87,7 @@ protected OpticalPipeProperties getFallbackType() { } @Override - public OpticalPipeType getItemPipeType(@Nonnull ItemStack itemStack) { + public OpticalPipeType getItemPipeType(@NotNull ItemStack itemStack) { if (itemStack.getItem() instanceof ItemBlockOpticalPipe pipe) { return ((BlockOpticalPipe) pipe.getBlock()).pipeType; } @@ -96,18 +95,18 @@ public OpticalPipeType getItemPipeType(@Nonnull ItemStack itemStack) { } @Override - public void setTileEntityData(@Nonnull TileEntityPipeBase pipeTile, + public void setTileEntityData(@NotNull TileEntityPipeBase pipeTile, ItemStack itemStack) { pipeTile.setPipeData(this, pipeType); } @Override - public void getSubBlocks(@Nonnull CreativeTabs itemIn, @Nonnull NonNullList items) { + public void getSubBlocks(@NotNull CreativeTabs itemIn, @NotNull NonNullList items) { items.add(new ItemStack(this, 1, this.pipeType.ordinal())); } @Override - protected boolean isPipeTool(@Nonnull ItemStack stack) { + protected boolean isPipeTool(@NotNull ItemStack stack) { return ToolHelper.isTool(stack, ToolClasses.WIRE_CUTTER); } @@ -135,10 +134,10 @@ public boolean isHoldingPipe(EntityPlayer player) { } @Override - @Nonnull + @NotNull @SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") - public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) { + public EnumBlockRenderType getRenderType(@NotNull IBlockState state) { return OpticalPipeRenderer.INSTANCE.getBlockRenderType(); } } diff --git a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java index beeb47d7bc6..18f02a3530c 100644 --- a/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java +++ b/src/main/java/gregtech/common/pipelike/optical/OpticalPipeType.java @@ -2,7 +2,7 @@ import gregtech.api.pipenet.block.IPipeType; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum OpticalPipeType implements IPipeType { @@ -23,7 +23,7 @@ public boolean isPaintable() { return true; } - @Nonnull + @NotNull @Override public String getName() { return "normal"; diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java index 539af26786e..1dfadf19a76 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetHandler.java @@ -10,10 +10,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.Collection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import java.util.Collection; public class OpticalNetHandler implements IDataAccessHatch, IOpticalComputationProvider { @@ -23,7 +23,7 @@ public class OpticalNetHandler implements IDataAccessHatch, IOpticalComputationP private OpticalPipeNet net; - public OpticalNetHandler(OpticalPipeNet net, @Nonnull TileEntityOpticalPipe pipe, @Nullable EnumFacing facing) { + public OpticalNetHandler(OpticalPipeNet net, @NotNull TileEntityOpticalPipe pipe, @Nullable EnumFacing facing) { this.net = net; this.pipe = pipe; this.facing = facing; @@ -39,7 +39,7 @@ public OpticalPipeNet getNet() { } @Override - public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { + public boolean isRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen) { boolean isAvailable = traverseRecipeAvailable(recipe, seen); if (isAvailable) setPipesActive(); return isAvailable; @@ -51,19 +51,19 @@ public boolean isCreative() { } @Override - public int requestCWUt(int cwut, boolean simulate, @Nonnull Collection seen) { + public int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { int provided = traverseRequestCWUt(cwut, simulate, seen); if (provided > 0) setPipesActive(); return provided; } @Override - public int getMaxCWUt(@Nonnull Collection seen) { + public int getMaxCWUt(@NotNull Collection seen) { return traverseMaxCWUt(seen); } @Override - public boolean canBridge(@Nonnull Collection seen) { + public boolean canBridge(@NotNull Collection seen) { return traverseCanBridge(seen); } @@ -79,7 +79,7 @@ private boolean isNetInvalidForTraversal() { return net == null || pipe == null || pipe.isInvalid(); } - private boolean traverseRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { + private boolean traverseRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen) { if (isNetInvalidForTraversal()) return false; OpticalRoutePath inv = net.getNetData(pipe.getPipePos(), facing); @@ -94,26 +94,26 @@ private boolean traverseRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collect return false; } - private int traverseRequestCWUt(int cwut, boolean simulate, @Nonnull Collection seen) { + private int traverseRequestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { IOpticalComputationProvider provider = getComputationProvider(seen); if (provider == null) return 0; return provider.requestCWUt(cwut, simulate, seen); } - private int traverseMaxCWUt(@Nonnull Collection seen) { + private int traverseMaxCWUt(@NotNull Collection seen) { IOpticalComputationProvider provider = getComputationProvider(seen); if (provider == null) return 0; return provider.getMaxCWUt(seen); } - private boolean traverseCanBridge(@Nonnull Collection seen) { + private boolean traverseCanBridge(@NotNull Collection seen) { IOpticalComputationProvider provider = getComputationProvider(seen); if (provider == null) return true; // nothing found, so don't report a problem, just pass quietly return provider.canBridge(seen); } @Nullable - private IOpticalComputationProvider getComputationProvider(@Nonnull Collection seen) { + private IOpticalComputationProvider getComputationProvider(@NotNull Collection seen) { if (isNetInvalidForTraversal()) return null; OpticalRoutePath inv = net.getNetData(pipe.getPipePos(), facing); diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java index 6f696565b37..531f86e0d13 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalNetWalker.java @@ -10,7 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class OpticalNetWalker extends PipeNetWalker { diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java index 09cfc97eb2c..18f2edd36ca 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalPipeNet.java @@ -10,11 +10,10 @@ import net.minecraft.util.math.BlockPos; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.Nullable; import java.util.Map; -import javax.annotation.Nullable; - public class OpticalPipeNet extends PipeNet { private final Map NET_DATA = new Object2ObjectOpenHashMap<>(); diff --git a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java index cc5b85ab500..52c89aa97bb 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/OpticalRoutePath.java @@ -9,8 +9,8 @@ import net.minecraft.util.EnumFacing; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class OpticalRoutePath implements IRoutePath { @@ -24,13 +24,13 @@ public OpticalRoutePath(TileEntityOpticalPipe targetPipe, EnumFacing faceToHandl this.distance = distance; } - @Nonnull + @NotNull @Override public TileEntityOpticalPipe getTargetPipe() { return targetPipe; } - @Nonnull + @NotNull @Override public EnumFacing getTargetFacing() { return faceToHandler; diff --git a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java index c4761328cbc..7fd1dad62be 100644 --- a/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java +++ b/src/main/java/gregtech/common/pipelike/optical/net/WorldOpticalPipeNet.java @@ -5,7 +5,7 @@ import net.minecraft.world.World; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class WorldOpticalPipeNet extends WorldPipeNet { @@ -15,8 +15,8 @@ public WorldOpticalPipeNet(String name) { super(name); } - @Nonnull - public static WorldOpticalPipeNet getWorldPipeNet(@Nonnull World world) { + @NotNull + public static WorldOpticalPipeNet getWorldPipeNet(@NotNull World world) { WorldOpticalPipeNet netWorldData = (WorldOpticalPipeNet) world.loadData(WorldOpticalPipeNet.class, DATA_ID); if (netWorldData == null) { netWorldData = new WorldOpticalPipeNet(DATA_ID); diff --git a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java index 82c80a09dcf..adf7f995ae1 100644 --- a/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java +++ b/src/main/java/gregtech/common/pipelike/optical/tile/TileEntityOpticalPipe.java @@ -19,13 +19,13 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.lang.ref.WeakReference; import java.util.Collection; import java.util.EnumMap; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class TileEntityOpticalPipe extends TileEntityPipeBase { private final EnumMap handlers = new EnumMap<>(EnumFacing.class); @@ -197,7 +197,7 @@ public void receiveCustomData(int discriminator, PacketBuffer buf) { private static class DefaultDataHandler implements IDataAccessHatch { @Override - public boolean isRecipeAvailable(@Nonnull Recipe recipe, @Nonnull Collection seen) { + public boolean isRecipeAvailable(@NotNull Recipe recipe, @NotNull Collection seen) { return false; } @@ -210,17 +210,17 @@ public boolean isCreative() { private static class DefaultComputationHandler implements IOpticalComputationProvider { @Override - public int requestCWUt(int cwut, boolean simulate, @Nonnull Collection seen) { + public int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { return 0; } @Override - public int getMaxCWUt(@Nonnull Collection seen) { + public int getMaxCWUt(@NotNull Collection seen) { return 0; } @Override - public boolean canBridge(@Nonnull Collection seen) { + public boolean canBridge(@NotNull Collection seen) { return false; } } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java index 86fe9c217cc..4f0070524ec 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectingTexture.java @@ -14,13 +14,13 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + import java.awt.*; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.util.HashMap; -import javax.annotation.Nullable; - public class ProspectingTexture extends AbstractTexture { public static final String SELECTED_ALL = "[all]"; diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java index 72acb2a302f..fb2144909ce 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorApp.java @@ -23,6 +23,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Table; import com.google.common.collect.Tables; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; @@ -31,8 +32,6 @@ import java.util.Map; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public class ProspectorApp extends AbstractApplication implements SearchComponent.IWidgetSearch { private WidgetOreList widgetOreList; @@ -42,7 +41,7 @@ public class ProspectorApp extends AbstractApplication implements SearchComponen private Table persist; private final ProspectorMode mode; - public ProspectorApp(@Nonnull ProspectorMode mode) { + public ProspectorApp(@NotNull ProspectorMode mode) { super(mode.terminalName); this.mode = mode; } diff --git a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java index cf5cbcae306..5de3b24ec9b 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/ProspectorMode.java @@ -1,6 +1,6 @@ package gregtech.common.terminal.app.prospector; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public enum ProspectorMode { @@ -12,12 +12,12 @@ public enum ProspectorMode { public final String terminalName; public final String unlocalizedName; - ProspectorMode(@Nonnull String terminalName, @Nonnull String unlocalizedName) { + ProspectorMode(@NotNull String terminalName, @NotNull String unlocalizedName) { this.terminalName = terminalName; this.unlocalizedName = unlocalizedName; } - @Nonnull + @NotNull public ProspectorMode next() { int next = ordinal() + 1; if (next >= VALUES.length) { diff --git a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java index 60a18f58247..106b142c66f 100644 --- a/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java +++ b/src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java @@ -38,6 +38,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; + import java.awt.*; import java.io.IOException; import java.util.*; @@ -46,8 +48,6 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; -import javax.annotation.Nonnull; - public class WidgetProspectingMap extends Widget { private final int chunkRadius; @@ -69,7 +69,7 @@ public class WidgetProspectingMap extends Widget { private int color; public WidgetProspectingMap(int xPosition, int yPosition, int chunkRadius, WidgetOreList widgetOreList, - @Nonnull ProspectorMode mode, int scanTick) { + @NotNull ProspectorMode mode, int scanTick) { super(new Position(xPosition, yPosition), new Size(16 * (chunkRadius * 2 - 1), 16 * (chunkRadius * 2 - 1))); this.chunkRadius = chunkRadius; this.mode = mode; @@ -375,7 +375,7 @@ private void trimHoveredNames() { } } - @Nonnull + @NotNull private String createVeinName() { // remove the [] surrounding the array String s = hoveredNames.toString(); @@ -397,7 +397,7 @@ private boolean addJourneymapWaypoint(BlockPos b) { } @Optional.Method(modid = GTValues.MODID_VOXELMAP) - private boolean addVoxelMapWaypoint(@Nonnull BlockPos b) { + private boolean addVoxelMapWaypoint(@NotNull BlockPos b) { Color c = new Color(color); TreeSet world = new TreeSet<>(); world.add(Minecraft.getMinecraft().world.provider.getDimension()); @@ -426,7 +426,7 @@ private boolean addVoxelMapWaypoint(@Nonnull BlockPos b) { } @Optional.Method(modid = GTValues.MODID_XAERO_MINIMAP) - private boolean addXaeroMapWaypoint(@Nonnull BlockPos b) { + private boolean addXaeroMapWaypoint(@NotNull BlockPos b) { int red = clampColor(color >> 16 & 0xFF); int green = clampColor(color >> 8 & 0xFF); int blue = clampColor(color & 0xFF); diff --git a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java index abb454892e7..f4b7fe6f2e1 100644 --- a/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java +++ b/src/main/java/gregtech/common/terminal/app/worldprospector/WorldProspectorARApp.java @@ -53,6 +53,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import mezz.jei.api.gui.IGhostIngredientHandler; +import org.jetbrains.annotations.NotNull; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -61,8 +62,6 @@ import java.util.*; import java.util.List; -import javax.annotation.Nonnull; - public class WorldProspectorARApp extends ARApplication { private SingleItemStackHandler[] handlers; @@ -106,14 +105,14 @@ public List> getPhantomTargets(Object ingredie Rectangle rectangle = toRectangleBox(); return Collections.singletonList(new IGhostIngredientHandler.Target() { - @Nonnull + @NotNull @Override public Rectangle getArea() { return rectangle; } @Override - public void accept(@Nonnull Object ingredient) { + public void accept(@NotNull Object ingredient) { if (ingredient instanceof ItemStack) { int mouseButton = Mouse.getEventButton(); boolean shiftDown = TooltipHelper.isShiftDown(); diff --git a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java index 141baa80c02..b9343e2df94 100644 --- a/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java +++ b/src/main/java/gregtech/common/terminal/hardware/BatteryHardware.java @@ -14,13 +14,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.capabilities.Capability; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * Created with IntelliJ IDEA. * @@ -155,13 +155,13 @@ public int getTier() { } @Override - public boolean hasCapability(@Nonnull Capability capability) { + public boolean hasCapability(@NotNull Capability capability) { return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM; } @Nullable @Override - public T getCapability(@Nonnull Capability capability) { + public T getCapability(@NotNull Capability capability) { return capability == GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM ? GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM.cast(this) : null; } diff --git a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java index 4b578cc3a74..62c5e5ccd19 100644 --- a/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java +++ b/src/main/java/gregtech/common/worldgen/AbstractItemLootEntry.java @@ -9,12 +9,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Random; -import javax.annotation.Nonnull; - public abstract class AbstractItemLootEntry extends LootEntry { private final LootFunction[] functions; @@ -28,7 +27,7 @@ protected AbstractItemLootEntry(int weightIn, int qualityIn, LootFunction[] func protected abstract ItemStack createItemStack(); @Override - public void addLoot(@Nonnull Collection stacks, @Nonnull Random rand, @Nonnull LootContext context) { + public void addLoot(@NotNull Collection stacks, @NotNull Random rand, @NotNull LootContext context) { ItemStack itemStack = createItemStack(); for (LootFunction lootfunction : this.functions) { if (LootConditionManager.testAllConditions(lootfunction.getConditions(), rand, context)) { @@ -52,7 +51,7 @@ public void addLoot(@Nonnull Collection stacks, @Nonnull Random rand, } @Override - protected final void serialize(@Nonnull JsonObject json, @Nonnull JsonSerializationContext context) { + protected final void serialize(@NotNull JsonObject json, @NotNull JsonSerializationContext context) { throw new UnsupportedOperationException("Unsupported by custom loot entries"); } } diff --git a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java index b39f31569cf..910286f418c 100644 --- a/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java +++ b/src/main/java/gregtech/common/worldgen/WorldGenRubberTree.java @@ -12,9 +12,9 @@ import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; import net.minecraftforge.fml.common.eventhandler.Event; -import java.util.Random; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; +import java.util.Random; import static gregtech.common.blocks.wood.BlockRubberLog.NATURAL; @@ -28,11 +28,11 @@ protected WorldGenRubberTree(boolean notify) { } @Override - public boolean generate(@Nonnull World world, @Nonnull Random random, @Nonnull BlockPos pos) { + public boolean generate(@NotNull World world, @NotNull Random random, @NotNull BlockPos pos) { return generateImpl(world, random, new BlockPos.MutableBlockPos(pos)); } - public boolean generateImpl(@Nonnull World world, @Nonnull Random random, BlockPos.MutableBlockPos pos) { + public boolean generateImpl(@NotNull World world, @NotNull Random random, BlockPos.MutableBlockPos pos) { pos.setPos(pos.getX() + 8, world.getHeight() - 1, pos.getZ() + 8); while (pos.getY() > 0 && world.isAirBlock(pos)) { pos.setY(pos.getY() - 1); @@ -88,7 +88,7 @@ public boolean grow(World world, BlockPos pos, Random random) { return true; } - public int getGrowHeight(@Nonnull World world, @Nonnull BlockPos pos) { + public int getGrowHeight(@NotNull World world, @NotNull BlockPos pos) { BlockPos below = pos.down(); IBlockState baseState = world.getBlockState(below); Block baseBlock = baseState.getBlock(); diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index 4899ce55371..9c4d019cbae 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -67,11 +67,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Map; -import javax.annotation.Nonnull; - import static gregtech.api.GregTechAPI.*; @GregTechModule( @@ -96,7 +95,7 @@ public CoreModule() { GregTechAPI.materialManager = MaterialRegistryManager.getInstance(); } - @Nonnull + @NotNull @Override public Logger getLogger() { return logger; diff --git a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java index 46737ccab59..f1697aebf9d 100644 --- a/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java +++ b/src/main/java/gregtech/core/advancement/criterion/AbstractCriterion.java @@ -4,13 +4,13 @@ import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class AbstractCriterion implements IAdvancementCriterion { private ResourceLocation id = new ResourceLocation("MISSING"); - @Nonnull + @NotNull @Override public ResourceLocation getId() { return id; diff --git a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java index 8117511b7b9..66cf4c22f73 100644 --- a/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java +++ b/src/main/java/gregtech/core/advancement/internal/AdvancementTrigger.java @@ -11,30 +11,29 @@ import com.google.common.collect.Maps; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; import java.util.Map; -import javax.annotation.Nonnull; - public class AdvancementTrigger implements IAdvancementTrigger { private final ResourceLocation id; private final T criterion; private final Map> listeners = Maps.newHashMap(); - public AdvancementTrigger(String name, @Nonnull T criterion) { + public AdvancementTrigger(String name, @NotNull T criterion) { this.id = GTUtility.gregtechId(name); this.criterion = criterion; } - @Nonnull + @NotNull @Override public ResourceLocation getId() { return id; } @Override - public void addListener(@Nonnull PlayerAdvancements playerAdvancementsIn, @Nonnull Listener listener) { + public void addListener(@NotNull PlayerAdvancements playerAdvancementsIn, @NotNull Listener listener) { AdvancementListeners gtListener = listeners.get(playerAdvancementsIn); if (gtListener == null) { @@ -46,7 +45,7 @@ public void addListener(@Nonnull PlayerAdvancements playerAdvancementsIn, @Nonnu } @Override - public void removeListener(@Nonnull PlayerAdvancements playerAdvancementsIn, @Nonnull Listener listener) { + public void removeListener(@NotNull PlayerAdvancements playerAdvancementsIn, @NotNull Listener listener) { AdvancementListeners gtListener = listeners.get(playerAdvancementsIn); if (gtListener != null) { @@ -59,13 +58,13 @@ public void removeListener(@Nonnull PlayerAdvancements playerAdvancementsIn, @No } @Override - public void removeAllListeners(@Nonnull PlayerAdvancements playerAdvancementsIn) { + public void removeAllListeners(@NotNull PlayerAdvancements playerAdvancementsIn) { listeners.remove(playerAdvancementsIn); } - @Nonnull + @NotNull @Override - public T deserializeInstance(@Nonnull JsonObject json, @Nonnull JsonDeserializationContext context) { + public T deserializeInstance(@NotNull JsonObject json, @NotNull JsonDeserializationContext context) { return criterion; } diff --git a/src/main/java/gregtech/core/command/internal/GregTechCommand.java b/src/main/java/gregtech/core/command/internal/GregTechCommand.java index f0f18a7e3f0..b9e1e96df89 100644 --- a/src/main/java/gregtech/core/command/internal/GregTechCommand.java +++ b/src/main/java/gregtech/core/command/internal/GregTechCommand.java @@ -13,33 +13,32 @@ import net.minecraftforge.server.command.CommandTreeBase; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.List; -import javax.annotation.Nonnull; - class GregTechCommand extends CommandTreeBase { - @Nonnull + @NotNull @Override public String getName() { return "gregtech"; } - @Nonnull + @NotNull @Override public List getAliases() { return Lists.newArrayList("gt"); } - @Nonnull + @NotNull @Override - public String getUsage(@Nonnull ICommandSender sender) { + public String getUsage(@NotNull ICommandSender sender) { return "gregtech.command.usage"; } @Override - public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, + public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, String[] args) throws CommandException { if (args.length > 0) { if (args[0].equals("copy")) { diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java index c35ac9e7a8b..5311166dd2c 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryImpl.java @@ -4,11 +4,11 @@ import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.core.CoreModule; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Collections; -import javax.annotation.Nonnull; - public class MaterialRegistryImpl extends MaterialRegistry { private static int networkIdCounter; @@ -19,7 +19,7 @@ public class MaterialRegistryImpl extends MaterialRegistry { private boolean isRegistryClosed = false; private Material fallbackMaterial = null; - protected MaterialRegistryImpl(@Nonnull String modid) { + protected MaterialRegistryImpl(@NotNull String modid) { super(); this.modid = modid; } @@ -30,7 +30,7 @@ public void register(Material material) { } @Override - public void register(int id, @Nonnull String key, @Nonnull Material value) { + public void register(int id, @NotNull String key, @NotNull Material value) { if (isRegistryClosed) { CoreModule.logger.error( "Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", @@ -40,18 +40,18 @@ public void register(int id, @Nonnull String key, @Nonnull Material value) { super.register(id, key, value); } - @Nonnull + @NotNull @Override public Collection getAllMaterials() { return Collections.unmodifiableCollection(this.registryObjects.values()); } @Override - public void setFallbackMaterial(@Nonnull Material material) { + public void setFallbackMaterial(@NotNull Material material) { this.fallbackMaterial = material; } - @Nonnull + @NotNull @Override public Material getFallbackMaterial() { if (this.fallbackMaterial == null) { @@ -65,7 +65,7 @@ public int getNetworkId() { return this.networkId; } - @Nonnull + @NotNull @Override public String getModid() { return this.modid; diff --git a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java index 4f812a8f0f8..265e2a875d0 100644 --- a/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java +++ b/src/main/java/gregtech/core/unification/material/internal/MaterialRegistryManager.java @@ -10,14 +10,13 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public final class MaterialRegistryManager implements IMaterialRegistryManager { private static MaterialRegistryManager INSTANCE; @@ -41,9 +40,9 @@ public static MaterialRegistryManager getInstance() { return INSTANCE; } - @Nonnull + @NotNull @Override - public MaterialRegistry createRegistry(@Nonnull String modid) { + public MaterialRegistry createRegistry(@NotNull String modid) { if (getPhase() != Phase.PRE) { throw new IllegalStateException("Cannot create registries in phase " + getPhase()); } @@ -56,21 +55,21 @@ public MaterialRegistry createRegistry(@Nonnull String modid) { return registry; } - @Nonnull + @NotNull @Override - public MaterialRegistry getRegistry(@Nonnull String modid) { + public MaterialRegistry getRegistry(@NotNull String modid) { MaterialRegistry registry = registries.get(modid); return registry != null ? registry : gregtechRegistry; } - @Nonnull + @NotNull @Override public MaterialRegistry getRegistry(int networkId) { MaterialRegistry registry = networkIds.get(networkId); return registry != null ? registry : gregtechRegistry; } - @Nonnull + @NotNull @Override public Collection getRegistries() { if (getPhase() == Phase.PRE) { @@ -79,7 +78,7 @@ public Collection getRegistries() { return Collections.unmodifiableCollection(registries.values()); } - @Nonnull + @NotNull @Override public Collection getRegisteredMaterials() { if (registeredMaterials == null || @@ -91,7 +90,7 @@ public Collection getRegisteredMaterials() { @Nullable @Override - public Material getMaterial(@Nonnull String name) { + public Material getMaterial(@NotNull String name) { if (!name.isEmpty()) { String modid; String materialName; @@ -108,7 +107,7 @@ public Material getMaterial(@Nonnull String name) { return null; } - @Nonnull + @NotNull @Override public Phase getPhase() { return registrationPhase; @@ -134,14 +133,14 @@ public void freezeRegistries() { registrationPhase = Phase.FROZEN; } - @Nonnull + @NotNull private MaterialRegistryImpl createInternalRegistry() { MaterialRegistryImpl registry = new MaterialRegistryImpl(GTValues.MODID); this.registries.put(GTValues.MODID, registry); return registry; } - @Nonnull + @NotNull public Material getDefaultFallback() { return gregtechRegistry.getFallbackMaterial(); } diff --git a/src/main/java/gregtech/integration/IntegrationModule.java b/src/main/java/gregtech/integration/IntegrationModule.java index 5dfb77b2d0f..15d760b4a63 100644 --- a/src/main/java/gregtech/integration/IntegrationModule.java +++ b/src/main/java/gregtech/integration/IntegrationModule.java @@ -17,12 +17,11 @@ import crazypants.enderio.base.farming.fertilizer.Bonemeal; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - @GregTechModule( moduleID = GregTechModules.MODULE_INTEGRATION, containerID = GTValues.MODID, @@ -32,13 +31,13 @@ public class IntegrationModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Mod Integration"); - @Nonnull + @NotNull @Override public Logger getLogger() { return logger; } - @Nonnull + @NotNull @Override public List> getEventBusSubscribers() { return Collections.singletonList(IntegrationModule.class); @@ -56,7 +55,7 @@ public void init(FMLInitializationEvent event) { @Optional.Method(modid = GTValues.MODID_EIO) @SubscribeEvent - public static void registerFertilizer(@Nonnull RegistryEvent.Register event) { + public static void registerFertilizer(@NotNull RegistryEvent.Register event) { event.getRegistry().register(new Bonemeal(MetaItems.FERTILIZER.getStackForm())); logger.info("Registered EnderIO Compat"); } diff --git a/src/main/java/gregtech/integration/IntegrationSubmodule.java b/src/main/java/gregtech/integration/IntegrationSubmodule.java index 3f66d8bd5e9..f5a5d38f758 100644 --- a/src/main/java/gregtech/integration/IntegrationSubmodule.java +++ b/src/main/java/gregtech/integration/IntegrationSubmodule.java @@ -7,12 +7,11 @@ import net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.Set; -import javax.annotation.Nonnull; - /** * Abstract class meant to be used by mod-specific compatibility modules. * Implements some shared skeleton code that should be shared by other modules. @@ -22,13 +21,13 @@ public abstract class IntegrationSubmodule extends BaseGregTechModule { private static final Set DEPENDENCY_UID = Collections.singleton( GTUtility.gregtechId(GregTechModules.MODULE_INTEGRATION)); - @Nonnull + @NotNull @Override public Logger getLogger() { return IntegrationModule.logger; } - @Nonnull + @NotNull @Override public Set getDependencyUids() { return DEPENDENCY_UID; diff --git a/src/main/java/gregtech/integration/RecipeCompatUtil.java b/src/main/java/gregtech/integration/RecipeCompatUtil.java index 67f7b788e22..cb0a7f3bd67 100644 --- a/src/main/java/gregtech/integration/RecipeCompatUtil.java +++ b/src/main/java/gregtech/integration/RecipeCompatUtil.java @@ -23,9 +23,8 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.ApiStatus; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Contains utilities for recipe compatibility with scripting mods @@ -38,8 +37,8 @@ private RecipeCompatUtil() {/**/} * @param recipe the recipe to retrieve from * @return the first output in a human-readable form */ - @Nonnull - public static String getFirstOutputString(@Nonnull Recipe recipe) { + @NotNull + public static String getFirstOutputString(@NotNull Recipe recipe) { String output = ""; if (!recipe.getOutputs().isEmpty()) { ItemStack item = recipe.getOutputs().get(0); @@ -90,7 +89,7 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) return null; } - @Nonnull + @NotNull public static TweakerType getPriorityTweaker() { if (GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS)) { return TweakerType.GROOVYSCRIPT; @@ -109,7 +108,7 @@ public static TweakerType getPriorityTweaker() { @ApiStatus.ScheduledForRemoval(inVersion = "2.8") @Deprecated @Nullable - public static Material getMaterial(@Nonnull String name) { + public static Material getMaterial(@NotNull String name) { return GregTechAPI.materialManager.getMaterial(name); } diff --git a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java index 195eec12b72..400c41a1110 100644 --- a/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java +++ b/src/main/java/gregtech/integration/crafttweaker/CraftTweakerModule.java @@ -19,12 +19,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import crafttweaker.CraftTweakerAPI; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - @GregTechModule( moduleID = GregTechModules.MODULE_CT, containerID = GTValues.MODID, @@ -35,7 +34,7 @@ public class CraftTweakerModule extends IntegrationSubmodule { public static MetaOreDictItem CT_OREDICT_ITEM; - @Nonnull + @NotNull @Override public List> getEventBusSubscribers() { return Collections.singletonList(CraftTweakerModule.class); diff --git a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java index 926621f180e..7c2dd912ab8 100644 --- a/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java +++ b/src/main/java/gregtech/integration/crafttweaker/block/CTHeatingCoilBlockStats.java @@ -7,12 +7,11 @@ import crafttweaker.annotations.ZenRegister; import crafttweaker.api.block.IBlockState; import crafttweaker.api.minecraft.CraftTweakerMC; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.blocks.HeatingCoils") @ZenRegister @SuppressWarnings("unused") @@ -43,7 +42,7 @@ public CTHeatingCoilBlockStats(String name, int coilTemperature, int level, int this.material = material; } - @Nonnull + @NotNull @Override public String getName() { return this.name; @@ -76,14 +75,14 @@ public Material getMaterial() { } @ZenMethod - public static void add(@Nonnull IBlockState state, @Nonnull String name, int coilTemperature, int level, + public static void add(@NotNull IBlockState state, @NotNull String name, int coilTemperature, int level, int energyDiscount, int tier, @Nullable Material material) { GregTechAPI.HEATING_COILS.put(CraftTweakerMC.getBlockState(state), new CTHeatingCoilBlockStats(name, coilTemperature, level, energyDiscount, tier, material)); } @ZenMethod - public static void remove(@Nonnull IBlockState state) { + public static void remove(@NotNull IBlockState state) { GregTechAPI.HEATING_COILS.remove(CraftTweakerMC.getBlockState(state)); } } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java index d099b499df2..008a2d81f1c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMatcher.java @@ -6,12 +6,12 @@ import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class CTNBTMatcher implements NBTMatcher { private final Set> requiredNBT; @@ -21,7 +21,7 @@ public class CTNBTMatcher implements NBTMatcher { * * @param tagCompound the required NBT tag to match. */ - public CTNBTMatcher(@Nonnull NBTTagCompound tagCompound) { + public CTNBTMatcher(@NotNull NBTTagCompound tagCompound) { this.requiredNBT = tagCompound.tagMap.entrySet(); } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java index ef8ebfff5d8..17320c85344 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTNBTMultiItemMatcher.java @@ -9,14 +9,13 @@ import net.minecraft.nbt.NBTTagCompound; import com.google.common.base.Preconditions; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class CTNBTMultiItemMatcher implements NBTMatcher { private final Map> map; @@ -26,7 +25,7 @@ public class CTNBTMultiItemMatcher implements NBTMatcher { * * @param map the mappings of ItemStack to potential nbt tags to match. Key hashing should ignore nbt tags. */ - public CTNBTMultiItemMatcher(@Nonnull Map> map) { + public CTNBTMultiItemMatcher(@NotNull Map> map) { Preconditions.checkArgument(!map.isEmpty(), "Map must not be empty."); this.map = map; } @@ -40,7 +39,7 @@ public boolean evaluate(@Nullable NBTTagCompound nbtTagCompound, @Nullable NBTCo } @Override - public boolean evaluate(@Nonnull ItemStack stack, @Nullable NBTCondition nbtCondition) { + public boolean evaluate(@NotNull ItemStack stack, @Nullable NBTCondition nbtCondition) { NBTTagCompound tagCompound = stack.getTagCompound(); // stack has no nbt to match if (tagCompound == null) return false; diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java index f523f3c5c8c..be74a57456c 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/CTRecipeBuilder.java @@ -21,6 +21,8 @@ import crafttweaker.api.minecraft.CraftTweakerMC; import crafttweaker.api.oredict.IOreDictEntry; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,9 +32,6 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @ZenClass("mods.gregtech.recipe.RecipeBuilder") @ZenRegister public class CTRecipeBuilder { @@ -72,7 +71,7 @@ private static String extractOreDictEntry(IIngredient ingredient) { } @ZenMethod - public CTRecipeBuilder inputs(@Nonnull IIngredient... ingredients) { + public CTRecipeBuilder inputs(@NotNull IIngredient... ingredients) { for (IIngredient ingredient : ingredients) { this.backingBuilder.input(getInputFromCTIngredient(ingredient)); } @@ -80,14 +79,14 @@ public CTRecipeBuilder inputs(@Nonnull IIngredient... ingredients) { } @ZenMethod - public CTRecipeBuilder notConsumable(@Nonnull IIngredient... ingredients) { + public CTRecipeBuilder notConsumable(@NotNull IIngredient... ingredients) { for (IIngredient ingredient : ingredients) { this.backingBuilder.notConsumable(getInputFromCTIngredient(ingredient)); } return this; } - @Nonnull + @NotNull private static GTRecipeInput getInputFromCTIngredient(@Nullable IIngredient ingredient) { if (ingredient == null) { throw new IllegalArgumentException("Invalid ingredient: is null"); @@ -151,8 +150,8 @@ private static GTRecipeInput getInputFromCTIngredient(@Nullable IIngredient ingr * @param compound the nbt compound to match * @return the nbt matching input if successful, otherwise the original recipe input */ - @Nonnull - private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, @Nullable NBTTagCompound compound) { + @NotNull + private static GTRecipeInput tryConstructNBTInput(@NotNull GTRecipeInput input, @Nullable NBTTagCompound compound) { if (compound == null) return input; // do not use nbt matching, if there is no tag to check if (compound.isEmpty()) { // special case which considers an empty nbt tag as allowing any or no NBT @@ -168,9 +167,9 @@ private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, * @param map a mapping of stacks to compounds. The map's key hashing should ignore NBT compounds * @return the nbt matching input if successful, otherwise the original recipe input */ - @Nonnull - private static GTRecipeInput tryConstructNBTInput(@Nonnull GTRecipeInput input, - @Nonnull Map> map) { + @NotNull + private static GTRecipeInput tryConstructNBTInput(@NotNull GTRecipeInput input, + @NotNull Map> map) { if (map.isEmpty()) return input; // do not use nbt matching, if there are no tags to check return input.setNBTMatchingCondition(new CTNBTMultiItemMatcher(map), null); } diff --git a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java index 018e2acf251..b516bfe282f 100644 --- a/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java +++ b/src/main/java/gregtech/integration/crafttweaker/recipe/MetaTileEntityBracketHandler.java @@ -13,6 +13,7 @@ import crafttweaker.api.item.IItemStack; import crafttweaker.mc1120.item.MCItemStack; import crafttweaker.zenscript.IBracketHandler; +import org.jetbrains.annotations.Nullable; import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionString; @@ -22,8 +23,6 @@ import java.util.List; -import javax.annotation.Nullable; - @BracketHandler @ZenRegister @SuppressWarnings("unused") diff --git a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java index 98bb74f60df..76d76eb64c9 100644 --- a/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java +++ b/src/main/java/gregtech/integration/ctm/IFacadeWrapper.java @@ -8,19 +8,18 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.Optional; +import org.jetbrains.annotations.NotNull; import team.chisel.ctm.api.IFacade; -import javax.annotation.Nonnull; - @Optional.Interface(modid = GTValues.MODID_CTM, iface = "team.chisel.ctm.api.IFacade") public interface IFacadeWrapper extends IFacade { - @Nonnull + @NotNull @Override - IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side); + IBlockState getFacade(@NotNull IBlockAccess world, @NotNull BlockPos pos, EnumFacing side); - @Nonnull + @NotNull @Override - IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side, - @Nonnull BlockPos connection); + IBlockState getFacade(@NotNull IBlockAccess world, @NotNull BlockPos pos, EnumFacing side, + @NotNull BlockPos connection); } diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index 9e064eb43b2..2b1576ca53e 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -38,15 +38,14 @@ import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; import com.google.common.collect.ImmutableList; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - @GregTechModule( moduleID = GregTechModules.MODULE_GRS, containerID = GTValues.MODID, @@ -58,7 +57,7 @@ public class GroovyScriptModule extends IntegrationSubmodule { private static ModSupport.Container modSupportContainer; private static final Map> metaItems = new Object2ObjectOpenHashMap<>(); - @Nonnull + @NotNull @Override public List> getEventBusSubscribers() { return ImmutableList.of(GroovyHandCommand.class, GroovyScriptModule.class); diff --git a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java index 7be3a9f822c..10c6e11b511 100644 --- a/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java +++ b/src/main/java/gregtech/integration/hwyla/renderer/RendererOffsetString.java @@ -8,10 +8,7 @@ import java.awt.*; -import javax.annotation.ParametersAreNonnullByDefault; - /** Adapted from Jade 1.12.2, a HWYLA addon mod. */ -@ParametersAreNonnullByDefault public class RendererOffsetString implements IWailaTooltipRenderer { @NotNull diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index 545d2e56b41..b6c1d9519bf 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -54,6 +54,7 @@ import mezz.jei.config.Constants; import mezz.jei.input.IShowsRecipeFocuses; import mezz.jei.input.InputHandler; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; import java.util.Collection; @@ -63,8 +64,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; - @JEIPlugin @GregTechModule( moduleID = GregTechModules.MODULE_JEI, @@ -86,12 +85,12 @@ public void loadComplete(FMLLoadCompleteEvent event) { } @Override - public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) { + public void onRuntimeAvailable(@NotNull IJeiRuntime jeiRuntime) { JustEnoughItemsModule.jeiRuntime = jeiRuntime; } @Override - public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) { + public void registerItemSubtypes(@NotNull ISubtypeRegistry subtypeRegistry) { MetaItemSubtypeHandler subtype = new MetaItemSubtypeHandler(); for (MetaItem metaItem : MetaItems.ITEMS) { subtypeRegistry.registerSubtypeInterpreter(metaItem, subtype); @@ -101,7 +100,7 @@ public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) { } @Override - public void registerCategories(@Nonnull IRecipeCategoryRegistration registry) { + public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { guiHelper = registry.getJeiHelpers().getGuiHelper(); registry.addRecipeCategories(new IntCircuitCategory(registry.getJeiHelpers().getGuiHelper())); registry.addRecipeCategories(new MultiblockInfoCategory(registry.getJeiHelpers())); diff --git a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java index 0ecd821d697..9017c0936e1 100644 --- a/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/BasicRecipeCategory.java @@ -10,13 +10,12 @@ import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapperFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public abstract class BasicRecipeCategory implements IRecipeCategory, IRecipeWrapperFactory { @@ -37,34 +36,34 @@ public IDrawable getIcon() { return null; } - @Nonnull + @NotNull @Override public String getUid() { return getModName() + ":" + uniqueName; } - @Nonnull + @NotNull @Override public String getTitle() { return localizedName; } - @Nonnull + @NotNull @Override public IDrawable getBackground() { return background; } @Override - public void drawExtras(@Nonnull Minecraft minecraft) {} + public void drawExtras(@NotNull Minecraft minecraft) {} - @Nonnull + @NotNull @Override public List getTooltipStrings(int mouseX, int mouseY) { return Collections.emptyList(); } - @Nonnull + @NotNull @Override public String getModName() { return GTValues.MODID; diff --git a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java index 6f53f16de6c..18d53c28986 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTFluidVeinCategory.java @@ -14,12 +14,11 @@ import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - public class GTFluidVeinCategory extends BasicRecipeCategory { private static final int SLOT_CENTER = 79; @@ -52,8 +51,8 @@ public GTFluidVeinCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, - @Nonnull IIngredients ingredients) { + public void setRecipe(@NotNull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFluidVeinInfo, + @NotNull IIngredients ingredients) { IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); fluidStackGroup.init(0, true, SLOT_CENTER, 19, 16, 16, 1, false, null); @@ -72,14 +71,14 @@ public void setRecipe(@Nonnull IRecipeLayout recipeLayout, GTFluidVeinInfo gtFlu gtFluidVeinInfo.getDefinition().getDimensionFilter()); } - @Nonnull + @NotNull @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull GTFluidVeinInfo gtFluidVeinInfo) { + public IRecipeWrapper getRecipeWrapper(@NotNull GTFluidVeinInfo gtFluidVeinInfo) { return gtFluidVeinInfo; } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { + public void drawExtras(@NotNull Minecraft minecraft) { GTStringUtils.drawCenteredStringWithCutoff(veinName, minecraft.fontRenderer, 176); this.slot.draw(minecraft, SLOT_CENTER - 1, 18); @@ -129,7 +128,7 @@ public void drawExtras(@Nonnull Minecraft minecraft) { TEXT_START_X + dimensionLength); } - @Nonnull + @NotNull @Override public List getTooltipStrings(int mouseX, int mouseY) { if (isPointWithinRange(TEXT_START_X, START_POS_Y, weightLength, FONT_HEIGHT, mouseX, mouseY)) { diff --git a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java index 6e6b14b8d1c..5427259ee8e 100644 --- a/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/GTOreCategory.java @@ -16,8 +16,7 @@ import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class GTOreCategory extends BasicRecipeCategory { @@ -45,7 +44,7 @@ public GTOreCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(IRecipeLayout recipeLayout, GTOreInfo recipeWrapper, @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, GTOreInfo recipeWrapper, @NotNull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); int baseYPos = 19; @@ -75,14 +74,14 @@ public void setRecipe(IRecipeLayout recipeLayout, GTOreInfo recipeWrapper, @Nonn this.dimension = JEIResourceDepositCategoryUtils.getAllRegisteredDimensions(definition.getDimensionFilter()); } - @Nonnull + @NotNull @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull GTOreInfo recipe) { + public IRecipeWrapper getRecipeWrapper(@NotNull GTOreInfo recipe) { return recipe; } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { + public void drawExtras(@NotNull Minecraft minecraft) { int baseXPos = 70; int baseYPos = 19; int dimDisplayPos = 70; diff --git a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java index fc6ce4ff27c..16a26032f73 100644 --- a/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/MaterialTreeCategory.java @@ -22,13 +22,12 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class MaterialTreeCategory extends BasicRecipeCategory { protected String materialName; @@ -128,7 +127,7 @@ public MaterialTreeCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull MaterialTree recipeWrapper, IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @NotNull MaterialTree recipeWrapper, IIngredients ingredients) { // place and check existence of items IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); List> itemInputs = ingredients.getInputs(VanillaTypes.ITEM); @@ -159,9 +158,9 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull MaterialTree recipeWr materialAvgN = I18n.format("gregtech.jei.materials.average_neutrons", recipeWrapper.getAvgN()); } - @Nonnull + @NotNull @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull MaterialTree recipe) { + public IRecipeWrapper getRecipeWrapper(@NotNull MaterialTree recipe) { return recipe; } @@ -172,7 +171,7 @@ public IDrawable getIcon() { } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { + public void drawExtras(@NotNull Minecraft minecraft) { // item slot rendering for (int i = 0; i < ITEM_LOCATIONS.size(); i += 2) { if (itemExists.get(i / 2)) diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java index 55daea56cbf..ad3899dd5a5 100644 --- a/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProductCategory.java @@ -22,13 +22,12 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class OreByProductCategory extends BasicRecipeCategory { protected final IDrawable slot; @@ -137,8 +136,8 @@ public OreByProductCategory(IGuiHelper guiHelper) { } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWrapper, - @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @NotNull OreByProduct recipeWrapper, + @NotNull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); @@ -174,9 +173,9 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull OreByProduct recipeWr hasSifter = recipeWrapper.hasSifter(); } - @Nonnull + @NotNull @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull OreByProduct recipe) { + public IRecipeWrapper getRecipeWrapper(@NotNull OreByProduct recipe) { return recipe; } @@ -187,7 +186,7 @@ public IDrawable getIcon() { } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { + public void drawExtras(@NotNull Minecraft minecraft) { arrowsBase.draw(minecraft, 0, 0); if (hasDirectSmelt) { arrowsDirectSmelt.draw(minecraft, 0, 0); diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java index 17b6a86bd73..f0325a4c488 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoCategory.java @@ -14,13 +14,12 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.gui.recipes.RecipeLayout; +import org.jetbrains.annotations.NotNull; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Nonnull; - public class MultiblockInfoCategory implements IRecipeCategory { private final IDrawable background; @@ -45,25 +44,25 @@ public static void registerRecipes(IModRegistry registry) { "gregtech:multiblock_info"); } - @Nonnull + @NotNull @Override public String getUid() { return "gregtech:multiblock_info"; } - @Nonnull + @NotNull @Override public String getTitle() { return I18n.format("gregtech.multiblock.title"); } - @Nonnull + @NotNull @Override public String getModName() { return GTValues.MODID; } - @Nonnull + @NotNull @Override public IDrawable getBackground() { return background; @@ -75,8 +74,8 @@ public IDrawable getIcon() { } @Override - public void setRecipe(@Nonnull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, - @Nonnull IIngredients ingredients) { + public void setRecipe(@NotNull IRecipeLayout recipeLayout, MultiblockInfoRecipeWrapper recipeWrapper, + @NotNull IIngredients ingredients) { recipeWrapper.setRecipeLayout((RecipeLayout) recipeLayout, this.guiHelper); } } diff --git a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java index ba9bcd92230..d0074db661c 100644 --- a/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/multiblock/MultiblockInfoRecipeWrapper.java @@ -58,6 +58,7 @@ import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.gui.recipes.RecipeLayout; +import org.jetbrains.annotations.NotNull; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -65,7 +66,6 @@ import java.util.Map.Entry; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.vecmath.Vector3f; public class MultiblockInfoRecipeWrapper implements IRecipeWrapper { @@ -122,7 +122,7 @@ public MBPattern(final WorldSceneRenderer sceneRenderer, final List p private TraceabilityPredicate father; @SuppressWarnings("NewExpressionSideOnly") - public MultiblockInfoRecipeWrapper(@Nonnull MultiblockControllerBase controller) { + public MultiblockInfoRecipeWrapper(@NotNull MultiblockControllerBase controller) { this.controller = controller; Set drops = new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAllButCount()); this.patterns = controller.getMatchingShapes().stream() @@ -280,7 +280,7 @@ private void updateParts() { } @Override - public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { + public void drawInfo(@NotNull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { WorldSceneRenderer renderer = getCurrentRenderer(); int sceneHeight = recipeHeight - PARTS_HEIGHT; @@ -395,7 +395,7 @@ private void drawMultiblockName(int recipeWidth) { } @Override - public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { + public boolean handleClick(@NotNull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { for (Entry button : buttons.entrySet()) { if (button.getKey().mousePressed(minecraft, mouseX, mouseY)) { button.getValue().run(); @@ -452,7 +452,7 @@ private void setItemStackGroup() { }); } - @Nonnull + @NotNull @Override public List getTooltipStrings(int mouseX, int mouseY) { if (drawInfoIcon) { @@ -501,7 +501,7 @@ private static class PartInfo { } } - @Nonnull + @NotNull ItemStack getItemStack() { ItemStack result = this.itemStack.copy(); result.setCount(this.amount); @@ -509,8 +509,8 @@ ItemStack getItemStack() { } } - @Nonnull - private static Collection gatherStructureBlocks(World world, @Nonnull Map blocks, + @NotNull + private static Collection gatherStructureBlocks(World world, @NotNull Map blocks, Set parts) { Map partsMap = new Object2ObjectOpenCustomHashMap<>( ItemStackHashStrategy.comparingAllButCount()); @@ -563,8 +563,8 @@ private static Collection gatherStructureBlocks(World world, @Nonnull } @SuppressWarnings("NewExpressionSideOnly") - @Nonnull - private MBPattern initializePattern(@Nonnull MultiblockShapeInfo shapeInfo, @Nonnull Set parts) { + @NotNull + private MBPattern initializePattern(@NotNull MultiblockShapeInfo shapeInfo, @NotNull Set parts) { Map blockMap = new HashMap<>(); MultiblockControllerBase controllerBase = null; BlockInfo[][][] blocks = shapeInfo.getBlocks(); diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java index 5f7ddbf7525..2e9dd1a869f 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRecipeWrapper.java @@ -9,8 +9,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class FacadeRecipeWrapper implements ICraftingRecipeWrapper { diff --git a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java index 93b160a1db0..87b461d328b 100644 --- a/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java +++ b/src/main/java/gregtech/integration/jei/recipe/FacadeRegistryPlugin.java @@ -14,15 +14,14 @@ import com.google.common.collect.Lists; import mezz.jei.api.recipe.*; import mezz.jei.api.recipe.IFocus.Mode; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - public class FacadeRegistryPlugin implements IRecipeRegistryPlugin { - @Nonnull + @NotNull @Override public List getRecipeCategoryUids(IFocus focus) { if (focus.getValue() instanceof ItemStack) { @@ -42,10 +41,10 @@ public List getRecipeCategoryUids(IFocus focus) { return Collections.emptyList(); } - @Nonnull + @NotNull @Override public List getRecipeWrappers(IRecipeCategory recipeCategory, - @Nonnull IFocus focus) { + @NotNull IFocus focus) { if (!VanillaRecipeCategoryUid.CRAFTING.equals(recipeCategory.getUid())) { return Collections.emptyList(); } @@ -79,9 +78,9 @@ private static IRecipeWrapper createFacadeRecipe(ItemStack itemStack, Material m OreDictUnifier.get(OrePrefix.plate, material), itemStackCopy); } - @Nonnull + @NotNull @Override - public List getRecipeWrappers(@Nonnull IRecipeCategory recipeCategory) { + public List getRecipeWrappers(@NotNull IRecipeCategory recipeCategory) { return Collections.emptyList(); } } diff --git a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java index 01334a9651f..9c1382a453d 100644 --- a/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java @@ -37,14 +37,13 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.BooleanSupplier; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class GTRecipeWrapper extends AdvancedRecipeWrapper { private static final int LINE_HEIGHT = 10; @@ -70,7 +69,7 @@ public Recipe getRecipe() { } @Override - public void getIngredients(@Nonnull IIngredients ingredients) { + public void getIngredients(@NotNull IIngredients ingredients) { // Inputs if (!sortedInputs.isEmpty()) { List> list = new ArrayList<>(); @@ -196,7 +195,7 @@ public void addFluidTooltip(int slotIndex, boolean input, Object ingredient, Lis addIngredientTooltips(tooltip, notConsumed, input, ingredient, null); } - public void addIngredientTooltips(@Nonnull Collection tooltip, boolean notConsumed, boolean input, + public void addIngredientTooltips(@NotNull Collection tooltip, boolean notConsumed, boolean input, @Nullable Object ingredient, @Nullable Object ingredient2) { if (ingredient2 instanceof ChancedOutputLogic logic) { if (ingredient instanceof BoostableChanceEntryentry) { @@ -234,7 +233,7 @@ public void addIngredientTooltips(@Nonnull Collection tooltip, boolean n } @Override - public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { + public void drawInfo(@NotNull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); var properties = recipe.getPropertyTypes(); boolean drawTotalEU = properties.isEmpty() || properties.stream().noneMatch(RecipeProperty::hideTotalEU); @@ -285,7 +284,7 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe } } - @Nonnull + @NotNull @Override public List getTooltipStrings(int mouseX, int mouseY) { List tooltips = new ArrayList<>(); diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java index db33a9801ec..82e2fa39fb5 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitCategory.java @@ -29,6 +29,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategory; +import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; import java.util.Iterator; @@ -37,11 +38,7 @@ import java.util.stream.IntStream; import java.util.stream.Stream; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault public class IntCircuitCategory implements IRecipeCategory { public static final String UID = GTValues.MODID + ":" + MetaItems.INTEGRATED_CIRCUIT.unlocalizedName; diff --git a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java index ef2a02685ea..402aca43d44 100644 --- a/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/recipe/IntCircuitRecipeWrapper.java @@ -14,9 +14,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import javax.annotation.ParametersAreNonnullByDefault; - -@ParametersAreNonnullByDefault public class IntCircuitRecipeWrapper implements IRecipeWrapper { public final boolean input; diff --git a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java index 2104bf474aa..ce0c074e933 100644 --- a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java @@ -38,15 +38,14 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class RecipeMapCategory implements IRecipeCategory { private final RecipeMap recipeMap; @@ -61,7 +60,7 @@ public class RecipeMapCategory implements IRecipeCategory { private static final Map gtCategories = new Object2ObjectOpenHashMap<>(); private static final Map, List> recipeMapCategories = new Object2ObjectOpenHashMap<>(); - public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCategory category, + public RecipeMapCategory(@NotNull RecipeMap recipeMap, @NotNull GTRecipeCategory category, IGuiHelper guiHelper) { this.recipeMap = recipeMap; this.category = category; @@ -90,13 +89,13 @@ public RecipeMapCategory(@Nonnull RecipeMap recipeMap, @Nonnull GTRecipeCateg } @Override - @Nonnull + @NotNull public String getUid() { return category.getUniqueID(); } @Override - @Nonnull + @NotNull public String getTitle() { return LocalizationUtils.format(category.getTranslationKey()); } @@ -123,20 +122,20 @@ public void setIcon(Object icon) { } @Override - @Nonnull + @NotNull public String getModName() { return GTValues.MODID; } @Override - @Nonnull + @NotNull public IDrawable getBackground() { return backgroundDrawable; } @Override - public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recipeWrapper, - @Nonnull IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, @NotNull GTRecipeWrapper recipeWrapper, + @NotNull IIngredients ingredients) { IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); for (Widget uiWidget : modularUI.guiWidgets.values()) { @@ -230,7 +229,7 @@ public void setRecipe(IRecipeLayout recipeLayout, @Nonnull GTRecipeWrapper recip } @Override - public void drawExtras(@Nonnull Minecraft minecraft) { + public void drawExtras(@NotNull Minecraft minecraft) { for (Widget widget : modularUI.guiWidgets.values()) { if (widget instanceof ProgressWidget) widget.detectAndSendChanges(); widget.drawInBackground(0, 0, minecraft.getRenderPartialTicks(), new IRenderContext() {}); @@ -239,12 +238,12 @@ public void drawExtras(@Nonnull Minecraft minecraft) { } @Nullable - public static RecipeMapCategory getCategoryFor(@Nonnull GTRecipeCategory category) { + public static RecipeMapCategory getCategoryFor(@NotNull GTRecipeCategory category) { return gtCategories.get(category); } @Nullable - public static Collection getCategoriesFor(@Nonnull RecipeMap recipeMap) { + public static Collection getCategoriesFor(@NotNull RecipeMap recipeMap) { return recipeMapCategories.get(recipeMap); } } diff --git a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java index 9b8b15b3068..4cdf86c5c75 100644 --- a/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java +++ b/src/main/java/gregtech/integration/jei/utils/AdvancedRecipeWrapper.java @@ -8,12 +8,11 @@ import net.minecraftforge.fml.client.config.GuiUtils; import mezz.jei.api.recipe.IRecipeWrapper; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public abstract class AdvancedRecipeWrapper implements IRecipeWrapper { protected final List buttons = new ArrayList<>(); @@ -25,7 +24,7 @@ public AdvancedRecipeWrapper() { public abstract void initExtras(); @Override - public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { + public void drawInfo(@NotNull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { for (JeiButton button : buttons) { button.render(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); if (button.isHovering(mouseX, mouseY)) { @@ -45,7 +44,7 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe } @Override - public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { + public boolean handleClick(@NotNull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { for (JeiButton button : buttons) { if (button.isHovering(mouseX, mouseY) && button.getClickAction().click(minecraft, mouseX, mouseY, mouseButton)) { diff --git a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java index 7778af062bb..77ee3c8bcb7 100644 --- a/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java +++ b/src/main/java/gregtech/integration/jei/utils/JEIResourceDepositCategoryUtils.java @@ -18,6 +18,7 @@ import it.unimi.dsi.fastutil.ints.IntSortedSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; @@ -26,8 +27,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.MODID_AR; /** diff --git a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java index 1ed37c488d0..510d928ac0d 100644 --- a/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MachineSubtypeHandler.java @@ -6,14 +6,13 @@ import net.minecraft.item.ItemStack; import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MachineSubtypeHandler implements ISubtypeInterpreter { - @Nonnull + @NotNull @Override - public String apply(@Nonnull ItemStack itemStack) { + public String apply(@NotNull ItemStack itemStack) { String additionalData = ""; MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(itemStack); if (metaTileEntity != null) { diff --git a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java index 4d453ed6c48..0ae7cff00cf 100644 --- a/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/MetaItemSubtypeHandler.java @@ -6,12 +6,11 @@ import net.minecraft.item.ItemStack; import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MetaItemSubtypeHandler implements ISubtypeInterpreter { - @Nonnull + @NotNull @Override public String apply(ItemStack itemStack) { MetaItem metaItem = (MetaItem) itemStack.getItem(); diff --git a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java index cd6af9d2d17..666484b3e78 100644 --- a/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java +++ b/src/main/java/gregtech/integration/jei/utils/ModularUIGuiHandler.java @@ -16,15 +16,14 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import mezz.jei.api.recipe.transfer.IRecipeTransferHandlerHelper; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; import java.util.*; import java.util.List; import java.util.function.Predicate; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class ModularUIGuiHandler implements IAdvancedGuiHandler, IGhostIngredientHandler, IRecipeTransferHandler { @@ -40,13 +39,13 @@ public void setValidHandlers(Predicate validHandle this.validHandlers = validHandlers; } - @Nonnull + @NotNull @Override public Class getGuiContainerClass() { return ModularUIGui.class; } - @Nonnull + @NotNull @Override public Class getContainerClass() { return ModularUIContainer.class; @@ -54,8 +53,8 @@ public Class getContainerClass() { @Nullable @Override - public IRecipeTransferError transferRecipe(@Nonnull ModularUIContainer container, - @Nonnull IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, + public IRecipeTransferError transferRecipe(@NotNull ModularUIContainer container, + @NotNull IRecipeLayout recipeLayout, @NotNull EntityPlayer player, boolean maxTransfer, boolean doTransfer) { if (this.recipeTransferCategoryBlacklist.contains(recipeLayout.getRecipeCategory().getUid())) { return this.transferHelper.createInternalError(); @@ -96,9 +95,9 @@ public Object getIngredientUnderMouse(ModularUIGui gui, int mouseX, int mouseY) return null; } - @Nonnull + @NotNull @Override - public List> getTargets(ModularUIGui gui, @Nonnull I ingredient, boolean doStart) { + public List> getTargets(ModularUIGui gui, @NotNull I ingredient, boolean doStart) { Collection widgets = gui.getModularUI().guiWidgets.values(); List> targets = new ArrayList<>(); for (Widget widget : widgets) { @@ -113,7 +112,7 @@ public List> getTargets(ModularUIGui gui, @Nonnull I ingredient, b @Nullable @Override - public List getGuiExtraAreas(@Nonnull ModularUIGui guiContainer) { + public List getGuiExtraAreas(@NotNull ModularUIGui guiContainer) { return Collections.emptyList(); } diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java index 65aa59fb0fe..187292640f0 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeDrawable.java @@ -3,12 +3,11 @@ import net.minecraft.client.Minecraft; import mezz.jei.api.gui.IDrawable; +import org.jetbrains.annotations.NotNull; import java.util.LinkedList; import java.util.List; -import javax.annotation.Nonnull; - public class CompositeDrawable implements IDrawable { private final int width; @@ -32,7 +31,7 @@ public int getHeight() { } @Override - public void draw(@Nonnull Minecraft minecraft, int xOffset, int yOffset) { + public void draw(@NotNull Minecraft minecraft, int xOffset, int yOffset) { for (RenderNode step : steps) { step.draw(minecraft, xOffset, yOffset); } @@ -70,6 +69,6 @@ public CompositeDrawable build() { @FunctionalInterface public interface RenderNode { - void draw(@Nonnull Minecraft minecraft, int xOffset, int yOffset); + void draw(@NotNull Minecraft minecraft, int xOffset, int yOffset); } } diff --git a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java index daac90efc7c..0e6566b614d 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/CompositeRenderer.java @@ -6,14 +6,11 @@ import mcp.MethodsReturnNonnullByDefault; import mezz.jei.api.ingredients.IIngredientRenderer; +import org.jetbrains.annotations.Nullable; import java.util.LinkedList; import java.util.List; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CompositeRenderer implements IIngredientRenderer { diff --git a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java index 0260601a9f3..32cc0313230 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/FluidStackTextRenderer.java @@ -12,9 +12,8 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.plugins.vanilla.ingredients.fluid.FluidStackRenderer; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class FluidStackTextRenderer extends FluidStackRenderer { @@ -46,7 +45,7 @@ public FluidStackTextRenderer(int capacityMb, boolean showCapacity, int width, i } @Override - public void render(@Nonnull Minecraft minecraft, final int xPosition, final int yPosition, + public void render(@NotNull Minecraft minecraft, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) { if (fluidStack == null) return; diff --git a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java index e2c642df694..fb1061ed0ff 100644 --- a/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java +++ b/src/main/java/gregtech/integration/jei/utils/render/ItemStackTextRenderer.java @@ -9,9 +9,8 @@ import net.minecraft.item.ItemStack; import mezz.jei.plugins.vanilla.ingredients.item.ItemStackRenderer; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ItemStackTextRenderer extends ItemStackRenderer { @@ -48,7 +47,7 @@ public ItemStackTextRenderer(boolean notConsumed) { } @Override - public void render(@Nonnull Minecraft minecraft, int xPosition, int yPosition, @Nullable ItemStack ingredient) { + public void render(@NotNull Minecraft minecraft, int xPosition, int yPosition, @Nullable ItemStack ingredient) { super.render(minecraft, xPosition, yPosition, ingredient); if (this.chanceBase >= 0) { diff --git a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java index ee6941cfd48..344b1d6b806 100644 --- a/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java +++ b/src/main/java/gregtech/integration/opencomputers/drivers/DriverRecipeMapMultiblockController.java @@ -20,13 +20,12 @@ import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; - public class DriverRecipeMapMultiblockController extends DriverSidedTileEntity { @Override @@ -102,7 +101,7 @@ public Object[] getOutputPerSec(final Context context, final Arguments args) { return new Object[] { tileEntity.getEnergyContainer().getOutputPerSec() }; } - @Nonnull + @NotNull private Object[] getInventory(IItemHandlerModifiable handler) { List> result = new ArrayList<>(); for (int slot = 0; slot < handler.getSlots(); slot++) { @@ -126,7 +125,7 @@ public Object[] getOutputInventory(final Context context, final Arguments args) return getInventory(tileEntity.getOutputInventory()); } - @Nonnull + @NotNull private Object[] getTank(IMultipleTankHandler handler) { List> result = new ArrayList<>(); handler.getFluidTanks().forEach(tank -> { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java index 511f5187dfa..5ce87d99ecc 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CapabilityInfoProvider.java @@ -10,12 +10,11 @@ import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.IProbeInfoProvider; import mcjty.theoneprobe.api.ProbeMode; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class CapabilityInfoProvider implements IProbeInfoProvider { - @Nonnull + @NotNull protected abstract Capability getCapability(); protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, EntityPlayer player, TileEntity tileEntity, @@ -26,8 +25,8 @@ protected boolean allowDisplaying(T capability) { } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, - @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@NotNull ProbeMode mode, @NotNull IProbeInfo probeInfo, @NotNull EntityPlayer player, + @NotNull World world, @NotNull IBlockState blockState, @NotNull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity == null) return; diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java index 58bcc90d46c..5ef4b7f6c30 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ControllableInfoProvider.java @@ -11,12 +11,11 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ControllableInfoProvider extends CapabilityInfoProvider { - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE; @@ -28,8 +27,8 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IControllable capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, - @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IControllable capability, @NotNull IProbeInfo probeInfo, EntityPlayer player, + @NotNull TileEntity tileEntity, @NotNull IProbeHitData data) { if (!capability.isWorkingEnabled()) probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.working_disabled*}"); } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java index fb205454caf..4a635e9058a 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ConverterInfoProvider.java @@ -16,8 +16,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ConverterInfoProvider extends CapabilityInfoProvider { @@ -26,15 +25,15 @@ public String getID() { return GTValues.MODID + ":converter_info_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechCapabilities.CAPABILITY_CONVERTER; } @Override - protected void addProbeInfo(@Nonnull ConverterTrait capability, @Nonnull IProbeInfo probeInfo, EntityPlayer player, - @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull ConverterTrait capability, @NotNull IProbeInfo probeInfo, EntityPlayer player, + @NotNull TileEntity tileEntity, @NotNull IProbeHitData data) { // Info on current converter mode probeInfo.text(TextStyleClass.INFO + ((capability.isFeToEu()) ? "{*gregtech.top.convert_fe*}" : "{*gregtech.top.convert_eu*}")); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java index e1f9bc47594..645e6774d3b 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/CoverInfoProvider.java @@ -16,13 +16,12 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class CoverInfoProvider extends CapabilityInfoProvider { - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_COVER_HOLDER; @@ -34,9 +33,9 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo probeInfo, - @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, - @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull CoverHolder capability, @NotNull IProbeInfo probeInfo, + @NotNull EntityPlayer player, @NotNull TileEntity tileEntity, + @NotNull IProbeHitData data) { Cover cover = capability.getCoverAtSide(data.getSideHit()); if (cover instanceof CoverConveyor conveyor) { conveyorInfo(probeInfo, conveyor); @@ -57,7 +56,7 @@ protected void addProbeInfo(@Nonnull CoverHolder capability, @Nonnull IProbeInfo * @param probeInfo the info to add the text to * @param conveyor the conveyor to get data from */ - private static void conveyorInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverConveyor conveyor) { + private static void conveyorInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverConveyor conveyor) { String rateUnit = " {*cover.conveyor.transfer_rate*}"; if (conveyor instanceof CoverItemVoiding) { @@ -82,7 +81,7 @@ private static void conveyorInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverCo * @param probeInfo the info to add the text to * @param voiding the voiding cover to get data from */ - private static void itemVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverItemVoiding voiding) { + private static void itemVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemVoiding voiding) { String unit = " {*gregtech.top.unit.items*}"; ItemFilterContainer container = voiding.getItemFilterContainer(); @@ -99,7 +98,7 @@ private static void itemVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove * @param probeInfo the info to add the text to * @param pump the pump to get data from */ - private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump pump) { + private static void pumpInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverPump pump) { String rateUnit = IProbeInfo.STARTLOC + pump.getBucketMode().getName() + IProbeInfo.ENDLOC; if (pump instanceof CoverFluidVoiding) { @@ -126,7 +125,7 @@ private static void pumpInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverPump p * @param probeInfo the info to add the text to * @param voiding the voiding cover to get data from */ - private static void fluidVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverFluidVoiding voiding) { + private static void fluidVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidVoiding voiding) { String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gregtech.top.unit.fluid_buckets*}" : " {*gregtech.top.unit.fluid_milibuckets*}"; @@ -146,7 +145,7 @@ private static void fluidVoidingInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cov * @param probeInfo the info to add the text to * @param itemFilter the filter to get data from */ - private static void itemFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverItemFilter itemFilter) { + private static void itemFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemFilter itemFilter) { filterModeText(probeInfo, itemFilter.getFilterMode()); itemFilterText(probeInfo, itemFilter.getItemFilter().getItemFilter()); } @@ -157,7 +156,7 @@ private static void itemFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cover * @param probeInfo the info to add the text to * @param fluidFilter the filter to get data from */ - private static void fluidFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverFluidFilter fluidFilter) { + private static void fluidFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidFilter fluidFilter) { filterModeText(probeInfo, fluidFilter.getFilterMode()); fluidFilterText(probeInfo, fluidFilter.getFluidFilter().getFluidFilter()); } @@ -168,7 +167,7 @@ private static void fluidFilterInfo(@Nonnull IProbeInfo probeInfo, @Nonnull Cove * @param probeInfo the info to add the text to * @param enderFluidLink the ender fluid link cover to get data from */ - private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull CoverEnderFluidLink enderFluidLink) { + private static void enderFluidLinkInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverEnderFluidLink enderFluidLink) { transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); fluidFilterText(probeInfo, enderFluidLink.getFluidFilterContainer().getFilterWrapper().getFluidFilter()); @@ -186,7 +185,7 @@ private static void enderFluidLinkInfo(@Nonnull IProbeInfo probeInfo, @Nonnull C * @param rateUnit the unit of what is transferred * @param rate the transfer rate of the mode */ - private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIOMode mode, @Nonnull String rateUnit, + private static void transferRateText(@NotNull IProbeInfo probeInfo, @NotNull IIOMode mode, @NotNull String rateUnit, int rate) { String modeText = mode.isImport() ? "{*gregtech.top.mode.import*} " : "{*gregtech.top.mode.export*} "; probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + TextFormattingUtil.formatNumbers(rate) + @@ -202,8 +201,8 @@ private static void transferRateText(@Nonnull IProbeInfo probeInfo, @Nonnull IIO * @param rate the transfer rate of the mode * @param hasFilter whether the cover has a filter installed */ - private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull TransferMode mode, - @Nonnull String rateUnit, int rate, boolean hasFilter) { + private static void transferModeText(@NotNull IProbeInfo probeInfo, @NotNull TransferMode mode, + @NotNull String rateUnit, int rate, boolean hasFilter) { String text = TextStyleClass.OK + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (!hasFilter && mode != TransferMode.TRANSFER_ANY) text += TextStyleClass.LABEL + " " + rate + rateUnit; probeInfo.text(text); @@ -218,7 +217,7 @@ private static void transferModeText(@Nonnull IProbeInfo probeInfo, @Nonnull Tra * @param amount the transfer rate of the mode * @param hasFilter whether the cover has a filter in it or not */ - private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingMode mode, @Nonnull String unit, + private static void voidingText(@NotNull IProbeInfo probeInfo, @NotNull VoidingMode mode, @NotNull String unit, int amount, boolean hasFilter) { String text = TextFormatting.RED + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; if (mode != VoidingMode.VOID_ANY && !hasFilter) text += " " + amount + unit; @@ -231,7 +230,7 @@ private static void voidingText(@Nonnull IProbeInfo probeInfo, @Nonnull VoidingM * @param probeInfo the info to add the text to * @param mode the filter mode of the cover */ - private static void filterModeText(@Nonnull IProbeInfo probeInfo, @Nonnull IFilterMode mode) { + private static void filterModeText(@NotNull IProbeInfo probeInfo, @NotNull IFilterMode mode) { probeInfo.text(TextStyleClass.WARNING + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC); } @@ -241,7 +240,7 @@ private static void filterModeText(@Nonnull IProbeInfo probeInfo, @Nonnull IFilt * @param probeInfo the info to add the text to * @param filter the filter to display info from */ - private static void itemFilterText(@Nonnull IProbeInfo probeInfo, @Nullable ItemFilter filter) { + private static void itemFilterText(@NotNull IProbeInfo probeInfo, @Nullable ItemFilter filter) { String label = TextStyleClass.INFO + "{*gregtech.top.filter.label*} "; if (filter instanceof OreDictionaryItemFilter) { String expression = ((OreDictionaryItemFilter) filter).getExpression(); @@ -258,7 +257,7 @@ private static void itemFilterText(@Nonnull IProbeInfo probeInfo, @Nullable Item * @param probeInfo the info to add the text to * @param filter the filter to display info from */ - private static void fluidFilterText(@Nonnull IProbeInfo probeInfo, @Nullable FluidFilter filter) { + private static void fluidFilterText(@NotNull IProbeInfo probeInfo, @Nullable FluidFilter filter) { // TODO If more unique fluid filtration is added, providers for it go here } } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java index 3896aff8dc5..80e48b04899 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/DiodeInfoProvider.java @@ -12,8 +12,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class DiodeInfoProvider extends ElectricContainerInfoProvider { @@ -23,8 +22,8 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, - EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IEnergyContainer capability, @NotNull IProbeInfo probeInfo, + EntityPlayer player, @NotNull TileEntity tileEntity, @NotNull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityDiode) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java index 40e4e96cab9..7252ebbca23 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/ElectricContainerInfoProvider.java @@ -10,8 +10,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ElectricContainerInfoProvider extends CapabilityInfoProvider { @@ -20,20 +19,20 @@ public String getID() { return GTValues.MODID + ":energy_container_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER; } @Override - protected boolean allowDisplaying(@Nonnull IEnergyContainer capability) { + protected boolean allowDisplaying(@NotNull IEnergyContainer capability) { return !capability.isOneProbeHidden(); } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, - EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IEnergyContainer capability, @NotNull IProbeInfo probeInfo, + EntityPlayer player, @NotNull TileEntity tileEntity, @NotNull IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java index d6170974374..0ee16199774 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LDPipeProvider.java @@ -13,8 +13,7 @@ import net.minecraft.world.World; import mcjty.theoneprobe.api.*; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class LDPipeProvider implements IProbeInfoProvider { @@ -24,8 +23,8 @@ public String getID() { } @Override - public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, @Nonnull World world, - IBlockState blockState, @Nonnull IProbeHitData probeHitData) { + public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer entityPlayer, @NotNull World world, + IBlockState blockState, @NotNull IProbeHitData probeHitData) { BlockPos pos = probeHitData.getPos(); TileEntity tileEntity = world.getTileEntity(pos); @@ -69,7 +68,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, EntityPlayer } } - private static void addIOText(@Nonnull IProbeInfo probeInfo, @Nonnull ILDEndpoint endpoint) { + private static void addIOText(@NotNull IProbeInfo probeInfo, @NotNull ILDEndpoint endpoint) { if (endpoint.isInput()) { probeInfo.text(TextStyleClass.INFOIMP + "{*gregtech.top.ld_pipe_input*}"); } else if (endpoint.isOutput()) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java index 922bee89460..d75c6a7c8eb 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/LaserContainerInfoProvider.java @@ -12,8 +12,6 @@ import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; - public class LaserContainerInfoProvider extends CapabilityInfoProvider { @NotNull @@ -23,7 +21,7 @@ protected Capability getCapability() { } @Override - protected boolean allowDisplaying(@Nonnull ILaserContainer capability) { + protected boolean allowDisplaying(@NotNull ILaserContainer capability) { return !capability.isOneProbeHidden(); } diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java index 09a95a16bc1..bf448048a1e 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MaintenanceInfoProvider.java @@ -18,8 +18,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MaintenanceInfoProvider extends CapabilityInfoProvider { @@ -35,7 +34,7 @@ public String getID() { return GTValues.MODID + ":multiblock_maintenance_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_MAINTENANCE; diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java index a26817af470..6446f056cc8 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiRecipeMapInfoProvider.java @@ -12,8 +12,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MultiRecipeMapInfoProvider extends CapabilityInfoProvider { @@ -22,16 +21,16 @@ public String getID() { return GTValues.MODID + ":multi_recipemap_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_MULTIPLE_RECIPEMAPS; } @Override - protected void addProbeInfo(@Nonnull IMultipleRecipeMaps iMultipleRecipeMaps, @Nonnull IProbeInfo iProbeInfo, - @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, - @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IMultipleRecipeMaps iMultipleRecipeMaps, @NotNull IProbeInfo iProbeInfo, + @NotNull EntityPlayer player, @NotNull TileEntity tileEntity, + @NotNull IProbeHitData data) { if (iMultipleRecipeMaps.getAvailableRecipeMaps().length == 1) return; iProbeInfo.text(TextStyleClass.INFO + IProbeInfo.STARTLOC + "gregtech.multiblock.multiple_recipemaps.header" + diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java index 82e36f8ce2a..368e7b91318 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/MultiblockInfoProvider.java @@ -12,8 +12,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MultiblockInfoProvider extends CapabilityInfoProvider { @@ -22,16 +21,16 @@ public String getID() { return GTValues.MODID + ":multiblock_controller_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechCapabilities.CAPABILITY_MULTIBLOCK_CONTROLLER; } @Override - protected void addProbeInfo(@Nonnull IMultiblockController capability, @Nonnull IProbeInfo probeInfo, - @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, - @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IMultiblockController capability, @NotNull IProbeInfo probeInfo, + @NotNull EntityPlayer player, @NotNull TileEntity tileEntity, + @NotNull IProbeHitData data) { if (capability.isStructureFormed()) { probeInfo.text(TextStyleClass.OK + "{*gregtech.top.valid_structure*}"); if (capability.isStructureObstructed()) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java index 94d253c514b..ea20f8be8a8 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/PrimitivePumpInfoProvider.java @@ -12,8 +12,7 @@ import net.minecraft.world.World; import mcjty.theoneprobe.api.*; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class PrimitivePumpInfoProvider implements IProbeInfoProvider { @@ -23,8 +22,8 @@ public String getID() { } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, - @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@NotNull ProbeMode mode, @NotNull IProbeInfo probeInfo, @NotNull EntityPlayer player, + @NotNull World world, @NotNull IBlockState blockState, @NotNull IProbeHitData data) { if (blockState.getBlock().hasTileEntity(blockState)) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (!(tileEntity instanceof IGregTechTileEntity)) return; diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java index 7bee7e657bc..8ea1a0ac3c7 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java @@ -20,8 +20,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class RecipeLogicInfoProvider extends CapabilityInfoProvider { @@ -30,16 +29,16 @@ public String getID() { return GTValues.MODID + ":recipe_logic_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC; } @Override - protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IProbeInfo probeInfo, - @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, - @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull AbstractRecipeLogic capability, @NotNull IProbeInfo probeInfo, + @NotNull EntityPlayer player, @NotNull TileEntity tileEntity, + @NotNull IProbeHitData data) { // do not show energy usage on machines that do not use energy if (capability.isWorking()) { if (capability instanceof PrimitiveRecipeLogic) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java index 774de2cb1d0..cf77786cc15 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/TransformerInfoProvider.java @@ -14,8 +14,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.TextStyleClass; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class TransformerInfoProvider extends ElectricContainerInfoProvider { @@ -25,8 +24,8 @@ public String getID() { } @Override - protected void addProbeInfo(@Nonnull IEnergyContainer capability, @Nonnull IProbeInfo probeInfo, - EntityPlayer player, @Nonnull TileEntity tileEntity, @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IEnergyContainer capability, @NotNull IProbeInfo probeInfo, + EntityPlayer player, @NotNull TileEntity tileEntity, @NotNull IProbeHitData data) { if (tileEntity instanceof IGregTechTileEntity) { MetaTileEntity metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (metaTileEntity instanceof MetaTileEntityTransformer) { diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java index 966498a355d..5d3c500e81e 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/WorkableInfoProvider.java @@ -11,8 +11,7 @@ import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class WorkableInfoProvider extends CapabilityInfoProvider { @@ -21,16 +20,16 @@ public String getID() { return GTValues.MODID + ":workable_provider"; } - @Nonnull + @NotNull @Override protected Capability getCapability() { return GregtechTileCapabilities.CAPABILITY_WORKABLE; } @Override - protected void addProbeInfo(@Nonnull IWorkable capability, @Nonnull IProbeInfo probeInfo, - @Nonnull EntityPlayer player, @Nonnull TileEntity tileEntity, - @Nonnull IProbeHitData data) { + protected void addProbeInfo(@NotNull IWorkable capability, @NotNull IProbeInfo probeInfo, + @NotNull EntityPlayer player, @NotNull TileEntity tileEntity, + @NotNull IProbeHitData data) { if (!capability.isActive()) return; int currentProgress = capability.getProgress(); diff --git a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java index 79146b737db..7edf69af532 100644 --- a/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java +++ b/src/main/java/gregtech/integration/theoneprobe/provider/debug/DebugPipeNetInfoProvider.java @@ -18,12 +18,11 @@ import mcjty.theoneprobe.api.IProbeInfo; import mcjty.theoneprobe.api.IProbeInfoProvider; import mcjty.theoneprobe.api.ProbeMode; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - public class DebugPipeNetInfoProvider implements IProbeInfoProvider { @Override @@ -32,8 +31,8 @@ public String getID() { } @Override - public void addProbeInfo(@Nonnull ProbeMode mode, @Nonnull IProbeInfo probeInfo, @Nonnull EntityPlayer player, - @Nonnull World world, @Nonnull IBlockState blockState, @Nonnull IProbeHitData data) { + public void addProbeInfo(@NotNull ProbeMode mode, @NotNull IProbeInfo probeInfo, @NotNull EntityPlayer player, + @NotNull World world, @NotNull IBlockState blockState, @NotNull IProbeHitData data) { if (ConfigHolder.misc.debug) { TileEntity tileEntity = world.getTileEntity(data.getPos()); if (tileEntity instanceof IGregTechTileEntity) { diff --git a/src/main/java/gregtech/loaders/WoodTypeEntry.java b/src/main/java/gregtech/loaders/WoodTypeEntry.java index 5ff9f964344..7a086b1b55e 100644 --- a/src/main/java/gregtech/loaders/WoodTypeEntry.java +++ b/src/main/java/gregtech/loaders/WoodTypeEntry.java @@ -8,20 +8,19 @@ import net.minecraft.item.ItemStack; import com.google.common.base.Preconditions; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Entry for a wood type and all of its associated items */ public final class WoodTypeEntry { - @Nonnull + @NotNull public final String modid; - @Nonnull + @NotNull public final String woodName; - @Nonnull + @NotNull public final ItemStack log; /** * if log -> charcoal recipes should be removed @@ -31,15 +30,15 @@ public final class WoodTypeEntry { * if log -> charcoal recipes should be added */ public final boolean addCharcoalRecipe; - @Nonnull + @NotNull public final ItemStack planks; @Nullable public final String planksRecipeName; - @Nonnull + @NotNull public final ItemStack door; @Nullable public final String doorRecipeName; - @Nonnull + @NotNull public final ItemStack slab; @Nullable public final String slabRecipeName; @@ -47,14 +46,14 @@ public final class WoodTypeEntry { public final ItemStack fence; @Nullable public final String fenceRecipeName; - @Nonnull + @NotNull public final ItemStack fenceGate; @Nullable public final String fenceGateRecipeName; - @Nonnull + @NotNull public final ItemStack stairs; public final boolean addStairsCraftingRecipe; - @Nonnull + @NotNull public final ItemStack boat; @Nullable public final String boatRecipeName; @@ -78,13 +77,13 @@ public final class WoodTypeEntry { /** * @see WoodTypeEntry.Builder */ - private WoodTypeEntry(@Nonnull String modid, @Nonnull String woodName, @Nonnull ItemStack log, - boolean removeCharcoalRecipe, boolean addCharcoalRecipe, @Nonnull ItemStack planks, - @Nullable String planksRecipeName, @Nonnull ItemStack door, @Nullable String doorRecipeName, - @Nonnull ItemStack slab, @Nullable String slabRecipeName, boolean addSlabCraftingRecipe, - @Nonnull ItemStack fence, @Nullable String fenceRecipeName, - @Nonnull ItemStack fenceGate, @Nullable String fenceGateRecipeName, @Nonnull ItemStack stairs, - boolean addStairsCraftingRecipe, @Nonnull ItemStack boat, @Nullable String boatRecipeName, + private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @NotNull ItemStack log, + boolean removeCharcoalRecipe, boolean addCharcoalRecipe, @NotNull ItemStack planks, + @Nullable String planksRecipeName, @NotNull ItemStack door, @Nullable String doorRecipeName, + @NotNull ItemStack slab, @Nullable String slabRecipeName, boolean addSlabCraftingRecipe, + @NotNull ItemStack fence, @Nullable String fenceRecipeName, + @NotNull ItemStack fenceGate, @Nullable String fenceGateRecipeName, @NotNull ItemStack stairs, + boolean addStairsCraftingRecipe, @NotNull ItemStack boat, @Nullable String boatRecipeName, @Nullable Material material, boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, boolean addSlabsOreDict, boolean addFencesOreDict, boolean addFenceGatesOreDict, boolean addStairsOreDict, boolean addPlanksUnificationInfo, @@ -129,7 +128,7 @@ private WoodTypeEntry(@Nonnull String modid, @Nonnull String woodName, @Nonnull this.addBoatsUnificationInfo = addBoatsUnificationInfo; } - @Nonnull + @NotNull public UnificationEntry getStick() { return new UnificationEntry(OrePrefix.stick, this.material); } @@ -180,7 +179,7 @@ public static class Builder { * @param modid the modid adding recipes for the wood * @param woodName the name of the wood */ - public Builder(@Nonnull String modid, @Nonnull String woodName) { + public Builder(@NotNull String modid, @NotNull String woodName) { Preconditions.checkArgument(!modid.isEmpty(), "Modid cannot be empty."); Preconditions.checkArgument(!woodName.isEmpty(), "Wood name cannot be empty."); this.modid = modid; @@ -193,7 +192,7 @@ public Builder(@Nonnull String modid, @Nonnull String woodName) { * @param log the log to add * @return this */ - public Builder log(@Nonnull ItemStack log) { + public Builder log(@NotNull ItemStack log) { this.log = log; return this; } @@ -225,7 +224,7 @@ public Builder addCharcoalRecipe() { * @param planksRecipeName the recipe for crafting the planks * @return this */ - public Builder planks(@Nonnull ItemStack planks, @Nullable String planksRecipeName) { + public Builder planks(@NotNull ItemStack planks, @Nullable String planksRecipeName) { this.planks = planks; this.planksRecipeName = planksRecipeName; return this; @@ -238,7 +237,7 @@ public Builder planks(@Nonnull ItemStack planks, @Nullable String planksRecipeNa * @param doorRecipeName the recipe name for crafting the door * @return this */ - public Builder door(@Nonnull ItemStack door, @Nullable String doorRecipeName) { + public Builder door(@NotNull ItemStack door, @Nullable String doorRecipeName) { this.door = door; this.doorRecipeName = doorRecipeName; return this; @@ -250,7 +249,7 @@ public Builder door(@Nonnull ItemStack door, @Nullable String doorRecipeName) { * @param slab the slab to add * @return this */ - public Builder slab(@Nonnull ItemStack slab, @Nullable String slabRecipeName) { + public Builder slab(@NotNull ItemStack slab, @Nullable String slabRecipeName) { this.slab = slab; this.slabRecipeName = slabRecipeName; return this; @@ -273,7 +272,7 @@ public Builder addSlabRecipe() { * @param fenceRecipeName the recipe name for crafting the fence * @return this */ - public Builder fence(@Nonnull ItemStack fence, @Nullable String fenceRecipeName) { + public Builder fence(@NotNull ItemStack fence, @Nullable String fenceRecipeName) { this.fence = fence; this.fenceRecipeName = fenceRecipeName; return this; @@ -286,7 +285,7 @@ public Builder fence(@Nonnull ItemStack fence, @Nullable String fenceRecipeName) * @param fenceGateRecipeName the recipe name for crafting the fence gate * @return this */ - public Builder fenceGate(@Nonnull ItemStack fenceGate, @Nullable String fenceGateRecipeName) { + public Builder fenceGate(@NotNull ItemStack fenceGate, @Nullable String fenceGateRecipeName) { this.fenceGate = fenceGate; this.fenceGateRecipeName = fenceGateRecipeName; return this; @@ -298,7 +297,7 @@ public Builder fenceGate(@Nonnull ItemStack fenceGate, @Nullable String fenceGat * @param stairs the stairs to add * @return this */ - public Builder stairs(@Nonnull ItemStack stairs) { + public Builder stairs(@NotNull ItemStack stairs) { this.stairs = stairs; return this; } @@ -320,7 +319,7 @@ public Builder addStairsRecipe() { * @param boatRecipeName the recipe name for crafting the boat * @return this */ - public Builder boat(@Nonnull ItemStack boat, @Nullable String boatRecipeName) { + public Builder boat(@NotNull ItemStack boat, @Nullable String boatRecipeName) { this.boat = boat; this.boatRecipeName = boatRecipeName; return this; @@ -332,7 +331,7 @@ public Builder boat(@Nonnull ItemStack boat, @Nullable String boatRecipeName) { * @param material material for wood entry * @return this */ - public Builder material(@Nonnull Material material) { + public Builder material(@NotNull Material material) { this.material = material; return this; } @@ -406,7 +405,7 @@ public Builder registerUnificationInfo(boolean planks, boolean door, boolean sla /** * @return a new wood type entry, if valid */ - @Nonnull + @NotNull public WoodTypeEntry build() { Preconditions.checkArgument(!planks.isEmpty(), "Planks cannot be empty."); return new WoodTypeEntry(modid, woodName, log, removeCharcoalRecipe, addCharcoalRecipe, planks, diff --git a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java index 81955f6b6fb..e4cbbab3310 100644 --- a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java @@ -25,15 +25,14 @@ import net.minecraft.util.Tuple; import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.L; import static gregtech.api.GTValues.M; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -277,7 +276,7 @@ private static void registerArcRecycling(ItemStack input, List ma } private static boolean needsRecyclingCategory(@Nullable OrePrefix prefix, @Nullable MaterialStack inputStack, - @Nonnull List outputs) { + @NotNull List outputs) { // separate special arc smelting recipes into the regular category // i.e. Iron -> Wrought Iron, Copper -> Annealed Copper if (prefix == OrePrefix.nugget || prefix == OrePrefix.ingot || prefix == OrePrefix.block) { @@ -329,7 +328,7 @@ private static MaterialStack getArcSmeltingResult(MaterialStack materialStack) { return materialStack; } - private static ItemStack getArcIngotOrDust(@Nonnull MaterialStack stack) { + private static ItemStack getArcIngotOrDust(@NotNull MaterialStack stack) { if (stack.material == Materials.Carbon) { return OreDictUnifier.getDust(stack); } diff --git a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java index 9eb764c8870..fb06348d385 100644 --- a/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java +++ b/src/main/java/gregtech/loaders/recipe/WoodRecipeLoader.java @@ -23,11 +23,11 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fml.common.registry.GameRegistry; +import org.jetbrains.annotations.NotNull; + import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; - import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.Materials.*; @@ -162,7 +162,7 @@ private static void registerWoodRecipes() { * * @param entry the entry to register for */ - public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { + public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { if (!entry.log.isEmpty() && entry.addLogOreDict) { OreDictUnifier.registerOre(entry.log, log, entry.material); } @@ -234,7 +234,7 @@ public static void registerWoodUnificationInfo(@Nonnull WoodTypeEntry entry) { * * @param entry the entry to register for */ - public static void registerWoodTypeRecipe(@Nonnull WoodTypeEntry entry) { + public static void registerWoodTypeRecipe(@NotNull WoodTypeEntry entry) { final String name = entry.woodName; if (entry.planks.isEmpty()) { diff --git a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java index 8ff1f825974..ac915b45dc7 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/MaterialRecipeHandler.java @@ -19,12 +19,12 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nullable; - import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.*; import static gregtech.api.unification.material.info.MaterialFlags.*; diff --git a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java index 1d5d8c57d2b..4b6ec9210b2 100644 --- a/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java +++ b/src/main/java/gregtech/loaders/recipe/handlers/ToolRecipeHandler.java @@ -25,14 +25,13 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries; import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; - import static gregtech.api.GTValues.*; import static gregtech.api.recipes.RecipeMaps.LATHE_RECIPES; import static gregtech.api.unification.material.info.MaterialFlags.*; @@ -317,7 +316,7 @@ public static void addElectricToolRecipe(OrePrefix toolHead, Material material, } } - public static void addToolRecipe(@Nonnull Material material, @Nonnull IGTTool tool, boolean mirrored, + public static void addToolRecipe(@NotNull Material material, @NotNull IGTTool tool, boolean mirrored, Object... recipe) { if (mirrored) { ModHandler.addMirroredShapedRecipe(String.format("%s_%s", tool.getToolId(), material), diff --git a/src/main/java/gregtech/modules/BaseGregTechModule.java b/src/main/java/gregtech/modules/BaseGregTechModule.java index ed4244abcbf..694d0a1051e 100644 --- a/src/main/java/gregtech/modules/BaseGregTechModule.java +++ b/src/main/java/gregtech/modules/BaseGregTechModule.java @@ -5,14 +5,14 @@ import net.minecraft.util.ResourceLocation; +import org.jetbrains.annotations.NotNull; + import java.util.Collections; import java.util.Set; -import javax.annotation.Nonnull; - public abstract class BaseGregTechModule implements IGregTechModule { - @Nonnull + @NotNull @Override public Set getDependencyUids() { return Collections.singleton(GTUtility.gregtechId(GregTechModules.MODULE_CORE)); diff --git a/src/main/java/gregtech/tools/ToolsModule.java b/src/main/java/gregtech/tools/ToolsModule.java index 8114b4c4628..f4fb8912619 100644 --- a/src/main/java/gregtech/tools/ToolsModule.java +++ b/src/main/java/gregtech/tools/ToolsModule.java @@ -15,12 +15,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import javax.annotation.Nonnull; - @GregTechModule( moduleID = GregTechModules.MODULE_TOOLS, containerID = GTValues.MODID, @@ -30,13 +29,13 @@ public class ToolsModule extends BaseGregTechModule { public static final Logger logger = LogManager.getLogger("GregTech Tools"); - @Nonnull + @NotNull @Override public Logger getLogger() { return logger; } - @Nonnull + @NotNull @Override public List> getEventBusSubscribers() { return Collections.singletonList(ToolsModule.class); diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java index e1054198f71..8d0c1502c53 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentEnderDamage.java @@ -14,7 +14,7 @@ import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.potion.PotionEffect; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class EnchantmentEnderDamage extends Enchantment { @@ -42,7 +42,7 @@ public int getMaxLevel() { } @Override - public void onEntityDamaged(@Nonnull EntityLivingBase user, @Nonnull Entity target, int level) { + public void onEntityDamaged(@NotNull EntityLivingBase user, @NotNull Entity target, int level) { String entityName = EntityList.getEntityString(target); if (target instanceof EntityLivingBase && (target instanceof EntityEnderman || target instanceof EntityDragon || target instanceof EntityEndermite || diff --git a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java index b2e7806d42c..ad704f611fb 100644 --- a/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java +++ b/src/main/java/gregtech/tools/enchants/EnchantmentHardHammer.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class EnchantmentHardHammer extends Enchantment { @@ -36,14 +36,14 @@ public int getMaxLevel() { } @Override - public boolean canApplyAtEnchantingTable(@Nonnull ItemStack stack) { + public boolean canApplyAtEnchantingTable(@NotNull ItemStack stack) { return super.canApplyAtEnchantingTable(stack) && stack.getItem().getToolClasses(stack).contains(ToolClasses.PICKAXE) && !stack.getItem().getToolClasses(stack).contains(ToolClasses.HARD_HAMMER); } @Override - protected boolean canApplyTogether(@Nonnull Enchantment ench) { + protected boolean canApplyTogether(@NotNull Enchantment ench) { return super.canApplyTogether(ench) && ench != Enchantments.SILK_TOUCH && ench != Enchantments.FORTUNE; } } diff --git a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java index 51302795940..f0f75d75580 100644 --- a/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java +++ b/src/test/java/gregtech/api/capability/impl/EnergyContainerListTest.java @@ -9,19 +9,18 @@ import net.minecraft.util.ResourceLocation; import org.hamcrest.MatcherAssert; +import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - import static gregtech.api.GTValues.*; import static org.hamcrest.CoreMatchers.is; public class EnergyContainerListTest { - @Nonnull + @NotNull private static MetaTileEntity createDummyMTE() { return new MetaTileEntity(new ResourceLocation("")) { @@ -37,18 +36,18 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { }; } - @Nonnull + @NotNull private static IEnergyContainer createContainer(int amps) { return createContainer(amps, LV); } - @Nonnull + @NotNull private static IEnergyContainer createContainer(int amps, int tier) { return EnergyContainerHandler.receiverContainer(createDummyMTE(), V[tier] * 64L * amps, V[tier], amps); } - @Nonnull + @NotNull private static EnergyContainerList createList(int size, int ampsPerHatch) { List list = new ArrayList<>(size); for (int i = 0; i < size; i++) { @@ -166,7 +165,7 @@ public void testMixed() { check(new EnergyContainerList(list), 320, 1); } - private static void check(@Nonnull EnergyContainerList list, long inputVoltage, long inputAmperage) { + private static void check(@NotNull EnergyContainerList list, long inputVoltage, long inputAmperage) { MatcherAssert.assertThat(list.getInputVoltage(), is(inputVoltage)); MatcherAssert.assertThat(list.getInputAmperage(), is(inputAmperage)); } diff --git a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java index 2f0dcb3b8c5..a734933b9fe 100644 --- a/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java +++ b/src/test/java/gregtech/api/capability/impl/FluidTankListTest.java @@ -10,15 +10,14 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import static net.minecraftforge.fluids.FluidRegistry.LAVA; import static net.minecraftforge.fluids.FluidRegistry.WATER; @@ -404,7 +403,7 @@ FluidHandlerTester beginSimulation() { return this; } - FluidHandlerTester expectContents(@Nonnull FluidStack... optionalFluidStacks) { + FluidHandlerTester expectContents(@NotNull FluidStack... optionalFluidStacks) { if (optionalFluidStacks.length != this.tank.getTanks()) { throw new IllegalArgumentException("Wrong number of fluids to compare; " + "expected: " + this.tank.getTanks() + ", provided: " + optionalFluidStacks.length); diff --git a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java index b229f1cc5e4..b8624475633 100644 --- a/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java +++ b/src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java @@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableList; import org.hamcrest.MatcherAssert; +import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -35,8 +36,6 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - import static gregtech.api.util.GTUtility.gregtechId; import static org.hamcrest.CoreMatchers.*; @@ -82,7 +81,7 @@ public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return true; } @@ -328,7 +327,7 @@ public boolean isDistinct() { // function checks for the temperature of the recipe against the coils @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return true; } }); @@ -572,7 +571,7 @@ public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return true; } diff --git a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java index 13e03f3775f..5d1105e8a5b 100644 --- a/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java +++ b/src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java @@ -38,8 +38,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import javax.annotation.Nonnull; - import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -80,7 +78,7 @@ public void reinitializeStructurePattern() {} // function checks for the temperature of the recipe against the coils @Override - public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + public boolean checkRecipe(@NotNull Recipe recipe, boolean consumeIfSuccess) { return true; } @@ -536,7 +534,7 @@ public long getMaxVoltage() { return 32; } - @Nonnull + @NotNull @Override public MetaTileEntity getMetaTileEntity() { return EBF; @@ -611,7 +609,7 @@ public long getMaxVoltage() { return 32; } - @Nonnull + @NotNull @Override public MetaTileEntity getMetaTileEntity() { return EBF; @@ -676,7 +674,7 @@ public long getMaxVoltage() { return 32; } - @Nonnull + @NotNull @Override public MetaTileEntity getMetaTileEntity() { return EBF; @@ -743,7 +741,7 @@ public long getMaxVoltage() { return 32; } - @Nonnull + @NotNull @Override public MetaTileEntity getMetaTileEntity() { return EBF; @@ -801,8 +799,8 @@ public ParallelableTestLogic(MetaTileEntity metaTileEntity, RecipeMap recipeM this(metaTileEntity, recipeMap, logicType, false); } - public ParallelableTestLogic(@Nonnull MetaTileEntity metaTileEntity, @Nonnull RecipeMap recipeMap, - @Nonnull ParallelLogicType logicType, boolean enableBonusOverride) { + public ParallelableTestLogic(@NotNull MetaTileEntity metaTileEntity, @NotNull RecipeMap recipeMap, + @NotNull ParallelLogicType logicType, boolean enableBonusOverride) { this.metaTileEntity = metaTileEntity; this.recipeMap = recipeMap; this.logicType = logicType; @@ -836,7 +834,7 @@ public void invalidateInputs() {} public void invalidateOutputs() {} @Override - public void applyParallelBonus(@Nonnull RecipeBuilder builder) { + public void applyParallelBonus(@NotNull RecipeBuilder builder) { if (enableBonusOverride) { builder.EUt(1).duration(50); } diff --git a/src/test/java/jabel/TestModernJavaSyntax.java b/src/test/java/jabel/TestModernJavaSyntax.java index a1b2ab9054e..fee1f632f9d 100644 --- a/src/test/java/jabel/TestModernJavaSyntax.java +++ b/src/test/java/jabel/TestModernJavaSyntax.java @@ -2,12 +2,11 @@ import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; +import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; -import javax.annotation.Nonnull; - /** * Tests to ensure compilation with Java 17 and running with Java 8 is functional */ @@ -22,7 +21,7 @@ public void testSwitchPatternMatching() { MatcherAssert.assertThat(getLengthSwitch("wrong"), CoreMatchers.is(-1)); } - private static int getLengthSwitch(@Nonnull String s) { + private static int getLengthSwitch(@NotNull String s) { return switch (s) { case "hello" -> 5; case "goodbye" -> 7; From 99072ac17827fe78243737c010f31f09cdab9f65 Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:12:56 -0600 Subject: [PATCH 14/77] git blame ignore revs file --- .git-blame-ignore-revs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..81ccbd5d123 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,6 @@ +# Convert to Jetbrains Annotations +5901bc912c9c3c5b03bf91747fff6c0276c3d773 + +# Enable Spotless Formatting +d0c17006a4d516252c3f0ebf7829d6ac81830872 + From bb5dee367138a9aedd5f059600b59106a950f405 Mon Sep 17 00:00:00 2001 From: froot <66188216+kumquat-ir@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:17:58 -0800 Subject: [PATCH 15/77] Only load the module config file once (#2198) --- src/main/java/gregtech/modules/ModuleManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/modules/ModuleManager.java b/src/main/java/gregtech/modules/ModuleManager.java index f5e8c4dc310..4a939058128 100644 --- a/src/main/java/gregtech/modules/ModuleManager.java +++ b/src/main/java/gregtech/modules/ModuleManager.java @@ -220,13 +220,13 @@ private void configureModules(Map> modules) { Set toLoad = new LinkedHashSet<>(); Set modulesToLoad = new LinkedHashSet<>(); Configuration config = getConfiguration(); + config.load(); + config.addCustomCategoryComment(MODULE_CFG_CATEGORY_NAME, + "Module configuration file. Can individually enable/disable modules from GregTech and its addons"); for (IModuleContainer container : containers.values()) { String containerID = container.getID(); List containerModules = modules.get(containerID); - config.load(); - config.addCustomCategoryComment(MODULE_CFG_CATEGORY_NAME, - "Module configuration file. Can individually enable/disable modules from GregTech and its addons"); IGregTechModule coreModule = getCoreModule(containerModules); if (coreModule == null) { throw new IllegalStateException("Could not find core module for module container " + containerID); From 86e199caab5bf962702508c2f30c6831e4316f75 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:25:46 -0600 Subject: [PATCH 16/77] Remove dangling 2.7 deprecation (#2200) --- .../gregtech/integration/RecipeCompatUtil.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main/java/gregtech/integration/RecipeCompatUtil.java b/src/main/java/gregtech/integration/RecipeCompatUtil.java index cb0a7f3bd67..e18d156a004 100644 --- a/src/main/java/gregtech/integration/RecipeCompatUtil.java +++ b/src/main/java/gregtech/integration/RecipeCompatUtil.java @@ -8,11 +8,9 @@ import gregtech.api.pipenet.block.material.BlockMaterialPipe; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; -import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; import gregtech.common.blocks.BlockCompressed; import gregtech.common.blocks.BlockFrame; -import gregtech.core.unification.material.internal.MaterialRegistryManager; import gregtech.integration.crafttweaker.CTRecipeHelper; import gregtech.integration.groovy.GrSRecipeHelper; import gregtech.modules.GregTechModules; @@ -22,7 +20,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -100,18 +97,6 @@ public static TweakerType getPriorityTweaker() { return TweakerType.NONE; } - /** - * Deprecated since 2.7 and will be removed in 2.8 - * - * @deprecated Use {@link MaterialRegistryManager#getMaterial(String)} - */ - @ApiStatus.ScheduledForRemoval(inVersion = "2.8") - @Deprecated - @Nullable - public static Material getMaterial(@NotNull String name) { - return GregTechAPI.materialManager.getMaterial(name); - } - public static boolean isTweakerLoaded() { return getPriorityTweaker() != TweakerType.NONE; } From ff9a019e776d7dcff89305d1611c67a1529fbcfd Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:27:26 -0600 Subject: [PATCH 17/77] 2.8.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ab47d3bdb1d..4c212be7072 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ modGroup = gregtech # Version of your mod. # This field can be left empty if you want your mod's version to be determined by the latest git tag instead. -modVersion = 2.7.4-beta +modVersion = 2.8.0-beta # Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) includeMCVersionJar = true From 53ccd80d843502bf836c41ab02a7908ea1f2de4b Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:48:54 -0600 Subject: [PATCH 18/77] Fix HPCA drawing power when disabled (#2201) --- .../metatileentities/multi/electric/MetaTileEntityHPCA.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java index 46098a29b79..45bf53d463d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java @@ -144,7 +144,7 @@ public void update() { @Override protected void updateFormedValid() { - consumeEnergy(); + if (isWorkingEnabled()) consumeEnergy(); if (isActive()) { // forcibly use active coolers at full rate if temperature is half-way to damaging temperature double midpoint = (DAMAGE_TEMPERATURE - IDLE_TEMPERATURE) / 2; From 4282590174bed69f41d2b22270aa58fa0603ca6e Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:49:12 -0600 Subject: [PATCH 19/77] Fix fluid tooltips overriding previous ones (#2202) --- .../java/gregtech/api/util/FluidTooltipUtil.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/util/FluidTooltipUtil.java b/src/main/java/gregtech/api/util/FluidTooltipUtil.java index b73b335e162..378ea55be88 100644 --- a/src/main/java/gregtech/api/util/FluidTooltipUtil.java +++ b/src/main/java/gregtech/api/util/FluidTooltipUtil.java @@ -21,7 +21,7 @@ public class FluidTooltipUtil { /** * Registry Mapping of */ - private static final Map>> tooltips = new HashMap<>(); + private static final Map>>> tooltips = new HashMap<>(); /** * Used to register a tooltip to a Fluid. @@ -30,7 +30,8 @@ public class FluidTooltipUtil { * @param tooltip The tooltip. */ public static void registerTooltip(@NotNull Fluid fluid, @NotNull Supplier> tooltip) { - tooltips.put(fluid, tooltip); + List>> list = tooltips.computeIfAbsent(fluid, $ -> new ArrayList<>(1)); + list.add(tooltip); } /** @@ -44,8 +45,13 @@ public static List getFluidTooltip(Fluid fluid) { return null; } - var supplier = tooltips.get(fluid); - return supplier == null ? Collections.emptyList() : supplier.get(); + var list = tooltips.get(fluid); + if (list == null) return Collections.emptyList(); + List tooltip = new ArrayList<>(); + for (var supplier : list) { + tooltip.addAll(supplier.get()); + } + return tooltip; } /** From 54f03af8711d71cf36ced2242d10c6ec797e2ab0 Mon Sep 17 00:00:00 2001 From: froot <66188216+kumquat-ir@users.noreply.github.com> Date: Sun, 26 Nov 2023 20:52:40 -0800 Subject: [PATCH 20/77] Reservoir hatch fixes (#2205) --- .../MetaTileEntityReservoirHatch.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java index 85c52302c24..9981538731d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -16,6 +16,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -25,6 +26,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; @@ -42,6 +44,7 @@ public class MetaTileEntityReservoirHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { + private static final int FLUID_AMOUNT = 2_000_000_000; private final InfiniteWaterTank fluidTank; public MetaTileEntityReservoirHatch(ResourceLocation metaTileEntityId) { @@ -85,7 +88,7 @@ public T getCapability(Capability capability, EnumFacing side) { } private int getInventorySize() { - return Integer.MAX_VALUE; + return FLUID_AMOUNT; } @Override @@ -146,9 +149,9 @@ public ModularUI.Builder createTankUI(IFluidTank fluidTank, String title, Entity private Consumer> getFluidNameText(TankWidget tankWidget) { return (list) -> { - String fluidName = tankWidget.getFluidUnlocalizedName(); - if (!fluidName.isEmpty()) { - list.add(new TextComponentTranslation(fluidName)); + TextComponentTranslation translation = tankWidget.getFluidTextComponent(); + if (translation != null) { + list.add(translation); } }; } @@ -177,15 +180,16 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t private static class InfiniteWaterTank extends NotifiableFluidTank { - private final FluidStack BIG_WATER = new FluidStack(FluidRegistry.WATER, Integer.MAX_VALUE); + private final FluidStack BIG_WATER = new FluidStack(FluidRegistry.WATER, FLUID_AMOUNT); public InfiniteWaterTank(int capacity, MetaTileEntity entityToNotify) { super(capacity, entityToNotify, false); + setFluid(BIG_WATER); } private void refillWater() { - if (BIG_WATER.amount != Integer.MAX_VALUE) { - BIG_WATER.amount = Integer.MAX_VALUE; + if (BIG_WATER.amount != FLUID_AMOUNT) { + BIG_WATER.amount = FLUID_AMOUNT; onContentsChanged(); } } @@ -216,10 +220,15 @@ public boolean canFillFluidType(FluidStack fluid) { return fluid.getFluid() == BIG_WATER.getFluid(); } - @Nullable + // serialization is unnecessary here, it should always have the same amount of fluid + @Override + public FluidTank readFromNBT(NBTTagCompound nbt) { + return this; + } + @Override - public FluidStack getFluid() { - return BIG_WATER; + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + return nbt; } } } From 3d7f959e3bc6ba2bef1b7211550245878d9889f9 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:52:53 -0600 Subject: [PATCH 21/77] Fix GT Water/Lava materials storing the wrong object (#2203) --- .../api/unification/material/Material.java | 23 ++++++++++++++++++- .../materials/FirstDegreeMaterials.java | 5 +++- .../UnknownCompositionMaterials.java | 6 ++++- .../gregtech/api/util/FluidTooltipUtil.java | 23 ++++++++++++------- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index 03609768a93..8a80801af48 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -13,6 +13,7 @@ import gregtech.api.unification.material.properties.*; import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.stack.MaterialStack; +import gregtech.api.util.FluidTooltipUtil; import gregtech.api.util.GTUtility; import gregtech.api.util.LocalizationUtils; import gregtech.api.util.SmallDigits; @@ -35,6 +36,7 @@ import stanhebben.zenscript.annotations.ZenOperator; import java.util.*; +import java.util.function.Consumer; import java.util.function.UnaryOperator; @ZenClass("mods.gregtech.material.Material") @@ -457,6 +459,8 @@ public static class Builder { private final MaterialProperties properties; private final MaterialFlags flags; + private final List> postProcessors = new ArrayList<>(1); + /* * The temporary list of components for this Material. */ @@ -522,6 +526,21 @@ public Builder fluid(@NotNull FluidStorageKey key, @NotNull FluidBuilder builder return this; } + /** + * Assign an existing fluid to this material. Useful for things like Lava and Water where MC + * already has a fluid to use, or for cross-mod compatibility. + * + * @param fluid The existing liquid + */ + public Builder fluid(@NotNull Fluid fluid, @NotNull FluidStorageKey key, @NotNull FluidState state) { + properties.ensureSet(PropertyKey.FLUID); + FluidProperty property = properties.getProperty(PropertyKey.FLUID); + property.getStorage().store(key, fluid); + postProcessors.add( + m -> FluidTooltipUtil.registerTooltip(fluid, FluidTooltipUtil.createFluidTooltip(m, fluid, state))); + return this; + } + /** * Add a liquid for this material. * @@ -1058,7 +1077,9 @@ public Builder addDefaultEnchant(Enchantment enchant, int level) { public Material build() { materialInfo.componentList = ImmutableList.copyOf(composition); materialInfo.verifyInfo(properties, averageRGB); - return new Material(materialInfo, properties, flags); + Material m = new Material(materialInfo, properties, flags); + if (!postProcessors.isEmpty()) postProcessors.forEach(p -> p.accept(m)); + return m; } } diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index 61aec7180c3..f5a760b7364 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -2,13 +2,16 @@ import gregtech.api.GTValues; import gregtech.api.fluids.FluidBuilder; +import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttributes; +import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.properties.BlastProperty.GasTier; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.properties.ToolProperty; import net.minecraft.init.Enchantments; +import net.minecraftforge.fluids.FluidRegistry; import static gregtech.api.GTValues.*; import static gregtech.api.unification.material.Materials.*; @@ -157,7 +160,7 @@ public static void register() { .build(); Water = new Material.Builder(269, gregtechId("water")) - .liquid(new FluidBuilder().temperature(300)) + .fluid(FluidRegistry.WATER, FluidStorageKeys.LIQUID, FluidState.LIQUID) .color(0x0000FF) .flags(DISABLE_DECOMPOSITION) .components(Hydrogen, 2, Oxygen, 1) diff --git a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java index f26fc316290..4321d7de644 100644 --- a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java @@ -1,9 +1,13 @@ package gregtech.api.unification.material.materials; import gregtech.api.fluids.FluidBuilder; +import gregtech.api.fluids.FluidState; import gregtech.api.fluids.attribute.FluidAttributes; +import gregtech.api.fluids.store.FluidStorageKeys; import gregtech.api.unification.material.Material; +import net.minecraftforge.fluids.FluidRegistry; + import static gregtech.api.unification.material.Materials.*; import static gregtech.api.unification.material.info.MaterialFlags.*; import static gregtech.api.unification.material.info.MaterialIconSet.*; @@ -427,7 +431,7 @@ public static void register() { .build(); Lava = new Material.Builder(1600, gregtechId("lava")) - .fluid() + .fluid(FluidRegistry.LAVA, FluidStorageKeys.LIQUID, FluidState.LIQUID) .color(0xFF4000) .flags(GLOWING) .build(); diff --git a/src/main/java/gregtech/api/util/FluidTooltipUtil.java b/src/main/java/gregtech/api/util/FluidTooltipUtil.java index 378ea55be88..5f2ccad8ed9 100644 --- a/src/main/java/gregtech/api/util/FluidTooltipUtil.java +++ b/src/main/java/gregtech/api/util/FluidTooltipUtil.java @@ -1,5 +1,6 @@ package gregtech.api.util; +import gregtech.api.fluids.FluidState; import gregtech.api.fluids.GTFluid; import gregtech.api.unification.material.Material; @@ -10,6 +11,7 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.Supplier; @@ -82,19 +84,24 @@ public static List getFluidTooltip(String fluidName) { return getFluidTooltip(FluidRegistry.getFluid(fluidName)); } - public static Supplier> createGTFluidTooltip(GTFluid fluid) { + public static Supplier> createGTFluidTooltip(@NotNull GTFluid fluid) { + Material material = fluid instanceof GTFluid.GTMaterialFluid matFluid ? matFluid.getMaterial() : null; + return createFluidTooltip(material, fluid, fluid.getState()); + } + + public static Supplier> createFluidTooltip(@Nullable Material material, @NotNull Fluid fluid, + @NotNull FluidState fluidState) { return () -> { List tooltip = new ArrayList<>(); - if (fluid instanceof GTFluid.GTMaterialFluid materialFluid) { - Material material = materialFluid.getMaterial(); - if (!material.getChemicalFormula().isEmpty()) { - tooltip.add(TextFormatting.YELLOW + material.getChemicalFormula()); - } + if (material != null && !material.getChemicalFormula().isEmpty()) { + tooltip.add(TextFormatting.YELLOW + material.getChemicalFormula()); } tooltip.add(I18n.format("gregtech.fluid.temperature", fluid.getTemperature())); - tooltip.add(I18n.format(fluid.getState().getTranslationKey())); - fluid.getAttributes().forEach(a -> a.appendFluidTooltips(tooltip)); + tooltip.add(I18n.format(fluidState.getTranslationKey())); + if (fluid instanceof GTFluid gtFluid) { + gtFluid.getAttributes().forEach(a -> a.appendFluidTooltips(tooltip)); + } if (fluid.getTemperature() < CRYOGENIC_FLUID_THRESHOLD) { tooltip.add(I18n.format("gregtech.fluid.temperature.cryogenic")); From e9b421b020ae0d34890ae45ced515c5773fa6a38 Mon Sep 17 00:00:00 2001 From: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:11:40 -0700 Subject: [PATCH 22/77] Set the Assembly Line particles config option true to default (#2204) --- src/main/java/gregtech/common/ConfigHolder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/ConfigHolder.java b/src/main/java/gregtech/common/ConfigHolder.java index f2d28b5388a..3a96df68b5f 100644 --- a/src/main/java/gregtech/common/ConfigHolder.java +++ b/src/main/java/gregtech/common/ConfigHolder.java @@ -494,7 +494,7 @@ public static class ShaderOptions { public FusionBloom fusionBloom = new FusionBloom(); @Config.Comment("Particle config option for the Assembly Line") - public boolean assemblyLineParticles = false; + public boolean assemblyLineParticles = true; @Config.Comment("Bloom config options for the heat effect (cable burning).") @Config.Name("Heat Effect") From 1d29504edd7bdcc047fdade4a57042b2e21afbe4 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:28:38 -0600 Subject: [PATCH 23/77] Fix mobs being able to spawn on warning signs (#2206) --- .../java/gregtech/common/blocks/BlockWarningSign.java | 10 ++++++++++ .../java/gregtech/common/blocks/BlockWarningSign1.java | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign.java b/src/main/java/gregtech/common/blocks/BlockWarningSign.java index a3e02d7b657..e452e203528 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign.java @@ -6,7 +6,11 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import org.jetbrains.annotations.NotNull; @@ -23,6 +27,12 @@ public BlockWarningSign() { setCreativeTab(GregTechAPI.TAB_GREGTECH_DECORATIONS); } + @Override + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { + return false; + } + public enum SignType implements IStringSerializable { YELLOW_STRIPES("yellow_stripes"), diff --git a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java index 2119c55ad83..b25d74c9397 100644 --- a/src/main/java/gregtech/common/blocks/BlockWarningSign1.java +++ b/src/main/java/gregtech/common/blocks/BlockWarningSign1.java @@ -6,7 +6,11 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import org.jetbrains.annotations.NotNull; @@ -23,6 +27,12 @@ public BlockWarningSign1() { setCreativeTab(GregTechAPI.TAB_GREGTECH_DECORATIONS); } + @Override + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { + return false; + } + public enum SignType implements IStringSerializable { MOB_SPAWNER_HAZARD("mob_spawner_hazard"), From a800c4232278eb982158f599ca6236f0af5309f5 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:48:05 -0500 Subject: [PATCH 24/77] stop clearing fluid sprite locations after registration (#2211) --- .../java/gregtech/api/fluids/GTFluidRegistration.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java index dcfb0bc7d4a..3668133b384 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java +++ b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java @@ -26,7 +26,7 @@ public class GTFluidRegistration { public static final GTFluidRegistration INSTANCE = new GTFluidRegistration(); - private static Collection fluidSprites = new ObjectOpenHashSet<>(); + private static final Collection fluidSprites = new ObjectOpenHashSet<>(); private static @Nullable BiMap MASTER_FLUID_REFERENCE; @@ -64,13 +64,8 @@ public void register() { @ApiStatus.Internal public void registerSprites(@NotNull TextureMap textureMap) { - if (fluidSprites == null) { - throw new IllegalStateException("Cannot register fluid sprites twice"); - } else { - for (ResourceLocation spriteLocation : fluidSprites) { - textureMap.registerSprite(spriteLocation); - } - fluidSprites = null; + for (ResourceLocation spriteLocation : fluidSprites) { + textureMap.registerSprite(spriteLocation); } } From 238ca2111a0bc4b5d60b8dec2b229766d1c7845f Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Mon, 27 Nov 2023 20:18:08 -0600 Subject: [PATCH 25/77] Fix cover ticking issues (#2213) --- src/main/java/gregtech/api/cover/Cover.java | 7 ------- src/main/java/gregtech/api/cover/CoverHolder.java | 5 +++-- .../api/pipenet/tile/PipeCoverableImplementation.java | 3 ++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/api/cover/Cover.java b/src/main/java/gregtech/api/cover/Cover.java index a5fc207812e..8540d97fc1f 100644 --- a/src/main/java/gregtech/api/cover/Cover.java +++ b/src/main/java/gregtech/api/cover/Cover.java @@ -98,13 +98,6 @@ default long getOffsetTimer() { return getCoverableView().getOffsetTimer(); } - default void update() {} - - default boolean isTickable() { - // noinspection InstanceofThis - return this instanceof ITickable; - } - /** * @return the side the cover is attached to */ diff --git a/src/main/java/gregtech/api/cover/CoverHolder.java b/src/main/java/gregtech/api/cover/CoverHolder.java index 06ab0791ce7..e2cf7d733f3 100644 --- a/src/main/java/gregtech/api/cover/CoverHolder.java +++ b/src/main/java/gregtech/api/cover/CoverHolder.java @@ -8,6 +8,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -84,8 +85,8 @@ default void dropCover(@NotNull EnumFacing side) { default void updateCovers() { for (EnumFacing facing : EnumFacing.VALUES) { Cover cover = getCoverAtSide(facing); - if (cover != null && cover.isTickable()) { - cover.update(); + if (cover instanceof ITickable tickable) { + tickable.update(); } } } diff --git a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java index 18caa16ea19..6be552bfc95 100644 --- a/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java +++ b/src/main/java/gregtech/api/pipenet/tile/PipeCoverableImplementation.java @@ -12,6 +12,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -48,7 +49,7 @@ public void transferDataTo(PipeCoverableImplementation destImpl) { @Override public final void addCover(@NotNull EnumFacing side, @NotNull Cover cover) { - if (cover.isTickable() && !holder.supportsTicking()) { + if (cover instanceof ITickable && !holder.supportsTicking()) { IPipeTile newHolderTile = holder.setSupportsTicking(); newHolderTile.getCoverableImplementation().addCover(side, cover); holder = newHolderTile; From a819bd5380730ddf2ad0702ef86549cb5ca0fad5 Mon Sep 17 00:00:00 2001 From: marisathewitch Date: Tue, 28 Nov 2023 06:19:19 +0400 Subject: [PATCH 26/77] Update ru_ru lang for 2.8.0 (#2208) Co-authored-by: Weblate Co-authored-by: Western01 --- .../resources/assets/gregtech/lang/ru_ru.lang | 514 ++++++++++++++++-- 1 file changed, 467 insertions(+), 47 deletions(-) diff --git a/src/main/resources/assets/gregtech/lang/ru_ru.lang b/src/main/resources/assets/gregtech/lang/ru_ru.lang index cc6e64bfaaa..349a33f2169 100644 --- a/src/main/resources/assets/gregtech/lang/ru_ru.lang +++ b/src/main/resources/assets/gregtech/lang/ru_ru.lang @@ -95,7 +95,7 @@ gregtech.multiblock.primitive_blast_furnace.bronze.description=Примитив gregtech.multiblock.coke_oven.description=Коксовая печь - это многоблочная структура, используемая для получения кокосового угля и креозота на ранней стадии игры. Не требует топлива и имеет внутренний бак на 32 ведра креозота. Доступ к инвентарю можно получить через Люк коксовой печи. gregtech.multiblock.vacuum_freezer.description=Вакуумный морозильник - это многоблочная структура, в основном используемая для охлаждения горячих слитков в обычные слитки. Тем не менее, он также может охлаждать другие вещества, к примеру воду. gregtech.multiblock.implosion_compressor.description=Детонационный компрессор - это многоблочная структура, в которой используются взрывчатые вещества для превращения пыли в соответствующие камни. -gregtech.multiblock.pyrolyse_oven.description=Пиролизная печь - это многоблочная структура, используемая для пиролиза древесины в древесный уголь и креозот, либо в пепел и тяжелую нефть. +gregtech.multiblock.pyrolyse_oven.description=Пиролизная печь - это многоблочная структура, используемая для пиролиза древесины в древесный уголь и креозот, либо в золу и тяжелую нефть. gregtech.multiblock.cracker.description=Крекинговая установка - это многоблочная структура, используемая для высокотемпературной переработки нефти и её фракций с целью получения продуктов меньшей молекулярной массы. gregtech.multiblock.large_combustion_engine.description=Большой дизельный генератор - представляет собой многоблочную структуру, которая действует как дизельный генератор, но EV напряжения. gregtech.multiblock.extreme_combustion_engine.description=Улучшенный дизельный генератор - представляет собой многоблочную структуру, которая действует как дизельный генератор, но IV напряжения. @@ -108,7 +108,6 @@ gregtech.multiblock.assembly_line.description=Сборочная линия пр gregtech.multiblock.fusion_reactor.luv.description=Термоядерный реактор модель 1 - это большая многоблочная структура использующаяся для термоядерного синтеза двух элементов в один. Может использовать LuV+ энергетические разъемы. За каждый энергетический разъём, внутренний буфер увеличивается на 10млн. EU, максимум энергии для старта 160млн. EU. gregtech.multiblock.fusion_reactor.zpm.description=Термоядерный реактор модель 2 - это большая многоблочная структура использующаяся для термоядерного синтеза двух элементов в один. Может использовать ZPM+ энергетические разъемы. За каждый энергетический разъём, внутренний буфер увеличивается на 20млн. EU, максимум энергии для старта 320млн. EU. gregtech.multiblock.fusion_reactor.uv.description=Термоядерный реактор модель 3 - это большая многоблочная структура использующаяся для термоядерного синтеза двух элементов в один. Может использовать UV+ энергетические разъемы. За каждый энергетический разъём, внутренний буфер увеличивается на 40млн. EU, максимум энергии для старта 640млн. EU. -gregtech.multiblock.fusion_reactor.energy=EU: %d / %d gregtech.multiblock.fusion_reactor.heat=Нагрев: %d gregtech.multiblock.large_chemical_reactor.description=Многоблочная версия химического реактора выполняющий операции в больших объёмах с удвоенной эффективностью. Ускорение умножает скорость и энергию на 4. Для мультиблочной структуры требуется ровно 1 блок купроникелевой катушки, который должен быть размещен рядом с корпусом ПТФЭ трубы, расположенным в центре. gregtech.multiblock.primitive_water_pump.description=Примитивная водяная помпа — это многоблочная структура до Паровой Эпохи, который собирает воду раз в секунду, в зависимости от биома, в котором он находится. Он может использовать насос, выходной люк ULV или LV, увеличивая количество воды от уровня. Выполняется по формуле: Коэффициент биома * Множитель люка. @@ -746,7 +745,7 @@ metaitem.item_filter.tooltip=Фильтрует §fПредметы§7 как § metaitem.ore_dictionary_filter.name=Предметный фильтр (Словарь руд) metaitem.ore_dictionary_filter.tooltip=Фильтрует §fПредметы§7 по §fСловарю руд§7 как §fУлучшение механизма§7./nМожет использоваться как улучшение §fКонвейера§7 и §fРобот. манипулятора§7. metaitem.fluid_filter.name=Жидкостный фильтр -metaitem.fluid_filter.tooltip=Фильтрует §fЖидкость§7 как §fУлучшение механизма§7./nМожет использоваться как улучшение §fНасоса§7 и §fРегулятора§7. +metaitem.fluid_filter.tooltip=Фильтрует §fЖидкость§7 как §fУлучшение механизма§7./nМожет использоваться как улучшение §fПомпы§7 и §fРегулятора§7. metaitem.smart_item_filter.name=Умный предметный фильтр metaitem.smart_item_filter.tooltip=Фильтрует §fПредметы§7 на основе §fРецептов машин§7 как §fУлучшение механизма§7./nМожет использоваться как улучшение §fКонвейера§7 и §fРобот. манипулятора§7. metaitem.cover.controller.name=Контроллер механизма (Улучшение) @@ -1093,8 +1092,8 @@ cover.item.voiding.advanced.title=Улучшенные настройки уда cover.voiding.label.disabled=Отключено cover.voiding.label.enabled=Включено cover.voiding.tooltip=§cВНИМАНИЕ!!!§7 Установка данного параметра в значение "Включено" означает, что жидкости или предметы будут удалены. -cover.voiding.message.disabled=Удаление Отключено -cover.voiding.message.enabled=Удаление Включено +cover.voiding.message.disabled=Удаление отключено +cover.voiding.message.enabled=Удаление включено cover.smart_item_filter.title=Умный предметный фильтр cover.smart_item_filter.filtering_mode.electrolyzer=Электролизер cover.smart_item_filter.filtering_mode.centrifuge=Центрифуга @@ -1133,7 +1132,7 @@ cover.fluid_regulator.supply_exact=Подавать: %s cover.fluid_regulator.keep_exact=Хранить: %s cover.machine_controller.title=Настройки контроллера механизма cover.machine_controller.normal=Нормально -cover.machine_controller.inverted=Инвертировано +cover.machine_controller.inverted=Инверт. cover.machine_controller.inverted.description=§eНормально§r — в этом режиме для работы улучшения требуется сигнал слабее установленного уровня редстоуна/n§eИнвертировано§r — в этом режиме для работы улучшения требуется сигнал сильнее установленного уровня редстоуна cover.machine_controller.redstone=Минимальный Редстоун сигнал: %d cover.machine_controller.mode.machine=Контролирует работу механизма @@ -1153,7 +1152,6 @@ cover.advanced_energy_detector.label=Улучшенный детектор эн cover.advanced_energy_detector.min=Минимум: cover.advanced_energy_detector.max=Максимум: cover.advanced_energy_detector.invert_tooltip=Переключите, чтобы инвертировать логику красного камня./nПо умолчанию красный камень испускает сигнал,/nкогда значение меньше минимального EU, и прекращает испускать сигнал, когда больше максимального EU -cover.advanced_energy_detector.invert_label=Направление: cover.advanced_energy_detector.normal=Обычный cover.advanced_energy_detector.inverted=Инвертировано cover.advanced_energy_detector.modes_tooltip=Переключение между использованием цифровых значений EU или процентов для сравнения мин./макс. с подключенным накопителем энергии. @@ -1161,13 +1159,12 @@ cover.advanced_energy_detector.modes_label=Режим: cover.advanced_energy_detector.mode_eu=Цифровое cover.advanced_energy_detector.mode_percent=Процент cover.advanced_fluid_detector.label=Улучшенный детектор жидкости -cover.advanced_fluid_detector.invert_tooltip=Переключите, чтобы инвертировать логику красного камня/nПо умолчанию красный камень перестает испускать сигнал, когда меньше минимального L жидкости, и начинает излучать, когда больше минимального L жидкости до установленного максимума -cover.advanced_fluid_detector.max=Максимум жид.: -cover.advanced_fluid_detector.min=Минимум жид.: +cover.advanced_fluid_detector.max=Макс. жидкости: +cover.advanced_fluid_detector.min=Мин. жидкости: cover.advanced_item_detector.label=Улучшенный детектор предметов cover.advanced_item_detector.invert_tooltip=Переключите, чтобы инвертировать логику красного камня./nПо умолчанию красный камень перестает испускать сигнал, когда количество предметов меньше минимального, и начинает испускать сигнал, при превышении минимального количества предметов до установленного максимума -cover.advanced_item_detector.max=Максимум предметов: -cover.advanced_item_detector.min=Минимум предметов: +cover.advanced_item_detector.max=Макс. предметов: +cover.advanced_item_detector.min=Мин. предметов: cover.storage.title=Хранилище (Улучшение) # %s это локализованное название материала @@ -1437,7 +1434,7 @@ gregtech.material.coal=Уголь gregtech.material.cobaltite=Кобальтит gregtech.material.cooperite=Шелдонит gregtech.material.cupronickel=Купроникель -gregtech.material.dark_ash=Темный пепел +gregtech.material.dark_ash=Пепел gregtech.material.diamond=Алмаз gregtech.material.electrum=Электрум gregtech.material.emerald=Изумруд @@ -1525,7 +1522,7 @@ gregtech.material.quicklime=Негашеная известь gregtech.material.sodium_bisulfate=Бисульфат натрия gregtech.material.ferrite_mixture=Ферритовая смесь gregtech.material.magnesia=Магнезия -gregtech.material.platinum_group_sludge=Осадок платиновой группы +gregtech.material.platinum_group_sludge=Шлам платиновой группы gregtech.material.realgar=Реальгар gregtech.material.sodium_bicarbonate=Натрия бикарбонат gregtech.material.potassium_dichromate=Дихромат калия @@ -1730,16 +1727,16 @@ gregtech.material.lightly_steamcracked_light_fuel=Легкое топливо п gregtech.material.severely_steamcracked_light_fuel=Легкое топливо прошедшее жесткий крекинг паром gregtech.material.sulfuric_naphtha=Серная нафта gregtech.material.naphtha=Нафта -gregtech.material.lightly_hydrocracked_naphtha=Нафта прошедшее легкий крекинг водородом -gregtech.material.severely_hydrocracked_naphtha=Нафта прошедшее тяжелый крекинг водородом -gregtech.material.lightly_steamcracked_naphtha=Нафта прошедшее легкий крекинг паром -gregtech.material.severely_steamcracked_naphtha=Нафта прошедшее жесткий крекинг паром +gregtech.material.lightly_hydrocracked_naphtha=Нафта прошедшая легкий крекинг водородом +gregtech.material.severely_hydrocracked_naphtha=Нафта прошедшая тяжелый крекинг водородом +gregtech.material.lightly_steamcracked_naphtha=Нафта прошедшая легкий крекинг паром +gregtech.material.severely_steamcracked_naphtha=Нафта прошедшая жесткий крекинг паром gregtech.material.sulfuric_gas=Серный газ gregtech.material.refinery_gas=Нефтяной газ -gregtech.material.lightly_hydrocracked_gas=Нефтяной газ легкого гидрокрекинга -gregtech.material.severely_hydrocracked_gas=Нефтяной газ прошедшее тяжелый крекинг водородом -gregtech.material.lightly_steamcracked_gas=Нефтяной газ легкого парового крекинга -gregtech.material.severely_steamcracked_gas=Нефтяной газ прошедшее жесткий крекинг паром +gregtech.material.lightly_hydrocracked_gas=Нефтяной газ прошедший легкий крекинг водородом +gregtech.material.severely_hydrocracked_gas=Нефтяной газ прошедший тяжелый крекинг водородом +gregtech.material.lightly_steamcracked_gas=Нефтяной газ прошедший легкий крекинг паром +gregtech.material.severely_steamcracked_gas=Нефтяной газ прошедший жесткий крекинг паром gregtech.material.hydrocracked_ethane=Этан прошедший крекинг водородом gregtech.material.hydrocracked_ethylene=Этилен прошедший крекинг водородом gregtech.material.hydrocracked_propene=Пропен прошедший крекинг водородом @@ -1844,7 +1841,7 @@ gregtech.material.vanadium_magnetite=Ванадий магнетит gregtech.material.quartz_sand=Кварцевый песок gregtech.material.pollucite=Поллуцит gregtech.material.bentonite=Бентонит -gregtech.material.fullers_earth=Странная земля +gregtech.material.fullers_earth=Смектическая глина gregtech.material.pitchblende=Уранит gregtech.material.monazite=Монацит gregtech.material.mirabilite=Мирабилит @@ -1930,9 +1927,9 @@ item.gregtech.material.paper.dust=Целюлоза item.gregtech.material.rare_earth.dustTiny=Крошечная кучка редкой земли item.gregtech.material.rare_earth.dustSmall=Маленькая кучка редкой земли item.gregtech.material.rare_earth.dust=Редкая земля -item.gregtech.material.ash.dustTiny=Крошечная кучка пепла -item.gregtech.material.ash.dustSmall=Маленькая кучка пепла -item.gregtech.material.ash.dust=Пепел +item.gregtech.material.ash.dustTiny=Крошечная кучка золы +item.gregtech.material.ash.dustSmall=Маленькая кучка золы +item.gregtech.material.ash.dust=Зола item.gregtech.material.bone.dustTiny=Крошечная кучка костной муки item.gregtech.material.bone.dustSmall=Маленькая кучка костной муки item.gregtech.material.bone.dust=Костная пыль @@ -1944,9 +1941,9 @@ item.gregtech.material.cassiterite_sand.dustSmall=Маленькая кучка item.gregtech.material.cassiterite_sand.dustImpure=Грязная кучка касситеритного песка item.gregtech.material.cassiterite_sand.dustPure=Очищеная кучка касситеритного песка item.gregtech.material.cassiterite_sand.dust=Касситеритовый песок -item.gregtech.material.dark_ash.dustTiny=Крошечная кучка темного пепла +item.gregtech.material.dark_ash.dustTiny=Крошечная кучка пепла item.gregtech.material.dark_ash.dustSmall=Маленькая кучка темного пепла -item.gregtech.material.dark_ash.dust=Темный пепел +item.gregtech.material.dark_ash.dust=Пепел item.gregtech.material.ice.dustTiny=Крошечная кучка колотого льда item.gregtech.material.ice.dustSmall=Маленькая кучка колотого льда item.gregtech.material.ice.dust=Колотый лёд @@ -1991,10 +1988,10 @@ item.gregtech.material.basaltic_mineral_sand.dustSmall=Маленькая куч item.gregtech.material.basaltic_mineral_sand.dust=Базальтовый минеральный песок item.gregtech.material.granitic_mineral_sand.dustTiny=Крошечная кучка гранитного минерального песка item.gregtech.material.granitic_mineral_sand.dustSmall=Маленькая кучка гранитного минерального песка -item.gregtech.material.granitic_mineral_sand.dust=Гранитовый минеральный песок -item.gregtech.material.garnet_sand.dustTiny=Крошечная кучка гранитного песка -item.gregtech.material.garnet_sand.dustSmall=Маленькая кучка гранитного песка -item.gregtech.material.garnet_sand.dust=Гранитновый песок +item.gregtech.material.granitic_mineral_sand.dust=Гранитный минеральный песок +item.gregtech.material.garnet_sand.dustTiny=Крошечная кучка гранатового песка +item.gregtech.material.garnet_sand.dustSmall=Маленькая кучка гранатового песка +item.gregtech.material.garnet_sand.dust=Гранатовый песок item.gregtech.material.quartz_sand.dustTiny=Крошечная кучка кварцевого песка item.gregtech.material.quartz_sand.dustSmall=Маленькая кучка кварцевого песка item.gregtech.material.quartz_sand.dust=Кварцевый песок @@ -2047,7 +2044,7 @@ item.gregtech.material.palladium_raw.dustTiny=Крошечная кучка не item.gregtech.material.palladium_raw.dust=Необработанный порошок палладия item.gregtech.material.inert_metal_mixture.dustSmall=Маленькая кучка инертной смеси металлов item.gregtech.material.inert_metal_mixture.dustTiny=Крошечная кучка инертной смеси металлов -item.gregtech.material.inert_metal_mixture.dust=Инертная смесь металлов +item.gregtech.material.inert_metal_mixture.dust=Смесь инертных металлов item.gregtech.material.rarest_metal_mixture.dustSmall=Маленькая кучка cмеси редких металлов item.gregtech.material.rarest_metal_mixture.dustTiny=Крошечная кучка cмеси редких металлов item.gregtech.material.rarest_metal_mixture.dust=Смесь редких металлов @@ -2254,7 +2251,6 @@ tile.wire_coil.tooltip_energy_cracking=§aЭнергопотребление: § tile.wire_coil.cupronickel.name=Купроникелевая катушка tile.wire_coil.kanthal.name=Канталовая катушка tile.wire_coil.nichrome.name=Нихромовая катушка -tile.wire_coil.tungstensteel.name=Вольфрамостальная катушка tile.wire_coil.hss_g.name=Катушка из HSS-G стали tile.wire_coil.naquadah.name=Катушка из наквада tile.wire_coil.trinium.name=Триниумная катушка @@ -4090,12 +4086,7 @@ gregtech.machine.world_accelerator.iv.name=Превосходный ускори gregtech.machine.world_accelerator.luv.name=Превосходный ускоритель мира II gregtech.machine.world_accelerator.zpm.name=Превосходный ускоритель мира III gregtech.machine.world_accelerator.uv.name=Безупречный ускоритель мира -gregtech.machine.world_accelerator.uev.name=Идеальный ускоритель мира II -gregtech.machine.world_accelerator.uhv.name=Идеальный ускоритель мира -gregtech.machine.world_accelerator.uiv.name=Идеальный ускоритель мира III -gregtech.machine.world_accelerator.uxv.name=Идеальный ускоритель мира IV -gregtech.machine.world_accelerator.opv.name=Совершенный ускоритель мира -gregtech.machine.world_accelerator.description=Увеличивает скорость ближайших механизмов. Имеет 2 режима: §fTE§7 и §fRT§7. Используйте отвертку для смены режима. +gregtech.machine.world_accelerator.description=Используйте §fОтвертку§7 чтобы переключить между §fTile Entity (ТЕ)§7 и §fСлучайный тик(RT)§7 режимами. gregtech.machine.world_accelerator.working_area=§bРабочая область: gregtech.machine.world_accelerator.working_area_random=RT Режим:§f %dx%d gregtech.machine.world_accelerator.working_area_tile=ТЕ Режим:§f Присоединённые блоки @@ -4289,8 +4280,6 @@ gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.name=Пластина Qbit gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.desc=Создайте пластину Qbit процессора. gregtech.advancement.insane_voltage.56_quantum_processor.name=Квантовый процессор gregtech.advancement.insane_voltage.56_quantum_processor.desc=Сделайте квантовый процессор. -gregtech.advancement.insane_voltage.57_tungstensteel_coil.name=Улучшите ваши катушки до уровня IV -gregtech.advancement.insane_voltage.57_tungstensteel_coil.desc=Создайте вольфрамостальную катушку. gregtech.advancement.insane_voltage.58_hss_g_coil.name=Улучшите ваши катушки до уровня V gregtech.advancement.insane_voltage.58_hss_g_coil.desc=Создайте катушку из HSS-G стали. gregtech.advancement.root_luv.name=Чудовищное напряжение @@ -4457,7 +4446,6 @@ gregtech.machine.cleanroom.tooltip.ae2.channels=Отправляйте до §f8 gregtech.machine.cleanroom.tooltip.ae2.no_channels=Отправляйте §aAE2 сеть§7 через §fКорпуса§7 в стенах. gregtech.multiblock.cleanroom.dirty_state=Статус: §4ЗАГРЯЗНЕНА gregtech.multiblock.cleanroom.clean_state=Статус: §aЧИСТАЯ -gregtech.multiblock.cleanroom.clean_amount=Очищена: §a%s%% gregtech.machine.charcoal_pile.name=Воспламенитель угольной ямы gregtech.machine.charcoal_pile.tooltip.1=§cПережигает§7 древесину в §aДревеный уголь§7. gregtech.machine.charcoal_pile.tooltip.2=Щелкните правой кнопкой мыши предметом, зажигающим огонь, чтобы начать. @@ -4985,7 +4973,6 @@ gregtech.multiblock.pattern.single=§6Только этот блок может gregtech.multiblock.pattern.location_end=§cСамый конец§r gregtech.multiblock.pattern.replaceable_air=Заменяется воздухом gregtech.multiblock.blast_furnace.max_temperature=Максимальная температура: %s -gregtech.multiblock.multi_furnace.heating_coil_level=Уровень нагревательной катушки: %s gregtech.multiblock.multi_furnace.heating_coil_discount=EU усиление нагревательной катушки: %sx gregtech.multiblock.distillation_tower.distilling_fluid=Дистилляция %s gregtech.multiblock.large_combustion_engine.no_lubricant=Нет Смазки. @@ -4994,7 +4981,6 @@ gregtech.multiblock.large_combustion_engine.oxygen_amount=Количество gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount=Количество жидкого кислорода: %smB gregtech.multiblock.large_combustion_engine.oxygen_boosted=§bКислород добавлен. gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted=§bЖидкий кислород добавлен. -gregtech.multiblock.large_combustion_engine.boost_disallowed=§bУлучшите энергетический выходной разъем чтобы ускорить кислородом. gregtech.multiblock.large_combustion_engine.supply_oxygen_to_boost=Принимает кислород для ускорения. gregtech.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost=Принимает жидкий кислород для ускорения. gregtech.multiblock.large_combustion_engine.obstructed=Что-то мешает воздухозаборнику двигателя. @@ -5055,8 +5041,6 @@ gregtech.multiblock.power_substation.time_forever=Вечно gregtech.multiblock.power_substation.under_one_hour_left=Менее 1 часа до полного опустошения! gregtech.multiblock.hpca.computation=Производит: %s / %s CWU/t gregtech.multiblock.hpca.energy=Используется: %s / %s EU/t (%s) -gregtech.multiblock.hpca.coolant=Требуется до: %s Л/t PCB Хладагента -gregtech.multiblock.hpca.cooling=Охлаждение: gregtech.multiblock.hpca.temperature=Температура: gregtech.multiblock.hpca.error_temperature=Температура выше 100С, возможно повреждение компонентов! gregtech.multiblock.hpca.error_damaged=Повреждённый компонент в структуре @@ -5486,3 +5470,439 @@ gregtech.machine.laser_hatch.tooltip2=§cЛазерные кабели долж gregtech.recipe.max_eu=Maкс. EU: %,d EU gregtech.tool_action.wrench.connect_and_block=§8Используйте гаечный ключ, чтобы настроить соединения, "SHIFT" чтобы заблокировать передачу gregtech.command.recipecheck.end_empty_inputs=Проверка рецептов обнаружила %d рецепт(а, ов) с пустыми входами и %d с пустыми Словарями Руд. Проверьте Логи сервера для получения дополнительной информации +gregtech.top.steam_heating_up=Нагрев +gregtech.top.steam_no_water=Нет воды +metaitem.minecart_wheels.iron.name=Железные колеса вагонетки +metaitem.minecart_wheels.iron.tooltip=Чтобы все пошло своим чередом +metaitem.minecart_wheels.steel.name=Стальные колеса вагонетки +metaitem.minecart_wheels.steel.tooltip=Чтобы все пошло своим чередом +metaitem.basic_tape.tooltip=Недостаточно крепкая для решения механических проблем +metaitem.basic_tape.name=Лента +cover.shutter.message.enabled=Затвор включен +cover.shutter.message.disabled=Затвор отключен +cover.generic.advanced_detector.invert_tooltip=Переключите, чтобы инвертировать логику красного камня +cover.ore_dictionary_filter.preview.match.not=не '%s' +cover.ore_dictionary_filter.preview.char=1 символ +cover.ore_dictionary_filter.preview.char.not=либо больше 1 символа, либо ничего +cover.ore_dictionary_filter.preview.match='%s' + +# Scoop +item.gt.tool.scoop.name=Сачок (%s) +metaitem.electrode.tin.name=Оловянный электрод +cover.ore_dictionary_filter.preview.chars.not=либо больше , либо меньше %s символов +cover.ore_dictionary_filter.preview.next=... следующий после +cover.ore_dictionary_filter.preview.chars=%s символа(ов) +cover.ore_dictionary_filter.preview.group=не: +cover.ore_dictionary_filter.preview.or=один из... +cover.ore_dictionary_filter.preview.nor=все , что не является одним из них ... +cover.ore_dictionary_filter.preview.or.entry= +cover.ore_dictionary_filter.preview.or.entry.start= +cover.ore_dictionary_filter.preview.and=все, что... +cover.ore_dictionary_filter.preview.nand=все, чтоне... +cover.ore_dictionary_filter.preview.and.entry= +cover.ore_dictionary_filter.preview.and.entry.start= +cover.ore_dictionary_filter.preview.xor=только один из... +cover.ore_dictionary_filter.preview.xnor=либо все, либо ни один из них... +cover.ore_dictionary_filter.preview.xor.entry= +cover.ore_dictionary_filter.preview.everything=что угодно +cover.ore_dictionary_filter.preview.impossible=(невозможно сопоставить) +cover.ore_dictionary_filter.preview.nonempty=что-нибудь +cover.ore_dictionary_filter.preview.empty=ничего +cover.ore_dictionary_filter.preview.error=ОШИБКА! +cover.ore_dictionary_filter.compile.eof=** Конец строчки ** +cover.ore_dictionary_filter.compile.error.unexpected_eof=Неожиданный конец выражения +cover.ore_dictionary_filter.compile.error.unexpected_token=Неожиданный токен '%s' +cover.ore_dictionary_filter.compile.error.unexpected_token_after_eof=Неожиданный токен '%s' в конце выражения +cover.ore_dictionary_filter.compile.error.empty_compilation_flag=Флаги компиляции не заданы +cover.ore_dictionary_filter.preview.chars_or_more=%s или более символов +cover.ore_dictionary_filter.preview.chars_or_more.not=меньше чем%s символов +cover.ore_dictionary_filter.compile.error.unknown_compilation_flag=Неизвестный флаг компиляции '%s' +cover.ore_dictionary_filter.compile.error.redundant_compilation_flag=Флаг компиляции '%s' записан дважды +cover.ore_dictionary_filter.compile.error.eof_after_escape=Конец файла после escape-символа ('') +cover.ore_dictionary_filter.compile.error.invalid_char=Недопустимый символ U+%s('%s') +cover.ore_dictionary_filter.compile.warn.nested_negation=Вложенные отрицания могут быть неинтуитивными. Рассмотрите возможность использования групп ( () ) для устранения двусмысленности. +cover.ore_dictionary_filter.compile.warn.consecutive_negation=Последовательные отрицания могут быть не интуитивными. Пожалуйста, проверьте, ожидаемый ли результат оценки. +cover.generic.advanced_detector.continuous=Непрерывный +cover.generic.advanced_detector.latched=Замкнутый +cover.ore_dictionary_filter.compile.error.unexpected_compilation_flag=Флаги компиляции в середине выражения +cover.generic.advanced_detector.invert_label=Вывод редстоуна: +cover.generic.advanced_detector.latch_tooltip=Измените поведение редстоуна этого Улучшения. /n§eНепрерывный§7 - По умолчанию; Значения меньше мин. выхода равны 0; Значения больше макс. выхода равны 15; Значения между мин. и макс. выходом от 0 до 15 /n§eЗамкнутый§7 - Выводит 15 пока выше макс., затем выводит 0 до тех пор, пока не станет ниже мин. + +# Decorative Metal Sheets +tile.metal_sheet.white.name=Белый лист металла +tile.metal_sheet.orange.name=Оранжевый лист металла +tile.metal_sheet.magenta.name=Пурпурный лист металла +tile.metal_sheet.light_blue.name=Голубой лист металла +tile.metal_sheet.yellow.name=Желтый лист металла +tile.metal_sheet.lime.name=Лаймовый лист металла +tile.metal_sheet.pink.name=Розовый лист металла +tile.metal_sheet.gray.name=Серый лист металла +tile.metal_sheet.silver.name=Светло-серый лист металла +tile.metal_sheet.cyan.name=Бирюзовый лист металла +tile.metal_sheet.purple.name=Фиолетовый лист металла +tile.metal_sheet.blue.name=Синий лист металла +tile.metal_sheet.brown.name=Коричневый лист металла +tile.studs.blue.name=Синяя перегородка +tile.studs.brown.name=Коричневая перегородка +tile.studs.green.name=Зеленая перегородка +tile.studs.red.name=Красная перегородка +tile.studs.black.name=Черная перегородка +tile.large_metal_sheet.red.name=Крупный красный лист металла +tile.large_metal_sheet.black.name=Крупный черный лист металла +tile.studs.white.name=Белая перегородка +tile.studs.orange.name=Оранжевая перегородка +tile.studs.magenta.name=Пурпурная перегородка +tile.studs.light_blue.name=Голубая перегородка +tile.studs.yellow.name=Желтая перегородка +tile.studs.lime.name=Лаймовая перегородка +tile.studs.pink.name=Розовая перегородка +tile.studs.gray.name=Серая перегородка +tile.studs.silver.name=Светло-серая перегородка +tile.studs.cyan.name=Бирюзовая перегородка +tile.studs.purple.name=Фиолетовая перегородка +gregtech.scanner.copy_stick_from=§oСкопировать Флешку +gregtech.scanner.copy_stick_to=§oСкопирова в Флешку +gregtech.scanner.copy_stick_empty=§oПустая флешка +gregtech.material.rtm_alloy=РВМ Сплав +tile.metal_sheet.red.name=Красный лист металла +tile.large_metal_sheet.white.name=Крупный белый лист металла +tile.large_metal_sheet.orange.name=Крупный оранжевый лист металла +tile.large_metal_sheet.light_blue.name=Крупный голубой лист металла +tile.large_metal_sheet.yellow.name=Крупный желтый лист металла +tile.large_metal_sheet.lime.name=Крупный лаймовый лист металла +tile.large_metal_sheet.silver.name=Крупный светло-серый лист металла +tile.large_metal_sheet.cyan.name=Крупный бирюзовый лист металла +tile.large_metal_sheet.blue.name=Крупный синий лист металла +tile.large_metal_sheet.brown.name=Крупный коричневый лист металла +tile.large_metal_sheet.green.name=Крупный зеленый лист металла +gregtech.machine.alarm.name=Тревога +gregtech.machine.world_accelerator.mv.tooltip=Тик ускоряет блоки +gregtech.machine.world_accelerator.ev.tooltip=Тик ускоряет блоки +gregtech.machine.world_accelerator.iv.tooltip=Время в §mБутылке§r§7 Блоке +gregtech.machine.world_accelerator.luv.tooltip=Время в §mБутылке§r§7 Блоке +gregtech.machine.world_accelerator.zpm.tooltip=Время в §mБутылке§r§7 Блоке +gregtech.machine.world_accelerator.uv.tooltip=Временная аномалия +tile.wire_coil.rtm_alloy.name=Катушка из РВМ Сплава +tile.metal_sheet.green.name=Зеленый лист металла +tile.metal_sheet.black.name=Черный лист металла +tile.large_metal_sheet.magenta.name=Крупный пурпурный лист металла +tile.large_metal_sheet.pink.name=Крупный розовый лист металла +tile.large_metal_sheet.gray.name=Крупный серый лист металла +tile.large_metal_sheet.purple.name=Крупный фиолетовый лист металла +gregtech.crate.tooltip.taped_movement=Можно заклеить скотчем, чтобы сохранить содержимое инвентаря в случае поломки. +gregtech.machine.alarm.tooltip=Воспроизводит звук при получении сигнала Редстоуна +gregtech.machine.world_accelerator.lv.tooltip=Тик ускоряет блоки +gregtech.machine.world_accelerator.hv.tooltip=Тик ускоряет блоки +gregtech.advancement.steam.91_primitive_blast_furnace.name=Почти до стали! +gregtech.advancement.steam.91_primitive_blast_furnace.desc=Создайте Примитивную доменную печь +cover.generic.advanced_detector.latch_label=Поведение: +gregtech.veins.ore.basalt_sphere=Базальтовая залежь +gregtech.multiblock.fluid_rig.drilled_fluid=Жидкость: %s +for.bees.species.coal=Угольная +gregtech.machine.fluid_drilling_rig.shows_depletion=Показывает информацию об истощении жидкостного месторождения +gregtech.multiblock.cleanroom.warning_contaminated=ЗАГРЯЗНЕНА! +gregtech.machine.machine_hatch.machines=Механизм: %s +gregtech.machine.machine_hatch.machines_none=Нет +gregtech.machine.machine_hatch.machines_none_hover=Поместите механизм в Интерфейс доступа к машине для запуска. +gregtech.machine.machine_hatch.machines_max=Макс. механизмов: %s +gregtech.machine.machine_hatch.machines_max_eut=Потребление EU/т: %s (%sА %s) +gregtech.machine.reservoir_hatch.name=Люк резервуара +gregtech.machine.reservoir_hatch.tooltip=Не раковина +gregtech.recipe.scan_for_research=Сканирование для Сборочной линии +gregtech.tool_action.wrench.extended_facing=§8Используйте Гаечный ключ, чтобы настроить направление и поворот Механизма +gregtech.fluid.liquid_generic=%s (Жидкость) +gregtech.fluid.gas_generic=%s (Газ) +gregtech.fluid.gas_vapor=Пар (%s) +gregtech.gui.item_voiding.tooltip.enabled=Удаление излишков Включено +gregtech.gui.item_voiding.tooltip.disabled=Удаление излишков Выключено +gregtech.gui.alarm.radius=Радиус: +gregtech.jei.ore.spawn_range=Радиус появления: %d - %d +gregtech.jei.ore.vein_weight=Объем жилы: %d +gregtech.jei.ore.dimension=Измерения: +gregtech.jei.ore.surfacematerial=Материал на поверхности +gregtech.veins.ore.bauxite=Бокситовая жила +gregtech.veins.ore.magnetite=Магнетитовая жила +gregtech.veins.ore.naquadah=Наквадная жила +gregtech.veins.ore.pitchblende=Уранитовая жила +gregtech.veins.ore.scheelite=Шеелитовая жила +gregtech.veins.ore.sheldonite=Шелдонитовая жила +gregtech.veins.ore.banded_iron=Полосчатого железа жила +gregtech.veins.ore.beryllium=Бериллиевая жила +gregtech.veins.ore.certus_quartz=Жила истинного кварца +gregtech.veins.ore.manganese=Марганецевая жила +gregtech.veins.ore.molybdenum=Молибденовая жила +gregtech.veins.ore.monazite=Монацитовая жила +gregtech.veins.ore.nether_quartz=Жила адского кварца +gregtech.veins.ore.redstone=Редстоуновая жила +gregtech.veins.fluid.natural_gas_overworld=Залежь природного газа +gregtech.veins.fluid.oil=Залежь нефть +gregtech.veins.fluid.raw_oil=Залежь сырой нефти +gregtech.veins.fluid.salt_water=Залежь соленой воды +gregtech.multiblock.max_energy_per_tick_amps=Макс EU/т: %s (%sA %s) +gregtech.multiblock.universal.muffler_obstructed_desc=Перед Люком глушителя должно быть пустое место. +gregtech.multiblock.large_combustion_engine.obstructed.desc=Перед воздухозаборниками двигателя должно быть пустое место. +gregtech.multiblock.turbine.rotor_rpm_unit_name=Об/Мин +gregtech.multiblock.turbine.obstructed.desc=Перед турбиной должно быть пустое место 3х3. +gregtech.multiblock.large_boiler.water_bar_hover=Вода: %s +gregtech.multiblock.large_boiler.no_water=НЕТ ВОДЫ! +gregtech.multiblock.pyrolyse_oven.speed_hover=Скорость обработки задается уровнем катушек в структуре. +gregtech.multiblock.cracking_unit.energy_hover=Энергопотребление задается уровнем катушек в структуре. +gregtech.multiblock.data_bank.providing=Передача данных. +gregtech.multiblock.hpca.hover_for_info=Наведите для подробностей +metaitem.electrode.bronze.name=Бронзовый электрод +metaitem.electrode.emerald.name=Изумрудный электрод +metaitem.electrode.ender.name=Эндер электрод +metaitem.electrode.gold.name=Золотой электрод +metaitem.electrode.iron.name=Железный электрод + +### Forestry Integration +# Frames +item.gt.frame_working.name=Рабочая рамка +item.gt.frame_mutagenic.name=Мутагенная рамка +item.gt.frame_accelerated.name=Ускоренная рамка +item.gt.frame_stabilizing.name=Стабильная рамка +item.gt.frame_arborist.name=Рамка арбориста +item.gt.frame_decaying.name=Разлагающаяся рамка +item.gt.frame_slowing.name=Замедляющая рамка + +# Electrodes +metaitem.electrode.apatite.name=Апатитовый электрод +metaitem.electrode.blaze.name=Ифритовый электрод +metaitem.electrode.lapis.name=Лазуритовый электрод +metaitem.electrode.obsidian.name=Обсидиановый электрод +metaitem.electrode.orchid.name=Орхидейный электрод +metaitem.electrode.rubber.name=Прорезиненный электрод +item.gt.comb.gold.name=Золотые соты +item.gt.comb.sulfur.name=Серные соты +item.gt.comb.gallium.name=Галлиевые соты +for.bees.species.lapis=Лаписная +for.bees.species.certus=Истинно Кварцевая +for.bees.species.xenon=Ксеноновая +for.bees.species.oxygen=Кислородная +gregtech.machine.world_accelerator.power_usage=Использует до §f%dА§7 в RT Режиме, §f%dA§7 в ТЕ Режиме. +gregtech.machine.world_accelerator.acceleration=§dУскоряет до: §f%dx раз +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.desc=Создайте катушку из РВМ Сплава. +gregtech.multiblock.cleanroom.clean_status=Состояние: %s +gregtech.chance_logic.and=И +gregtech.chance_logic.xor=XOR +gregtech.chance_logic.none=НЕТ +gregtech.veins.ore.sulfur=Серная жила +gregtech.veins.ore.tetrahedrite=Тетрадеритовая жила +gregtech.veins.ore.topaz=Топазовая жила +gregtech.veins.ore.apatite=Аратитовая жила +gregtech.veins.ore.cassiterite=Касситеритовая жила +gregtech.veins.ore.coal=Угольная жила +gregtech.veins.ore.copper_tin=Медно-оловянная жила +gregtech.veins.ore.copper=Медная жила +gregtech.veins.ore.diamond=Алмазная жила +gregtech.veins.ore.galena=Галеновая жила +gregtech.veins.ore.garnet=Гранатовая жила +gregtech.veins.ore.iron=Железная жила +gregtech.veins.ore.lapis=Лазуритовая жила +gregtech.veins.ore.lubricant=Жила лубрикантов +gregtech.veins.ore.marble_sphere=Мраморная залежь +gregtech.veins.ore.mineral_sand=Жила минерального песка +gregtech.veins.ore.nickel=Никелевая жила +gregtech.veins.ore.oilsands=Жила нефтеносного песка +gregtech.veins.ore.olivine=Оливиновая жила +gregtech.veins.ore.red_granite_sphere=Залежь красного гранита +gregtech.veins.ore.salts=Солевая жила +gregtech.veins.ore.sapphire=Сапфировая жила +gregtech.veins.fluid.heavy_oil=Залежь тяжелой нефти +gregtech.veins.fluid.light_oil=Залежь легкой нефти +gregtech.veins.fluid.lava=Залежь лавы Нижнего мира +gregtech.multiblock.hpca.info_max_computation=Макс. CWU/т: %s +for.bees.species.osmium=Осмиевая +for.bees.species.salty=Солевая +for.bees.species.lithium=Литиевая +for.bees.species.electrotine=Электротиновая +for.bees.species.energy=Энергетическая +for.bees.species.lapotron=Лапотронная +gregtech.multiblock.max_energy_per_tick_hover=Макс. EU/t, возможный для запуска рецептов или ускорения +gregtech.multiblock.max_recipe_tier=Макс. уровень рецепта: %s +gregtech.multiblock.max_recipe_tier_hover=Макс. уровень рецепта возможный для старта +gregtech.multiblock.multi_furnace.parallel_hover=Кол-во параллелей Мультиплавильни задается уровнем катушки +gregtech.multiblock.large_combustion_engine.fuel_amount=Топливо: %s +gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed=Улучшите выходной разъем, чтобы включить Форсаж. +gregtech.multiblock.fluid_rig.no_fluid_in_area=Пусто. +gregtech.multiblock.fluid_rig.fluid_amount=Скорость добычи: %s +gregtech.multiblock.fluid_rig.vein_depletion=Размер: %s +gregtech.multiblock.fluid_rig.vein_depleted=Жила опустошена. +gregtech.multiblock.miner.drilling=Бурение. +gregtech.multiblock.hpca.info_max_cooling_demand=Потребность в хладогенте: %s +gregtech.multiblock.hpca.info_max_coolant_required=Хладогента требуется: %s +gregtech.multiblock.hpca.info_coolant_name=Хладоген (ПХД) +gregtech.multiblock.hpca.info_bridging_enabled=Мост Включен +gregtech.multiblock.hpca.info_bridging_disabled=Мост Выключен +gregtech.creative.energy.source=Источник +metaitem.electrode.diamond.name=Алмазный электрод +gt.tool.class.scoop=Сачок + +# Drops +item.gt.honey_drop.oil.name=Капля нефти +item.gt.honey_drop.biomass.name=Капля биомассы +item.gt.honey_drop.ethanol.name=Капля этанола +item.gt.honey_drop.mutagen.name=Капля мутагена + +# Combs +item.gt.comb.coal.name=Угольные соты +item.gt.comb.coke.name=Коксовые соты +item.gt.comb.stickyresin.name=Резиновые соты +item.gt.comb.oil.name=Нефтяные соты +item.gt.comb.ash.name=Пепельные соты +item.gt.comb.biomass.name=Соты биомассы +item.gt.comb.energy.name=Энергетические соты +item.gt.comb.lapotron.name=Лапотронные соты +item.gt.comb.stainlesssteel.name=Соты нержавеки +item.gt.comb.stone.name=Каменные соты +item.gt.comb.certus.name=Кварцевые соты +item.gt.comb.redstone.name=Редстоун соты +item.gt.comb.rareearth.name=Соты редкой земли +item.gt.comb.ruby.name=Рубиновые соты +item.gt.comb.sapphire.name=Сапфировые соты +item.gt.comb.diamond.name=Алмазные соты +item.gt.comb.olivine.name=Оливиновые соты +item.gt.comb.pyrope.name=Пироповые соты +item.gt.comb.grossular.name=Гроссуляровые соты +item.gt.comb.sparkling.name=Блестящие соты +item.gt.comb.slag.name=Шлаковые соты +item.gt.comb.copper.name=Медные соты +item.gt.comb.lead.name=Свинцовые соты +item.gt.comb.iron.name=Железные соты +item.gt.comb.nickel.name=Никелевые соты +item.gt.comb.zinc.name=Цинковые соты +item.gt.comb.bauxite.name=Бокситовые соты +item.gt.comb.arsenic.name=Соты мышьяка +item.gt.comb.aluminium.name=Алюминиевые соты +item.gt.comb.manganese.name=Марганцевые соты +item.gt.comb.titanium.name=Титановые соты +item.gt.comb.chrome.name=Соты хрома +item.gt.comb.tungsten.name=Вольфрамовые соты +item.gt.comb.platinum.name=Платиновые соты +item.gt.comb.iridium.name=Иридиумные соты +item.gt.comb.osmium.name=Осмиевые соты +item.gt.comb.lithium.name=Литиевые соты +item.gt.comb.salt.name=Соды соли +item.gt.comb.electrotine.name=Электротиновые соты +item.gt.comb.almandine.name=Альмадиновые соты +item.gt.comb.plutonium.name=Плутониевые соты +item.gt.comb.naquadah.name=Соты наквады +item.gt.comb.naquadria.name=Соты наквадрия +item.gt.comb.thorium.name=Ториевые соты +item.gt.comb.americium.name=Соты америция +item.gt.comb.neutronium.name=Нейтронивые соты +item.gt.comb.phosphorus.name=Фосфорные соты +item.gt.comb.indium.name=Соты индия +item.gt.comb.trinium.name=Триниумовые соты +item.gt.comb.helium.name=Гелиевые соты +item.gt.comb.xenon.name=Ксеноновые соты +item.gt.comb.neon.name=Неоновые соты +item.gt.comb.krypton.name=Криптоновые соты +item.gt.comb.nitrogen.name=Азотные соты +item.gt.comb.hydrogen.name=Водородные соты +item.gt.comb.fluorine.name=Фторовые соты +item.gt.comb.fluix.name=Флюкс-соты + +# Bees +for.bees.species.clay=Глиняная +for.bees.species.slimeball=Слаймовая +for.bees.species.peat=Торфяная +for.bees.species.stickyresin=Резиновая +for.bees.species.oil=Нефтяная +for.bees.species.apatite=Апатитовая +for.bees.species.biomass=Биомассная +for.bees.species.redstone=Редстоуновая +for.bees.species.diamond=Алмазная +for.bees.species.sapphire=Сапфировая +for.bees.species.olivine=Оливиновая +for.bees.species.emerald=Изумрудная +for.bees.species.copper=Медная +for.bees.species.tin=Оловянная +for.bees.species.lead=Свинцовая +for.bees.species.iron=Железная +for.bees.species.nickel=Никелевая +for.bees.species.zinc=Цинковая +for.bees.species.silver=Серебрянная +for.bees.species.gold=Золотая +for.bees.species.arsenic=Мышьяковая +for.bees.species.titanium=Титановая +for.bees.species.chrome=Хромовая +for.bees.species.manganese=Марганцевая +for.bees.species.tungsten=Вольфрамовая +for.bees.species.platinum=Платиновая +for.bees.species.iridium=Иридиевая +for.bees.species.redalloy=Красносплавная +for.bees.species.uranium=Урановая +for.bees.species.plutonium=Плутониевая +for.bees.species.naquadah=Наквадная +for.bees.species.naquadria=Наквадриевая +for.bees.species.thorium=Ториевая +for.bees.species.lutetium=Лютециевая +for.bees.species.americium=Америциевая +for.bees.species.divided=Разделенная +for.bees.species.sandwich=Сэндвич +for.bees.species.sparkling=Звездная +for.bees.species.fertilizer=Удобряющая +for.bees.species.phosphorus=Фосфорная +for.bees.species.sulfur=Серная +for.bees.species.indium=Индиевая +for.bees.species.trinium=Триниумная +for.bees.species.helium=Гелиевая +for.bees.species.argon=Аргоновая +for.bees.species.neon=Неоновая +for.bees.species.krypton=Криптоновая +for.bees.species.hydrogen=Водородная +for.bees.species.nitrogen=Азотная +for.bees.species.fluix=Флюкс- +for.bees.species.silicon=Кремниевая + +# Scanner Information +gregtech.scanner.forestry.drone=§oОтсканированный трутень +gregtech.scanner.forestry.princess=§oОтсканированная принцесса +gregtech.scanner.forestry.queen=§oОтсканированная королева +gregtech.scanner.forestry.sapling=§oОтсканированный саженец +gregtech.scanner.forestry.butterfly=§oОтсканированная бабочка +gregtech.scanner.forestry.larvae=§oОтсканированная личинка +gregtech.scanner.forestry.serum=§oОтсканированная сыворотка +gregtech.scanner.forestry.caterpillar=§oОтсканированная гусеница +gregtech.scanner.forestry.pollen=§oОтсканированная пыльца +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.name=Улучшите ваши катушки до уровня IV +gregtech.machine.research_station.researching=Исследование. +gregtech.recipe.chance_logic=Шанс: %s%% +%s%%/уровень (%s) +gregtech.chance_logic.or=ИЛИ +gregtech.veins.ore.saltpeter=Селитровая жила +gregtech.veins.ore.black_granite_sphere=Залежь черного гранита +gregtech.veins.ore.garnet_tin=Оловяно-Гранатовая жила +gregtech.veins.ore.mica=Слюдовая жила +gregtech.veins.ore.raw_oil_sphere=Залежь нефти +gregtech.veins.fluid.natural_gas_nether=Залежь природного газа Нижнего мира +gregtech.multiblock.multi_furnace.heating_coil_discount_hover=Множитель энергопотребления задается уровнем катушки +gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed=Улучшите выходной разъем, чтобы включить жидкостный форсаж. +gregtech.multiblock.hpca.info_max_cooling_available=Хладогента доступно: %s +gregtech.creative.energy.sink=Разряд +metaitem.electrode.copper.name=Медный электрод +item.gt.tool.behavior.scoop=§dЛовец: §fЛовит бабочек при ЛКМ +item.gt.comb.apatite.name=Апатитовые соты +item.gt.comb.redalloy.name=Соты красного сплава +item.gt.comb.lapis.name=Ляписовые соты +item.gt.comb.emerald.name=Изумрудные соты +item.gt.comb.tin.name=Оловянные соты +item.gt.comb.steel.name=Стальные соты +item.gt.comb.silver.name=Серебрянные соты +item.gt.comb.magnesium.name=Магниевые соты +item.gt.comb.molybdenum.name=Молибденовые соты +item.gt.comb.uranium.name=Урановые соты +item.gt.comb.lutetium.name=Соты лютеция +item.gt.comb.argon.name=Аргоновые соты +item.gt.comb.oxygen.name=Кислородные соты +for.bees.species.ash=Золяная +for.bees.species.ruby=Рубиновая +for.bees.species.steel=Стальная +for.bees.species.aluminium=Алюминиевая +for.bees.species.stainlesssteel=Нержавеющая +for.bees.species.neutronium=Нейтрониевая +for.bees.species.explosive=Взрывная +for.bees.species.fluorine=Фторовая + +# Bee Descriptions (many more to do) +for.bees.description.clay=Органическая пчела, известная своей трудолюбивостью и усердием. Ходят слухи, что их можно найти грязь в нужном биоме.|Пчеловодство 101 From 0f7cbe0b263a85a2309692c0895c4b93d4dda004 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:04:20 -0600 Subject: [PATCH 27/77] Fix HPCA allocation logic (#2214) --- .../metatileentities/multi/electric/MetaTileEntityHPCA.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java index 45bf53d463d..06f8286d8ff 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityHPCA.java @@ -112,13 +112,13 @@ public void invalidateStructure() { @Override public int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { seen.add(this); - return isActive() && !hasNotEnoughEnergy ? hpcaHandler.allocateCWUt(cwut, simulate) : 0; + return isActive() && isWorkingEnabled() && !hasNotEnoughEnergy ? hpcaHandler.allocateCWUt(cwut, simulate) : 0; } @Override public int getMaxCWUt(@NotNull Collection seen) { seen.add(this); - return isActive() ? hpcaHandler.getMaxCWUt() : 0; + return isActive() && isWorkingEnabled() ? hpcaHandler.getMaxCWUt() : 0; } @Override From 518c647383f01891a06c639331be922c65999b4a Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 21:49:55 -0600 Subject: [PATCH 28/77] Add groovy shortcuts for common fluid calls (#2215) --- .../groovy/GroovyMaterialBuilderExpansion.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java index 515a8261f6e..3f5ea4873f4 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java +++ b/src/main/java/gregtech/integration/groovy/GroovyMaterialBuilderExpansion.java @@ -28,6 +28,18 @@ public static Material.Builder fluid(Material.Builder builder, String raw, Fluid return builder; } + public static Material.Builder gas(Material.Builder builder, int temp) { + return builder.gas(new FluidBuilder().temperature(temp)); + } + + public static Material.Builder liquid(Material.Builder builder, int temp) { + return builder.liquid(new FluidBuilder().temperature(temp)); + } + + public static Material.Builder plasma(Material.Builder builder, int temp) { + return builder.plasma(new FluidBuilder().temperature(temp)); + } + public static Material.Builder element(Material.Builder builder, String raw) { Element element = Elements.get(raw); if (GroovyScriptModule.validateNonNull(element, From 76a130438e8e7e8d6b288ceb57b9306b4a4be08c Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Wed, 29 Nov 2023 04:13:10 +0000 Subject: [PATCH 29/77] Fix Multiblock tanks (#2221) Co-authored-by: alongstringofnumbers --- .../multi/MetaTileEntityMultiblockTank.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 5e6736a21ac..eeabc2cd762 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -28,6 +28,8 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -56,10 +58,6 @@ public MetaTileEntityMultiblockTank(ResourceLocation metaTileEntityId, boolean i protected void initializeInventory() { super.initializeInventory(); - if (!isStructureFormed()) { - return; - } - FilteredFluidHandler tank = new FilteredFluidHandler(capacity); if (!isMetal) { tank.setFilter(new PropertyFluidFilter(340, false, false, false, false)); @@ -125,6 +123,11 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac return super.onRightClick(playerIn, hand, facing, hitResult); } + @Override + protected boolean openGUIOnRightClick() { + return isStructureFormed(); + } + @Override protected ModularUI.Builder createUITemplate(@NotNull EntityPlayer entityPlayer) { return ModularUI.defaultBuilder() @@ -155,4 +158,16 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.multiblock.tank.tooltip")); tooltip.add(I18n.format("gregtech.universal.tooltip.fluid_storage_capacity", capacity)); } + + @Override + public T getCapability(Capability capability, EnumFacing side) { + if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { + if (isStructureFormed()) { + return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidInventory); + } else { + return null; + } + } + return super.getCapability(capability, side); + } } From ab59f5131958e1f0db5c99ba4df09b5a0dcdaa9d Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:18:14 -0600 Subject: [PATCH 30/77] Groovyscript 0.7.0 compat (#2217) --- dependencies.gradle | 2 +- src/main/java/gregtech/GregTechMod.java | 2 +- .../groovy/GroovyScriptModule.java | 71 +++++++++---------- .../groovy/VirtualizedRecipeMap.java | 17 +---- 4 files changed, 39 insertions(+), 53 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 7325a64e96f..ef3c505bd1d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -31,7 +31,7 @@ dependencies { implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.684" implementation rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31 - implementation rfg.deobf("curse.maven:groovyscript-687577:4687204") // GRS 0.6.0 + implementation rfg.deobf("curse.maven:groovyscript-687577:4905039") // GRS 0.7.0 implementation rfg.deobf("curse.maven:ae2-extended-life-570458:4402048") // AE2UEL 0.55.6 compileOnlyApi rfg.deobf("curse.maven:opencomputers-223008:4526246") // OpenComputers 1.8.0+9833087 diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index 1cb973f18ee..1942c3a0c9f 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -24,7 +24,7 @@ dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + "after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + "after:genetics;" + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + - "after:groovyscript@[0.6.0,);" + "after:theoneprobe;" + "after:hwyla;") + "after:groovyscript@[0.7.0,);" + "after:theoneprobe;" + "after:hwyla;") public class GregTechMod { // Hold this so that we can reference non-interface methods without diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index 2b1576ca53e..183372fde05 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -25,16 +25,15 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.event.FMLConstructionEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.cleanroommc.groovyscript.GroovyScript; import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.brackets.BracketHandlerManager; -import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import com.cleanroommc.groovyscript.api.GroovyPlugin; +import com.cleanroommc.groovyscript.api.IGameObjectHandler; +import com.cleanroommc.groovyscript.compat.mods.GroovyContainer; +import com.cleanroommc.groovyscript.gameobjects.GameObjectHandlerManager; import com.cleanroommc.groovyscript.sandbox.expand.ExpansionHelper; import com.google.common.collect.ImmutableList; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -52,9 +51,9 @@ modDependencies = GTValues.MODID_GROOVYSCRIPT, name = "GregTech GroovyScript Integration", description = "GroovyScript Integration Module") -public class GroovyScriptModule extends IntegrationSubmodule { +public class GroovyScriptModule extends IntegrationSubmodule implements GroovyPlugin { - private static ModSupport.Container modSupportContainer; + private static GroovyContainer modSupportContainer; private static final Map> metaItems = new Object2ObjectOpenHashMap<>(); @NotNull @@ -68,18 +67,13 @@ public static void onRecipeEvent(RegistryEvent.Register event) { GroovyScriptModule.loadMetaItemBracketHandler(); } - @Override - public void construction(FMLConstructionEvent event) { - modSupportContainer = new ModSupport.Container<>(GTValues.MODID, "GregTech", Container::new, "gt"); - } - public static boolean isCurrentlyRunning() { return GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) && GroovyScript.getSandbox().isRunning(); } - public static Container getInstance() { - return modSupportContainer.get(); + public static GroovyContainer getInstance() { + return modSupportContainer; } public static boolean validateNonNull(Object o, Supplier errorMsg) { @@ -186,31 +180,34 @@ public static void loadMetaItemBracketHandler() { } } - /** - * A GroovyScript mod compat container. This should not be referenced when GrS is not installed! - */ - public static class Container extends ModPropertyContainer { + @Override + public @NotNull String getModId() { + return GTValues.MODID; + } - private Container() {} + @Override + public @NotNull String getModName() { + return "GregTech"; + } - @Override - protected void addRegistry(VirtualizedRegistry registry) { - super.addRegistry(registry); - } + @Override + public void onCompatLoaded(GroovyContainer groovyContainer) { + modSupportContainer = groovyContainer; + GameObjectHandlerManager.registerGameObjectHandler(GTValues.MODID, "recipemap", + IGameObjectHandler.wrapStringGetter(RecipeMap::getByName)); - @Override - public void initialize() { - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "recipemap", RecipeMap::getByName); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "material", - GregTechAPI.materialManager::getMaterial); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "oreprefix", OrePrefix::getPrefix); - BracketHandlerManager.registerBracketHandler(GTValues.MODID, "metaitem", GroovyScriptModule::getMetaItem, - ItemStack.EMPTY); - - ExpansionHelper.mixinClass(Material.class, MaterialExpansion.class); - ExpansionHelper.mixinClass(Material.class, MaterialPropertyExpansion.class); - ExpansionHelper.mixinClass(Material.Builder.class, GroovyMaterialBuilderExpansion.class); - ExpansionHelper.mixinClass(RecipeBuilder.class, GroovyRecipeBuilderExpansion.class); - } + GameObjectHandlerManager.registerGameObjectHandler(GTValues.MODID, "material", + IGameObjectHandler.wrapStringGetter(GregTechAPI.materialManager::getMaterial)); + + GameObjectHandlerManager.registerGameObjectHandler(GTValues.MODID, "oreprefix", + IGameObjectHandler.wrapStringGetter(OrePrefix::getPrefix)); + + GameObjectHandlerManager.registerGameObjectHandler(GTValues.MODID, "metaitem", + IGameObjectHandler.wrapStringGetter(GroovyScriptModule::getMetaItem), ItemStack.EMPTY); + + ExpansionHelper.mixinClass(Material.class, MaterialExpansion.class); + ExpansionHelper.mixinClass(Material.class, MaterialPropertyExpansion.class); + ExpansionHelper.mixinClass(Material.Builder.class, GroovyMaterialBuilderExpansion.class); + ExpansionHelper.mixinClass(RecipeBuilder.class, GroovyRecipeBuilderExpansion.class); } } diff --git a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java index a1a6d1f6151..a2dbf7a3d55 100644 --- a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java +++ b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java @@ -8,11 +8,11 @@ import net.minecraftforge.fluids.FluidStack; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import com.google.common.base.CaseFormat; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -21,20 +21,9 @@ public class VirtualizedRecipeMap extends VirtualizedRegistry { private final RecipeMap recipeMap; public VirtualizedRecipeMap(RecipeMap recipeMap) { - super(false, generateAliases(recipeMap.unlocalizedName)); + super(Alias.generateOf(recipeMap.unlocalizedName, CaseFormat.LOWER_UNDERSCORE)); this.recipeMap = recipeMap; - GroovyScriptModule.getInstance().addRegistry(this); - } - - public static String[] generateAliases(String name) { - ArrayList aliases = new ArrayList<>(); - aliases.add(name); - aliases.add(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name)); - if (name.split("_").length > 2) { - aliases.add(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name)); - } - - return aliases.toArray(new String[0]); + GroovyScriptModule.getInstance().getVirtualizedRegistrar().addRegistry(this); } @Override From 224e1d280dca3ca453deff0352584f9ba6b1caf9 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:24:37 -0600 Subject: [PATCH 31/77] Fix fluid property with no fluid (#2222) --- src/main/java/gregtech/api/fluids/store/FluidStorage.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorage.java b/src/main/java/gregtech/api/fluids/store/FluidStorage.java index ea21d756480..6c4a284d3ec 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorage.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorage.java @@ -61,6 +61,13 @@ public void registerFluids(@NotNull Material material) { throw new IllegalStateException("FluidStorage has already been registered"); } + // if nothing is queued for registration, we need something for the registry to handle + // this will prevent cases of a material having a fluid property but no + // fluids actually created for the material. + if (toRegister.isEmpty()) { + enqueueRegistration(FluidStorageKeys.LIQUID, new FluidBuilder()); + } + for (var entry : toRegister.entrySet()) { Fluid fluid = entry.getValue().build(material.getModid(), material, entry.getKey()); if (!storeNoOverwrites(entry.getKey(), fluid)) { From efe85a8cef124abe6061a95311b0f62dcdc44d33 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:28:44 -0600 Subject: [PATCH 32/77] Fix data access hatch render when facing up/down (#2218) --- .../cube/SimpleOrientedCubeRenderer.java | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java index fc26dfda3b5..074c2c55a98 100644 --- a/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java +++ b/src/main/java/gregtech/client/renderer/texture/cube/SimpleOrientedCubeRenderer.java @@ -85,39 +85,49 @@ public TextureAtlasSprite getParticleSprite() { public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) { - Textures.renderFace(renderState, translation, pipeline, EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), - BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), - BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), - BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, - sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); - - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateY(), bounds, - sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); - Textures.renderFace(renderState, translation, pipeline, frontFacing.rotateYCCW(), bounds, - sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); - IVertexOperation[] lightPipeline = ConfigHolder.client.machinesEmissiveTextures ? ArrayUtils.add(pipeline, new LightMapOperation(240, 240)) : pipeline; - if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, - EnumFacing.UP, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); - if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, - EnumFacing.DOWN, bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); - + // Front + Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), + BlockRenderLayer.CUTOUT_MIPPED); if (spritesEmissive.containsKey(CubeSide.FRONT)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, sprites.get(CubeSide.FRONT), BloomEffectUtil.getEffectiveBloomLayer()); + + // Back + Textures.renderFace(renderState, translation, pipeline, frontFacing.getOpposite(), bounds, + sprites.get(CubeSide.BACK), BlockRenderLayer.CUTOUT_MIPPED); if (spritesEmissive.containsKey(CubeSide.BACK)) Textures.renderFace(renderState, translation, lightPipeline, frontFacing.getOpposite(), bounds, sprites.get(CubeSide.BACK), BloomEffectUtil.getEffectiveBloomLayer()); + // Left + // best guess in this weird case + EnumFacing left = frontFacing.getAxis() != EnumFacing.Axis.Y ? frontFacing.rotateYCCW() : EnumFacing.NORTH; + Textures.renderFace(renderState, translation, pipeline, left, bounds, + sprites.get(CubeSide.LEFT), BlockRenderLayer.CUTOUT_MIPPED); if (spritesEmissive.containsKey(CubeSide.LEFT)) Textures.renderFace(renderState, translation, lightPipeline, - frontFacing.rotateY(), bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); + left, bounds, sprites.get(CubeSide.LEFT), BloomEffectUtil.getEffectiveBloomLayer()); + + // Right + Textures.renderFace(renderState, translation, pipeline, left.getOpposite(), bounds, + sprites.get(CubeSide.RIGHT), BlockRenderLayer.CUTOUT_MIPPED); if (spritesEmissive.containsKey(CubeSide.RIGHT)) - Textures.renderFace(renderState, translation, lightPipeline, frontFacing.rotateYCCW(), bounds, + Textures.renderFace(renderState, translation, lightPipeline, left.getOpposite(), bounds, sprites.get(CubeSide.RIGHT), BloomEffectUtil.getEffectiveBloomLayer()); + + // Up + // best guess in this weird case + EnumFacing up = frontFacing.getAxis() != EnumFacing.Axis.Y ? EnumFacing.UP : EnumFacing.WEST; + Textures.renderFace(renderState, translation, pipeline, up, bounds, sprites.get(CubeSide.TOP), + BlockRenderLayer.CUTOUT_MIPPED); + if (spritesEmissive.containsKey(CubeSide.TOP)) Textures.renderFace(renderState, translation, lightPipeline, + up, bounds, sprites.get(CubeSide.TOP), BloomEffectUtil.getEffectiveBloomLayer()); + + // Down + Textures.renderFace(renderState, translation, pipeline, up.getOpposite(), bounds, sprites.get(CubeSide.BOTTOM), + BlockRenderLayer.CUTOUT_MIPPED); + if (spritesEmissive.containsKey(CubeSide.BOTTOM)) Textures.renderFace(renderState, translation, lightPipeline, + up.getOpposite(), bounds, sprites.get(CubeSide.BOTTOM), BloomEffectUtil.getEffectiveBloomLayer()); } } From 2186489a68a700f64e6a452dc00808ddd6a68cf1 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:36:20 -0600 Subject: [PATCH 33/77] Fix crashes when other mods add fluids of same name (#2212) --- .../gregtech/api/fluids/FluidBuilder.java | 73 +++++++++++++------ .../api/fluids/GTFluidRegistration.java | 13 ++-- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index 31eb9e358fe..60cc47fa243 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -1,6 +1,7 @@ package gregtech.api.fluids; import gregtech.api.GTValues; +import gregtech.api.fluids.attribute.AttributedFluid; import gregtech.api.fluids.attribute.FluidAttribute; import gregtech.api.fluids.store.FluidStorageKey; import gregtech.api.unification.FluidUnifier; @@ -9,11 +10,14 @@ import gregtech.api.unification.material.properties.BlastProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.util.FluidTooltipUtil; +import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; import net.minecraft.block.material.MaterialLiquid; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.Loader; import com.google.common.base.Preconditions; @@ -271,19 +275,28 @@ private static int convertViscosity(double viscosity) { throw new IllegalStateException("Could not determine fluid name"); } - GTFluid fluid; - if (material == null) { - fluid = new GTFluid(name, still, flowing, state); - } else if (key != null) { - if (translationKey == null) { - translationKey = key.getTranslationKeyFor(material); + Fluid fluid = FluidRegistry.getFluid(name); + boolean needsRegistration = false; + if (fluid == null) { + needsRegistration = true; + if (material == null) { + fluid = new GTFluid(name, still, flowing, state); + } else if (key != null) { + if (translationKey == null) { + translationKey = key.getTranslationKeyFor(material); + } + fluid = new GTFluid.GTMaterialFluid(name, still, flowing, state, translationKey, material); + } else { + throw new IllegalArgumentException("Fluids with materials must have a FluidStorageKey"); } - fluid = new GTFluid.GTMaterialFluid(name, still, flowing, state, translationKey, material); - } else { - throw new IllegalArgumentException("Fluids with materials must have a FluidStorageKey"); } - attributes.forEach(fluid::addAttribute); + if (fluid instanceof AttributedFluid attrFluid) { + attributes.forEach(attrFluid::addAttribute); + } else { + GTLog.logger + .warn("Unable to set Fluid Attributes for Fluid {}, as it is owned by another mod! Skipping..."); + } determineTemperature(material); fluid.setTemperature(temperature); @@ -302,26 +315,44 @@ private static int convertViscosity(double viscosity) { determineViscosity(material); fluid.setViscosity(viscosity); - GTFluidRegistration.INSTANCE.registerFluid(fluid, modid, hasBucket); + if (needsRegistration) { + GTFluidRegistration.INSTANCE.registerFluid(fluid, modid, hasBucket); + } else if (hasBucket) { + // In case it didn't have it before, but now it does + FluidRegistry.addBucketForFluid(fluid); + } if (material != null) { FluidUnifier.registerFluid(fluid, material); } - FluidTooltipUtil.registerTooltip(fluid, FluidTooltipUtil.createGTFluidTooltip(fluid)); + FluidTooltipUtil.registerTooltip(fluid, FluidTooltipUtil.createFluidTooltip(material, fluid, state)); if (hasFluidBlock) { - GTFluidBlock block; - if (material == null) { - MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), false); - block = new GTFluidBlock(fluid, materialLiquid, false, false, false); + if (fluid.getBlock() == null) { + GTFluidBlock block; + if (material == null) { + MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), false); + block = new GTFluidBlock(fluid, materialLiquid, false, false, false); + } else { + MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), + material.hasFlag(MaterialFlags.STICKY)); + block = new GTFluidBlock(fluid, materialLiquid, material); + } + block.setRegistryName(modid, "fluid." + name); + GTFluidRegistration.INSTANCE.registerFluidBlock(block); + fluid.setBlock(block); + } else if (fluid.getBlock() instanceof BlockFluidBase fluidBlock) { + // refresh the necessary fluid block stats to our new ones + fluidBlock.setDensity(fluid.getDensity()); + fluidBlock.setTemperature(fluid.getTemperature()); + fluidBlock.setMaxScaledLight(fluid.getLuminosity()); + fluidBlock.setTickRate(fluid.getViscosity() / 200); } else { - MaterialLiquid materialLiquid = new GTFluidMaterial(GTUtility.getMapColor(color), - material.hasFlag(MaterialFlags.STICKY)); - block = new GTFluidBlock(fluid, materialLiquid, material); + GTLog.logger.warn( + "Unable to set custom Fluid Block stats for Fluid {}, Fluid Block owned by other mod with unknown type!", + fluid.getName()); } - block.setRegistryName(modid, "fluid." + name); - GTFluidRegistration.INSTANCE.registerFluidBlock(block); } // register cross mod compat for colors diff --git a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java index 3668133b384..c3dbf8b24bc 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java +++ b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java @@ -77,12 +77,15 @@ public void registerSprites(@NotNull TextureMap textureMap) { * @param generateBucket if a universal bucket entry should be generated */ public void registerFluid(@NotNull Fluid fluid, @NotNull String modid, boolean generateBucket) { - fluidSprites.add(fluid.getStill()); - fluidSprites.add(fluid.getFlowing()); - + boolean didExist = FluidRegistry.getFluid(fluid.getName()) != null; FluidRegistry.registerFluid(fluid); - fixFluidRegistryName(fluid, modid); - + if (!didExist) { + // If it didn't exist, that means that this is a fresh fluid of our own + // creation and not one which is being transformed by a Material. + fluidSprites.add(fluid.getStill()); + fluidSprites.add(fluid.getFlowing()); + fixFluidRegistryName(fluid, modid); + } if (generateBucket) { FluidRegistry.addBucketForFluid(fluid); } From 5470edcd7c619e2393f1a74f1f932f6147c3eb18 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:36:45 -0600 Subject: [PATCH 34/77] Repair the fluid registry for addons (#2216) --- .../api/fluids/GTFluidRegistration.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java index c3dbf8b24bc..52409e9f871 100644 --- a/src/main/java/gregtech/api/fluids/GTFluidRegistration.java +++ b/src/main/java/gregtech/api/fluids/GTFluidRegistration.java @@ -21,6 +21,7 @@ import java.lang.reflect.Field; import java.util.Collection; +import java.util.Objects; public class GTFluidRegistration { @@ -30,6 +31,8 @@ public class GTFluidRegistration { private static @Nullable BiMap MASTER_FLUID_REFERENCE; + private static @Nullable BiMap DEFAULT_FLUID_NAME; + /** * Fixes all registered fluids being under the gregtech modid * @@ -49,7 +52,29 @@ private static void fixFluidRegistryName(@NotNull Fluid fluid, @NotNull String m throw new IllegalStateException("Could not reflect the Forge Master Fluid Registry", e); } } - MASTER_FLUID_REFERENCE.inverse().put(fluid, modid + ':' + fluid.getName()); + Objects.requireNonNull(MASTER_FLUID_REFERENCE); + + if (DEFAULT_FLUID_NAME == null) { + try { + Field field = FluidRegistry.class.getDeclaredField("defaultFluidName"); + field.setAccessible(true); + // noinspection unchecked + DEFAULT_FLUID_NAME = (BiMap) field.get(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new IllegalStateException("Could not reflect the Forge Default Fluid Name map", e); + } + } + Objects.requireNonNull(DEFAULT_FLUID_NAME); + + String masterKey = MASTER_FLUID_REFERENCE.inverse().get(fluid); + if (masterKey != null && masterKey.startsWith(GTValues.MODID + ":")) { + MASTER_FLUID_REFERENCE.inverse().put(fluid, modid + ':' + fluid.getName()); + } + + String defaultName = DEFAULT_FLUID_NAME.get(fluid.getName()); + if (defaultName.startsWith(GTValues.MODID + ":")) { + DEFAULT_FLUID_NAME.put(fluid.getName(), modid + ':' + fluid.getName()); + } } @ApiStatus.Internal From 82aad90f8fb947091d40ed11c82327cb6a7bb5c0 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:40:43 -0600 Subject: [PATCH 35/77] Allow Titanium, Tungstensteel to be acid proof (#2223) --- .../api/unification/material/materials/ElementMaterials.java | 2 +- .../unification/material/materials/SecondDegreeMaterials.java | 2 +- src/main/java/gregtech/common/items/MetaItem1.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java index f199f2c5a3d..37c745dc5c5 100644 --- a/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java @@ -833,7 +833,7 @@ public static void register() { .toolStats(ToolProperty.Builder.of(8.0F, 6.0F, 1536, 3) .enchantability(14).build()) .rotorStats(7.0f, 3.0f, 1600) - .fluidPipeProperties(2426, 150, true) + .fluidPipeProperties(2426, 150, true, true, false, false) .blast(b -> b .temp(1941, GasTier.MID) .blastStats(VA[HV], 1500) diff --git a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java index cd24317b9bf..aff4da9ac1f 100644 --- a/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/SecondDegreeMaterials.java @@ -122,7 +122,7 @@ public static void register() { .toolStats(ToolProperty.Builder.of(9.0F, 7.0F, 2048, 4) .enchantability(14).build()) .rotorStats(8.0f, 4.0f, 2560) - .fluidPipeProperties(3587, 225, true) + .fluidPipeProperties(3587, 225, true, true, false, false) .cableProperties(V[IV], 3, 2) .blast(b -> b .temp(4000, GasTier.MID) diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 78650965336..9620ccaa60b 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -192,7 +192,7 @@ public void registerSubItems() { FLUID_CELL_LARGE_TITANIUM = addItem(83, "large_fluid_cell.titanium") .addComponents(new FilteredFluidStats(128000, - Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + Materials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, true, false, false, true), new ItemFluidContainer()) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.Titanium, M * 6))) // ingot * 6 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); @@ -200,7 +200,7 @@ public void registerSubItems() { FLUID_CELL_LARGE_TUNGSTEN_STEEL = addItem(84, "large_fluid_cell.tungstensteel") .addComponents(new FilteredFluidStats(512000, Materials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, - false, false, false, true), new ItemFluidContainer()) + true, false, false, true), new ItemFluidContainer()) .setMaxStackSize(32) .setMaterialInfo(new ItemMaterialInfo(new MaterialStack(Materials.TungstenSteel, M * 8))) // ingot * 8 .setCreativeTabs(GregTechAPI.TAB_GREGTECH_TOOLS); From 2776388638fa3c9b7e63505eb58174e1df2780ce Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:41:26 -0600 Subject: [PATCH 36/77] 2.8.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4c212be7072..562713469f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ modGroup = gregtech # Version of your mod. # This field can be left empty if you want your mod's version to be determined by the latest git tag instead. -modVersion = 2.8.0-beta +modVersion = 2.8.1-beta # Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) includeMCVersionJar = true From a7e1a2c1e29e2c3298afa62a1bde923ce44a7587 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Thu, 30 Nov 2023 23:09:48 -0500 Subject: [PATCH 37/77] fix groovyscript hard dep (#2230) --- .../java/gregtech/integration/groovy/GroovyScriptModule.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java index 183372fde05..adb308fe4e6 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java +++ b/src/main/java/gregtech/integration/groovy/GroovyScriptModule.java @@ -25,6 +25,7 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -45,6 +46,9 @@ import java.util.Objects; import java.util.function.Supplier; +@Optional.Interface(modid = GTValues.MODID_GROOVYSCRIPT, + iface = "com.cleanroommc.groovyscript.api.GroovyPlugin", + striprefs = true) @GregTechModule( moduleID = GregTechModules.MODULE_GRS, containerID = GTValues.MODID, From 86517eef8239c4deca7e0d4c599b75270e1cbb84 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:14:48 -0600 Subject: [PATCH 38/77] Reimplement alternative fluid names (#2238) --- .../java/gregtech/api/fluids/FluidBuilder.java | 16 ++++++++++++++++ .../material/materials/FirstDegreeMaterials.java | 5 +++-- .../materials/OrganicChemistryMaterials.java | 2 +- .../materials/UnknownCompositionMaterials.java | 4 ++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index 60cc47fa243..ec0aedd5f43 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -59,6 +59,7 @@ public class FluidBuilder { private boolean hasFluidBlock = false; private boolean hasBucket = true; + private String alternativeName = null; public FluidBuilder() {} @@ -213,6 +214,15 @@ private static int convertViscosity(double viscosity) { return this; } + /** + * @param name Alternative registry name for this fluid to look for + * @return this + */ + public @NotNull FluidBuilder alternativeName(@NotNull String name) { + this.alternativeName = name; + return this; + } + /** * Mark this fluid as having a custom still texture * @@ -275,7 +285,13 @@ private static int convertViscosity(double viscosity) { throw new IllegalStateException("Could not determine fluid name"); } + // try to find an already registered fluid that we can use instead of a new one Fluid fluid = FluidRegistry.getFluid(name); + if (fluid == null && alternativeName != null) { + // try to use alternative fluid name if needed + fluid = FluidRegistry.getFluid(alternativeName); + } + boolean needsRegistration = false; if (fluid == null) { needsRegistration = true; diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index f5a760b7364..8fe4c42472c 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -263,7 +263,8 @@ public static void register() { .dust(0) .liquid(new FluidBuilder() .temperature(273) - .customStill()) + .customStill() + .alternativeName("fluid.ice")) .color(0xC8C8FF).iconSet(SHINY) .flags(NO_SMASHING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) .components(Hydrogen, 2, Oxygen, 1) @@ -1281,7 +1282,7 @@ public static void register() { .build(); DistilledWater = new Material.Builder(421, gregtechId("distilled_water")) - .fluid() + .liquid(new FluidBuilder().alternativeName("fluidDistWater")) .color(0x4A94FF) .flags(DISABLE_DECOMPOSITION) .components(Hydrogen, 2, Oxygen, 1) diff --git a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java index 729df027e64..f47c7cc0a42 100644 --- a/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/OrganicChemistryMaterials.java @@ -392,7 +392,7 @@ public static void register() { // FREE ID 1053 Ethanol = new Material.Builder(1054, gregtechId("ethanol")) - .liquid(new FluidBuilder().customStill()) + .liquid(new FluidBuilder().customStill().alternativeName("bio.ethanol")) .color(0xFC4C04) .flags(DISABLE_DECOMPOSITION) .components(Carbon, 2, Hydrogen, 6, Oxygen, 1) diff --git a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java index 4321d7de644..2b8918b2abb 100644 --- a/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/UnknownCompositionMaterials.java @@ -48,7 +48,7 @@ public static void register() { .flags(STICKY).build(); Diesel = new Material.Builder(1508, gregtechId("diesel")) - .liquid(new FluidBuilder().customStill()) + .liquid(new FluidBuilder().customStill().alternativeName("fuel")) .color(0xFCF404) .flags(FLAMMABLE, EXPLOSIVE).build(); @@ -72,7 +72,7 @@ public static void register() { .color(0x0E2950).build(); SeedOil = new Material.Builder(1514, gregtechId("seed_oil")) - .liquid(new FluidBuilder().customStill()) + .liquid(new FluidBuilder().customStill().alternativeName("seed.oil")) .color(0xE4FC8C) .flags(STICKY, FLAMMABLE).build(); From f11d1194811a7d6a1f64f200851dc1be0a9103b4 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:19:20 -0600 Subject: [PATCH 39/77] Add default fluid state for storage key (#2240) --- src/main/java/gregtech/api/fluids/FluidBuilder.java | 12 ++++++++++-- .../gregtech/api/fluids/store/FluidStorageKey.java | 13 ++++++++++++- .../gregtech/api/fluids/store/FluidStorageKeys.java | 10 +++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index ec0aedd5f43..c49af6a61bc 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -44,7 +44,7 @@ public class FluidBuilder { private final Collection attributes = new ArrayList<>(); - private FluidState state = FluidState.LIQUID; + private FluidState state = null; private int temperature = INFER_TEMPERATURE; private int color = INFER_COLOR; private boolean isColorEnabled = true; @@ -285,6 +285,14 @@ private static int convertViscosity(double viscosity) { throw new IllegalStateException("Could not determine fluid name"); } + if (state == null) { + if (key != null && key.getDefaultFluidState() != null) { + state = key.getDefaultFluidState(); + } else { + state = FluidState.LIQUID; // default fallback + } + } + // try to find an already registered fluid that we can use instead of a new one Fluid fluid = FluidRegistry.getFluid(name); if (fluid == null && alternativeName != null) { @@ -309,7 +317,7 @@ private static int convertViscosity(double viscosity) { if (fluid instanceof AttributedFluid attrFluid) { attributes.forEach(attrFluid::addAttribute); - } else { + } else if (!attributes.isEmpty()) { GTLog.logger .warn("Unable to set Fluid Attributes for Fluid {}, as it is owned by another mod! Skipping..."); } diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java index dae9a0c02e6..ecbc94fe5b7 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java @@ -1,5 +1,6 @@ package gregtech.api.fluids.store; +import gregtech.api.fluids.FluidState; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.info.MaterialIconType; @@ -22,15 +23,18 @@ public final class FluidStorageKey { private final UnaryOperator registryNameOperator; private final Function translationKeyFunction; private final int hashCode; + private final FluidState defaultFluidState; public FluidStorageKey(@NotNull ResourceLocation resourceLocation, @NotNull MaterialIconType iconType, @NotNull UnaryOperator<@NotNull String> registryNameOperator, - @NotNull Function<@NotNull Material, @NotNull String> translationKeyFunction) { + @NotNull Function<@NotNull Material, @NotNull String> translationKeyFunction, + @Nullable FluidState defaultFluidState) { this.resourceLocation = resourceLocation; this.iconType = iconType; this.registryNameOperator = registryNameOperator; this.translationKeyFunction = translationKeyFunction; this.hashCode = resourceLocation.hashCode(); + this.defaultFluidState = defaultFluidState; if (keys.containsKey(resourceLocation)) { throw new IllegalArgumentException("Cannot create duplicate keys"); } @@ -64,6 +68,13 @@ public FluidStorageKey(@NotNull ResourceLocation resourceLocation, @NotNull Mate return this.translationKeyFunction.apply(material); } + /** + * @return the default fluid state for this storage key, if it exists. + */ + public @Nullable FluidState getDefaultFluidState() { + return defaultFluidState; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorageKeys.java b/src/main/java/gregtech/api/fluids/store/FluidStorageKeys.java index 195b6d9bb63..10407e03b03 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorageKeys.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorageKeys.java @@ -1,5 +1,6 @@ package gregtech.api.fluids.store; +import gregtech.api.fluids.FluidState; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.unification.material.properties.PropertyKey; @@ -12,7 +13,8 @@ public final class FluidStorageKeys { public static final FluidStorageKey LIQUID = new FluidStorageKey(gregtechId("liquid"), MaterialIconType.liquid, UnaryOperator.identity(), - m -> m.hasProperty(PropertyKey.DUST) ? "gregtech.fluid.liquid_generic" : "gregtech.fluid.generic"); + m -> m.hasProperty(PropertyKey.DUST) ? "gregtech.fluid.liquid_generic" : "gregtech.fluid.generic", + FluidState.LIQUID); public static final FluidStorageKey GAS = new FluidStorageKey(gregtechId("gas"), MaterialIconType.gas, @@ -25,11 +27,13 @@ public final class FluidStorageKeys { return "gregtech.fluid.gas_generic"; } return "gregtech.fluid.generic"; - }); + }, + FluidState.GAS); public static final FluidStorageKey PLASMA = new FluidStorageKey(gregtechId("plasma"), MaterialIconType.plasma, - s -> "plasma." + s, m -> "gregtech.fluid.plasma"); + s -> "plasma." + s, m -> "gregtech.fluid.plasma", + FluidState.PLASMA); private FluidStorageKeys() {} } From 90c731ba030335c750292c80de3d9f13cdede985 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:22:39 -0600 Subject: [PATCH 40/77] Fix manual fluid generation issues (#2237) --- .../java/gregtech/api/fluids/store/FluidStorage.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorage.java b/src/main/java/gregtech/api/fluids/store/FluidStorage.java index 6c4a284d3ec..f9a232b0d27 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorage.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorage.java @@ -61,10 +61,11 @@ public void registerFluids(@NotNull Material material) { throw new IllegalStateException("FluidStorage has already been registered"); } - // if nothing is queued for registration, we need something for the registry to handle - // this will prevent cases of a material having a fluid property but no - // fluids actually created for the material. - if (toRegister.isEmpty()) { + // If nothing is queued for registration and nothing is manually stored, + // we need something for the registry to handle this will prevent cases + // of a material having a fluid property but no fluids actually created + // for the material. + if (toRegister.isEmpty() && map.isEmpty()) { enqueueRegistration(FluidStorageKeys.LIQUID, new FluidBuilder()); } From ea6a4890c89288ad189d284cea0a2da5f61a99be Mon Sep 17 00:00:00 2001 From: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:24:10 -0700 Subject: [PATCH 41/77] Fix a missed advancement with the new coil (#2232) --- .../gregtech/advancements/insane_voltage/58_hss_g_coil.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/gregtech/advancements/insane_voltage/58_hss_g_coil.json b/src/main/resources/assets/gregtech/advancements/insane_voltage/58_hss_g_coil.json index 0a7e9c71675..b09618d1568 100644 --- a/src/main/resources/assets/gregtech/advancements/insane_voltage/58_hss_g_coil.json +++ b/src/main/resources/assets/gregtech/advancements/insane_voltage/58_hss_g_coil.json @@ -25,5 +25,5 @@ } } }, - "parent": "gregtech:insane_voltage/57_tungstensteel_coil" + "parent": "gregtech:insane_voltage/57_rtm_alloy_coil" } From 351aeef187b91c6870b7d4112f70a22464e84bc4 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:24:44 -0600 Subject: [PATCH 42/77] Exclude scala modules from classpath (#2233) --- .editorconfig | 4 ++-- dependencies.gradle | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 14c3798da03..61a63aa508c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -58,9 +58,9 @@ ij_java_blank_lines_around_field_in_interface = 0 ij_java_blank_lines_around_initializer = 1 ij_java_blank_lines_around_method = 1 ij_java_blank_lines_around_method_in_interface = 1 -ij_java_blank_lines_before_class_end = 1 +ij_java_blank_lines_before_class_end = 0 ij_java_blank_lines_before_imports = 1 -ij_java_blank_lines_before_method_body = 1 +ij_java_blank_lines_before_method_body = 0 ij_java_blank_lines_before_package = 1 ij_java_block_brace_style = end_of_line ij_java_block_comment_add_space = false diff --git a/dependencies.gradle b/dependencies.gradle index ef3c505bd1d..3af530e782d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -63,5 +63,9 @@ configurations { exclude group: "net.sf.trove4j", module: "trove4j" // exclude javax.annotation from findbugs, jetbrains annotations are superior exclude group: "com.google.code.findbugs", module: "jsr305" + // exclude scala as we don't use it for anything and causes import confusion + exclude group: "org.scala-lang" + exclude group: "org.scala-lang.modules" + exclude group: "org.scala-lang.plugins" } } From 796c1b8898b39d444f5813bbe4ca3b1bbe92f07b Mon Sep 17 00:00:00 2001 From: iouter <62897714+iouter@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:28:27 +0800 Subject: [PATCH 43/77] update zh_cn.lang (#2225) --- .../resources/assets/gregtech/lang/zh_cn.lang | 1344 +++++++++-------- 1 file changed, 715 insertions(+), 629 deletions(-) diff --git a/src/main/resources/assets/gregtech/lang/zh_cn.lang b/src/main/resources/assets/gregtech/lang/zh_cn.lang index e807a2ac934..f410418bbce 100644 --- a/src/main/resources/assets/gregtech/lang/zh_cn.lang +++ b/src/main/resources/assets/gregtech/lang/zh_cn.lang @@ -112,37 +112,37 @@ gregtech.waila.progress_computation=计算进度:%s / %s gregtech.multiblock.title=多方块结构 gregtech.multiblock.primitive_blast_furnace.bronze.description=土高炉是(PBF)是个多方块结构。尽管它不是很快,却能在游戏前期为你的发展提供钢材。 -gregtech.multiblock.coke_oven.description=焦炉是个多方块结构,用于在早期生产焦炭和杂酚油。无需燃料即可工作,内部至多可容纳 32 桶杂酚油。其存储可通过焦炉仓进行访问。 +gregtech.multiblock.coke_oven.description=焦炉是个多方块结构,用于在早期生产焦炭和杂酚油。无需燃料即可工作,内部至多可容纳32桶杂酚油。其存储可通过焦炉仓进行访问。 gregtech.multiblock.vacuum_freezer.description=真空冷冻机是个多方块结构,主要用于热锭冷却。此外,它还可以冻结水等其他物质。 gregtech.multiblock.implosion_compressor.description=聚爆压缩机是个多方块结构,能够借助炸药将宝石粉转化为相应的宝石。 gregtech.multiblock.pyrolyse_oven.description=热解炉是种用于将原木处理为木炭、杂酚油、灰烬或重油的多方块结构。 gregtech.multiblock.cracker.description=石油裂化机是种用于将轻燃油和重燃油裂化为相应裂化物的多方块结构。 -gregtech.multiblock.large_combustion_engine.description=大型内燃引擎是种产出 EV 能量的多方块结构,工作方式与内燃发电机类似。 -gregtech.multiblock.extreme_combustion_engine.description=极限内燃引擎是种产出 IV 能量的多方块结构,工作方式与内燃发电机类似。 +gregtech.multiblock.large_combustion_engine.description=大型内燃引擎是种产出EV能量的多方块结构,工作方式与内燃发电机类似。 +gregtech.multiblock.extreme_combustion_engine.description=极限内燃引擎是种产出IV能量的多方块结构,工作方式与内燃发电机类似。 gregtech.multiblock.distillation_tower.description=蒸馏塔是种用于蒸馏不同石油及其副产品的多方块结构。 gregtech.multiblock.electric_blast_furnace.description=电力高炉(EBF)是种用来熔炼合金、熔化金属或冶炼矿石的多方块结构。也可用于获取高级的合金和金属,例如铝、不锈钢、钛或硅岩合金。 -gregtech.multiblock.multi_furnace.description=工业熔炉是种用于一次性烧制大量物品的多方块结构。不同级别的线圈会提供速度增幅和能量效率增幅。每次运作的基础烧制数量为 32,且可以使用高等级的线圈增加烧制数量。 +gregtech.multiblock.multi_furnace.description=工业熔炉是种用于一次性烧制大量物品的多方块结构。不同级别的线圈会提供速度增幅和能量效率增幅。每次运作的基础烧制数量为32,且可以使用高等级的线圈增加烧制数量。 gregtech.multiblock.large_boiler.description=大型锅炉是种使用水和能量源产生蒸汽的多方块结构。这里说的“能量源”通常是指固体燃料和高密度流体。不同等级的锅炉仅在蒸汽产量上有所差别。 gregtech.multiblock.large_turbine.description=大型涡轮是种使用蒸汽、燃气或等离子体转动涡轮转子来发电的多方块结构。转子效率和转子转速会影响能量的输出。 -gregtech.multiblock.assembly_line.description=装配线是台由 5 到 16 “片”相同的结构所组成的大型多方块机器。理论上讲,它就是个大号组装机,用以生产高级合成组件。 -gregtech.multiblock.fusion_reactor.luv.description=核聚变反应堆 MK-I 是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用 LuV,ZPM 或 UV 等级的能源仓。每个能源仓可增加 10M EU 的能量缓存,最大能量缓存为 160M EU。 -gregtech.multiblock.fusion_reactor.zpm.description=核聚变反应堆 MK-II 是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用 ZPM 或 UV 等级的能源仓。每个能源仓可增加 20M EU 的能量缓存,最大能量缓存为 320M EU。 -gregtech.multiblock.fusion_reactor.uv.description=核聚变反应堆 MK-III 是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用 UV 等级的能源仓。每个能源仓可增加 40M EU 的能量缓存,最大能量缓存为 640M EU。 +gregtech.multiblock.assembly_line.description=装配线是台由5到16“片”相同的结构所组成的大型多方块机器。理论上讲,它就是个大号组装机,用以生产高级合成组件。 +gregtech.multiblock.fusion_reactor.luv.description=核聚变反应堆MK-I是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用LuV,ZPM或UV等级的能源仓。每个能源仓可增加10MEU的能量缓存,最大能量缓存为160MEU。 +gregtech.multiblock.fusion_reactor.zpm.description=核聚变反应堆MK-II是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用ZPM或UV等级的能源仓。每个能源仓可增加20MEU的能量缓存,最大能量缓存为320MEU。 +gregtech.multiblock.fusion_reactor.uv.description=核聚变反应堆MK-III是台大型多方块机器,用于融合元素形成更重的元素。它仅可使用UV等级的能源仓。每个能源仓可增加40MEU的能量缓存,最大能量缓存为640MEU。 gregtech.multiblock.fusion_reactor.heat=热量:%s -gregtech.multiblock.large_chemical_reactor.description=大型化学反应釜能够以 100% 的能效进行化学反应。每次超频将使处理速度与能耗均提升 4 倍。该多方块机器需要在中心位置的聚四氟乙烯管道外壳旁放置一个白铜线圈方块。 -gregtech.multiblock.primitive_water_pump.description=原始水泵是台前蒸汽时代的多方块机器。它每秒收集一次水资源,基础收集量取决于其所处的生物群系。水泵输出仓以及 ULV 和 LV 的输出仓都可以使用,输出仓的等级越高,水资源收集量也会越多。收集量的公式为:生物群系系数 * 输出仓倍数。 +gregtech.multiblock.large_chemical_reactor.description=大型化学反应釜能够以100%的能效进行化学反应。每次超频将使处理速度与能耗均提升4倍。该多方块机器需要在中心位置的聚四氟乙烯管道外壳旁放置一个白铜线圈方块。 +gregtech.multiblock.primitive_water_pump.description=原始水泵是台前蒸汽时代的多方块机器。它每秒收集一次水资源,基础收集量取决于其所处的生物群系。水泵输出仓以及ULV和LV的输出仓都可以使用,输出仓的等级越高,水资源收集量也会越多。收集量的公式为:生物群系系数*输出仓倍数。 gregtech.multiblock.primitive_water_pump.extra1=生物群系系数:/n 海洋(Ocean)、河流(River):1000 L/s/n 沼泽(Swamp):800 L/s/n 丛林(Jungle):350 L/s/n 积雪的(Snowy):300 L/s/n 平原(Plains)、森林(Forest):250 L/s/n 针叶林(Taiga):175 L/s/n 沙滩(Beach):170 L/s/n 其他:100 L/s -gregtech.multiblock.primitive_water_pump.extra2=输出仓倍数:/n 水泵输出仓:1x/n ULV 输出仓:2x/n LV 输出仓:4x -gregtech.multiblock.processing_array.description=处理阵列可将最多 16 个单方块机器集成在一个多方块机器中,以实现更高效的自动化。 -gregtech.multiblock.advanced_processing_array.description=处理阵列可将最多 64 个单方块机器集成在一个多方块机器中,以实现更高效的自动化。 +gregtech.multiblock.primitive_water_pump.extra2=输出仓倍数:/n水泵输出仓:1x/nULV输出仓:2x/nLV输出仓:4x +gregtech.multiblock.processing_array.description=处理阵列可将最多16个单方块机器集成在一个多方块机器中,以实现更高效的自动化。 +gregtech.multiblock.advanced_processing_array.description=处理阵列可将最多64个单方块机器集成在一个多方块机器中,以实现更高效的自动化。 item.invalid.name=无效物品 fluid.empty=空 -gregtech.tooltip.hold_shift=按住 SHIFT 以获得更多信息 -gregtech.tooltip.hold_ctrl=按住 CTRL 以获得更多信息 -gregtech.tooltip.fluid_pipe_hold_shift=按住 SHIFT 以查看流体容器详情 -gregtech.tooltip.tool_fluid_hold_shift=按住 SHIFT 以查看流体容器及工具详情 +gregtech.tooltip.hold_shift=按住SHIFT以获得更多信息 +gregtech.tooltip.hold_ctrl=按住CTRL以获得更多信息 +gregtech.tooltip.fluid_pipe_hold_shift=按住SHIFT以查看流体容器详情 +gregtech.tooltip.tool_fluid_hold_shift=按住SHIFT以查看流体容器及工具详情 metaitem.generic.fluid_container.tooltip=%,d/%,dL %s metaitem.generic.electric_item.tooltip=%,d/%,d EU - %s级 @@ -320,24 +320,24 @@ metaitem.tool.lighter.platinum.tooltip=上面刻着一位知名的恶作剧大 metaitem.battery.hull.lv.name=小型电池外壳 -metaitem.battery.hull.lv.tooltip=一个空的§7 LV §7电池外壳 +metaitem.battery.hull.lv.tooltip=一个空的§7LV§7电池外壳 metaitem.battery.hull.mv.name=中型电池外壳 -metaitem.battery.hull.mv.tooltip=一个空的§b MV §7电池外壳 +metaitem.battery.hull.mv.tooltip=一个空的§bMV§7电池外壳 metaitem.battery.hull.hv.name=大型电池外壳 -metaitem.battery.hull.hv.tooltip=一个空的§6 HV §7电池外壳 +metaitem.battery.hull.hv.tooltip=一个空的§6HV§7电池外壳 metaitem.battery.hull.ev.name=小型钒电池外壳 -metaitem.battery.hull.ev.tooltip=一个空的§5 EV §7电池外壳 +metaitem.battery.hull.ev.tooltip=一个空的§5EV§7电池外壳 metaitem.battery.hull.iv.name=中型钒电池外壳 -metaitem.battery.hull.iv.tooltip=一个空的§1 IV §7电池外壳 +metaitem.battery.hull.iv.tooltip=一个空的§1IV§7电池外壳 metaitem.battery.hull.luv.name=大型钒电池外壳 -metaitem.battery.hull.luv.tooltip=一个空的§d LuV §r电池外壳 +metaitem.battery.hull.luv.tooltip=一个空的§dLuV§r电池外壳 metaitem.battery.hull.zpm.name=中型超能硅岩电池外壳 -metaitem.battery.hull.zpm.tooltip=一个空的§f ZPM §7电池外壳 +metaitem.battery.hull.zpm.tooltip=一个空的§fZPM§7电池外壳 metaitem.battery.hull.uv.name=大型超能硅岩电池外壳 -metaitem.battery.hull.uv.tooltip=一个空的§3 UV §7电池外壳 +metaitem.battery.hull.uv.tooltip=一个空的§3UV§7电池外壳 metaitem.battery.charge_time=§a最大供能时长:%,d%s -metaitem.battery.charge_detailed=%,d/%,d EU - %s级§7(§%c剩余供能时长:%,d%s§7) +metaitem.battery.charge_detailed=%,d/%,dEU-%s级§7(§%c剩余供能时长:%,d%s§7) metaitem.battery.charge_unit.second=秒 metaitem.battery.charge_unit.minute=分钟 metaitem.battery.charge_unit.hour=小时 @@ -394,134 +394,134 @@ metaitem.energy.cluster.tooltip=可充电电池 metaitem.max.battery.name=终极电池 metaitem.max.battery.tooltip=填满就能通关Minecraft -metaitem.electric.motor.lv.name=§7LV§r 电动马达 -metaitem.electric.motor.mv.name=§bMV§r 电动马达 -metaitem.electric.motor.hv.name=§6HV§r 电动马达 -metaitem.electric.motor.ev.name=§5EV§r 电动马达 -metaitem.electric.motor.iv.name=§1IV§r 电动马达 -metaitem.electric.motor.luv.name=§dLuV§r 电动马达 -metaitem.electric.motor.zpm.name=§cZPM§r 电动马达 -metaitem.electric.motor.uv.name=§3UV§r 电动马达 -metaitem.electric.motor.uhv.name=§4UHV§r 电动马达 -metaitem.electric.motor.uev.name=§aUEV§r 电动马达 -metaitem.electric.motor.uiv.name=§2UIV§r 电动马达 -metaitem.electric.motor.uxv.name=§eUXV§r 电动马达 -metaitem.electric.motor.opv.name=§9OpV§r 电动马达 - -metaitem.electric.pump.lv.name=§7LV§r 电动泵 -metaitem.electric.pump.mv.name=§bMV§r 电动泵 -metaitem.electric.pump.hv.name=§6HV§r 电动泵 -metaitem.electric.pump.ev.name=§5EV§r 电动泵 -metaitem.electric.pump.iv.name=§1IV§r 电动泵 -metaitem.electric.pump.luv.name=§dLuV§r 电动泵 -metaitem.electric.pump.zpm.name=§cZPM§r 电动泵 -metaitem.electric.pump.uv.name=§3UV§r 电动泵 -metaitem.electric.pump.uhv.name=§4UHV§r 电动泵 -metaitem.electric.pump.uev.name=§aUEV§r 电动泵 -metaitem.electric.pump.uiv.name=§2UIV§r 电动泵 -metaitem.electric.pump.uxv.name=§eUXV§r 电动泵 -metaitem.electric.pump.opv.name=§9OpV§r 电动泵 +metaitem.electric.motor.lv.name=§7LV§r电动马达 +metaitem.electric.motor.mv.name=§bMV§r电动马达 +metaitem.electric.motor.hv.name=§6HV§r电动马达 +metaitem.electric.motor.ev.name=§5EV§r电动马达 +metaitem.electric.motor.iv.name=§1IV§r电动马达 +metaitem.electric.motor.luv.name=§dLuV§r电动马达 +metaitem.electric.motor.zpm.name=§cZPM§r电动马达 +metaitem.electric.motor.uv.name=§3UV§r电动马达 +metaitem.electric.motor.uhv.name=§4UHV§r电动马达 +metaitem.electric.motor.uev.name=§aUEV§r电动马达 +metaitem.electric.motor.uiv.name=§2UIV§r电动马达 +metaitem.electric.motor.uxv.name=§eUXV§r电动马达 +metaitem.electric.motor.opv.name=§9OpV§r电动马达 + +metaitem.electric.pump.lv.name=§7LV§r电动泵 +metaitem.electric.pump.mv.name=§bMV§r电动泵 +metaitem.electric.pump.hv.name=§6HV§r电动泵 +metaitem.electric.pump.ev.name=§5EV§r电动泵 +metaitem.electric.pump.iv.name=§1IV§r电动泵 +metaitem.electric.pump.luv.name=§dLuV§r电动泵 +metaitem.electric.pump.zpm.name=§cZPM§r电动泵 +metaitem.electric.pump.uv.name=§3UV§r电动泵 +metaitem.electric.pump.uhv.name=§4UHV§r电动泵 +metaitem.electric.pump.uev.name=§aUEV§r电动泵 +metaitem.electric.pump.uiv.name=§2UIV§r电动泵 +metaitem.electric.pump.uxv.name=§eUXV§r电动泵 +metaitem.electric.pump.opv.name=§9OpV§r电动泵 metaitem.electric.pump.tooltip=作§f覆盖板§7时以特定速率传输§f流体§7。 -metaitem.fluid.regulator.lv.name=§7LV§r 流体校准器 -metaitem.fluid.regulator.mv.name=§bMV§r 流体校准器 -metaitem.fluid.regulator.hv.name=§6HV§r 流体校准器 -metaitem.fluid.regulator.ev.name=§5EV§r 流体校准器 -metaitem.fluid.regulator.iv.name=§1IV§r 流体校准器 -metaitem.fluid.regulator.luv.name=§dLuV§r 流体校准器 -metaitem.fluid.regulator.zpm.name=§cZPM§r 流体校准器 -metaitem.fluid.regulator.uv.name=§3UV§r 流体校准器 +metaitem.fluid.regulator.lv.name=§7LV§r流体校准器 +metaitem.fluid.regulator.mv.name=§bMV§r流体校准器 +metaitem.fluid.regulator.hv.name=§6HV§r流体校准器 +metaitem.fluid.regulator.ev.name=§5EV§r流体校准器 +metaitem.fluid.regulator.iv.name=§1IV§r流体校准器 +metaitem.fluid.regulator.luv.name=§dLuV§r流体校准器 +metaitem.fluid.regulator.zpm.name=§cZPM§r流体校准器 +metaitem.fluid.regulator.uv.name=§3UV§r流体校准器 metaitem.fluid.regulator.tooltip=§7作§f覆盖板§7时§7限制§f§f流体§7的流量。 -metaitem.conveyor.module.lv.name=§7LV§r 传送带 -metaitem.conveyor.module.mv.name=§bMV§r 传送带 -metaitem.conveyor.module.hv.name=§6HV§r 传送带 -metaitem.conveyor.module.ev.name=§5EV§r 传送带 -metaitem.conveyor.module.iv.name=§1IV§r 传送带 -metaitem.conveyor.module.luv.name=§dLuV§r 传送带 -metaitem.conveyor.module.zpm.name=§cZPM§r 传送带 -metaitem.conveyor.module.uv.name=§3UV§r 传送带 -metaitem.conveyor.module.uhv.name=§4UHV§r 传送带 -metaitem.conveyor.module.uev.name=§aUEV§r 传送带 -metaitem.conveyor.module.uiv.name=§2UIV§r 传送带 -metaitem.conveyor.module.uxv.name=§eUXV§r 传送带 -metaitem.conveyor.module.opv.name=§9OpV§r 传送带 +metaitem.conveyor.module.lv.name=§7LV§r传送带 +metaitem.conveyor.module.mv.name=§bMV§r传送带 +metaitem.conveyor.module.hv.name=§6HV§r传送带 +metaitem.conveyor.module.ev.name=§5EV§r传送带 +metaitem.conveyor.module.iv.name=§1IV§r传送带 +metaitem.conveyor.module.luv.name=§dLuV§r传送带 +metaitem.conveyor.module.zpm.name=§cZPM§r传送带 +metaitem.conveyor.module.uv.name=§3UV§r传送带 +metaitem.conveyor.module.uhv.name=§4UHV§r传送带 +metaitem.conveyor.module.uev.name=§aUEV§r传送带 +metaitem.conveyor.module.uiv.name=§2UIV§r传送带 +metaitem.conveyor.module.uxv.name=§eUXV§r传送带 +metaitem.conveyor.module.opv.name=§9OpV§r传送带 metaitem.conveyor.module.tooltip=作§f覆盖板§7时以特定速率传输§f物品§7。 -metaitem.electric.piston.lv.name=§7LV§r 电力活塞 -metaitem.electric.piston.mv.name=§bMV§r 电力活塞 -metaitem.electric.piston.hv.name=§6HV§r 电力活塞 -metaitem.electric.piston.ev.name=§5EV§r 电力活塞 -metaitem.electric.piston.iv.name=§1IV§r 电力活塞 -metaitem.electric.piston.luv.name=§dLuV§r 电力活塞 -metaitem.electric.piston.zpm.name=§cZPM§r 电力活塞 -metaitem.electric.piston.uv.name=§3UV§r 电力活塞 -metaitem.electric.piston.uhv.name=§4UHV§r 电力活塞 -metaitem.electric.piston.uev.name=§aUEV§r 电力活塞 -metaitem.electric.piston.uiv.name=§2UIV§r 电力活塞 -metaitem.electric.piston.uxv.name=§eUXV§r 电力活塞 -metaitem.electric.piston.opv.name=§9OpV§r 电力活塞 - -metaitem.robot.arm.lv.name=§7LV§r 机械臂 -metaitem.robot.arm.mv.name=§bMV§r 机械臂 -metaitem.robot.arm.hv.name=§6HV§r 机械臂 -metaitem.robot.arm.ev.name=§5EV§r 机械臂 -metaitem.robot.arm.iv.name=§1IV§r 机械臂 -metaitem.robot.arm.luv.name=§dLuV§r 机械臂 -metaitem.robot.arm.zpm.name=§cZPM§r 机械臂 -metaitem.robot.arm.uv.name=§3UV§r 机械臂 -metaitem.robot.arm.uhv.name=§4UHV§r 机械臂 -metaitem.robot.arm.uev.name=§aUEV§r 机械臂 -metaitem.robot.arm.uiv.name=§2UIV§r 机械臂 -metaitem.robot.arm.uxv.name=§eUXV§r 机械臂 -metaitem.robot.arm.opv.name=§9OpV§r 机械臂 +metaitem.electric.piston.lv.name=§7LV§r电力活塞 +metaitem.electric.piston.mv.name=§bMV§r电力活塞 +metaitem.electric.piston.hv.name=§6HV§r电力活塞 +metaitem.electric.piston.ev.name=§5EV§r电力活塞 +metaitem.electric.piston.iv.name=§1IV§r电力活塞 +metaitem.electric.piston.luv.name=§dLuV§r电力活塞 +metaitem.electric.piston.zpm.name=§cZPM§r电力活塞 +metaitem.electric.piston.uv.name=§3UV§r电力活塞 +metaitem.electric.piston.uhv.name=§4UHV§r电力活塞 +metaitem.electric.piston.uev.name=§aUEV§r电力活塞 +metaitem.electric.piston.uiv.name=§2UIV§r电力活塞 +metaitem.electric.piston.uxv.name=§eUXV§r电力活塞 +metaitem.electric.piston.opv.name=§9OpV§r电力活塞 + +metaitem.robot.arm.lv.name=§7LV§r机械臂 +metaitem.robot.arm.mv.name=§bMV§r机械臂 +metaitem.robot.arm.hv.name=§6HV§r机械臂 +metaitem.robot.arm.ev.name=§5EV§r机械臂 +metaitem.robot.arm.iv.name=§1IV§r机械臂 +metaitem.robot.arm.luv.name=§dLuV§r机械臂 +metaitem.robot.arm.zpm.name=§cZPM§r机械臂 +metaitem.robot.arm.uv.name=§3UV§r机械臂 +metaitem.robot.arm.uhv.name=§4UHV§r机械臂 +metaitem.robot.arm.uev.name=§aUEV§r机械臂 +metaitem.robot.arm.uiv.name=§2UIV§r机械臂 +metaitem.robot.arm.uxv.name=§eUXV§r机械臂 +metaitem.robot.arm.opv.name=§9OpV§r机械臂 metaitem.robot.arm.tooltip=作§f覆盖板§7时限制§f物品§7到特定数量。 -metaitem.field.generator.lv.name=§7LV§r 力场发生器 -metaitem.field.generator.mv.name=§bMV§r 力场发生器 -metaitem.field.generator.hv.name=§6HV§r 力场发生器 -metaitem.field.generator.ev.name=§5EV§r 力场发生器 -metaitem.field.generator.iv.name=§1IV§r 力场发生器 -metaitem.field.generator.luv.name=§dLuV§r 力场发生器 -metaitem.field.generator.zpm.name=§cZPM§r 力场发生器 -metaitem.field.generator.uv.name=§3UV§r 力场发生器 -metaitem.field.generator.uhv.name=§4UHV§r 力场发生器 -metaitem.field.generator.uev.name=§aUEV§r 力场发生器 -metaitem.field.generator.uiv.name=§2UIV§r 力场发生器 -metaitem.field.generator.uxv.name=§eUXV§r 力场发生器 -metaitem.field.generator.opv.name=§9OpV§r 力场发生器 - -metaitem.emitter.lv.name=§7LV§r 发射器 -metaitem.emitter.mv.name=§bMV§r 发射器 -metaitem.emitter.hv.name=§6HV§r 发射器 -metaitem.emitter.ev.name=§5EV§r 发射器 -metaitem.emitter.iv.name=§1IV§r 发射器 -metaitem.emitter.luv.name=§dLuV§r 发射器 -metaitem.emitter.zpm.name=§cZPM§r 发射器 -metaitem.emitter.uv.name=§3UV§r 发射器 -metaitem.emitter.uhv.name=§4UHV§r 发射器 -metaitem.emitter.uev.name=§aUEV§r 发射器 -metaitem.emitter.uiv.name=§2UIV§r 发射器 -metaitem.emitter.uxv.name=§eUXV§r 发射器 -metaitem.emitter.opv.name=§9OpV§r 发射器 - -metaitem.sensor.lv.name=§7LV§r 传感器 -metaitem.sensor.mv.name=§bMV§r 传感器 -metaitem.sensor.hv.name=§6HV§r 传感器 -metaitem.sensor.ev.name=§5EV§r 传感器 -metaitem.sensor.iv.name=§1IV§r 传感器 -metaitem.sensor.luv.name=§dLuV§r 传感器 -metaitem.sensor.zpm.name=§cZPM§r 传感器 -metaitem.sensor.uv.name=§3UV§r 传感器 -metaitem.sensor.uhv.name=§4UHV§r 传感器 -metaitem.sensor.uev.name=§aUEV§r 传感器 -metaitem.sensor.uiv.name=§2UIV§r 传感器 -metaitem.sensor.uxv.name=§eUXV§r 传感器 -metaitem.sensor.opv.name=§9OpV§r 传感器 +metaitem.field.generator.lv.name=§7LV§r力场发生器 +metaitem.field.generator.mv.name=§bMV§r力场发生器 +metaitem.field.generator.hv.name=§6HV§r力场发生器 +metaitem.field.generator.ev.name=§5EV§r力场发生器 +metaitem.field.generator.iv.name=§1IV§r力场发生器 +metaitem.field.generator.luv.name=§dLuV§r力场发生器 +metaitem.field.generator.zpm.name=§cZPM§r力场发生器 +metaitem.field.generator.uv.name=§3UV§r力场发生器 +metaitem.field.generator.uhv.name=§4UHV§r力场发生器 +metaitem.field.generator.uev.name=§aUEV§r力场发生器 +metaitem.field.generator.uiv.name=§2UIV§r力场发生器 +metaitem.field.generator.uxv.name=§eUXV§r力场发生器 +metaitem.field.generator.opv.name=§9OpV§r力场发生器 + +metaitem.emitter.lv.name=§7LV§r发射器 +metaitem.emitter.mv.name=§bMV§r发射器 +metaitem.emitter.hv.name=§6HV§r发射器 +metaitem.emitter.ev.name=§5EV§r发射器 +metaitem.emitter.iv.name=§1IV§r发射器 +metaitem.emitter.luv.name=§dLuV§r发射器 +metaitem.emitter.zpm.name=§cZPM§r发射器 +metaitem.emitter.uv.name=§3UV§r发射器 +metaitem.emitter.uhv.name=§4UHV§r发射器 +metaitem.emitter.uev.name=§aUEV§r发射器 +metaitem.emitter.uiv.name=§2UIV§r发射器 +metaitem.emitter.uxv.name=§eUXV§r发射器 +metaitem.emitter.opv.name=§9OpV§r发射器 + +metaitem.sensor.lv.name=§7LV§r传感器 +metaitem.sensor.mv.name=§bMV§r传感器 +metaitem.sensor.hv.name=§6HV§r传感器 +metaitem.sensor.ev.name=§5EV§r传感器 +metaitem.sensor.iv.name=§1IV§r传感器 +metaitem.sensor.luv.name=§dLuV§r传感器 +metaitem.sensor.zpm.name=§cZPM§r传感器 +metaitem.sensor.uv.name=§3UV§r传感器 +metaitem.sensor.uhv.name=§4UHV§r传感器 +metaitem.sensor.uev.name=§aUEV§r传感器 +metaitem.sensor.uiv.name=§2UIV§r传感器 +metaitem.sensor.uxv.name=§eUXV§r传感器 +metaitem.sensor.opv.name=§9OpV§r传感器 metaitem.tool.datastick.name=闪存 metaitem.tool.datastick.tooltip=一个小容量的数据存储器 @@ -633,37 +633,37 @@ metaitem.component.advanced_smd.resistor.tooltip=高级电子元件 metaitem.component.advanced_smd.inductor.name=高级贴片电感 metaitem.component.advanced_smd.inductor.tooltip=高级电子元件 -metaitem.wafer.highly_advanced_system_on_chip.name=HASoC 晶圆 +metaitem.wafer.highly_advanced_system_on_chip.name=HASoC晶圆 metaitem.wafer.highly_advanced_system_on_chip.tooltip=高度先进的电路原料 -metaitem.wafer.advanced_system_on_chip.name=ASoC 晶圆 +metaitem.wafer.advanced_system_on_chip.name=ASoC晶圆 metaitem.wafer.advanced_system_on_chip.tooltip=高级电路原料 metaitem.wafer.integrated_logic_circuit.name=集成逻辑电路晶圆 metaitem.wafer.integrated_logic_circuit.tooltip=集成电路原料 -metaitem.wafer.central_processing_unit.name=CPU 晶圆 +metaitem.wafer.central_processing_unit.name=CPU晶圆 metaitem.wafer.central_processing_unit.tooltip=中央处理器原料 -metaitem.wafer.high_power_integrated_circuit.name=HPIC 晶圆 +metaitem.wafer.high_power_integrated_circuit.name=HPIC晶圆 metaitem.wafer.high_power_integrated_circuit.tooltip=高功率集成电路原料 -metaitem.wafer.ultra_high_power_integrated_circuit.name=UHPIC 晶圆 +metaitem.wafer.ultra_high_power_integrated_circuit.name=UHPIC晶圆 metaitem.wafer.ultra_high_power_integrated_circuit.tooltip=超高功率集成电路原料 -metaitem.wafer.nand_memory_chip.name=NAND 晶圆 +metaitem.wafer.nand_memory_chip.name=NAND晶圆 metaitem.wafer.nand_memory_chip.tooltip=逻辑门原料 -metaitem.wafer.ultra_low_power_integrated_circuit.name=ULPIC 晶圆 +metaitem.wafer.ultra_low_power_integrated_circuit.name=ULPIC晶圆 metaitem.wafer.ultra_low_power_integrated_circuit.tooltip=超低功率集成电路原料 -metaitem.wafer.low_power_integrated_circuit.name=LPIC 晶圆 +metaitem.wafer.low_power_integrated_circuit.name=LPIC晶圆 metaitem.wafer.low_power_integrated_circuit.tooltip=低功率集成电路原料 -metaitem.wafer.power_integrated_circuit.name=PIC 晶圆 +metaitem.wafer.power_integrated_circuit.name=PIC晶圆 metaitem.wafer.power_integrated_circuit.tooltip=功率集成电路原料 -metaitem.wafer.nano_central_processing_unit.name=纳米 CPU 晶圆 +metaitem.wafer.nano_central_processing_unit.name=纳米CPU晶圆 metaitem.wafer.nano_central_processing_unit.tooltip=纳米电路原料 -metaitem.wafer.nor_memory_chip.name=NOR 晶圆 +metaitem.wafer.nor_memory_chip.name=NOR晶圆 metaitem.wafer.nor_memory_chip.tooltip=逻辑门原料 -metaitem.wafer.qbit_central_processing_unit.name=量子位 CPU 晶圆 +metaitem.wafer.qbit_central_processing_unit.name=量子位CPU晶圆 metaitem.wafer.qbit_central_processing_unit.tooltip=量子位电路原料 -metaitem.wafer.random_access_memory.name=RAM 晶圆 +metaitem.wafer.random_access_memory.name=RAM晶圆 metaitem.wafer.random_access_memory.tooltip=内存原料 -metaitem.wafer.system_on_chip.name=SoC 晶圆 +metaitem.wafer.system_on_chip.name=SoC晶圆 metaitem.wafer.system_on_chip.tooltip=基础电路原料 -metaitem.wafer.simple_system_on_chip.name=SSoC 晶圆 +metaitem.wafer.simple_system_on_chip.name=SSoC晶圆 metaitem.wafer.simple_system_on_chip.tooltip=简易电路原料 metaitem.engraved.crystal_chip.name=刻蚀水晶芯片 metaitem.engraved.crystal_chip.tooltip=晶体电路所需 @@ -673,9 +673,9 @@ metaitem.crystal.raw_chip.name=晶体芯片部件原料 metaitem.crystal.raw_chip.tooltip=晶体处理器部件原料 metaitem.engraved.lapotron_chip.name=刻蚀兰波顿芯片 -metaitem.crystal.central_processing_unit.name=晶体 CPU +metaitem.crystal.central_processing_unit.name=晶体CPU metaitem.crystal.central_processing_unit.tooltip=晶体处理器 -metaitem.crystal.system_on_chip.name=晶体 SoC +metaitem.crystal.system_on_chip.name=晶体SoC metaitem.crystal.system_on_chip.tooltip=晶体系统级芯片 metaitem.plate.advanced_system_on_chip.name=ASoC metaitem.plate.advanced_system_on_chip.tooltip=先进系统级芯片 @@ -691,7 +691,7 @@ metaitem.plate.ultra_high_power_integrated_circuit.name=UHPIC metaitem.plate.ultra_high_power_integrated_circuit.tooltip=超高功率集成电路 metaitem.plate.nand_memory_chip.name=NAND metaitem.plate.nand_memory_chip.tooltip=与非逻辑门 -metaitem.plate.nano_central_processing_unit.name=纳米 CPU +metaitem.plate.nano_central_processing_unit.name=纳米CPU metaitem.plate.nano_central_processing_unit.tooltip=纳米中央处理器 metaitem.plate.nor_memory_chip.name=NOR metaitem.plate.nor_memory_chip.tooltip=或非逻辑门 @@ -701,49 +701,49 @@ metaitem.plate.low_power_integrated_circuit.name=LPIC metaitem.plate.low_power_integrated_circuit.tooltip=低功率集成电路 metaitem.plate.power_integrated_circuit.name=PIC metaitem.plate.power_integrated_circuit.tooltip=功率集成电路 -metaitem.plate.qbit_central_processing_unit.name=量子位 CPU +metaitem.plate.qbit_central_processing_unit.name=量子位CPU metaitem.plate.qbit_central_processing_unit.tooltip=量子位中央处理器 metaitem.plate.random_access_memory.name=RAM metaitem.plate.random_access_memory.tooltip=随机存取存储器 metaitem.plate.system_on_chip.name=SoC metaitem.plate.system_on_chip.tooltip=系统级芯片 -metaitem.plate.simple_system_on_chip.name=简易 SoC +metaitem.plate.simple_system_on_chip.name=简易SoC metaitem.plate.simple_system_on_chip.tooltip=简易系统级芯片 # T1: Electronic metaitem.circuit.electronic.name=电子电路 -metaitem.circuit.electronic.tooltip=你的第一块电路/n§cLV 级电路 +metaitem.circuit.electronic.tooltip=你的第一块电路/n§cLV级电路 metaitem.circuit.good_electronic.name=优质电子电路 -metaitem.circuit.good_electronic.tooltip=你的第二块电路/n§cMV 级电路 +metaitem.circuit.good_electronic.tooltip=你的第二块电路/n§cMV级电路 # T2: Integrated metaitem.circuit.basic_integrated.name=集成逻辑电路 -metaitem.circuit.basic_integrated.tooltip=更小也更强/n§6LV 级电路 +metaitem.circuit.basic_integrated.tooltip=更小也更强/n§6LV级电路 metaitem.circuit.good_integrated.name=优质集成电路 -metaitem.circuit.good_integrated.tooltip=更小也更强/n§6MV 级电路 +metaitem.circuit.good_integrated.tooltip=更小也更强/n§6MV级电路 metaitem.circuit.advanced_integrated.name=进阶集成电路 -metaitem.circuit.advanced_integrated.tooltip=更小也更强/n§6HV 级电路 +metaitem.circuit.advanced_integrated.tooltip=更小也更强/n§6HV级电路 # Misc -metaitem.circuit.nand_chip.name=NAND 芯片 -metaitem.circuit.nand_chip.tooltip=卓越的简单电路/n§6ULV 级电路 +metaitem.circuit.nand_chip.name=NAND芯片 +metaitem.circuit.nand_chip.tooltip=卓越的简单电路/n§6ULV级电路 metaitem.circuit.microprocessor.name=微型处理器 -metaitem.circuit.microprocessor.tooltip=卓越的基础电路/n§eLV 级电路 +metaitem.circuit.microprocessor.tooltip=卓越的基础电路/n§eLV级电路 # T3: Processor metaitem.circuit.processor.name=集成处理器 -metaitem.circuit.processor.tooltip=运算速度惊人!/n§eMV 级电路 +metaitem.circuit.processor.tooltip=运算速度惊人!/n§eMV级电路 metaitem.circuit.assembly.name=集成处理器集群 -metaitem.circuit.assembly.tooltip=运算速度惊人!/n§eHV 级电路 +metaitem.circuit.assembly.tooltip=运算速度惊人!/n§eHV级电路 metaitem.circuit.workstation.name=工作站 -metaitem.circuit.workstation.tooltip=运算速度惊人!/n§eEV 级电路 +metaitem.circuit.workstation.tooltip=运算速度惊人!/n§eEV级电路 metaitem.circuit.mainframe.name=处理器主机 -metaitem.circuit.mainframe.tooltip=运算速度惊人!/n§eIV 级电路 +metaitem.circuit.mainframe.tooltip=运算速度惊人!/n§eIV级电路 # T4: Nano metaitem.circuit.nano_processor.name=纳米处理器 -metaitem.circuit.nano_processor.tooltip=比小更小/n§bHV 级电路 +metaitem.circuit.nano_processor.tooltip=比小更小/n§bHV级电路 metaitem.circuit.nano_assembly.name=纳米处理器集群 metaitem.circuit.nano_assembly.tooltip=比小更小/n§bEV级电路 metaitem.circuit.nano_computer.name=纳米超级计算机 @@ -753,33 +753,33 @@ metaitem.circuit.nano_mainframe.tooltip=比小更小/n§bLuV级电路 # T5: Quantum metaitem.circuit.quantum_processor.name=量子处理器 -metaitem.circuit.quantum_processor.tooltip=量子计算终成现实!/n§aEV 级电路 +metaitem.circuit.quantum_processor.tooltip=量子计算终成现实!/n§aEV级电路 metaitem.circuit.quantum_assembly.name=量子处理器集群 -metaitem.circuit.quantum_assembly.tooltip=量子计算终成现实!/n§aIV 级电路 +metaitem.circuit.quantum_assembly.tooltip=量子计算终成现实!/n§aIV级电路 metaitem.circuit.quantum_computer.name=量子超级计算机 -metaitem.circuit.quantum_computer.tooltip=量子计算终成现实!/n§aLuV 级电路 +metaitem.circuit.quantum_computer.tooltip=量子计算终成现实!/n§aLuV级电路 metaitem.circuit.quantum_mainframe.name=量子处理器主机 -metaitem.circuit.quantum_mainframe.tooltip=量子计算终成现实!/n§aZPM 级电路 +metaitem.circuit.quantum_mainframe.tooltip=量子计算终成现实!/n§aZPM级电路 # T6: Crystal metaitem.circuit.crystal_processor.name=晶体处理器 -metaitem.circuit.crystal_processor.tooltip=得益于晶体蚀刻技术/n§9IV 级电路 +metaitem.circuit.crystal_processor.tooltip=得益于晶体蚀刻技术/n§9IV级电路 metaitem.circuit.crystal_assembly.name=晶体处理器集群 -metaitem.circuit.crystal_assembly.tooltip=得益于晶体蚀刻技术/n§9LuV 级电路 +metaitem.circuit.crystal_assembly.tooltip=得益于晶体蚀刻技术/n§9LuV级电路 metaitem.circuit.crystal_computer.name=晶体超级计算机 -metaitem.circuit.crystal_computer.tooltip=得益于晶体蚀刻技术/n§9ZPM 级电路 +metaitem.circuit.crystal_computer.tooltip=得益于晶体蚀刻技术/n§9ZPM级电路 metaitem.circuit.crystal_mainframe.name=晶体处理器主机 -metaitem.circuit.crystal_mainframe.tooltip=得益于晶体蚀刻技术/n§9UV 级电路 +metaitem.circuit.crystal_mainframe.tooltip=得益于晶体蚀刻技术/n§9UV级电路 # T7: Wetware metaitem.circuit.wetware_processor.name=湿件处理器 -metaitem.circuit.wetware_processor.tooltip=祂在看我吗?/n§4LuV 级电路 +metaitem.circuit.wetware_processor.tooltip=祂在看我吗?/n§4LuV级电路 metaitem.circuit.wetware_assembly.name=湿件处理器集群 -metaitem.circuit.wetware_assembly.tooltip=可以玩Minecraft/n§4ZPM 级电路 +metaitem.circuit.wetware_assembly.tooltip=可以玩Minecraft/n§4ZPM级电路 metaitem.circuit.wetware_computer.name=湿件超级计算机 -metaitem.circuit.wetware_computer.tooltip=肉体与机器的终极结合/n§4UV 级电路 +metaitem.circuit.wetware_computer.tooltip=肉体与机器的终极结合/n§4UV级电路 metaitem.circuit.wetware_mainframe.name=湿件处理器主机 -metaitem.circuit.wetware_mainframe.tooltip=千载独步,惟公一人/n§4UHV 级电路 +metaitem.circuit.wetware_mainframe.tooltip=千载独步,惟公一人/n§4UHV级电路 metaitem.stem_cells.name=干细胞 metaitem.stem_cells.tooltip=智慧原料 @@ -802,6 +802,11 @@ metaitem.basic_tape.tooltip=强度不足,无法解决机械故障 metaitem.component.grinder.diamond.name=钻石研磨头 metaitem.component.grinder.tungsten.name=钨研磨头 +metaitem.minecart_wheels.iron.name=铁矿车车轮 +metaitem.minecart_wheels.iron.tooltip=让一切运转起来 +metaitem.minecart_wheels.steel.name=钢矿车车轮 +metaitem.minecart_wheels.steel.tooltip=让一切运转起来 + metaitem.quantumeye.name=量子之眼 metaitem.quantumeye.tooltip=改良的末影之眼 metaitem.quantumstar.name=量子之星 @@ -827,15 +832,15 @@ metaitem.cover.activity.detector_advanced.tooltip=作§f覆盖板§7时依照§f metaitem.cover.fluid.detector.name=流体探测覆盖板 metaitem.cover.fluid.detector.tooltip=作§f覆盖板§7时依照§f流体储量§7发出红石信号。 metaitem.cover.fluid.detector.advanced.name=进阶流体探测覆盖板 -metaitem.cover.fluid.detector.advanced.tooltip=作§f覆盖板§7时依照由 §fRS 锁存器§7控制的§f流体存储状态§7发出红石信号。 +metaitem.cover.fluid.detector.advanced.tooltip=作§f覆盖板§7时依照由§fRS锁存器§7控制的§f流体存储状态§7发出红石信号。 metaitem.cover.item.detector.name=物品探测覆盖板 metaitem.cover.item.detector.tooltip=作§f覆盖板§7时依照§f物品储量§7发出红石信号。 metaitem.cover.item.detector.advanced.name=进阶物品探测覆盖板 -metaitem.cover.item.detector.advanced.tooltip=作§f覆盖板§7时依照由 §fRS 锁存器§7控制的§f物品存储状态§7发出红石信号。 +metaitem.cover.item.detector.advanced.tooltip=作§f覆盖板§7时依照由§fRS锁存器§7控制的§f物品存储状态§7发出红石信号。 metaitem.cover.energy.detector.name=能量探测覆盖板 metaitem.cover.energy.detector.tooltip=作§f覆盖板§7时依照§f能量储量§7发出红石信号。 metaitem.cover.energy.detector.advanced.name=进阶能量探测覆盖板 -metaitem.cover.energy.detector.advanced.tooltip=作§f覆盖板§7时依照由 §fRS 锁存器§7控制的§f能量状态§7发出红石信号。 +metaitem.cover.energy.detector.advanced.tooltip=作§f覆盖板§7时依照由§fRS锁存器§7控制的§f能量状态§7发出红石信号。 metaitem.cover.fluid.voiding.name=流体销毁覆盖板 metaitem.cover.fluid.voiding.tooltip=作§f覆盖板§7时销毁§f流体§7。/n加装后使用§f软锤§7右击激活。 metaitem.cover.fluid.voiding.advanced.name=进阶流体销毁覆盖板 @@ -951,7 +956,7 @@ gt.tool.class.scythe=镰刀 gt.tool.class.shears=剪刀 gt.tool.class.knife=刀 gt.tool.class.butchery_knife=屠刀 -gt.tool.class.grafter=嫁接器 +gt.tool.class.grafter=剪枝器 gt.tool.class.plunger=搋子 item.gt.tool.sword.name=%s剑 @@ -1021,7 +1026,7 @@ item.gt.tool.harvest_level.4=§d哈氏合金 item.gt.tool.harvest_level.5=§9铿铀 item.gt.tool.harvest_level.6=§c中子素 -item.gt.tool.tooltip.repair_info=按住 SHIFT 以查看修复详情 +item.gt.tool.tooltip.repair_info=按住SHIFT以查看修复详情 item.gt.tool.tooltip.repair_material=可使用§a%s§f来修复 item.gt.tool.aoe.rows=行 @@ -1032,10 +1037,10 @@ metaitem.turbine_rotor.name=%s涡轮转子 metaitem.turbine_rotor.tooltip=供涡轮机使用的涡轮转子 metaitem.clipboard.name=写字板 -metaitem.clipboard.tooltip=可以在上面写东西。手持写字板右击墙面可放置,按住 SHIFT 后鼠标右击则可取下 +metaitem.clipboard.tooltip=可以在上面写东西。手持写字板右击墙面可放置,按住SHIFT后鼠标右击则可取下 -metaitem.behavior.mode_switch.tooltip=按住 SHIFT 鼠标右击以切换模式 +metaitem.behavior.mode_switch.tooltip=按住SHIFT鼠标右击以切换模式 metaitem.behavior.mode_switch.mode_switched=§e模式设置为:%s metaitem.behavior.mode_switch.current_mode=模式:%s @@ -1099,7 +1104,7 @@ metaitem.gravitation_engine.name=重力引擎单元 metaitem.tool.multiblock_builder.name=多方块构建器 metaitem.tool.multiblock_builder.tooltip=检查与建造你的多方块结构! -metaitem.tool.multiblock_builder.tooltip2=按住 SHIFT 键后右键单击多方块结构控制器以自动构建 +metaitem.tool.multiblock_builder.tooltip2=按住SHIFT键后右键单击多方块结构控制器以自动构建 metaarmor.nms.nightvision.enabled=纳米肌体™套装:夜视已启用 metaarmor.nms.nightvision.disabled=纳米肌体™套装:夜视已禁用 @@ -1160,11 +1165,11 @@ metaitem.fertilizer.name=肥料 metaitem.blacklight.name=黑光灯 metaitem.blacklight.tooltip=长波§d紫外线§7光源 -gui.widget.incrementButton.default_tooltip=按住 Shift,Ctrl 或两者来更改数量 +gui.widget.incrementButton.default_tooltip=按住Shift,Ctrl或两者来更改数量 gui.widget.recipeProgressWidget.default_tooltip=显示配方 gregtech.recipe_memory_widget.tooltip.1=§7左键点击可自动将该配方输入至合成格 -gregtech.recipe_memory_widget.tooltip.2=§7按住 Shift 并点击以锁定或解锁该配方 +gregtech.recipe_memory_widget.tooltip.2=§7按住Shift并点击以锁定或解锁该配方 cover.filter.blacklist.disabled=白名单 cover.filter.blacklist.enabled=黑名单 @@ -1176,9 +1181,9 @@ cover.ore_dictionary_filter.test_slot.matches=§a* %s cover.ore_dictionary_filter.test_slot.matches_not=§c* %s cover.ore_dictionary_filter.test_slot.no_oredict.matches=§a(无矿物词典) cover.ore_dictionary_filter.test_slot.no_oredict.matches_not=§c(无矿物词典) -cover.ore_dictionary_filter.status.err=§c%s 个错误 -cover.ore_dictionary_filter.status.err_warn=§c%s 个错误、%s 个警告 -cover.ore_dictionary_filter.status.warn=§7%s 个警告 +cover.ore_dictionary_filter.status.err=§c%s个错误 +cover.ore_dictionary_filter.status.err_warn=§c%s个错误、%s个警告 +cover.ore_dictionary_filter.status.warn=§7%s个警告 cover.ore_dictionary_filter.status.no_issues=§a无问题 cover.ore_dictionary_filter.status.explain=矿物过滤说明: @@ -1209,23 +1214,23 @@ cover.ore_dictionary_filter.preview.nonempty=非空值 cover.ore_dictionary_filter.preview.empty=空值 cover.ore_dictionary_filter.preview.error=错误! -cover.ore_dictionary_filter.compile.eof=** 表达式结尾 ** +cover.ore_dictionary_filter.compile.eof=**表达式结尾** cover.ore_dictionary_filter.compile.error.unexpected_eof=意外结束的表达式 -cover.ore_dictionary_filter.compile.error.unexpected_token=意外的标记 ‘%s’ -cover.ore_dictionary_filter.compile.error.unexpected_token_after_eof=表达式结束后出现意外标记 ‘%s’ +cover.ore_dictionary_filter.compile.error.unexpected_token=意外的标记‘%s’ +cover.ore_dictionary_filter.compile.error.unexpected_token_after_eof=表达式结束后出现意外标记‘%s’ cover.ore_dictionary_filter.compile.error.unexpected_compilation_flag=编译标志出现在了表达式中间 cover.ore_dictionary_filter.compile.error.empty_compilation_flag=没有给出编译标志 -cover.ore_dictionary_filter.compile.error.unknown_compilation_flag=未知的编译标志 ‘%s’ -cover.ore_dictionary_filter.compile.error.redundant_compilation_flag=编译标记 ‘%s’ 被写了两次 +cover.ore_dictionary_filter.compile.error.unknown_compilation_flag=未知的编译标志‘%s’ +cover.ore_dictionary_filter.compile.error.redundant_compilation_flag=编译标记‘%s’被写了两次 cover.ore_dictionary_filter.compile.error.eof_after_escape=在转义字符(‘\’)后结束表达式 -cover.ore_dictionary_filter.compile.error.invalid_char=无效字符 U+%s(‘%s’) +cover.ore_dictionary_filter.compile.error.invalid_char=无效字符U+%s(‘%s’) cover.ore_dictionary_filter.compile.warn.nested_negation=嵌套否定可能不够直观。可以考虑使用分组(())来消除歧义。 cover.ore_dictionary_filter.compile.warn.consecutive_negation=连续否定可能不够直观。请检查评估结果是否理想。 cover.fluid_filter.title=流体过滤 -cover.fluid_filter.config_amount=向上或向下滚动鼠标滚轮以增加或减少流体量。/nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]/n亦可通过右击或左击来增减流体量。/n按住 Shift 时点击鼠标则将使流体量翻倍或减半。/n点击中键以清除 +cover.fluid_filter.config_amount=向上或向下滚动鼠标滚轮以增加或减少流体量。/nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]/n亦可通过右击或左击来增减流体量。/n按住Shift时点击鼠标则将使流体量翻倍或减半。/n点击中键以清除 cover.fluid_filter.mode.filter_fill=过滤输入 cover.fluid_filter.mode.filter_drain=过滤输出 cover.fluid_filter.mode.filter_both=过滤两者 @@ -1252,6 +1257,9 @@ cover.voiding.tooltip=§c警告!§7“启用”时所有流体和物品全部 cover.voiding.message.disabled=已禁用销毁覆盖板 cover.voiding.message.enabled=已启用销毁覆盖板 +cover.shutter.message.disabled=扇板已禁用 +cover.shutter.message.enabled=扇板已启用 + cover.smart_item_filter.title=智能物品过滤 cover.smart_item_filter.filtering_mode.electrolyzer=电解机 cover.smart_item_filter.filtering_mode.centrifuge=离心机 @@ -1312,20 +1320,25 @@ cover.ender_fluid_link.private.tooltip.disabled=切换至私有储罐模式/n私 cover.ender_fluid_link.private.tooltip.enabled=切换至公共储罐模式 cover.ender_fluid_link.incomplete_hex=输入的颜色不正确!/n输入正确的八位十六进制颜色码方可应用/n此时关闭界面将导致丢失编辑内容! +cover.generic.advanced_detector.latched=锁存 +cover.generic.advanced_detector.continuous=线性 +cover.generic.advanced_detector.latch_tooltip=更改此覆盖板的红石行为。/n§e线性§7 - 默认值;物品数量小于最小值时不发出红石信号,大于最大值时发出信号强度15的红石信号,数量介于二者之间发出信号强度在0 - 15之间的红石信号/n§e锁存§7 - 发出满级红石信号,直到物品数量大于最大值;然后停止发出红石信号,直到数量低于最小值。 +cover.generic.advanced_detector.invert_label=红石输出: +cover.generic.advanced_detector.latch_label=行为: +cover.generic.advanced_detector.invert_tooltip=切换以反转红石逻辑 + cover.advanced_energy_detector.label=进阶能量探测覆盖板 cover.advanced_energy_detector.min=最小: cover.advanced_energy_detector.max=最大: -cover.advanced_energy_detector.invert_tooltip=启用反相以反转红石逻辑/n默认情况下,能量小于所设定的最小 EU 时覆盖板将发出红石信号,大于最大 EU 时则停止发出红石信号 -cover.advanced_energy_detector.invert_label=反相: +cover.advanced_energy_detector.invert_tooltip=启用反相以反转红石逻辑/n默认情况下,能量小于所设定的最小EU时覆盖板将发出红石信号,大于最大EU时则停止发出红石信号 cover.advanced_energy_detector.normal=普通 cover.advanced_energy_detector.inverted=反相 -cover.advanced_energy_detector.modes_tooltip=使用 EU 的离散值或百分比来比较所附着的能量存储中能量的最大/最小值。 +cover.advanced_energy_detector.modes_tooltip=使用给定的EU数值或百分比来比较所附着的能量存储中能量的最大/最小值。 cover.advanced_energy_detector.modes_label=模式: -cover.advanced_energy_detector.mode_eu=EU离散值 +cover.advanced_energy_detector.mode_eu=EU设定值 cover.advanced_energy_detector.mode_percent=百分比 cover.advanced_fluid_detector.label=进阶流体探测器 -cover.advanced_fluid_detector.invert_tooltip=启用反相以反转红石逻辑/n默认情况下,流体量处于所设定的最小值和最大值之间时覆盖板将发出红石信号,小于最小值时则停止发出红石信号 cover.advanced_fluid_detector.max=最大流体量: cover.advanced_fluid_detector.min=最小流体量: cover.advanced_item_detector.label=进阶物品探测器 @@ -1418,16 +1431,16 @@ item.material.oreprefix.pipeSmallRestrictive=小型加固%s物品管道 item.material.oreprefix.pipeNormalRestrictive=加固%s物品管道 item.material.oreprefix.pipeLargeRestrictive=大型加固%s物品管道 item.material.oreprefix.pipeHugeRestrictive=巨型加固%s物品管道 -item.material.oreprefix.wireGtHex=16x %s导线 -item.material.oreprefix.wireGtOctal=8x %s导线 -item.material.oreprefix.wireGtQuadruple=4x %s导线 -item.material.oreprefix.wireGtDouble=2x %s导线 -item.material.oreprefix.wireGtSingle=1x %s导线 -item.material.oreprefix.cableGtHex=16x %s线缆 -item.material.oreprefix.cableGtOctal=8x %s线缆 -item.material.oreprefix.cableGtQuadruple=4x %s线缆 -item.material.oreprefix.cableGtDouble=2x %s线缆 -item.material.oreprefix.cableGtSingle=1x %s线缆 +item.material.oreprefix.wireGtHex=16x%s导线 +item.material.oreprefix.wireGtOctal=8x%s导线 +item.material.oreprefix.wireGtQuadruple=4x%s导线 +item.material.oreprefix.wireGtDouble=2x%s导线 +item.material.oreprefix.wireGtSingle=1x%s导线 +item.material.oreprefix.cableGtHex=16x%s线缆 +item.material.oreprefix.cableGtOctal=8x%s线缆 +item.material.oreprefix.cableGtQuadruple=4x%s线缆 +item.material.oreprefix.cableGtDouble=2x%s线缆 +item.material.oreprefix.cableGtSingle=1x%s线缆 item.material.oreprefix.polymer.plate=%s片 item.material.oreprefix.polymer.foil=薄%s片 item.material.oreprefix.polymer.nugget=%s颗粒 @@ -1581,47 +1594,47 @@ gregtech.material.andradite=钙铁榴石 gregtech.material.annealed_copper=退火铜 gregtech.material.asbestos=石棉 gregtech.material.ash=灰烬 -gregtech.material.banded_iron=带状铁 +gregtech.material.banded_iron=带状铁矿 gregtech.material.battery_alloy=电池合金 gregtech.material.blue_topaz=蓝黄玉 gregtech.material.bone=骨头 gregtech.material.brass=黄铜 gregtech.material.bronze=青铜 -gregtech.material.brown_limonite=棕褐铁 +gregtech.material.brown_limonite=棕褐铁矿 gregtech.material.calcite=方解石 gregtech.material.cassiterite=锡石 gregtech.material.cassiterite_sand=锡石矿砂 -gregtech.material.chalcopyrite=黄铜 +gregtech.material.chalcopyrite=黄铜矿 gregtech.material.charcoal=木炭 -gregtech.material.chromite=铬铁 +gregtech.material.chromite=铬铁矿 gregtech.material.chromium_dioxide=二氧化铬 gregtech.material.cinnabar=朱砂 gregtech.material.water=水 gregtech.material.liquid_oxygen=液氧 gregtech.material.coal=煤炭 -gregtech.material.cobaltite=辉钴 -gregtech.material.cooperite=谢尔顿 +gregtech.material.cobaltite=辉钴矿 +gregtech.material.cooperite=谢尔顿矿 gregtech.material.cupronickel=白铜 gregtech.material.dark_ash=黑色灰烬 gregtech.material.diamond=钻石 gregtech.material.electrum=琥珀金 gregtech.material.emerald=绿宝石 -gregtech.material.galena=方铅 -gregtech.material.garnierite=硅镁镍 +gregtech.material.galena=方铅矿 +gregtech.material.garnierite=硅镁镍矿 gregtech.material.green_sapphire=绿色蓝宝石 gregtech.material.grossular=钙铝榴石 gregtech.material.ice=冰 -gregtech.material.ilmenite=钛铁 +gregtech.material.ilmenite=钛铁矿 gregtech.material.rutile=金红石 -gregtech.material.bauxite=铝土 +gregtech.material.bauxite=铝土矿 gregtech.material.invar=殷钢 -gregtech.material.kanthal=坎塔尔 +gregtech.material.kanthal=坎塔尔合金 gregtech.material.lazurite=蓝金石 gregtech.material.liquid_helium=液氦 gregtech.material.magnalium=镁铝合金 -gregtech.material.magnesite=菱镁 -gregtech.material.magnetite=磁铁 -gregtech.material.molybdenite=辉钼 +gregtech.material.magnesite=菱镁矿 +gregtech.material.magnetite=磁铁矿 +gregtech.material.molybdenite=辉钼矿 gregtech.material.nichrome=镍铬合金 gregtech.material.niobium_nitride=氮化铌 gregtech.material.niobium_titanium=铌钛合金 @@ -1632,9 +1645,9 @@ gregtech.material.rose_gold=玫瑰金 gregtech.material.black_bronze=黑青铜 gregtech.material.bismuth_bronze=铋青铜 gregtech.material.biotite=黑云母 -gregtech.material.powellite=钼钨钙 -gregtech.material.pyrite=黄铁 -gregtech.material.pyrolusite=软锰 +gregtech.material.powellite=钼钨钙矿 +gregtech.material.pyrite=黄铁矿 +gregtech.material.pyrolusite=软锰矿 gregtech.material.pyrope=镁铝榴石 gregtech.material.rock_salt=岩盐 gregtech.material.ruridit=钌铱合金 @@ -1643,29 +1656,29 @@ gregtech.material.ruby=红宝石 gregtech.material.salt=盐 gregtech.material.saltpeter=硝石 gregtech.material.sapphire=蓝宝石 -gregtech.material.scheelite=白钨 +gregtech.material.scheelite=白钨矿 gregtech.material.sodalite=方钠石 gregtech.material.aluminium_sulfite=亚硫酸铝 -gregtech.material.tantalite=钽铁 +gregtech.material.tantalite=钽铁矿 gregtech.material.coke=焦煤 gregtech.material.soldering_alloy=焊锡 gregtech.material.spessartine=锰铝榴石 -gregtech.material.sphalerite=闪锌 +gregtech.material.sphalerite=闪锌矿 gregtech.material.stainless_steel=不锈钢 gregtech.material.steel=钢 -gregtech.material.stibnite=辉锑 -gregtech.material.tetrahedrite=黝铜 +gregtech.material.stibnite=辉锑矿 +gregtech.material.tetrahedrite=黝铜矿 gregtech.material.tin_alloy=锡铁合金 gregtech.material.topaz=黄玉 gregtech.material.tungstate=钨酸锂 gregtech.material.ultimet=哈氏合金 -gregtech.material.uraninite=晶质铀 +gregtech.material.uraninite=晶质铀矿 gregtech.material.uvarovite=钙铬榴石 gregtech.material.vanadium_gallium=钒镓合金 gregtech.material.wrought_iron=锻铁 gregtech.material.wulfenite=钼铅矿 -gregtech.material.yellow_limonite=黄褐铁 +gregtech.material.yellow_limonite=黄褐铁矿 gregtech.material.yttrium_barium_cuprate=钇钡铜氧化物 gregtech.material.nether_quartz=下界石英 gregtech.material.certus_quartz=赛特斯石英 @@ -1676,8 +1689,8 @@ gregtech.material.tungstic_acid=钨酸 gregtech.material.osmiridium=铱锇合金 gregtech.material.calcium_chloride=氯化钙 gregtech.material.lithium_chloride=氯化锂 -gregtech.material.bornite=斑铜 -gregtech.material.chalcocite=辉铜 +gregtech.material.bornite=斑铜矿 +gregtech.material.chalcocite=辉铜矿 gregtech.material.gallium_arsenide=砷化镓 gregtech.material.potash=钾碱 @@ -1698,7 +1711,7 @@ gregtech.material.sodium_bicarbonate=碳酸氢钠 gregtech.material.potassium_dichromate=重铬酸钾 gregtech.material.chromium_trioxide=三氧化铬 gregtech.material.antimony_trioxide=三氧化二锑 -gregtech.material.zincite=红锌 +gregtech.material.zincite=红锌矿 gregtech.material.cupric_oxide=氧化铜 gregtech.material.cobalt_oxide=氧化钴 gregtech.material.arsenic_trioxide=三氧化二砷 @@ -1707,8 +1720,8 @@ gregtech.material.ferrosilite=铁辉石 gregtech.material.metal_mixture=金属混合物 gregtech.material.sodium_hydroxide=氢氧化钠 gregtech.material.sodium_persulfate=过硫酸钠 -gregtech.material.bastnasite=氟碳镧铈 -gregtech.material.pentlandite=镍黄铁 +gregtech.material.bastnasite=氟碳镧铈矿 +gregtech.material.pentlandite=镍黄铁矿 gregtech.material.spodumene=锂辉石 gregtech.material.lepidolite=锂云母 gregtech.material.glauconite_sand=海绿石矿砂 @@ -1775,6 +1788,7 @@ gregtech.material.antimony_trifluoride=三氟化锑 gregtech.material.enriched_naquadah_sulfate=硫酸富集硅岩 gregtech.material.naquadria_sulfate=硫酸超能硅岩 gregtech.material.pyrochlore=烧绿石 +gregtech.material.rtm_alloy=钌钨钼合金 # Organic Chemistry Materials @@ -2015,7 +2029,7 @@ gregtech.material.quartz_sand=石英砂 gregtech.material.pollucite=铯榴石 gregtech.material.bentonite=膨润土 gregtech.material.fullers_earth=漂白土 -gregtech.material.pitchblende=沥青铀 +gregtech.material.pitchblende=沥青铀矿 gregtech.material.monazite=独居石 gregtech.material.mirabilite=芒硝 gregtech.material.trona=天然碱 @@ -2189,7 +2203,7 @@ item.gregtech.material.pitchblende.dustTiny=小撮沥青铀矿 item.gregtech.material.pitchblende.dustSmall=小堆沥青铀矿 item.gregtech.material.pitchblende.dustImpure=含杂沥青铀矿 item.gregtech.material.pitchblende.dustPure=纯净沥青铀矿 -item.gregtech.material.pitchblende.dust=沥青铀 +item.gregtech.material.pitchblende.dust=沥青铀矿 item.gregtech.material.talc.crushedCentrifuged=离心滑石 item.gregtech.material.talc.crushedPurified=纯净滑石 item.gregtech.material.talc.crushed=精研滑石 @@ -2344,8 +2358,8 @@ metaitem.prospector.hv.name=电动勘探扫描仪(HV) metaitem.prospector.luv.name=电动勘探扫描仪(LuV) metaitem.prospector.mode.ores=§a矿物勘探模式 metaitem.prospector.mode.fluid=§b流体勘探模式 -metaitem.prospector.tooltip.ores=在半径为 %s 个区块的范围内扫描矿物 -metaitem.prospector.tooltip.fluids=在半径为 %s 个区块的范围内扫描矿物与流体 +metaitem.prospector.tooltip.ores=在半径为%s个区块的范围内扫描矿物 +metaitem.prospector.tooltip.fluids=在半径为%s个区块的范围内扫描矿物与流体 behavior.prospector.not_enough_energy=能量不足! behavior.prospector.added_waypoint=路径点已添加! @@ -2353,12 +2367,12 @@ metaitem.tricorder_scanner.name=便携式扫描仪 metaitem.tricorder_scanner.tooltip=三录仪 metaitem.debug_scanner.name=调试扫描仪 metaitem.debug_scanner.tooltip=三录仪 -behavior.tricorder.position=----- X:%s Y:%s Z:%s D:%s ----- -behavior.tricorder.block_hardness=硬度:%s 爆炸抗性:%s -behavior.tricorder.block_name=名称:%s 元数据:%s +behavior.tricorder.position=----- X:%s;Y:%s;Z:%s;D:%s ----- +behavior.tricorder.block_hardness=硬度:%s;爆炸抗性:%s +behavior.tricorder.block_name=名称:%s;元数据:%s behavior.tricorder.state=%s:%s behavior.tricorder.divider========================== -behavior.tricorder.tank=流体储量(槽位 %s):%s L / %s L %s +behavior.tricorder.tank=流体储量(槽位%s):%s L / %s L %s behavior.tricorder.tanks_empty=未存储流体 behavior.tricorder.muffled=已静音。 behavior.tricorder.machine_disabled=已停止。 @@ -2370,8 +2384,8 @@ behavior.tricorder.energy_container_storage=电量:%s EU / %s EU behavior.tricorder.bedrock_fluid.amount=流体蕴含量:%s %s - %s%% behavior.tricorder.bedrock_fluid.amount_unknown=流体蕴含量:%s%% behavior.tricorder.bedrock_fluid.nothing=流体蕴含量:§6无§r -behavior.tricorder.eut_per_sec=最后一秒%s EU/t -behavior.tricorder.amp_per_sec=最后一秒 %sA +behavior.tricorder.eut_per_sec=最后一秒 %s EU/t +behavior.tricorder.amp_per_sec=最后一秒 %s A behavior.tricorder.workable_progress=处理进度:%s s / %s s behavior.tricorder.workable_stored_energy=电量缓存:%s EU / %s EU behavior.tricorder.workable_consumption=预计耗能:%s EU/t,%s A @@ -2380,13 +2394,13 @@ behavior.tricorder.multiblock_energy_input=最大输入:%s EU/t,电压等级 behavior.tricorder.multiblock_energy_output=最大输出:%s EU/t,电压等级 %s behavior.tricorder.multiblock_maintenance=故障:%s behavior.tricorder.multiblock_parallel=并行处理:%s -behavior.tricorder.debug_machine=元 ID:%s +behavior.tricorder.debug_machine=元ID:%s behavior.tricorder.debug_machine_valid= 有效 behavior.tricorder.debug_machine_invalid= 无效! behavior.tricorder.debug_machine_invalid_null=无效!MetaTileEntity == null! -behavior.tricorder.debug_cpu_load=%2$s 刻内平均 CPU 负载约 %1$sns,最差情况为 %sns。 -behavior.tricorder.debug_cpu_load_seconds=负载秒数为 %s 秒。 -behavior.tricorder.debug_lag_count=已在服务器中造成 %s 次延迟尖峰警告(任何大于 %sms 的情况)。 +behavior.tricorder.debug_cpu_load=%2$s刻内平均CPU负载约%1$sns,最差情况为%sns。 +behavior.tricorder.debug_cpu_load_seconds=负载秒数为%s秒。 +behavior.tricorder.debug_lag_count=已在服务器中造成%s次延迟尖峰警告(任何大于%sms的情况)。 metaitem.item_magnet.lv.name=低压物品磁铁 metaitem.item_magnet.hv.name=高压物品磁铁 @@ -2415,7 +2429,7 @@ metaitem.plugin.tooltips.1=可为屏幕安装插件以实现更多功能。 metaitem.plugin.proxy.tooltips.1=(请将屏幕调整为代理模式) metaitem.plugin.text.name=文本插件 metaitem.plugin.online_pic.name=在线图片插件 -metaitem.plugin.fake_gui.name=GUI 代理插件 +metaitem.plugin.fake_gui.name=GUI代理插件 metaitem.plugin.advanced_monitor.name=高级监控器代理插件 metaitem.cover.digital.name=数字接口 metaitem.cover.digital.tooltip=作§f覆盖板§7时可借助§f能量线缆§7将机器接入§f中央监控器§7。 @@ -2431,7 +2445,7 @@ tile.casing.ev=§5EV§r机械方块 tile.casing.iv=§1IV§r机械方块 # Wire coil blocks -tile.wire_coil.tooltip_extended_info=按住 SHIFT 获得更多线圈信息 +tile.wire_coil.tooltip_extended_info=按住SHIFT获得更多线圈信息 tile.wire_coil.tooltip_heat=§c基础热容:§f%,d K tile.wire_coil.tooltip_smelter=§8多重冶炼炉: tile.wire_coil.tooltip_parallel_smelter= §5最大并行处理配方数:§e%s§7 @@ -2444,7 +2458,7 @@ tile.wire_coil.tooltip_energy_cracking= §a能量消耗:§f%s%% tile.wire_coil.cupronickel.name=白铜线圈方块 tile.wire_coil.kanthal.name=坎塔尔合金线圈方块 tile.wire_coil.nichrome.name=镍铬合金线圈方块 -tile.wire_coil.tungstensteel.name=钨钢线圈方块 +tile.wire_coil.rtm_alloy.name=钌钨钼合金线圈方块 tile.wire_coil.hss_g.name=高速钢-G线圈方块 tile.wire_coil.naquadah.name=硅岩线圈方块 tile.wire_coil.trinium.name=凯金线圈方块 @@ -2477,6 +2491,58 @@ tile.warning_sign_1.causality_hazard.name=非标准因果律危害警示方块 tile.warning_sign_1.automated_defenses_hazard.name=自动化防御设施危害警示方块 tile.warning_sign_1.high_pressure_hazard.name=高压力危害警示方块 +# Decorative Metal Sheets +tile.metal_sheet.white.name=白色金属板方块 +tile.metal_sheet.orange.name=橘色金属板方块 +tile.metal_sheet.magenta.name=品红色金属板方块 +tile.metal_sheet.light_blue.name=淡蓝色金属板方块 +tile.metal_sheet.yellow.name=黄色金属板方块 +tile.metal_sheet.lime.name=黄绿色金属板方块 +tile.metal_sheet.pink.name=粉红色金属板方块 +tile.metal_sheet.gray.name=灰色金属板方块 +tile.metal_sheet.silver.name=淡灰色金属板方块 +tile.metal_sheet.cyan.name=青色金属板方块 +tile.metal_sheet.purple.name=紫色金属板方块 +tile.metal_sheet.blue.name=蓝色金属板方块 +tile.metal_sheet.brown.name=棕色金属板方块 +tile.metal_sheet.green.name=绿色金属板方块 +tile.metal_sheet.red.name=红色金属板方块 +tile.metal_sheet.black.name=黑色金属板方块 + +tile.large_metal_sheet.white.name=白色粗纹金属板方块 +tile.large_metal_sheet.orange.name=橘色粗纹金属板方块 +tile.large_metal_sheet.magenta.name=品红色粗纹金属板方块 +tile.large_metal_sheet.light_blue.name=淡蓝色粗纹金属板方块 +tile.large_metal_sheet.yellow.name=黄色粗纹金属板方块 +tile.large_metal_sheet.lime.name=黄绿色粗纹金属板方块 +tile.large_metal_sheet.pink.name=粉红色粗纹金属板方块 +tile.large_metal_sheet.gray.name=灰色粗纹金属板方块 +tile.large_metal_sheet.silver.name=淡灰色粗纹金属板方块 +tile.large_metal_sheet.cyan.name=青色粗纹金属板方块 +tile.large_metal_sheet.purple.name=紫色粗纹金属板方块 +tile.large_metal_sheet.blue.name=蓝色粗纹金属板方块 +tile.large_metal_sheet.brown.name=棕色粗纹金属板方块 +tile.large_metal_sheet.green.name=绿色粗纹金属板方块 +tile.large_metal_sheet.red.name=红色粗纹金属板方块 +tile.large_metal_sheet.black.name=黑色粗纹金属板方块 + +tile.studs.white.name=白色橡胶混凝土 +tile.studs.orange.name=橘色橡胶混凝土 +tile.studs.magenta.name=品红色橡胶混凝土 +tile.studs.light_blue.name=淡蓝色橡胶混凝土 +tile.studs.yellow.name=黄色橡胶混凝土 +tile.studs.lime.name=黄绿色橡胶混凝土 +tile.studs.pink.name=粉红色橡胶混凝土 +tile.studs.gray.name=灰色橡胶混凝土 +tile.studs.silver.name=淡灰色橡胶混凝土 +tile.studs.cyan.name=青色橡胶混凝土 +tile.studs.purple.name=紫色橡胶混凝土 +tile.studs.blue.name=蓝色橡胶混凝土 +tile.studs.brown.name=棕色橡胶混凝土 +tile.studs.green.name=绿色橡胶混凝土 +tile.studs.red.name=红色橡胶混凝土 +tile.studs.black.name=黑色橡胶混凝土 + # Lamps(ON) tile.gregtech_lamp.white.name=白色灯 tile.gregtech_lamp.orange.name=橙色灯 @@ -4033,8 +4099,8 @@ gregtech.machine.transformer.tooltip_transform_down=§a降压:§f%dA %d EU(% gregtech.machine.transformer.message_transform_down=已切换为降压模式,输入:%d EU %dA,输出:%d EU %dA gregtech.machine.transformer.tooltip_transform_up=§c升压:§f%dA %d EU(%s§f)-> %dA %d EU(%s§f) gregtech.machine.transformer.message_transform_up=已切换为升压模式,输入:%d EU %dA,输出:%d EU %dA -gregtech.machine.transformer_adjustable.tooltip_tool_usage=默认为 §f4 安§7。使用螺丝刀来轮换电流设定 -gregtech.machine.transformer_adjustable.message_adjust=已将高电流及低电流分别调整至%d EU %dA 及 %d EU %dA +gregtech.machine.transformer_adjustable.tooltip_tool_usage=默认为§f4安§7。使用螺丝刀来轮换电流设定 +gregtech.machine.transformer_adjustable.message_adjust=已将高电流及低电流分别调整至%d EU %dA及%d EU %dA gregtech.machine.transformer.ulv.name=超低压变压器(§8ULV§r) gregtech.machine.transformer.lv.name=低压变压器(§7LV§r) @@ -4085,7 +4151,7 @@ gregtech.machine.transformer.adjustable.opv.name=过载压高能变压器(§9O gregtech.machine.diode.message=电流吞吐上限:%s gregtech.machine.diode.tooltip_tool_usage=手持软锤右击以调节电流。 gregtech.machine.diode.tooltip_general=使能量作单向传输并限制电流 -gregtech.machine.diode.tooltip_starts_at=默认为 §f1A§7,使用软锤来轮换电流设定 +gregtech.machine.diode.tooltip_starts_at=默认为§f1A§7,使用软锤来轮换电流设定 gregtech.machine.diode.ulv.name=超低压二极管(§8ULV§r) gregtech.machine.diode.lv.name=低压二极管(§7LV§r) @@ -4181,8 +4247,8 @@ gregtech.machine.energy_converter.max.4.name=4安§c§lMAX§r能量转换器 gregtech.machine.energy_converter.max.8.name=8安§c§lMAX§r能量转换器 gregtech.machine.energy_converter.max.16.name=16安§c§lMAX§r能量转换器 -gregtech.machine.energy_converter.description=转换能量形式,支持 EU 与 FE 互换。 -gregtech.machine.energy_converter.tooltip_tool_usage=默认为 §fFE 转 EU§7,手持软锤右击以切换模式 +gregtech.machine.energy_converter.description=转换能量形式,支持EU与FE互换。 +gregtech.machine.energy_converter.tooltip_tool_usage=默认为§fFE转EU§7,手持软锤右击以切换模式 gregtech.machine.energy_converter.tooltip_conversion_fe=§cFE 转 EU:§f%,d FE -> %,dA %,d EU(%s§f) gregtech.machine.energy_converter.message_conversion_fe=FE 转为 EU,输入:%d FE,输出:%dA %d EU gregtech.machine.energy_converter.tooltip_conversion_eu=§aEU 转 FE:§f%,dA %,d EU(%s§f)-> %,d FE @@ -4190,7 +4256,7 @@ gregtech.machine.energy_converter.message_conversion_eu=EU 转为 FE,输入: # Pumps gregtech.machine.pump.tooltip=抽干大海的最佳手段! -gregtech.machine.pump.tooltip_buckets=每产出一桶耗时 §f%,d§7 ticks +gregtech.machine.pump.tooltip_buckets=每产出一桶耗时§f%,d§7ticks gregtech.machine.pump.lv.name=基础泵 gregtech.machine.pump.mv.name=进阶泵 @@ -4206,7 +4272,7 @@ gregtech.machine.item_collector.mv.name=进阶物品收集器 gregtech.machine.item_collector.hv.name=进阶物品收集器 II gregtech.machine.item_collector.ev.name=进阶物品收集器 III -gregtech.machine.item_collector.gui.collect_range=作用半径:%s 格 +gregtech.machine.item_collector.gui.collect_range=作用半径:%s格 gregtech.machine.item_collector.tooltip=接收到红石信号时吸取设定范围内的掉落物 gregtech.machine.alarm.name=报警器 @@ -4320,23 +4386,28 @@ gregtech.machine.fisher.hv.name=进阶捕鱼机 II gregtech.machine.fisher.ev.name=进阶捕鱼机 III gregtech.machine.fisher.tooltip=消耗线捕鱼。每次运行消耗一根线。 gregtech.machine.fisher.speed=每%d刻获得一条鱼(或者其它什么东西) -gregtech.machine.fisher.requirement=需要在正下方倾倒边长为 %,d 格的静止水。 +gregtech.machine.fisher.requirement=需要在正下方倾倒边长为%,d格的静止水。 # World Accelerator gregtech.machine.world_accelerator.lv.name=基础世界加速器 +gregtech.machine.world_accelerator.lv.tooltip=游戏刻加速方块 gregtech.machine.world_accelerator.mv.name=进阶世界加速器 +gregtech.machine.world_accelerator.mv.tooltip=游戏刻加速方块 gregtech.machine.world_accelerator.hv.name=进阶世界加速器 II +gregtech.machine.world_accelerator.hv.tooltip=游戏刻加速方块 gregtech.machine.world_accelerator.ev.name=进阶世界加速器 III +gregtech.machine.world_accelerator.ev.tooltip=游戏刻加速方块 gregtech.machine.world_accelerator.iv.name=精英世界加速器 +gregtech.machine.world_accelerator.iv.tooltip=“时间之§m瓶§r”§7方块 gregtech.machine.world_accelerator.luv.name=精英世界加速器 II +gregtech.machine.world_accelerator.luv.tooltip=“时间之§m瓶§r”§7方块 gregtech.machine.world_accelerator.zpm.name=精英世界加速器 III +gregtech.machine.world_accelerator.zpm.tooltip=“时间之§m瓶§r”§7方块 gregtech.machine.world_accelerator.uv.name=终极世界加速器 -gregtech.machine.world_accelerator.uhv.name=史诗世界加速器 -gregtech.machine.world_accelerator.uev.name=史诗世界加速器 II -gregtech.machine.world_accelerator.uiv.name=史诗世界加速器 III -gregtech.machine.world_accelerator.uxv.name=史诗世界加速器 IV -gregtech.machine.world_accelerator.opv.name=传奇世界加速器 -gregtech.machine.world_accelerator.description=以两种模式之一加速周围方块的更新刻:§f方块实体§7或§f随机刻§7。使用螺丝刀切换模式。 +gregtech.machine.world_accelerator.uv.tooltip=时间扭曲者 +gregtech.machine.world_accelerator.description=使用§f螺丝刀§7在§f方块实体§7或§f随机刻§7模式中切换。 +gregtech.machine.world_accelerator.power_usage=§7在随机刻模式下最多使用§f%dA,§7在方块实体模式下最多使用§f%dA 。 +gregtech.machine.world_accelerator.acceleration=§d加速倍率: §f%dx gregtech.machine.world_accelerator.working_area=§b作用范围: gregtech.machine.world_accelerator.working_area_tile= 方块实体模式:§f相邻方块 gregtech.machine.world_accelerator.working_area_random= 随机刻模式:§f%dx%d @@ -4369,7 +4440,7 @@ gregtech.machine.hpca.component_type.cooler_active=§b冷却类型:§f主动 gregtech.machine.hpca.component_type.cooler_cooling=§a提供:§f%,d 冷却 gregtech.machine.hpca.component_type.cooler_active_coolant=§c最多需要:§f%,d L/t %s gregtech.machine.hpca.component_type.computation_cwut=§9算力:§f%,d CWU/t -gregtech.machine.hpca.component_type.computation_cooling=§c最多需要: §f%,d 冷却 +gregtech.machine.hpca.component_type.computation_cooling=§c最多需要:§f%,d 冷却 gregtech.machine.hpca.component_type.bridge=允许§fHPCA§7与§f网络交换机§7连接 gregtech.machine.hpca.component_type.damaged=HPCA过热可能会损坏! @@ -4379,11 +4450,11 @@ gregtech.machine.basic.input_from_output_side.disallow=禁止输出端输入 gregtech.machine.muffle.on=静音:已启用 gregtech.machine.muffle.off=静音:已禁用 gregtech.machine.perfect_oc=超频不会损失能效。 -gregtech.machine.parallel_limit=可同时处理至多 §b%d§7 个配方。 +gregtech.machine.parallel_limit=可同时处理至多§b%d§7个配方。 gregtech.machine.ld_item_endpoint.name=长距离物品管道接口 gregtech.machine.ld_fluid_endpoint.name=长距离流体管道接口 -gregtech.machine.endpoint.tooltip.min_length=§b最低接口间距: §f%d格方块 +gregtech.machine.endpoint.tooltip.min_length=§b最低接口间距:§f%d格方块 gregtech.machine.endpoint.tooltip.1=使用§f长距离管道§7方块连接管道接口以创建管路。 gregtech.machine.endpoint.tooltip.2=管路必须有且仅有一个§f1输入§7接口和一个§f1输出§7接口。 gregtech.machine.endpoint.tooltip.3=只有管道接口需要被§f区块加载§7。 @@ -4420,7 +4491,7 @@ gregtech.advancement.steam.13_steel.desc=使用土高炉来炼钢。 gregtech.advancement.steam.14_magnetic_iron.name=磁化铁 gregtech.advancement.steam.14_magnetic_iron.desc=用四个红石合成一根磁化铁杆。 gregtech.advancement.steam.15_lv_motor.name=低压马达 -gregtech.advancement.steam.15_lv_motor.desc=合成一个 LV 电动马达 +gregtech.advancement.steam.15_lv_motor.desc=合成一个LV电动马达 gregtech.advancement.steam.16_steel_boiler.name=高气压 gregtech.advancement.steam.16_steel_boiler.desc=合成一台高压锅炉。 gregtech.advancement.steam.81_crafting_station.name=合成站 @@ -4438,17 +4509,17 @@ gregtech.advancement.steam.91_primitive_blast_furnace.desc=搭建一台土高炉 gregtech.advancement.root_lv.name=低压 gregtech.advancement.root_lv.desc=合成一台基础蒸汽轮机 gregtech.advancement.low_voltage.17_lv_pump.name=泵 -gregtech.advancement.low_voltage.17_lv_pump.desc=合成一个 LV 电动泵。 +gregtech.advancement.low_voltage.17_lv_pump.desc=合成一个LV电动泵。 gregtech.advancement.low_voltage.18_shutter_cover.name=关上它! gregtech.advancement.low_voltage.18_shutter_cover.desc=获取一块扇板。 gregtech.advancement.low_voltage.19_lv_pump_block.name=吸溜 gregtech.advancement.low_voltage.19_lv_pump_block.desc=合成一台基础泵。 gregtech.advancement.low_voltage.20_lv_conveyor.name=传送 -gregtech.advancement.low_voltage.20_lv_conveyor.desc=合成一条 LV 传送带。 +gregtech.advancement.low_voltage.20_lv_conveyor.desc=合成一条LV传送带。 gregtech.advancement.low_voltage.21_machine_controller_cover.name=操纵 gregtech.advancement.low_voltage.21_machine_controller_cover.desc=获取一块机器控制覆盖板。 gregtech.advancement.low_voltage.22_lv_robot_arm.name=复杂机器 -gregtech.advancement.low_voltage.22_lv_robot_arm.desc=合成一个 LV 机械臂。 +gregtech.advancement.low_voltage.22_lv_robot_arm.desc=合成一个LV机械臂。 gregtech.advancement.low_voltage.23_lv_assembler.name=复仇者,集结! gregtech.advancement.low_voltage.23_lv_assembler.desc=合成一台低压的组装机。 gregtech.advancement.low_voltage.24_smart_filter.name=过滤,校准 @@ -4462,7 +4533,7 @@ gregtech.advancement.low_voltage.27_electric_blast_furnace.desc=合成一台电 gregtech.advancement.low_voltage.28_lv_energy_hatch.name=两个才够用 gregtech.advancement.low_voltage.28_lv_energy_hatch.desc=合成一台低压能源仓。 gregtech.advancement.low_voltage.29_lv_battery_buffer.name=电池 -gregtech.advancement.low_voltage.29_lv_battery_buffer.desc=合成一台 4x 低压电池箱。 +gregtech.advancement.low_voltage.29_lv_battery_buffer.desc=合成一台4x低压电池箱。 gregtech.advancement.low_voltage.30_good_electronic_circuit.name=更好的电路 gregtech.advancement.low_voltage.30_good_electronic_circuit.desc=获得一块优质电子电路。 gregtech.advancement.low_voltage.86_electrocution_death.name=把导线裹上啊! @@ -4513,31 +4584,31 @@ gregtech.advancement.high_voltage.89_fluid_pipe_death_cold.name=冰冷! gregtech.advancement.high_voltage.89_fluid_pipe_death_cold.desc=被一根满是冰冷流体的流体管道冻死。 gregtech.advancement.root_ev.name=超高压 gregtech.advancement.root_ev.desc=冷却一块热钛锭。 -gregtech.advancement.extreme_voltage.47_nichrome_coil.name=升级线圈至等级 III +gregtech.advancement.extreme_voltage.47_nichrome_coil.name=升级线圈至等级III gregtech.advancement.extreme_voltage.47_nichrome_coil.desc=合成一个镍铬合金线圈方块。 gregtech.advancement.extreme_voltage.48_osmium.name=锇 gregtech.advancement.extreme_voltage.48_osmium.desc=冷却一块热锇锭。 -gregtech.advancement.extreme_voltage.49_nano_cpu_wafer.name=纳米 CPU 晶圆 -gregtech.advancement.extreme_voltage.49_nano_cpu_wafer.desc=产出一片纳米 CPU 晶圆。 +gregtech.advancement.extreme_voltage.49_nano_cpu_wafer.name=纳米CPU晶圆 +gregtech.advancement.extreme_voltage.49_nano_cpu_wafer.desc=产出一片纳米CPU晶圆。 gregtech.advancement.extreme_voltage.50_nano_processor.name=纳米处理器 gregtech.advancement.extreme_voltage.50_nano_processor.desc=获取纳米处理器。 gregtech.advancement.extreme_voltage.51_large_combustion_engine.name=大型内燃引擎 gregtech.advancement.extreme_voltage.51_large_combustion_engine.desc=搭建大型内燃引擎。需要润滑油方可运转,可使用氧气助燃。 -gregtech.advancement.extreme_voltage.52_soc_wafer.name=SoC 晶圆 -gregtech.advancement.extreme_voltage.52_soc_wafer.desc=生成 SoC 晶圆来压低基础与优质电路板的生产成本。 +gregtech.advancement.extreme_voltage.52_soc_wafer.name=SoC晶圆 +gregtech.advancement.extreme_voltage.52_soc_wafer.desc=生成SoC晶圆来压低基础与优质电路板的生产成本。 gregtech.advancement.root_iv.name=强导压 gregtech.advancement.root_iv.desc=冷却一块热钨钢锭。 gregtech.advancement.insane_voltage.53_plutonium_239.name=钚-239 gregtech.advancement.insane_voltage.53_plutonium_239.desc=获取钚-239,氡的来源之一。 gregtech.advancement.insane_voltage.54_indium.name=铟 gregtech.advancement.insane_voltage.54_indium.desc=从闪锌矿和方铅矿中获取铟。 -gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.name=量子位 CPU 晶圆 -gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.desc=产出量子位 CPU 晶圆。 +gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.name=量子位CPU晶圆 +gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.desc=产出量子位CPU晶圆。 gregtech.advancement.insane_voltage.56_quantum_processor.name=量子处理器 gregtech.advancement.insane_voltage.56_quantum_processor.desc=获取量子处理器。 -gregtech.advancement.insane_voltage.57_tungstensteel_coil.name=升级线圈至等级 IV -gregtech.advancement.insane_voltage.57_tungstensteel_coil.desc=制造一个钨钢线圈方块。 -gregtech.advancement.insane_voltage.58_hss_g_coil.name=升级线圈至等级 V +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.name=升级你的线圈至等级IV +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.desc=制造一个钌钨钼合金线圈方块。 +gregtech.advancement.insane_voltage.58_hss_g_coil.name=升级线圈至等级V gregtech.advancement.insane_voltage.58_hss_g_coil.desc=制造一个高速钢-G线圈方块。 gregtech.advancement.root_luv.name=剧差压 gregtech.advancement.root_luv.desc=搭建一条装配线。 @@ -4555,10 +4626,10 @@ gregtech.advancement.ludicrous_voltage.64_crystal_processor.name=晶体处理器 gregtech.advancement.ludicrous_voltage.64_crystal_processor.desc=获取晶体处理器。 gregtech.advancement.ludicrous_voltage.65_naquadah.name=星门材料 gregtech.advancement.ludicrous_voltage.65_naquadah.desc=冷却一块热硅岩锭。 -gregtech.advancement.ludicrous_voltage.66_naquadah_coil.name=升级线圈至等级 VI +gregtech.advancement.ludicrous_voltage.66_naquadah_coil.name=升级线圈至等级VI gregtech.advancement.ludicrous_voltage.66_naquadah_coil.desc=制造一个硅岩线圈方块。 -gregtech.advancement.ludicrous_voltage.67_asoc_wafer.name=ASoC 晶圆 -gregtech.advancement.ludicrous_voltage.67_asoc_wafer.desc=产出一片 ASoC 晶圆来压低进阶和极限电路板的生产成本。 +gregtech.advancement.ludicrous_voltage.67_asoc_wafer.name=ASoC晶圆 +gregtech.advancement.ludicrous_voltage.67_asoc_wafer.desc=产出一片ASoC晶圆来压低进阶和极限电路板的生产成本。 gregtech.advancement.ludicrous_voltage.68_large_plasma_turbine.name=大型等离子涡轮 gregtech.advancement.ludicrous_voltage.68_large_plasma_turbine.desc=搭建一台大型等离子涡轮,将等离子转化为可利用的流体。 gregtech.advancement.root_zpm.name=零点压 @@ -4587,8 +4658,8 @@ gregtech.advancement.ultimate_voltage.76_neutronium.name=要多密,有多密 gregtech.advancement.ultimate_voltage.76_neutronium.desc=产出中子素。 gregtech.advancement.ultimate_voltage.77_ultimate_battery.name=现在呢? gregtech.advancement.ultimate_voltage.77_ultimate_battery.desc=制造一块终极电池。 -gregtech.advancement.ultimate_voltage.78_hasoc_wafer.name=HASoC 晶圆 -gregtech.advancement.ultimate_voltage.78_hasoc_wafer.desc=生产 HASoC 晶圆来压低大师电路板的制造成本。 +gregtech.advancement.ultimate_voltage.78_hasoc_wafer.name=HASoC晶圆 +gregtech.advancement.ultimate_voltage.78_hasoc_wafer.desc=生产HASoC晶圆来压低大师电路板的制造成本。 gregtech.advancement.ultimate_voltage.79_tritanium_coil.name=最后的线圈 gregtech.advancement.ultimate_voltage.79_tritanium_coil.desc=制造一个三钛合金线圈方块。 @@ -4622,13 +4693,13 @@ behaviour.prospecting=适用于探矿 gregtech.machine.primitive_water_pump.name=原始水泵 gregtech.machine.primitive_blast_furnace.bronze.name=土高炉 gregtech.machine.electric_blast_furnace.name=电力高炉 -gregtech.machine.electric_blast_furnace.tooltip.1=每超过配方温度 §f900K§7,耗能均将乘以 §f95%%§7(不计超频)。 -gregtech.machine.electric_blast_furnace.tooltip.2=每超过配方温度 §f1800K§7,将一次超频的效率变为 §f100%%§7(无损超频)。 -gregtech.machine.electric_blast_furnace.tooltip.3=超过§fMV§7后的每一级电压,都会将温度提高 §f100K§7。 +gregtech.machine.electric_blast_furnace.tooltip.1=每超过配方温度§f900K§7,耗能均将乘以§f95%%§7(不计超频)。 +gregtech.machine.electric_blast_furnace.tooltip.2=每超过配方温度§f1800K§7,将一次超频的效率变为§f100%%§7(无损超频)。 +gregtech.machine.electric_blast_furnace.tooltip.3=超过§fMV§7后的每一级电压,都会将温度提高§f100K§7。 gregtech.machine.vacuum_freezer.name=真空冷冻机 gregtech.machine.implosion_compressor.name=聚爆压缩机 gregtech.machine.pyrolyse_oven.name=热解炉 -gregtech.machine.pyrolyse_oven.tooltip.1=§a白铜§7线圈会使效率降低 §f25%%§7,§a坎塔尔合金§7后的每个线圈都会增加 §f50%%§7 的速度。 +gregtech.machine.pyrolyse_oven.tooltip.1=§a白铜§7线圈会使效率降低§f25%%§7,§a坎塔尔合金§7后的每个线圈都会增加§f50%%§7的速度。 gregtech.machine.distillation_tower.name=蒸馏塔 gregtech.machine.multi_furnace.name=工业熔炉 gregtech.machine.cracker.name=石油裂化机 @@ -4642,8 +4713,8 @@ gregtech.machine.large_chemical_reactor.name=大型化学反应釜 gregtech.machine.large_combustion_engine.name=大型内燃引擎 gregtech.machine.extreme_combustion_engine.name=极限内燃引擎 -gregtech.machine.large_combustion_engine.tooltip.boost_regular=提供 §f20 L/s§7 的氧气,并消耗§f双倍§7燃料以产生高达 §f%s§7 EU/t的功率。 -gregtech.machine.large_combustion_engine.tooltip.boost_extreme=提供 §f80 L/s§7 的液氧,并消耗§f双倍§7燃料以产生高达 §f%s§7EU/t 的功率。 +gregtech.machine.large_combustion_engine.tooltip.boost_regular=提供§f20 L/s§7的氧气,并消耗§f双倍§7燃料以产生高达§f%s§7 EU/t的功率。 +gregtech.machine.large_combustion_engine.tooltip.boost_extreme=提供§f80 L/s§7的液氧,并消耗§f双倍§7燃料以产生高达§f%s§7 EU/t的功率。 gregtech.machine.large_turbine.steam.name=大型蒸汽涡轮 gregtech.machine.large_turbine.gas.name=大型燃气涡轮 @@ -4667,15 +4738,15 @@ gregtech.machine.fusion_reactor.overclocking=超频将使能耗翻倍,处理 gregtech.machine.miner.lv.name=基础采矿机 gregtech.machine.miner.mv.name=进阶采矿机 gregtech.machine.miner.hv.name=进阶采矿机 II -gregtech.machine.miner.tooltip=只采掘机器下方的矿石!工作范围默认为 §f%sx%s§7。 +gregtech.machine.miner.tooltip=只采掘机器下方的矿石!工作范围默认为§f%sx%s§7。 gregtech.machine.miner.per_block=§7每个方块需要§f%d§7秒。 gregtech.machine.large_miner.ev.name=基础采矿场 gregtech.machine.large_miner.iv.name=进阶采矿场 gregtech.machine.large_miner.luv.name=进阶采矿场 II gregtech.machine.miner.multi.modes=具有精准采集模式与区块对齐模式。 -gregtech.machine.miner.multi.production=粉碎矿石的产出量为§f研磨机§7的 §f3 倍§7。 -gregtech.machine.miner.fluid_usage=每 tick 消耗 §f%,d L§7 的§f%s§7,超频时翻倍。 +gregtech.machine.miner.multi.production=粉碎矿石的产出量为§f研磨机§7的§f3倍§7。 +gregtech.machine.miner.fluid_usage=每tick消耗§f%,d L§7的§f%s§7,超频时翻倍。 gregtech.machine.miner.multi.description=一台工作范围极广的多方块采矿机,能够提供巨量矿石。 gregtech.machine.miner.multi.needsfluid=钻井液不足! @@ -4686,24 +4757,24 @@ gregtech.machine.miner.minex=mX:%d gregtech.machine.miner.miney=mY:%d gregtech.machine.miner.minez=mZ:%d gregtech.machine.miner.radius=半径:%d -gregtech.machine.miner.working_area=工作范围:%dx%d 格 -gregtech.machine.miner.working_area_chunks=工作范围:%dx%d 区块 +gregtech.machine.miner.working_area=工作范围:%dx%d格 +gregtech.machine.miner.working_area_chunks=工作范围:%dx%d区块 gregtech.machine.miner.chunkradius=区块半径:%d gregtech.machine.fluid_drilling_rig.mv.name=基础流体钻机 gregtech.machine.fluid_drilling_rig.hv.name=进阶流体钻机 gregtech.machine.fluid_drilling_rig.ev.name=进阶流体钻机 II gregtech.machine.fluid_drilling_rig.description=钻取基岩之下的涓涓流体。 -gregtech.machine.fluid_drilling_rig.production=§e产量倍数:§f%dx,超频时为 %fx +gregtech.machine.fluid_drilling_rig.production=§e产量倍数:§f%dx,超频时为%fx gregtech.machine.fluid_drilling_rig.depletion=§b损耗率:§f%s%% gregtech.machine.fluid_drilling_rig.shows_depletion=显示流体矿脉信息 gregtech.machine.cleanroom.name=超净间 gregtech.machine.cleanroom.tooltip.1=使其内部的机器能够处理需要超净环境的配方。 -gregtech.machine.cleanroom.tooltip.2=污染状态下耗能功率为 §f30 EU/t§7,洁净状态下则为 §f4 EU/t§7。 +gregtech.machine.cleanroom.tooltip.2=污染状态下耗能功率为§f30EU/t§7,洁净状态下则为§f4EU/t§7。 gregtech.machine.cleanroom.tooltip.3=超频可提升每个周期的清洁度。 -gregtech.machine.cleanroom.tooltip.4=§b尺寸:§f最小 5x5x5,最大 15x15x15 -gregtech.machine.cleanroom.tooltip.hold_ctrl=按住 CTRL 以查看更多结构信息 +gregtech.machine.cleanroom.tooltip.4=§b尺寸:§f最小5x5x5,最大15x15x15 +gregtech.machine.cleanroom.tooltip.hold_ctrl=按住CTRL以查看更多结构信息 gregtech.machine.cleanroom.tooltip.5=天花板需要§f过滤器机械方块§7,不包含天花板的边缘。 gregtech.machine.cleanroom.tooltip.6=接受最多§f四扇门§7!门处于打开状态时不会影响洁净度。 gregtech.machine.cleanroom.tooltip.7=发电机、消声仓、采矿机和原始机器对于超净间来说太脏了! @@ -4721,22 +4792,22 @@ gregtech.machine.charcoal_pile.tooltip.1=§c点火后§7将原木烧制成§a木 gregtech.machine.charcoal_pile.tooltip.2=使用可点火的物品右击即可启动。 gregtech.machine.charcoal_pile.tooltip.3=热解发生在下方至多§b9x4x9§7的空间内。 gregtech.machine.charcoal_pile.tooltip.4=原木不可暴露在§e空气§7中! -gregtech.multiblock.charcoal_pile.description=将下方最大 9x4x9 区域内的原木烧制成脆木炭块。\n\n木炭堆底部必须由砖块构成,壁面和顶面则可选用泥土、沙子等任何土地类方块。堆内必须填满,不可存在空气。\n\n木炭堆的尺寸越大,所需的处理时间就越长,但收效会更高。 +gregtech.multiblock.charcoal_pile.description=将下方最大9x4x9区域内的原木烧制成脆木炭块。\n\n木炭堆底部必须由砖块构成,壁面和顶面则可选用泥土、沙子等任何土地类方块。堆内必须填满,不可存在空气。\n\n木炭堆的尺寸越大,所需的处理时间就越长,但收效会更高。 gregtech.machine.data_bank.name=数据库 gregtech.machine.data_bank.tooltip.1=你的个人网络存储器 gregtech.machine.data_bank.tooltip.2=大容量数据存储,使用光缆传输。 gregtech.machine.data_bank.tooltip.3=数据库间可以相互连接。 -gregtech.machine.data_bank.tooltip.4=每个数据/光学仓耗能为 §f%s EU/t§7 。 -gregtech.machine.data_bank.tooltip.5=每个已连接的数据/光学仓耗能为 §f%s EU/t§7 。 +gregtech.machine.data_bank.tooltip.4=每个数据/光学仓耗能为§f%s EU/t§7。 +gregtech.machine.data_bank.tooltip.5=每个已连接的数据/光学仓耗能为§f%s EU/t§7。 gregtech.multiblock.data_bank.description=数据库是一个用于在多个装配线间分享研究数据的多方块结构。此外,它也能让装配线读取数据模块里更复杂的研究数据。 gregtech.machine.power_substation.name=蓄能变电站 gregtech.machine.power_substation.tooltip1=集中电网的核心 gregtech.machine.power_substation.tooltip2=所有§f电容§7不需要保持同一电压等级。 -gregtech.machine.power_substation.tooltip3=最多容许 §f%d 层电容§7。 -gregtech.machine.power_substation.tooltip4=每 §f24 小时§7损失相当于总容量的 §f1%%§7 的能量。 -gregtech.machine.power_substation.tooltip5=每个电容上的损失上限为 §f%,d EU/t§7。 +gregtech.machine.power_substation.tooltip3=最多容许§f%d层电容§7。 +gregtech.machine.power_substation.tooltip4=每§f24小时§7损失相当于总容量的§f1%%§7的能量。 +gregtech.machine.power_substation.tooltip5=每个电容的损失上限为§f%,d EU/t§7。 gregtech.machine.power_substation.tooltip6=可以使用 gregtech.machine.power_substation.tooltip6.5= 激光仓§7。 gregtech.multiblock.power_substation.description=蓄能变电站是一个用于储存大量能量的多方块结构,它最多可以容纳18层电容,每层都必须填充完整,这意味着你可以用空电容来填充空间。 @@ -4761,7 +4832,7 @@ gregtech.machine.network_switch.name=网络交换机 gregtech.machine.network_switch.tooltip.1=以太网集线器 gregtech.machine.network_switch.tooltip.2=用于路由与分发§f算力§7。 gregtech.machine.network_switch.tooltip.3=可以将任意数量的算力§f输入§7整合为为任意数量的算力§f输出§7。 -gregtech.machine.network_switch.tooltip.4=每个算力数据仓使用 §f%s EU/t§7。 +gregtech.machine.network_switch.tooltip.4=每个算力数据仓使用§f%s EU/t§7。 gregtech.multiblock.network_switch.description=网络交换机是个多方块结构,可以接受任意数量的算力数据靶仓输入,并从任意数量的算力数据源仓输出。对于需要更高算力的研究数据配方,网络交换机的存在是必要的,这是因为研究站只接受一个算力数据靶仓。当与HPCA连接时,HPCA必须具有桥接组件才可以令网络交换机接收其算力。 gregtech.machine.high_performance_computing_array.name=高性能计算阵列 @@ -4776,9 +4847,9 @@ gregtech.multiblock.central_monitor.height=屏幕高度:%d gregtech.multiblock.central_monitor.width=屏幕宽度:%d gregtech.multiblock.central_monitor.height_modify=调整高度:%d gregtech.multiblock.central_monitor.tooltip.1=该机器能够监控由数字接口覆盖板所代理的机器。你可以在此处轻易对能量网络中接受代理的机器进行流体、物品、能量及状态监控。 -gregtech.multiblock.central_monitor.tooltip.2=监控器屏幕的搭建尺寸最小为 3x3,最大为 %dX%d(宽x高)。 -gregtech.multiblock.central_monitor.tooltip.3=默认高度为 3。可于结构成型前在GUI中调整高度。 -gregtech.multiblock.central_monitor.tooltip.4=能耗:每块屏幕 %d EU/s。 +gregtech.multiblock.central_monitor.tooltip.2=监控器屏幕的搭建尺寸最小为3x3,最大为%dX%d(宽x高)。 +gregtech.multiblock.central_monitor.tooltip.3=默认高度为3。可于结构成型前在GUI中调整高度。 +gregtech.multiblock.central_monitor.tooltip.4=能耗:每块屏幕%dEU/s。 gregtech.multiblock.monitor_screen.tooltip.1=手持螺丝刀右击即可打开界面。 gregtech.multiblock.monitor_screen.tooltip.2=数字接口覆盖板的代理模式可托管机器的功能与界面(没错,你可以直接给屏幕接上管道)。 gregtech.multiblock.monitor_screen.tooltip.3=该屏幕也支持安装插件 @@ -4841,29 +4912,29 @@ gregtech.machine.item_bus.import.tooltip=为多方块结构输入物品 gregtech.universal.disabled=多方块结构共享:§4禁止 gregtech.universal.enabled=多方块结构共享:§a允许 -gregtech.machine.item_bus.import.ulv.name=§8ULV§r 输入总线 -gregtech.machine.item_bus.import.lv.name=§7LV§r 输入总线 -gregtech.machine.item_bus.import.mv.name=§bMV§r 输入总线 -gregtech.machine.item_bus.import.hv.name=§6HV§r 输入总线 -gregtech.machine.item_bus.import.ev.name=§5EV§r 输入总线 -gregtech.machine.item_bus.import.iv.name=§1IV§r 输入总线 -gregtech.machine.item_bus.import.luv.name=§dLuV§r 输入总线 -gregtech.machine.item_bus.import.zpm.name=§cZPM§r 输入总线 -gregtech.machine.item_bus.import.uv.name=§3UV§r 输入总线 -gregtech.machine.item_bus.import.uhv.name=§4UHV§r 输入总线 +gregtech.machine.item_bus.import.ulv.name=§8ULV§r输入总线 +gregtech.machine.item_bus.import.lv.name=§7LV§r输入总线 +gregtech.machine.item_bus.import.mv.name=§bMV§r输入总线 +gregtech.machine.item_bus.import.hv.name=§6HV§r输入总线 +gregtech.machine.item_bus.import.ev.name=§5EV§r输入总线 +gregtech.machine.item_bus.import.iv.name=§1IV§r输入总线 +gregtech.machine.item_bus.import.luv.name=§dLuV§r输入总线 +gregtech.machine.item_bus.import.zpm.name=§cZPM§r输入总线 +gregtech.machine.item_bus.import.uv.name=§3UV§r输入总线 +gregtech.machine.item_bus.import.uhv.name=§4UHV§r输入总线 gregtech.machine.item_bus.export.tooltip=为多方块结构输出物品 -gregtech.machine.item_bus.export.ulv.name=§8ULV§r 输出总线 -gregtech.machine.item_bus.export.lv.name=§7LV§r 输出总线 -gregtech.machine.item_bus.export.mv.name=§bMV§r 输出总线 -gregtech.machine.item_bus.export.hv.name=§6HV§r 输出总线 -gregtech.machine.item_bus.export.ev.name=§5EV§r 输出总线 -gregtech.machine.item_bus.export.iv.name=§1IV§r 输出总线 -gregtech.machine.item_bus.export.luv.name=§dLuV§r 输出总线 -gregtech.machine.item_bus.export.zpm.name=§cZPM§r 输出总线 -gregtech.machine.item_bus.export.uv.name=§3UV§r 输出总线 -gregtech.machine.item_bus.export.uhv.name=§4UHV§r 输出总线 +gregtech.machine.item_bus.export.ulv.name=§8ULV§r输出总线 +gregtech.machine.item_bus.export.lv.name=§7LV§r输出总线 +gregtech.machine.item_bus.export.mv.name=§bMV§r输出总线 +gregtech.machine.item_bus.export.hv.name=§6HV§r输出总线 +gregtech.machine.item_bus.export.ev.name=§5EV§r输出总线 +gregtech.machine.item_bus.export.iv.name=§1IV§r输出总线 +gregtech.machine.item_bus.export.luv.name=§dLuV§r输出总线 +gregtech.machine.item_bus.export.zpm.name=§cZPM§r输出总线 +gregtech.machine.item_bus.export.uv.name=§3UV§r输出总线 +gregtech.machine.item_bus.export.uhv.name=§4UHV§r输出总线 gregtech.bus.collapse_true=已启用物品堆叠自动合并 gregtech.bus.collapse_false=已禁用物品堆叠自动合并 @@ -4871,149 +4942,149 @@ gregtech.bus.collapse.error=总线位于已成型的多方块结构后方可进 gregtech.machine.fluid_hatch.import.tooltip=为多方块结构输入流体 -gregtech.machine.fluid_hatch.import.ulv.name=§8ULV§r 输入仓 -gregtech.machine.fluid_hatch.import.lv.name=§7LV§r 输入仓 -gregtech.machine.fluid_hatch.import.mv.name=§bMV§r 输入仓 -gregtech.machine.fluid_hatch.import.hv.name=§6HV§r 输入仓 -gregtech.machine.fluid_hatch.import.ev.name=§5EV§r 输入仓 -gregtech.machine.fluid_hatch.import.iv.name=§1IV§r 输入仓 -gregtech.machine.fluid_hatch.import.luv.name=§dLuV§r 输入仓 -gregtech.machine.fluid_hatch.import.zpm.name=§cZPM§r 输入仓 -gregtech.machine.fluid_hatch.import.uv.name=§3UV§r 输入仓 -gregtech.machine.fluid_hatch.import.uhv.name=§4UHV§r 输入仓 +gregtech.machine.fluid_hatch.import.ulv.name=§8ULV§r输入仓 +gregtech.machine.fluid_hatch.import.lv.name=§7LV§r输入仓 +gregtech.machine.fluid_hatch.import.mv.name=§bMV§r输入仓 +gregtech.machine.fluid_hatch.import.hv.name=§6HV§r输入仓 +gregtech.machine.fluid_hatch.import.ev.name=§5EV§r输入仓 +gregtech.machine.fluid_hatch.import.iv.name=§1IV§r输入仓 +gregtech.machine.fluid_hatch.import.luv.name=§dLuV§r输入仓 +gregtech.machine.fluid_hatch.import.zpm.name=§cZPM§r输入仓 +gregtech.machine.fluid_hatch.import.uv.name=§3UV§r输入仓 +gregtech.machine.fluid_hatch.import.uhv.name=§4UHV§r输入仓 gregtech.machine.fluid_hatch.export.tooltip=为多方块结构输出流体 -gregtech.machine.fluid_hatch.import_4x.name=§5EV§r 四重输入仓 -gregtech.machine.fluid_hatch.import_4x.iv.name=§1IV§r 四重输入仓 -gregtech.machine.fluid_hatch.import_4x.luv.name=§dLuV§r 四重输入仓 -gregtech.machine.fluid_hatch.import_4x.zpm.name=§cZPM§r 四重输入仓 -gregtech.machine.fluid_hatch.import_4x.uv.name=§3UV§r 四重输入仓 -gregtech.machine.fluid_hatch.import_4x.uhv.name=§4UHV§r 四重输入仓 - -gregtech.machine.fluid_hatch.import_9x.name=§5EV§r 九重输入仓 -gregtech.machine.fluid_hatch.import_9x.iv.name=§1IV§r 九重输入仓 -gregtech.machine.fluid_hatch.import_9x.luv.name=§dLuV§r 九重输入仓 -gregtech.machine.fluid_hatch.import_9x.zpm.name=§cZPM§r 九重输入仓 -gregtech.machine.fluid_hatch.import_9x.uv.name=§3UV§r 九重输入仓 -gregtech.machine.fluid_hatch.import_9x.uhv.name=§4UHV§r 九重输入仓 - -gregtech.machine.fluid_hatch.export_4x.name=§5EV§r 四重输出仓 -gregtech.machine.fluid_hatch.export_4x.iv.name=§1IV§r 四重输出仓 -gregtech.machine.fluid_hatch.export_4x.luv.name=§dLuV§r 四重输出仓 -gregtech.machine.fluid_hatch.export_4x.zpm.name=§cZPM§r 四重输出仓 -gregtech.machine.fluid_hatch.export_4x.uv.name=§3UV§r 四重输出仓 -gregtech.machine.fluid_hatch.export_4x.uhv.name=§4UHV§r 四重输出仓 - -gregtech.machine.fluid_hatch.export_9x.name=§5EV§r 九重输出仓 -gregtech.machine.fluid_hatch.export_9x.iv.name=§1IV§r 九重输出仓 -gregtech.machine.fluid_hatch.export_9x.luv.name=§dLuV§r 九重输出仓 -gregtech.machine.fluid_hatch.export_9x.zpm.name=§cZPM§r 九重输出仓 -gregtech.machine.fluid_hatch.export_9x.uv.name=§3UV§r 九重输出仓 -gregtech.machine.fluid_hatch.export_9x.uhv.name=§4UHV§r 九重输出仓 - -gregtech.machine.fluid_hatch.export.ulv.name=§8ULV§r 输出仓 -gregtech.machine.fluid_hatch.export.lv.name=§7LV§r 输出仓 -gregtech.machine.fluid_hatch.export.mv.name=§bMV§r 输出仓 -gregtech.machine.fluid_hatch.export.hv.name=§6HV§r 输出仓 -gregtech.machine.fluid_hatch.export.ev.name=§5EV§r 输出仓 -gregtech.machine.fluid_hatch.export.iv.name=§1IV§r 输出仓 -gregtech.machine.fluid_hatch.export.luv.name=§dLuV§r 输出仓 -gregtech.machine.fluid_hatch.export.zpm.name=§cZPM§r 输出仓 -gregtech.machine.fluid_hatch.export.uv.name=§3UV§r 输出仓 -gregtech.machine.fluid_hatch.export.uhv.name=§4UHV§r 输出仓 +gregtech.machine.fluid_hatch.import_4x.name=§5EV§r四重输入仓 +gregtech.machine.fluid_hatch.import_4x.iv.name=§1IV§r四重输入仓 +gregtech.machine.fluid_hatch.import_4x.luv.name=§dLuV§r四重输入仓 +gregtech.machine.fluid_hatch.import_4x.zpm.name=§cZPM§r四重输入仓 +gregtech.machine.fluid_hatch.import_4x.uv.name=§3UV§r四重输入仓 +gregtech.machine.fluid_hatch.import_4x.uhv.name=§4UHV§r四重输入仓 + +gregtech.machine.fluid_hatch.import_9x.name=§5EV§r九重输入仓 +gregtech.machine.fluid_hatch.import_9x.iv.name=§1IV§r九重输入仓 +gregtech.machine.fluid_hatch.import_9x.luv.name=§dLuV§r九重输入仓 +gregtech.machine.fluid_hatch.import_9x.zpm.name=§cZPM§r九重输入仓 +gregtech.machine.fluid_hatch.import_9x.uv.name=§3UV§r九重输入仓 +gregtech.machine.fluid_hatch.import_9x.uhv.name=§4UHV§r九重输入仓 + +gregtech.machine.fluid_hatch.export_4x.name=§5EV§r四重输出仓 +gregtech.machine.fluid_hatch.export_4x.iv.name=§1IV§r四重输出仓 +gregtech.machine.fluid_hatch.export_4x.luv.name=§dLuV§r四重输出仓 +gregtech.machine.fluid_hatch.export_4x.zpm.name=§cZPM§r四重输出仓 +gregtech.machine.fluid_hatch.export_4x.uv.name=§3UV§r四重输出仓 +gregtech.machine.fluid_hatch.export_4x.uhv.name=§4UHV§r四重输出仓 + +gregtech.machine.fluid_hatch.export_9x.name=§5EV§r九重输出仓 +gregtech.machine.fluid_hatch.export_9x.iv.name=§1IV§r九重输出仓 +gregtech.machine.fluid_hatch.export_9x.luv.name=§dLuV§r九重输出仓 +gregtech.machine.fluid_hatch.export_9x.zpm.name=§cZPM§r九重输出仓 +gregtech.machine.fluid_hatch.export_9x.uv.name=§3UV§r九重输出仓 +gregtech.machine.fluid_hatch.export_9x.uhv.name=§4UHV§r九重输出仓 + +gregtech.machine.fluid_hatch.export.ulv.name=§8ULV§r输出仓 +gregtech.machine.fluid_hatch.export.lv.name=§7LV§r输出仓 +gregtech.machine.fluid_hatch.export.mv.name=§bMV§r输出仓 +gregtech.machine.fluid_hatch.export.hv.name=§6HV§r输出仓 +gregtech.machine.fluid_hatch.export.ev.name=§5EV§r输出仓 +gregtech.machine.fluid_hatch.export.iv.name=§1IV§r输出仓 +gregtech.machine.fluid_hatch.export.luv.name=§dLuV§r输出仓 +gregtech.machine.fluid_hatch.export.zpm.name=§cZPM§r输出仓 +gregtech.machine.fluid_hatch.export.uv.name=§3UV§r输出仓 +gregtech.machine.fluid_hatch.export.uhv.name=§4UHV§r输出仓 gregtech.machine.energy_hatch.input.tooltip=为多方块结构输入能量 -gregtech.machine.energy_hatch.input.ulv.name=§8ULV§r 能源仓 -gregtech.machine.energy_hatch.input.lv.name=§7LV§r 能源仓 -gregtech.machine.energy_hatch.input.mv.name=§bMV§r 能源仓 -gregtech.machine.energy_hatch.input.hv.name=§6HV§r 能源仓 -gregtech.machine.energy_hatch.input.ev.name=§5EV§r 能源仓 -gregtech.machine.energy_hatch.input.iv.name=§1IV§r 能源仓 -gregtech.machine.energy_hatch.input.luv.name=§dLuV§r 能源仓 -gregtech.machine.energy_hatch.input.zpm.name=§cZPM§r 能源仓 -gregtech.machine.energy_hatch.input.uv.name=§3UV§r 能源仓 -gregtech.machine.energy_hatch.input.uhv.name=§4UHV§r 能源仓 -gregtech.machine.energy_hatch.input.uev.name=§aUEV§r 能源仓 -gregtech.machine.energy_hatch.input.uiv.name=§2UIV§r 能源仓 -gregtech.machine.energy_hatch.input.uxv.name=§eUXV§r 能源仓 -gregtech.machine.energy_hatch.input.opv.name=§9OpV§r 能源仓 -gregtech.machine.energy_hatch.input.max.name=§c§lMAX§r 能源仓 +gregtech.machine.energy_hatch.input.ulv.name=§8ULV§r能源仓 +gregtech.machine.energy_hatch.input.lv.name=§7LV§r能源仓 +gregtech.machine.energy_hatch.input.mv.name=§bMV§r能源仓 +gregtech.machine.energy_hatch.input.hv.name=§6HV§r能源仓 +gregtech.machine.energy_hatch.input.ev.name=§5EV§r能源仓 +gregtech.machine.energy_hatch.input.iv.name=§1IV§r能源仓 +gregtech.machine.energy_hatch.input.luv.name=§dLuV§r能源仓 +gregtech.machine.energy_hatch.input.zpm.name=§cZPM§r能源仓 +gregtech.machine.energy_hatch.input.uv.name=§3UV§r能源仓 +gregtech.machine.energy_hatch.input.uhv.name=§4UHV§r能源仓 +gregtech.machine.energy_hatch.input.uev.name=§aUEV§r能源仓 +gregtech.machine.energy_hatch.input.uiv.name=§2UIV§r能源仓 +gregtech.machine.energy_hatch.input.uxv.name=§eUXV§r能源仓 +gregtech.machine.energy_hatch.input.opv.name=§9OpV§r能源仓 +gregtech.machine.energy_hatch.input.max.name=§c§lMAX§r能源仓 gregtech.machine.energy_hatch.input_hi_amp.tooltip=为多方块结构输入更多电流 -gregtech.machine.energy_hatch.input_4a.ev.name=4安 §5EV§r 能源仓 -gregtech.machine.energy_hatch.input_4a.iv.name=4安 §1IV§r 能源仓 -gregtech.machine.energy_hatch.input_4a.luv.name=4安 §dLuV§r 能源仓 -gregtech.machine.energy_hatch.input_4a.zpm.name=4安 §cZPM§r 能源仓 -gregtech.machine.energy_hatch.input_4a.uv.name=4安 §3UV§r 能源仓 -gregtech.machine.energy_hatch.input_4a.uhv.name=4安 §4UHV§r 能源仓 +gregtech.machine.energy_hatch.input_4a.ev.name=4安§5EV§r能源仓 +gregtech.machine.energy_hatch.input_4a.iv.name=4安§1IV§r能源仓 +gregtech.machine.energy_hatch.input_4a.luv.name=4安§dLuV§r能源仓 +gregtech.machine.energy_hatch.input_4a.zpm.name=4安§cZPM§r能源仓 +gregtech.machine.energy_hatch.input_4a.uv.name=4安§3UV§r能源仓 +gregtech.machine.energy_hatch.input_4a.uhv.name=4安§4UHV§r能源仓 -gregtech.machine.energy_hatch.input_16a.iv.name=16安 §1IV§r 能源仓 -gregtech.machine.energy_hatch.input_16a.luv.name=16安 §dLuV§r 能源仓 -gregtech.machine.energy_hatch.input_16a.zpm.name=16安 §cZPM§r 能源仓 -gregtech.machine.energy_hatch.input_16a.uv.name=16安 §3UV§r 能源仓 -gregtech.machine.energy_hatch.input_16a.uhv.name=16安 §4UHV§r 能源仓 +gregtech.machine.energy_hatch.input_16a.iv.name=16安§1IV§r能源仓 +gregtech.machine.energy_hatch.input_16a.luv.name=16安§dLuV§r能源仓 +gregtech.machine.energy_hatch.input_16a.zpm.name=16安§cZPM§r能源仓 +gregtech.machine.energy_hatch.input_16a.uv.name=16安§3UV§r能源仓 +gregtech.machine.energy_hatch.input_16a.uhv.name=16安§4UHV§r能源仓 gregtech.machine.substation_hatch.input.tooltip=为蓄能变电站输入能量 -gregtech.machine.substation_hatch.input_64a.iv.name=64安 §1IV§r 变电能源仓 -gregtech.machine.substation_hatch.input_64a.luv.name=64安 §dLuV§r 变电能源仓 -gregtech.machine.substation_hatch.input_64a.zpm.name=64安 §cZPM§r 变电能源仓 -gregtech.machine.substation_hatch.input_64a.uv.name=64安 §3UV§r 变电能源仓 -gregtech.machine.substation_hatch.input_64a.uhv.name=64安 §4UHV§r 变电能源仓 +gregtech.machine.substation_hatch.input_64a.iv.name=64安§1IV§r变电能源仓 +gregtech.machine.substation_hatch.input_64a.luv.name=64安§dLuV§r变电能源仓 +gregtech.machine.substation_hatch.input_64a.zpm.name=64安§cZPM§r变电能源仓 +gregtech.machine.substation_hatch.input_64a.uv.name=64安§3UV§r变电能源仓 +gregtech.machine.substation_hatch.input_64a.uhv.name=64安§4UHV§r变电能源仓 gregtech.machine.energy_hatch.output.tooltip=为多方块结构输出能量 -gregtech.machine.energy_hatch.output.ulv.name=§8ULV§r 动力仓 -gregtech.machine.energy_hatch.output.lv.name=§7LV§r 动力仓 -gregtech.machine.energy_hatch.output.mv.name=§bMV§r 动力仓 -gregtech.machine.energy_hatch.output.hv.name=§6HV§r 动力仓 -gregtech.machine.energy_hatch.output.ev.name=§5EV§r 动力仓 -gregtech.machine.energy_hatch.output.iv.name=§1IV§r 动力仓 -gregtech.machine.energy_hatch.output.luv.name=§dLuV§r 动力仓 -gregtech.machine.energy_hatch.output.zpm.name=§cZPM§r 动力仓 -gregtech.machine.energy_hatch.output.uv.name=§3UV§r 动力仓 -gregtech.machine.energy_hatch.output.uhv.name=§4UHV§r 动力仓 -gregtech.machine.energy_hatch.output.uev.name=§aUEV§r 动力仓 -gregtech.machine.energy_hatch.output.uiv.name=§2UIV§r 动力仓 -gregtech.machine.energy_hatch.output.uxv.name=§eUXV§r 动力仓 -gregtech.machine.energy_hatch.output.opv.name=§9OpV§r 动力仓 -gregtech.machine.energy_hatch.output.max.name=§c§lMAX§r 动力仓 +gregtech.machine.energy_hatch.output.ulv.name=§8ULV§r动力仓 +gregtech.machine.energy_hatch.output.lv.name=§7LV§r动力仓 +gregtech.machine.energy_hatch.output.mv.name=§bMV§r动力仓 +gregtech.machine.energy_hatch.output.hv.name=§6HV§r动力仓 +gregtech.machine.energy_hatch.output.ev.name=§5EV§r动力仓 +gregtech.machine.energy_hatch.output.iv.name=§1IV§r动力仓 +gregtech.machine.energy_hatch.output.luv.name=§dLuV§r动力仓 +gregtech.machine.energy_hatch.output.zpm.name=§cZPM§r动力仓 +gregtech.machine.energy_hatch.output.uv.name=§3UV§r动力仓 +gregtech.machine.energy_hatch.output.uhv.name=§4UHV§r动力仓 +gregtech.machine.energy_hatch.output.uev.name=§aUEV§r动力仓 +gregtech.machine.energy_hatch.output.uiv.name=§2UIV§r动力仓 +gregtech.machine.energy_hatch.output.uxv.name=§eUXV§r动力仓 +gregtech.machine.energy_hatch.output.opv.name=§9OpV§r动力仓 +gregtech.machine.energy_hatch.output.max.name=§c§lMAX§r动力仓 gregtech.machine.energy_hatch.output_hi_amp.tooltip=为多方块结构输出更多电流 -gregtech.machine.energy_hatch.output_4a.ev.name=4安 §5EV§r 动力仓 -gregtech.machine.energy_hatch.output_4a.iv.name=4安 §1IV§r 动力仓 -gregtech.machine.energy_hatch.output_4a.luv.name=4安 §dLuV§r 动力仓 -gregtech.machine.energy_hatch.output_4a.zpm.name=4安 §cZPM§r 动力仓 -gregtech.machine.energy_hatch.output_4a.uv.name=4安 §3UV§r 动力仓 -gregtech.machine.energy_hatch.output_4a.uhv.name=4安 §4UHV§r 动力仓 +gregtech.machine.energy_hatch.output_4a.ev.name=4安§5EV§r动力仓 +gregtech.machine.energy_hatch.output_4a.iv.name=4安§1IV§r动力仓 +gregtech.machine.energy_hatch.output_4a.luv.name=4安§dLuV§r动力仓 +gregtech.machine.energy_hatch.output_4a.zpm.name=4安§cZPM§r动力仓 +gregtech.machine.energy_hatch.output_4a.uv.name=4安§3UV§r动力仓 +gregtech.machine.energy_hatch.output_4a.uhv.name=4安§4UHV§r动力仓 -gregtech.machine.energy_hatch.output_16a.iv.name=16安 §1IV§r 动力仓 -gregtech.machine.energy_hatch.output_16a.luv.name=16安 §dLuV§r 动力仓 -gregtech.machine.energy_hatch.output_16a.zpm.name=16安 §cZPM§r 动力仓 -gregtech.machine.energy_hatch.output_16a.uv.name=16安 §3UV§r 动力仓 -gregtech.machine.energy_hatch.output_16a.uhv.name=16安 §4UHV§r 动力仓 +gregtech.machine.energy_hatch.output_16a.iv.name=16安§1IV§r动力仓 +gregtech.machine.energy_hatch.output_16a.luv.name=16安§dLuV§r动力仓 +gregtech.machine.energy_hatch.output_16a.zpm.name=16安§cZPM§r动力仓 +gregtech.machine.energy_hatch.output_16a.uv.name=16安§3UV§r动力仓 +gregtech.machine.energy_hatch.output_16a.uhv.name=16安§4UHV§r动力仓 gregtech.machine.substation_hatch.output.tooltip=为蓄能变电站输出能量 -gregtech.machine.substation_hatch.output_64a.iv.name=64安 §1IV§r 变电动力仓 -gregtech.machine.substation_hatch.output_64a.luv.name=64安 §dLuV§r 变电动力仓 -gregtech.machine.substation_hatch.output_64a.zpm.name=64安 §cZPM§r 变电动力仓 -gregtech.machine.substation_hatch.output_64a.uv.name=64安 §3UV§r 变电动力仓 -gregtech.machine.substation_hatch.output_64a.uhv.name=64安 §4UHV§r 变电动力仓 +gregtech.machine.substation_hatch.output_64a.iv.name=64安§1IV§r变电动力仓 +gregtech.machine.substation_hatch.output_64a.luv.name=64安§dLuV§r变电动力仓 +gregtech.machine.substation_hatch.output_64a.zpm.name=64安§cZPM§r变电动力仓 +gregtech.machine.substation_hatch.output_64a.uv.name=64安§3UV§r变电动力仓 +gregtech.machine.substation_hatch.output_64a.uhv.name=64安§4UHV§r变电动力仓 gregtech.machine.rotor_holder.tooltip1=为多方块结构的转子 gregtech.machine.rotor_holder.tooltip2=提供支撑,固定转子使其不能飞走 -gregtech.machine.rotor_holder.hv.name=§6HV§r 转子支架 -gregtech.machine.rotor_holder.ev.name=§5EV§r 转子支架 -gregtech.machine.rotor_holder.iv.name=§1IV§r 转子支架 -gregtech.machine.rotor_holder.luv.name=§dLuV§r 转子支架 -gregtech.machine.rotor_holder.zpm.name=§cZPM§r 转子支架 -gregtech.machine.rotor_holder.uv.name=§3UV§r 转子支架 +gregtech.machine.rotor_holder.hv.name=§6HV§r转子支架 +gregtech.machine.rotor_holder.ev.name=§5EV§r转子支架 +gregtech.machine.rotor_holder.iv.name=§1IV§r转子支架 +gregtech.machine.rotor_holder.luv.name=§dLuV§r转子支架 +gregtech.machine.rotor_holder.zpm.name=§cZPM§r转子支架 +gregtech.machine.rotor_holder.uv.name=§3UV§r转子支架 gregtech.machine.maintenance_hatch.name=维护仓 gregtech.machine.maintenance_hatch.tooltip=用以对多方块机器进行维护 @@ -5029,35 +5100,35 @@ gregtech.machine.maintenance_hatch_tape_slot.tooltip=放入胶带以防止发生 gregtech.maintenance.configurable_duration=处理耗时:%fx gregtech.maintenance.configurable_duration.unchanged_description=配方以正常速度运行。更改配置以更新。 -gregtech.maintenance.configurable_duration.changed_description=配方处理速度现为正常速度(不计超频)的 %f 倍。 +gregtech.maintenance.configurable_duration.changed_description=配方处理速度现为正常速度(不计超频)的%f倍。 gregtech.maintenance.configurable_time=故障几率:%fx gregtech.maintenance.configurable_time.unchanged_description=故障的发生几率为正常值。更改配置以更新。 -gregtech.maintenance.configurable_time.changed_description=故障的发生几率现为正常值的 %f 倍。 +gregtech.maintenance.configurable_time.changed_description=故障的发生几率现为正常值的%f倍。 gregtech.maintenance.configurable.tooltip_basic=以更频繁的维护需求为代价,加快机器的处理速度 -gregtech.maintenance.configurable.tooltip_more_info=按住 SHIFT 进行特殊交互 +gregtech.maintenance.configurable.tooltip_more_info=按住SHIFT进行特殊交互 gregtech.maintenance.configurable.tooltip_pss_header=§8蓄能变电站: gregtech.maintenance.configurable.tooltip_pss_info= §f减少被动能量损失 gregtech.machine.muffler_hatch.tooltip1=收集机器内部的废料 gregtech.machine.muffler_hatch.tooltip2=§l切 勿 阻 隔 输 出 口! -gregtech.machine.muffler_hatch.ulv.name=§8ULV§r 消声仓 -gregtech.machine.muffler_hatch.lv.name=§7LV§r 消声仓 -gregtech.machine.muffler_hatch.mv.name=§bMV§r 消声仓 -gregtech.machine.muffler_hatch.hv.name=§6HV§r 消声仓 -gregtech.machine.muffler_hatch.ev.name=§5EV§r 消声仓 -gregtech.machine.muffler_hatch.iv.name=§1IV§r 消声仓 -gregtech.machine.muffler_hatch.luv.name=§dLuV§r 消声仓 -gregtech.machine.muffler_hatch.zpm.name=§cZPM§r 消声仓 -gregtech.machine.muffler_hatch.uv.name=§3UV§r 消声仓 -gregtech.machine.muffler_hatch.uhv.name=§4UHV§r 消声仓 -gregtech.machine.muffler_hatch.uev.name=§aUEV§r 消声仓 -gregtech.machine.muffler_hatch.uiv.name=§2UIV§r 消声仓 -gregtech.machine.muffler_hatch.uxv.name=§eUXV§r 消声仓 -gregtech.machine.muffler_hatch.opv.name=§9OpV§r 消声仓 -gregtech.machine.muffler_hatch.max.name=§c§lMAX§r 消声仓 +gregtech.machine.muffler_hatch.ulv.name=§8ULV§r消声仓 +gregtech.machine.muffler_hatch.lv.name=§7LV§r消声仓 +gregtech.machine.muffler_hatch.mv.name=§bMV§r消声仓 +gregtech.machine.muffler_hatch.hv.name=§6HV§r消声仓 +gregtech.machine.muffler_hatch.ev.name=§5EV§r消声仓 +gregtech.machine.muffler_hatch.iv.name=§1IV§r消声仓 +gregtech.machine.muffler_hatch.luv.name=§dLuV§r消声仓 +gregtech.machine.muffler_hatch.zpm.name=§cZPM§r消声仓 +gregtech.machine.muffler_hatch.uv.name=§3UV§r消声仓 +gregtech.machine.muffler_hatch.uhv.name=§4UHV§r消声仓 +gregtech.machine.muffler_hatch.uev.name=§aUEV§r消声仓 +gregtech.machine.muffler_hatch.uiv.name=§2UIV§r消声仓 +gregtech.machine.muffler_hatch.uxv.name=§eUXV§r消声仓 +gregtech.machine.muffler_hatch.opv.name=§9OpV§r消声仓 +gregtech.machine.muffler_hatch.max.name=§c§lMAX§r消声仓 gregtech.muffler.recovery_tooltip=§b收集几率:§f%d%% @@ -5084,7 +5155,7 @@ gregtech.machine.reservoir_hatch.tooltip=并不是水槽 gregtech.machine.data_access_hatch.name=数据访问仓 gregtech.machine.data_access_hatch.tooltip.1=令多方块结构得以访问数据 -gregtech.machine.data_access_hatch.tooltip.2=添加了 §a%s§7 个数据容器(闪存等)插槽 +gregtech.machine.data_access_hatch.tooltip.2=添加了§a%s§7个数据容器(闪存等)插槽 gregtech.machine.data_access_hatch.advanced.name=高级数据访问仓 gregtech.machine.data_access_hatch.creative.name=创造模式数据访问仓 @@ -5100,83 +5171,83 @@ gregtech.machine.research_station.object_holder.name=物品支架 gregtech.machine.research_station.object_holder.tooltip=研究站的先进支撑机构 # laser hatches -gregtech.machine.laser_hatch.source_256a.iv.name=256安 §1IV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.luv.name=256安 §dLuV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.zpm.name=256安 §cZPM§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.uv.name=256安 §3UV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.uhv.name=256安 §4UHV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.uev.name=256安 §aUEV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.uiv.name=256安 §2UIV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.uxv.name=256安 §eUXV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.opv.name=256安 §9OpV§r 激光源仓 -gregtech.machine.laser_hatch.source_256a.max.name=256安 §c§lMAX§r 激光源仓 - -gregtech.machine.laser_hatch.source_1024a.iv.name=1024安 §1IV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.luv.name=1024安 §dLuV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.zpm.name=1024安 §cZPM§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.uv.name=1024安 §3UV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.uhv.name=1024安 §4UHV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.uev.name=1024安 §aUEV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.uiv.name=1024安 §2UIV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.uxv.name=1024安 §eUXV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.opv.name=1024安 §9OpV§r 激光源仓 -gregtech.machine.laser_hatch.source_1024a.max.name=1024安 §c§lMAX§r 激光源仓 - -gregtech.machine.laser_hatch.source_4096a.iv.name=4096安 §1IV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.luv.name=4096安 §dLuV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.zpm.name=4096安 §cZPM§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.uv.name=4096安 §3UV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.uhv.name=4096安 §4UHV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.uev.name=4096安 §aUEV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.uiv.name=4096安 §2UIV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.uxv.name=4096安 §eUXV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.opv.name=4096安 §9OpV§r 激光源仓 -gregtech.machine.laser_hatch.source_4096a.max.name=4096安 §c§lMAX§r 激光源仓 - -gregtech.machine.laser_hatch.target_256a.iv.name=256安 §1IV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.luv.name=256安 §dLuV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.zpm.name=256安 §cZPM§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.uv.name=256安 §3UV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.uhv.name=256安 §4UHV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.uev.name=256安 §aUEV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.uiv.name=256安 §2UIV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.uxv.name=256安 §eUXV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.opv.name=256安 §9OpV§r 激光靶仓 -gregtech.machine.laser_hatch.target_256a.max.name=256安 §c§lMAX§r 激光靶仓 - -gregtech.machine.laser_hatch.target_1024a.iv.name=1024安 §1IV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.luv.name=1024安 §dLuV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.zpm.name=1024安 §cZPM§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.uv.name=1024安 §3UV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.uhv.name=1024安 §4UHV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.uev.name=1024安 §aUEV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.uiv.name=1024安 §2UIV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.uxv.name=1024安 §eUXV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.opv.name=1024安 §9OpV§r 激光靶仓 -gregtech.machine.laser_hatch.target_1024a.max.name=1024安 §c§lMAX§r 激光靶仓 - -gregtech.machine.laser_hatch.target_4096a.iv.name=4096安 §1IV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.luv.name=4096安 §dLuV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.zpm.name=4096安 §cZPM§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.uv.name=4096安 §3UV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.uhv.name=4096安 §4UHV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.uev.name=4096安 §aUEV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.uiv.name=4096安 §2UIV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.uxv.name=4096安 §eUXV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.opv.name=096安 §9OpV§r 激光靶仓 -gregtech.machine.laser_hatch.target_4096a.max.name=4096安 §c§lMAX§r 激光靶仓 +gregtech.machine.laser_hatch.source_256a.iv.name=256安§1IV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.luv.name=256安§dLuV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.zpm.name=256安§cZPM§r激光源仓 +gregtech.machine.laser_hatch.source_256a.uv.name=256安§3UV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.uhv.name=256安§4UHV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.uev.name=256安§aUEV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.uiv.name=256安§2UIV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.uxv.name=256安§eUXV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.opv.name=256安§9OpV§r激光源仓 +gregtech.machine.laser_hatch.source_256a.max.name=256安§c§lMAX§r激光源仓 + +gregtech.machine.laser_hatch.source_1024a.iv.name=1024安§1IV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.luv.name=1024安§dLuV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.zpm.name=1024安§cZPM§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.uv.name=1024安§3UV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.uhv.name=1024安§4UHV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.uev.name=1024安§aUEV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.uiv.name=1024安§2UIV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.uxv.name=1024安§eUXV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.opv.name=1024安§9OpV§r激光源仓 +gregtech.machine.laser_hatch.source_1024a.max.name=1024安§c§lMAX§r激光源仓 + +gregtech.machine.laser_hatch.source_4096a.iv.name=4096安§1IV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.luv.name=4096安§dLuV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.zpm.name=4096安§cZPM§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.uv.name=4096安§3UV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.uhv.name=4096安§4UHV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.uev.name=4096安§aUEV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.uiv.name=4096安§2UIV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.uxv.name=4096安§eUXV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.opv.name=4096安§9OpV§r激光源仓 +gregtech.machine.laser_hatch.source_4096a.max.name=4096安§c§lMAX§r激光源仓 + +gregtech.machine.laser_hatch.target_256a.iv.name=256安§1IV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.luv.name=256安§dLuV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.zpm.name=256安§cZPM§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.uv.name=256安§3UV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.uhv.name=256安§4UHV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.uev.name=256安§aUEV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.uiv.name=256安§2UIV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.uxv.name=256安§eUXV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.opv.name=256安§9OpV§r激光靶仓 +gregtech.machine.laser_hatch.target_256a.max.name=256安§c§lMAX§r激光靶仓 + +gregtech.machine.laser_hatch.target_1024a.iv.name=1024安§1IV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.luv.name=1024安§dLuV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.zpm.name=1024安§cZPM§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.uv.name=1024安§3UV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.uhv.name=1024安§4UHV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.uev.name=1024安§aUEV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.uiv.name=1024安§2UIV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.uxv.name=1024安§eUXV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.opv.name=1024安§9OpV§r激光靶仓 +gregtech.machine.laser_hatch.target_1024a.max.name=1024安§c§lMAX§r激光靶仓 + +gregtech.machine.laser_hatch.target_4096a.iv.name=4096安§1IV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.luv.name=4096安§dLuV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.zpm.name=4096安§cZPM§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.uv.name=4096安§3UV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.uhv.name=4096安§4UHV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.uev.name=4096安§aUEV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.uiv.name=4096安§2UIV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.uxv.name=4096安§eUXV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.opv.name=096安§9OpV§r激光靶仓 +gregtech.machine.laser_hatch.target_4096a.max.name=4096安§c§lMAX§r激光靶仓 gregtech.machine.laser_hatch.source.tooltip1=远距离发射能量 gregtech.machine.laser_hatch.target.tooltip1=远距离接收能量 gregtech.machine.laser_hatch.tooltip2=§c激光传导线缆必须直线摆放!§7 gregtech.machine.fluid_tank.max_multiblock=多方块结构最大尺寸:%,dx%,dx%,d -gregtech.machine.fluid_tank.fluid=含有 %s mB %s +gregtech.machine.fluid_tank.fluid=含有%s mB%s gregtech.machine.me_export_fluid_hatch.name=ME输出仓 gregtech.machine.me_export_item_bus.name=ME输出总线 -gregtech.machine.me_import_fluid_hatch.name=ME 库存输入仓 -gregtech.machine.me_import_item_bus.name=ME 库存输入总线 +gregtech.machine.me_import_fluid_hatch.name=ME库存输入仓 +gregtech.machine.me_import_item_bus.name=ME库存输入总线 gregtech.machine.me.fluid_export.tooltip=将流体直接存储到ME网络中。 gregtech.machine.me.item_export.tooltip=将物品直接存储到ME网络中。 gregtech.machine.me.fluid_import.tooltip=自动从ME网络获取流体。 @@ -5199,23 +5270,23 @@ gregtech.universal.tooltip.amperage_in_out_till=§e输入/输出电流上限: gregtech.universal.tooltip.energy_storage_capacity=§c能量缓存:§r%,d EU gregtech.universal.tooltip.energy_tier_range=§a适配电压等级:§f%s §f- %s gregtech.universal.tooltip.item_storage_capacity=§6物品槽位数量:§f%,d -gregtech.universal.tooltip.item_storage_total=§6物品容量:§f%,d 物品 -gregtech.universal.tooltip.item_stored=§d内含物品:§f%2$,d个%1$s -gregtech.universal.tooltip.item_transfer_rate=§b传输速率:§f%,d 件物品/s -gregtech.universal.tooltip.item_transfer_rate_stacks=§b传输速率:§f%,d 组物品/s +gregtech.universal.tooltip.item_storage_total=§6物品容量:§f%,d物品 +gregtech.universal.tooltip.item_stored=§d内含物品:§f%2$,d + %3$,d 个%1$s +gregtech.universal.tooltip.item_transfer_rate=§b传输速率:§f%,d件物品/s +gregtech.universal.tooltip.item_transfer_rate_stacks=§b传输速率:§f%,d组物品/s gregtech.universal.tooltip.fluid_storage_capacity=§9流体容量:§f%,d L -gregtech.universal.tooltip.fluid_storage_capacity_mult=§9流体容量:共 §f%d§7 个流体槽,每个 §f%dL§7 +gregtech.universal.tooltip.fluid_storage_capacity_mult=§9流体容量:共§f%d§7个流体槽,每个§f%dL§7 gregtech.universal.tooltip.fluid_stored=§d内含流体:§f%2$,d L %1$s gregtech.universal.tooltip.fluid_transfer_rate=§b传输速率:§f%,d L/t gregtech.universal.tooltip.parallel=§d最大并行:§f%d gregtech.universal.tooltip.working_area=§b工作范围:§f%,dx%,d gregtech.universal.tooltip.working_area_max=§b最大工作范围:§f%,dx%,d -gregtech.universal.tooltip.working_area_chunks_max=§b最大工作范围:§f%,dx%,d 区块 -gregtech.universal.tooltip.uses_per_tick=工作时消耗 §f%,d EU/t§7 -gregtech.universal.tooltip.uses_per_tick_steam=工作时消耗 §f%,d L/t§7 蒸汽 -gregtech.universal.tooltip.uses_per_hour_lubricant=工作时消耗 §f%,d L/hr§7 润滑油 -gregtech.universal.tooltip.uses_per_second=工作时消耗 §f%,d EU/t§7 -gregtech.universal.tooltip.uses_per_op=工作时消耗 §f%,d EU/t§7 +gregtech.universal.tooltip.working_area_chunks_max=§b最大工作范围:§f%,dx%,d区块 +gregtech.universal.tooltip.uses_per_tick=工作时消耗§f%,d EU/t§7 +gregtech.universal.tooltip.uses_per_tick_steam=工作时消耗§f%,d L/t§7蒸汽 +gregtech.universal.tooltip.uses_per_hour_lubricant=工作时消耗§f%,d L/hr§7润滑油 +gregtech.universal.tooltip.uses_per_second=工作时消耗§f%,d EU/t§7 +gregtech.universal.tooltip.uses_per_op=工作时消耗§f%,d EU/t§7 gregtech.universal.tooltip.base_production_eut=§e基础产能功率:§f%,d EU/t gregtech.universal.tooltip.base_production_fluid=§e基础产出速率:§f%,d L/t gregtech.universal.tooltip.produces_fluid=§e产出速率:§f%,d L/t @@ -5225,13 +5296,18 @@ gregtech.universal.tooltip.requires_redstone=§4需要红石信号 gregtech.block.tooltip.no_mob_spawning=§b生物不会在这个方块上生成 gregtech.recipe.total=总计:%,d EU -gregtech.recipe.max_eu=最大 EU:%,d EU -gregtech.recipe.eu=耗能功率:%,d EU/t (%s) +gregtech.recipe.max_eu=最大EU:%,d EU +gregtech.recipe.eu=耗能功率:%,d EU/t(%s) gregtech.recipe.eu_inverted=产能功率:%,d EU/t gregtech.recipe.duration=耗时:%s 秒 gregtech.recipe.amperage=电流:%,d gregtech.recipe.not_consumed=不在加工中消耗 -gregtech.recipe.chance=出产概率:%s%% +%s%%/电压等级 +gregtech.recipe.chance=出产概率:%s%% + %s%%/电压等级 +gregtech.recipe.chance_logic=出产概率:%s%% +%s%%/电压等级(%s) +gregtech.chance_logic.or=OR +gregtech.chance_logic.and=AND +gregtech.chance_logic.xor=XOR +gregtech.chance_logic.none=空 gregtech.recipe.temperature=温度:%,dK(%s) gregtech.recipe.explosive=爆炸物:%s gregtech.recipe.eu_to_start=启动耗能:%sEU @@ -5249,7 +5325,7 @@ gregtech.fluid.click_to_fill=§7手持流体容器点击流体槽以§b填入§7 gregtech.fluid.click_combined=§7手持流体容器左键点击流体槽以§c倒出§7或§b填入§7流体(Shift+单击以用整组容器倒出流体或用整组容器中的流体填入) gregtech.fluid.click_to_empty=§7手持流体容器左键点击流体槽以§c倒出§7流体(Shift+单击以用整组容器倒出流体) -gregtech.tool_action.show_tooltips=按住 SHIFT 以显示工具信息 +gregtech.tool_action.show_tooltips=按住SHIFT以显示工具信息 gregtech.tool_action.screwdriver.auto_output_covers=§8使用螺丝刀设置允许从输出端输入或访问覆盖板 gregtech.tool_action.screwdriver.toggle_mode_covers=§8使用螺丝刀切换模式或访问覆盖板 gregtech.tool_action.screwdriver.access_covers=§8使用螺丝刀访问覆盖板 @@ -5258,6 +5334,7 @@ gregtech.tool_action.screwdriver.auto_output=§8使用螺丝刀切换自动输 gregtech.tool_action.screwdriver.auto_output_down=§8使用螺丝刀开关底面自动输出 gregtech.tool_action.screwdriver.toggle_mode=§8使用螺丝刀切换模式 gregtech.tool_action.wrench.set_facing=§8使用扳手设置朝向 +gregtech.tool_action.wrench.extended_facing=§8使用扳手设置朝向或旋转机器 gregtech.tool_action.wrench.connect=§8使用扳手连接/断开管道 gregtech.tool_action.wrench.connect_and_block=§8使用扳手连接/断开管道,潜行可以阻止输入 gregtech.tool_action.wire_cutter.connect=§8使用剪线钳连接/断开电线 @@ -5268,6 +5345,9 @@ gregtech.tool_action.crowbar=§8使用撬棍卸下覆盖板 gregtech.tool_action.tape=§8使用胶带维护机器 gregtech.fluid.generic=%s +gregtech.fluid.liquid_generic=液态%s +gregtech.fluid.gas_generic=气态%s +gregtech.fluid.gas_vapor=%s蒸气 gregtech.fluid.plasma=%s等离子体 gregtech.fluid.empty=空 gregtech.fluid.amount=§9数量:%,d/%,d L @@ -5291,13 +5371,15 @@ gregtech.gui.fluid_auto_output.tooltip.enabled=流体自动输出已启用 gregtech.gui.fluid_auto_output.tooltip.disabled=流体自动输出已禁用 gregtech.gui.item_auto_output.tooltip.enabled=物品自动输出已启用 gregtech.gui.item_auto_output.tooltip.disabled=物品自动输出已禁用 -gregtech.gui.charger_slot.tooltip=§f充电槽§r/n§7从 %s 电池中取电§7/n§7也可为 %s 工具或电池充电 +gregtech.gui.charger_slot.tooltip=§f充电槽§r/n§7从%s电池中取电§7/n§7也可为%s工具或电池充电 gregtech.gui.configurator_slot.tooltip=§f编程电路槽§r/n§a配置值:§f%d§7/n/n§7左击/右击/滚轮可浏览循环列表/n§7Shift+右键单击以清除 gregtech.gui.configurator_slot.no_value=空 gregtech.gui.fluid_lock.tooltip.enabled=流体锁定已启用 gregtech.gui.fluid_lock.tooltip.disabled=流体锁定已禁用 gregtech.gui.fluid_voiding.tooltip.enabled=过量流体销毁已启用 gregtech.gui.fluid_voiding.tooltip.disabled=过量流体销毁已禁用 +gregtech.gui.item_voiding.tooltip.enabled=过量物品销毁已启用 +gregtech.gui.item_voiding.tooltip.disabled=过量物品销毁已禁用 gregtech.gui.multiblock_item_voiding=销毁模式/n§7销毁§6物品 gregtech.gui.multiblock_fluid_voiding=销毁模式/n§7销毁§9流体 gregtech.gui.multiblock_item_fluid_voiding=销毁模式/n§7销毁§6物品§7与§9流体 @@ -5315,7 +5397,7 @@ gregtech.gui.alarm.radius=半径: ore.spawnlocation.name=矿物生成信息 gregtech.jei.ore.surface_rock_1=这种地表岩石标志着矿脉的生成位置。 -gregtech.jei.ore.surface_rock_2=挖掘掉落 3 小撮粉受时运加成 +gregtech.jei.ore.surface_rock_2=挖掘掉落3小撮粉受时运加成 gregtech.jei.ore.biome_weighting_title=§d特定生物群系中的例外权重: gregtech.jei.ore.biome_weighting=§d%s中的生成权重:§3%d gregtech.jei.ore.biome_weighting_no_spawn=§d%s中的生成权重:§c无法生成 @@ -5323,9 +5405,9 @@ gregtech.jei.ore.ore_weight=矿脉内生成权重:%d%% gregtech.jei.ore.primary_1=顶层矿石 gregtech.jei.ore.primary_2=在矿脉的顶部 %d 层生成 gregtech.jei.ore.secondary_1=底层矿石 -gregtech.jei.ore.secondary_2=在矿脉的底部 %d 层生成 +gregtech.jei.ore.secondary_2=在矿脉的底部%d层生成 gregtech.jei.ore.between_1=中层矿石 -gregtech.jei.ore.between_2=和其他矿石一起生成在矿脉的中间 %d 层 +gregtech.jei.ore.between_2=和其他矿石一起生成在矿脉的中间%d层 gregtech.jei.ore.sporadic_1=散布矿石 gregtech.jei.ore.sporadic_2=生成在矿脉的任何地方 gregtech.jei.ore.spawn_range=生成范围:%d - %d @@ -5410,7 +5492,7 @@ gregtech.item_filter.footer=§e手持物品右键覆盖设置 gregtech.cable.voltage=§a最大电压:§f%,d §f(%s§f) gregtech.cable.amperage=§e最大电流:§f%,d gregtech.cable.loss_per_block=§c线损/米/安:§f%,d§f 伏 -gregtech.cable.superconductor=§d%s 超导体 +gregtech.cable.superconductor=§d%s超导体 gregtech.fluid_pipe.capacity=§9容积:§f%,d L gregtech.fluid_pipe.max_temperature=§c温度上限:§f%,d K @@ -5433,7 +5515,10 @@ gregtech.multiblock.invalid_structure=结构无效。 gregtech.multiblock.invalid_structure.tooltip=该方块是多方块结构的控制器,请查看该方块的JEI界面以获取搭建图示。 gregtech.multiblock.validation_failed=输入仓/输出仓数量无效。 gregtech.multiblock.max_energy_per_tick=最大功率:%s(%s) +gregtech.multiblock.max_energy_per_tick_hover=可用于运行配方或超频的最大EU/t gregtech.multiblock.max_energy_per_tick_amps=最大功率:%s(%sA %s) +gregtech.multiblock.max_recipe_tier=最大配方等级:%s +gregtech.multiblock.max_recipe_tier_hover=可运行配方的最大等级 gregtech.multiblock.generation_eu=输出功率:%s EU/t gregtech.multiblock.universal.no_problems=无故障! gregtech.multiblock.universal.has_problems=存在故障! @@ -5443,11 +5528,11 @@ gregtech.multiblock.universal.problem.screwdriver=§7螺丝没拧紧。(§a螺 gregtech.multiblock.universal.problem.soft_mallet=§7有什么东西卡住了。(§a软锤§7) gregtech.multiblock.universal.problem.hard_hammer=§7外壳有些凹痕。(§a锻造锤§7) gregtech.multiblock.universal.problem.wire_cutter=§7有几根线烧焦了。(§a剪线钳§7) -gregtech.multiblock.universal.problem.crowbar=§7这东西不属于这儿。 (§a撬棍§7) +gregtech.multiblock.universal.problem.crowbar=§7这东西不属于这儿。(§a撬棍§7) gregtech.multiblock.universal.muffler_obstructed=消声仓受阻! gregtech.multiblock.universal.muffler_obstructed_desc=消音仓口前方必须有一格空气。 -gregtech.multiblock.universal.distinct_enabled=总线隔离: §a是§r/n每个物品总线将在配方识别中被视为完全独立。对于消耗材料相同,使用的非消耗材料(模头、透镜等)不同则产物也不同的配方来说作用显著。 -gregtech.multiblock.universal.distinct_disabled=总线隔离: §c否§r/n每个物品总线将在配方识别中被视为组合的物品输入。 +gregtech.multiblock.universal.distinct_enabled=总线隔离:§a是§r/n每个物品总线将在配方识别中被视为完全独立。对于消耗材料相同,使用的非消耗材料(模头、透镜等)不同则产物也不同的配方来说作用显著。 +gregtech.multiblock.universal.distinct_disabled=总线隔离:§c否§r/n每个物品总线将在配方识别中被视为组合的物品输入。 gregtech.multiblock.universal.distinct_not_supported=这个多方块不支持总线隔离 gregtech.multiblock.universal.no_flex_button=这个多方块没有这个按钮的附加功能 gregtech.multiblock.parallel=最大并行:%s @@ -5463,18 +5548,18 @@ gregtech.multiblock.preview.select=右击方块以查看其他可选方块 gregtech.multiblock.pattern.error_message_header=潜在的结构错误: gregtech.multiblock.pattern.no_errors=没有发现结构错误! -gregtech.multiblock.pattern.error=在 %2$s 处需要%1$s。 +gregtech.multiblock.pattern.error=在%2$s处需要%1$s。 gregtech.multiblock.pattern.error.limited_exact=§c精确:%d§r -gregtech.multiblock.pattern.error.limited_within=§c最少 %d 个,最多 %d 个§r -gregtech.multiblock.pattern.error.limited.0=§c最多:%d 个§r -gregtech.multiblock.pattern.error.limited.1=§c最少:%d 个§r -gregtech.multiblock.pattern.error.limited.2=§c最多:每层 %d 个§r -gregtech.multiblock.pattern.error.limited.3=§c最少:每层 %d 个§r +gregtech.multiblock.pattern.error.limited_within=§c最少%d个,最多%d个§r +gregtech.multiblock.pattern.error.limited.0=§c最多:%d个§r +gregtech.multiblock.pattern.error.limited.1=§c最少:%d个§r +gregtech.multiblock.pattern.error.limited.2=§c最多:每层%d个§r +gregtech.multiblock.pattern.error.limited.3=§c最少:每层%d个§r gregtech.multiblock.pattern.error.coils=§c必须使用同种线圈方块§r gregtech.multiblock.pattern.error.batteries=§c必须至少有一个不是空电容§r gregtech.multiblock.pattern.error.filters=§c必须使用同种过滤器§r -gregtech.multiblock.pattern.clear_amount_1=§6前方必须有 1x1x1 大小的空间§r -gregtech.multiblock.pattern.clear_amount_3=§6前方必须有 3x3x1 大小的空间§r +gregtech.multiblock.pattern.clear_amount_1=§6前方必须有1x1x1大小的空间§r +gregtech.multiblock.pattern.clear_amount_3=§6前方必须有3x3x1大小的空间§r gregtech.multiblock.pattern.single=§6仅可使用该种方块§r gregtech.multiblock.pattern.location_end=§c最末端§r gregtech.multiblock.pattern.replaceable_air=可为空气 @@ -5510,14 +5595,14 @@ gregtech.multiblock.turbine.efficiency=涡轮效率:%s gregtech.multiblock.turbine.energy_per_tick=产能功率:%s/%s EU/t gregtech.multiblock.turbine.obstructed=涡轮表面受阻! gregtech.multiblock.turbine.obstructed.desc=涡轮前方3x3必须是空气。 -gregtech.multiblock.turbine.efficiency_tooltip=转子支架等级超过 %s§7 时,每级增加 §610%%§7 的效率。 +gregtech.multiblock.turbine.efficiency_tooltip=转子支架等级超过%s§7时,每级增加§610%%§7的效率。 gregtech.multiblock.large_boiler.efficiency=效率:%s gregtech.multiblock.large_boiler.steam_output=蒸汽输出:%s gregtech.multiblock.large_boiler.throttle=节流:%s gregtech.multiblock.large_boiler.throttle.tooltip=锅炉可以节流,以减少燃料消耗与蒸汽产出,并且不损失效率,不影响加热时间。 -gregtech.multiblock.large_boiler.throttle_increment=节流阀 §a+5%%§r/n§7减少燃料消耗与蒸汽产出,并且不损失效率,不影响加热时间。 -gregtech.multiblock.large_boiler.throttle_decrement=节流阀 §c-5%%§r/n§7减少燃料消耗与蒸汽产出,并且不损失效率,不影响加热时间。 +gregtech.multiblock.large_boiler.throttle_increment=节流阀§a+5%%§r/n§7减少燃料消耗与蒸汽产出,并且不损失效率,不影响加热时间。 +gregtech.multiblock.large_boiler.throttle_decrement=节流阀§c-5%%§r/n§7减少燃料消耗与蒸汽产出,并且不损失效率,不影响加热时间。 gregtech.multiblock.large_boiler.rate_tooltip=§7每块§1煤炭§7可以生产§f%dL§7的蒸汽 gregtech.multiblock.large_boiler.heat_time_tooltip=§7需要§f%d秒§7预热 gregtech.multiblock.large_boiler.explosion_tooltip=无水时提供燃料将爆炸 @@ -5538,6 +5623,7 @@ gregtech.multiblock.miner.silk_touch_mode=区块对齐模式:§c禁用§r/n精 gregtech.multiblock.miner.both_modes=区块对齐模式:§a启用§r/n精准采集模式:§a启用§r/n§7机器必须在闲置状态下切换。 gregtech.multiblock.fluid_rig.drilled_fluid=流体:%s +gregtech.multiblock.fluid_rig.no_fluid_in_area=区域内没有。 gregtech.multiblock.fluid_rig.fluid_amount=抽取速率:%s gregtech.multiblock.fluid_rig.vein_depletion=矿脉大小:%s gregtech.multiblock.fluid_rig.vein_depleted=矿脉已殆尽 @@ -5563,11 +5649,11 @@ gregtech.multiblock.power_substation.average_io=平均输入/输出:%s gregtech.multiblock.power_substation.average_io_hover=蓄能变电站内部的平均能量变化 gregtech.multiblock.power_substation.time_to_fill=预计充满时间:%s gregtech.multiblock.power_substation.time_to_drain=预计耗空时间:%s -gregtech.multiblock.power_substation.time_seconds=%s 秒 -gregtech.multiblock.power_substation.time_minutes=%s 分 -gregtech.multiblock.power_substation.time_hours=%s 时 -gregtech.multiblock.power_substation.time_days=%s 天 -gregtech.multiblock.power_substation.time_years=%s 年 +gregtech.multiblock.power_substation.time_seconds=%s秒 +gregtech.multiblock.power_substation.time_minutes=%s分 +gregtech.multiblock.power_substation.time_hours=%s时 +gregtech.multiblock.power_substation.time_days=%s天 +gregtech.multiblock.power_substation.time_years=%s年 gregtech.multiblock.power_substation.time_forever=永远 gregtech.multiblock.power_substation.under_one_hour_left=不到一小时就会完全耗光! @@ -5598,24 +5684,24 @@ gregtech.command.worldgen.usage=用法:/gregtech worldgen gregtech.command.worldgen.reload.usage=用法:/gregtech worldgen reload gregtech.command.worldgen.reload.success=已从配置文件中重载世界生成设定。 gregtech.command.worldgen.reload.failed=世界生成设定重载失败,请在控制台中查看错误。 -gregtech.command.hand.groovy=你也可以使用 GroovyScript 提供的 §6/gs hand §f命令 +gregtech.command.hand.groovy=你也可以使用GroovyScript提供的§6/gs hand §f命令 gregtech.command.hand.usage=用法:/gregtech hand gregtech.command.hand.item_id=物品:%s(元数据:%d) gregtech.command.hand.electric=电力信息:%d / %d EU - 电压等级:%d;是否为电池:%s gregtech.command.hand.fluid=流体信息:%d / %d L;能否输入:%s;能否输出:%s -gregtech.command.hand.fluid2=流体 ID: -gregtech.command.hand.material=材料 ID: +gregtech.command.hand.fluid2=流体ID: +gregtech.command.hand.material=材料ID: gregtech.command.hand.ore_prefix=矿物前缀: -gregtech.command.hand.meta_item=元物品 ID: +gregtech.command.hand.meta_item=元物品ID: gregtech.command.hand.ore_dict_entries=§3矿物词典条目: gregtech.command.hand.tool_stats=工具状态类:%s gregtech.command.hand.not_a_player=这条命令只能由玩家使用。 gregtech.command.hand.no_item=必须在主手持握物品时执行这条命令。 gregtech.command.recipecheck.usage=用法:/gregtech recipecheck gregtech.command.recipecheck.begin=正在检查配方冲突…… -gregtech.command.recipecheck.end=已检查出 %d 个可能的配方冲突。请查看服务器日志以了解详情 +gregtech.command.recipecheck.end=已检查出%d个可能的配方冲突。请查看服务器日志以了解详情 gregtech.command.recipecheck.end_no_conflicts=未发现配方冲突! -gregtech.command.recipecheck.end_empty_inputs=配方检查发现了 %d 个输入为空的配方和 %d 个预测为空的配方。查看服务器日志了解更多信息 +gregtech.command.recipecheck.end_empty_inputs=配方检查发现了%d个输入为空的配方和%d个预测为空的配方。查看服务器日志了解更多信息 gregtech.command.copy.copied_and_click=已复制至剪贴板。点击以再次复制 gregtech.command.copy.click_to_copy=点击以复制 gregtech.command.copy.copied_start=已复制[ @@ -5673,10 +5759,10 @@ terminal.app_name.maximize.unsupported=该应用程序不支持最大化。 terminal.items.description=一本关于物品的指南书。 terminal.machines.description=一本关于格雷科技机器的指南书。 terminal.multiblocks.description=一本关于多方块结构的指南书。 -terminal.tutorials.description=对包括 CT 集成、各类提示、教程等等的事物进行介绍。 +terminal.tutorials.description=对包括CT集成、各类提示、教程等等的事物进行介绍。 terminal.pong.description=经典的街机游戏——“乓”,用来消磨百无聊赖的时光,在生产钨钢的时候让你不至于盯着干等。 terminal.minesweeper.description=经典的扫雷游戏,上课的时候偷偷来一盘。 -terminal.maze.description=GTOS 独占游戏。在无尽的迷宫中逃离米诺陶的魔爪! +terminal.maze.description=GTOS独占游戏。在无尽的迷宫中逃离米诺陶的魔爪! terminal.cape_selector.description=你可在此装备通过进度获得的披风。 terminal.teleport.description=打开一扇通往任何维度中任何坐标的传送门。用的时候小心,别卡进墙里! @@ -5686,7 +5772,7 @@ texture.url_texture.fail=加载失败 terminal.hw.battery=电池 terminal.hw.device=设备 -terminal.os.shutdown_confirm=确认关闭?(再次按下 ESC 键以退出) +terminal.os.shutdown_confirm=确认关闭?(再次按下ESC键以退出) terminal.os.hw_demand=缺少硬件: terminal.system_call.null=无 @@ -5753,7 +5839,7 @@ terminal.settings.os.double_check=再次确认 terminal.settings.os.double_check.desc=关机时是否需要再次确认。 -terminal.recipe_chart.description=配方链分析工具,助你轻松构建配方图并像 JEC 配方计算器一样计算出所需的材料。 +terminal.recipe_chart.description=配方链分析工具,助你轻松构建配方图并像JEC配方计算器一样计算出所需的材料。 terminal.recipe_chart.limit=页面数量受限。 terminal.recipe_chart.delete=删除页面 terminal.recipe_chart.add_slot=添加根槽位 @@ -5765,10 +5851,10 @@ terminal.recipe_chart.visible=可见 terminal.recipe_chart.jei=打开JEI terminal.recipe_chart.tier=等级: terminal.recipe_chart.ratio=权重 -terminal.recipe_chart.tier.0=可缓存 5 个页面 -terminal.recipe_chart.tier.1=可缓存 6 个页面 -terminal.recipe_chart.tier.2=可缓存 7 个页面 -terminal.recipe_chart.tier.3=可缓存 8 个页面 +terminal.recipe_chart.tier.0=可缓存5个页面 +terminal.recipe_chart.tier.1=可缓存6个页面 +terminal.recipe_chart.tier.2=可缓存7个页面 +terminal.recipe_chart.tier.3=可缓存8个页面 terminal.prospector.vis_mode=切换色彩模式 terminal.prospector.list=全部资源 @@ -5778,22 +5864,22 @@ terminal.prospector.fluid.info=%s %s - %s%% terminal.prospector.waypoint.add=[双击§7左键§r]添加路径点 terminal.ore_prospector.description=厌烦那种给小孩玩的扫描仪了吗?不想跑来跑去四处找矿了吗?过来看看这个。 -terminal.ore_prospector.tier.0=半径大小 1 -terminal.ore_prospector.tier.1=半径大小 2 -terminal.ore_prospector.tier.2=半径大小 3 -terminal.ore_prospector.tier.3=半径大小 4 -terminal.ore_prospector.tier.4=半径大小 5 -terminal.ore_prospector.tier.5=半径大小 6 -terminal.ore_prospector.tier.6=半径大小 7 +terminal.ore_prospector.tier.0=半径大小1 +terminal.ore_prospector.tier.1=半径大小2 +terminal.ore_prospector.tier.2=半径大小3 +terminal.ore_prospector.tier.3=半径大小4 +terminal.ore_prospector.tier.4=半径大小5 +terminal.ore_prospector.tier.5=半径大小6 +terminal.ore_prospector.tier.6=半径大小7 terminal.fluid_prospector.description=你也知道,基岩底下藏着宝贝。 -terminal.fluid_prospector.tier.0=半径大小 1 -terminal.fluid_prospector.tier.1=半径大小 2 -terminal.fluid_prospector.tier.2=半径大小 3 -terminal.fluid_prospector.tier.3=半径大小 4 -terminal.fluid_prospector.tier.4=半径大小 5 -terminal.fluid_prospector.tier.5=半径大小 6 -terminal.fluid_prospector.tier.6=半径大小 7 +terminal.fluid_prospector.tier.0=半径大小1 +terminal.fluid_prospector.tier.1=半径大小2 +terminal.fluid_prospector.tier.2=半径大小3 +terminal.fluid_prospector.tier.3=半径大小4 +terminal.fluid_prospector.tier.4=半径大小5 +terminal.fluid_prospector.tier.5=半径大小6 +terminal.fluid_prospector.tier.6=半径大小7 terminal.console.description=扳手、螺丝刀、锤、撬棍四合一,一站式为物品栏腾出空间。 terminal.console.notice=以潜行右击机器的方式打开终端并进入本应用程序即可进行操作。 @@ -5836,10 +5922,10 @@ terminal.multiblock_ar.builder.place=放置方块 terminal.multiblock_ar.builder.debug=调试 terminal.world_prospector.description="我要是有双镭射眼就好了。"\n"不好意思,先生,我们这儿不是卖超能力的。你得相信科学。" -terminal.world_prospector.tier.0=半径 15 米(1个槽位) -terminal.world_prospector.tier.1=半径 30 米(2个槽位) -terminal.world_prospector.tier.2=半径 60 米(4个槽位) -terminal.world_prospector.radius=半径 %s 米 +terminal.world_prospector.tier.0=半径15米(1个槽位) +terminal.world_prospector.tier.1=半径30米(2个槽位) +terminal.world_prospector.tier.2=半径60米(4个槽位) +terminal.world_prospector.radius=半径%s米 terminal.world_prospector.reference=选择参照物 terminal.world_prospector.color=选择方格颜色 @@ -5855,14 +5941,14 @@ terminal.maze.play=游玩 terminal.maze.continue=继续 terminal.maze.pause=游戏已暂停 terminal.maze.death.1=哦不!你被米诺陶吃掉了! -terminal.maze.death.2=你在输掉游戏前穿过了 %s 道迷宫。 +terminal.maze.death.2=你在输掉游戏前穿过了%s道迷宫。 terminal.maze.death.3=再试一次? terminal.maze.retry=重试 terminal.minesweeper.time=耗时:%s -terminal.minesweeper.lose=你输了。游戏将在 %s 秒后重新开始。 -terminal.minesweeper.win.1=你用时 %s 秒赢下了游戏! -terminal.minesweeper.win.2=游戏将在 %s 秒后重新开始 +terminal.minesweeper.lose=你输了。游戏将在%s秒后重新开始。 +terminal.minesweeper.win.1=你用时%s秒赢下了游戏! +terminal.minesweeper.win.2=游戏将在%s秒后重新开始 terminal.cape_selector.empty=你好像还没有解锁任何披风! terminal.cape_selector.select=点击一件已解锁的披风即可装备! @@ -5930,7 +6016,7 @@ gregtech.subtitle.maintenance.electrical=机器:电网瘫痪 gregtech.subtitle.maintenance.mechanical=机器:机械故障 # Debug messaging -gregtech.debug.f3_h.enabled=格雷科技对调试信息作出了修改!开发者可在配置选项中启用 misc:debug 来显示更多信息 +gregtech.debug.f3_h.enabled=格雷科技对调试信息作出了修改!开发者可在配置选项中启用misc:debug来显示更多信息 ### Forestry Integration # Frames From 2406457e94ec757a4751da0440d83ab213f36f42 Mon Sep 17 00:00:00 2001 From: vrejhead <113960896+vrejhead@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:34:21 -0800 Subject: [PATCH 44/77] Fix Fluid Drilling Rig sometimes drilling on the incorrect vein (#2224) --- .../java/gregtech/api/capability/impl/FluidDrillLogic.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java index e7a1e6930cf..4a80583e813 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java @@ -166,11 +166,11 @@ protected boolean checkCanDrain() { } public int getChunkX() { - return metaTileEntity.getPos().getX() / 16; + return Math.floorDiv(metaTileEntity.getPos().getX(), 16); } public int getChunkZ() { - return metaTileEntity.getPos().getZ() / 16; + return Math.floorDiv(metaTileEntity.getPos().getZ(), 16); } /** From 64d199f6a06559604de2514ebddb4259ec816b0b Mon Sep 17 00:00:00 2001 From: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:36:35 -0700 Subject: [PATCH 45/77] Fix warning with cinnabar (#2241) --- .../unification/material/materials/FirstDegreeMaterials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java index 8fe4c42472c..c5136fc4a32 100644 --- a/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java +++ b/src/main/java/gregtech/api/unification/material/materials/FirstDegreeMaterials.java @@ -155,7 +155,7 @@ public static void register() { Cinnabar = new Material.Builder(268, gregtechId("cinnabar")) .dust(1).ore() .color(0x960000).iconSet(EMERALD) - .flags(CRYSTALLIZABLE, DECOMPOSITION_BY_CENTRIFUGING) + .flags(DECOMPOSITION_BY_CENTRIFUGING) .components(Mercury, 1, Sulfur, 1) .build(); From 4e4407040b7bcb0d023f6fa8d8664ea6854bf6d2 Mon Sep 17 00:00:00 2001 From: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:38:43 -0700 Subject: [PATCH 46/77] Fix Processing Array of Canners not processing some fluid (#2228) --- .../machines/RecipeMapFluidCanner.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 9b0048e2bf7..19a32b23d0a 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -55,17 +55,22 @@ public Recipe findRecipe(long voltage, List inputs, List } // if we didn't drain anything, try filling container - if (!fluidInputs.isEmpty() && fluidInputs.get(0) != null) { - FluidStack inputFluid = fluidInputs.get(0).copy(); - inputFluid.amount = fluidHandlerItem.fill(inputFluid, true); - if (inputFluid.amount > 0) { - return recipeBuilder() - // we can reuse recipe as long as input container stack fully matches our one - .inputs(new GTRecipeItemInput(inputStack, 1)) - .fluidInputs(inputFluid) - .outputs(fluidHandlerItem.getContainer()) - .duration(Math.max(16, inputFluid.amount / 64)).EUt(4) - .build().getResult(); + if (!fluidInputs.isEmpty()) { + for (FluidStack inputFluid : fluidInputs) { + if (inputFluid == null) { + continue; + } + inputFluid = inputFluid.copy(); + inputFluid.amount = fluidHandlerItem.fill(inputFluid, true); + if (inputFluid.amount > 0) { + return recipeBuilder() + // we can reuse recipe as long as input container stack fully matches our one + .inputs(new GTRecipeItemInput(inputStack, 1)) + .fluidInputs(inputFluid) + .outputs(fluidHandlerItem.getContainer()) + .duration(Math.max(16, inputFluid.amount / 64)).EUt(4) + .build().getResult(); + } } } } From 8263f2c8b144e38fc8f4d79b249ae5b4385d3cb2 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:42:21 -0700 Subject: [PATCH 47/77] Fix Issues with Multiblock Generators (#2229) --- .../impl/MultiblockFuelRecipeLogic.java | 5 ++ .../LargeTurbineWorkableHandler.java | 2 +- .../MetaTileEntityLargeCombustionEngine.java | 52 ++++++++++--------- .../generator/MetaTileEntityLargeTurbine.java | 4 +- ...etaTileEntityMultiblockNotifiablePart.java | 10 ++-- .../MetaTileEntityRotorHolder.java | 29 ++++++++--- 6 files changed, 64 insertions(+), 38 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java index 2333a2742e9..9f93440025c 100644 --- a/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/MultiblockFuelRecipeLogic.java @@ -155,4 +155,9 @@ public FluidStack getInputFluidStack() { FluidStack fuelStack = previousRecipe.getFluidInputs().get(0).getInputFluidStack(); return getInputTank().drain(new FluidStack(fuelStack.getFluid(), Integer.MAX_VALUE), false); } + + @Override + public boolean isAllowOverclocking() { + return false; + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java index 98344cce952..482d6c710b5 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/LargeTurbineWorkableHandler.java @@ -104,7 +104,7 @@ protected boolean prepareRecipe(Recipe recipe) { // rebuild the recipe and adjust voltage to match the turbine RecipeBuilder recipeBuilder = getRecipeMap().recipeBuilder(); recipeBuilder.append(recipe, parallel, false) - .EUt(-turbineMaxVoltage); + .EUt(turbineMaxVoltage); applyParallelBonus(recipeBuilder); recipe = recipeBuilder.build().getResult(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 5fad60478ff..64f7bedd107 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -345,30 +345,6 @@ public LargeCombustionEngineWorkableHandler(RecipeMapMultiblockController tileEn protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { - // drain lubricant and invalidate if it fails - if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { - IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); - if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { - inputTank.drain(LUBRICANT_STACK, true); - } else { - invalidate(); - return; - } - } - - // drain oxygen if present to boost production, and if the dynamo hatch supports it - if (combustionEngine.isBoostAllowed() && - (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { - IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); - FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; - if (boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false))) { - isOxygenBoosted = true; - inputTank.drain(boosterStack, true); - } else { - isOxygenBoosted = false; - } - } - drawEnergy(recipeEUt, false); // as recipe starts with progress on 1 this has to be > only not => to compensate for it @@ -412,5 +388,33 @@ public void invalidate() { isOxygenBoosted = false; super.invalidate(); } + + @Override + protected boolean canProgressRecipe() { + // drain lubricant and invalidate if it fails + if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { + IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); + if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { + inputTank.drain(LUBRICANT_STACK, true); + } else { + invalidate(); + return false; + } + } + + // drain oxygen if present to boost production, and if the dynamo hatch supports it + if (combustionEngine.isBoostAllowed() && + (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { + IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); + FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; + if (boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false))) { + isOxygenBoosted = true; + inputTank.drain(boosterStack, true); + } else { + isOxygenBoosted = false; + } + } + return super.canProgressRecipe(); + } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index b647de173ae..777307110af 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -104,10 +104,10 @@ protected void formStructure(PatternMatchContext context) { @Override protected long getMaxVoltage() { - long maxProduction = ((LargeTurbineWorkableHandler) recipeMapWorkable).getMaxVoltage(); + long maxProduction = recipeMapWorkable.getMaxVoltage(); long currentProduction = ((LargeTurbineWorkableHandler) recipeMapWorkable).boostProduction((int) maxProduction); if (isActive() && currentProduction < maxProduction) { - return ((LargeTurbineWorkableHandler) recipeMapWorkable).getMaxVoltage(); + return recipeMapWorkable.getMaxVoltage(); } else { return 0L; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java index 6af14227d09..1d3d2be909f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiblockNotifiablePart.java @@ -27,6 +27,8 @@ private NotifiableItemStackHandler getItemHandler() { handler = (NotifiableItemStackHandler) getExportItems(); } else if (!isExportHatch && getImportItems() instanceof NotifiableItemStackHandler) { handler = (NotifiableItemStackHandler) getImportItems(); + } else if (getItemInventory() instanceof NotifiableItemStackHandler) { + handler = (NotifiableItemStackHandler) getItemInventory(); } return handler; } @@ -44,11 +46,9 @@ private FluidTankList getFluidHandlers() { private List getPartHandlers() { List handlerList = new ArrayList<>(); - if (this.itemInventory.getSlots() > 0) { - NotifiableItemStackHandler itemHandler = getItemHandler(); - if (itemHandler != null) { - handlerList.add(itemHandler); - } + NotifiableItemStackHandler itemHandler = getItemHandler(); + if (itemHandler != null && itemHandler.getSlots() > 0) { + handlerList.add(itemHandler); } if (this.fluidInventory.getTankProperties().length > 0) { diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java index a1f3ad2074b..e36b9bb24d4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java @@ -2,16 +2,18 @@ import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IRotorHolder; +import gregtech.api.capability.impl.MultiblockFuelRecipeLogic; +import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.damagesources.DamageSources; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; -import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.ITieredMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.client.renderer.texture.Textures; +import gregtech.common.items.behaviors.AbstractMaterialPartBehavior; import gregtech.common.items.behaviors.TurbineRotorBehavior; import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; import gregtech.core.advancement.AdvancementTriggers; @@ -29,6 +31,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.items.IItemHandlerModifiable; import codechicken.lib.raytracer.CuboidRayTraceResult; import codechicken.lib.render.CCRenderState; @@ -39,7 +42,7 @@ import java.util.List; -public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart +public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart, IRotorHolder { static final int SPEED_INCREMENT = 1; @@ -54,7 +57,7 @@ public class MetaTileEntityRotorHolder extends MetaTileEntityMultiblockPart private boolean frontFaceFree; public MetaTileEntityRotorHolder(ResourceLocation metaTileEntityId, int tier) { - super(metaTileEntityId, tier); + super(metaTileEntityId, tier, false); this.inventory = new InventoryRotorHolder(); this.maxSpeed = 2000 + 1000 * tier; } @@ -64,6 +67,11 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityRotorHolder(metaTileEntityId, getTier()); } + @Override + public IItemHandlerModifiable getImportItems() { + return this.inventory; + } + @Override protected ModularUI createUI(@NotNull EntityPlayer entityPlayer) { return ModularUI.defaultBuilder() @@ -343,10 +351,10 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, getController() != null, hasRotor(), isRotorSpinning, getRotorColor()); } - private class InventoryRotorHolder extends GTItemStackHandler { + private class InventoryRotorHolder extends NotifiableItemStackHandler { public InventoryRotorHolder() { - super(MetaTileEntityRotorHolder.this, 1); + super(MetaTileEntityRotorHolder.this, 1, null, false); } @Override @@ -360,7 +368,7 @@ protected void onLoad() { } @Override - protected void onContentsChanged(int slot) { + public void onContentsChanged(int slot) { super.onContentsChanged(slot); setRotorColor(getRotorColor()); scheduleRenderUpdate(); @@ -415,6 +423,15 @@ private int getRotorPower() { private void damageRotor(int damageAmount) { if (!hasRotor()) return; + + if (getTurbineBehavior().getPartMaxDurability(getTurbineStack()) <= + AbstractMaterialPartBehavior.getPartDamage(getTurbineStack()) + damageAmount) { + var holder = (MultiblockFuelRecipeLogic) getController().getRecipeLogic(); + if (holder != null && holder.isWorking()) { + holder.invalidate(); + } + } + // noinspection ConstantConditions getTurbineBehavior().applyRotorDamage(getStackInSlot(0), damageAmount); } From 2e97c3f21af2aa3bbab1884fbdbe6b8ff4ecca8c Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:42:31 -0600 Subject: [PATCH 48/77] Remove no longer desired configs (#2234) --- .../java/gregtech/api/recipes/logic/OverclockingLogic.java | 4 +--- src/main/java/gregtech/common/ConfigHolder.java | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java index 200eb71ed35..824d69b8c5f 100644 --- a/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/OverclockingLogic.java @@ -1,7 +1,5 @@ package gregtech.api.recipes.logic; -import gregtech.common.ConfigHolder; - import org.jetbrains.annotations.NotNull; /** @@ -10,7 +8,7 @@ public class OverclockingLogic { public static final double STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER = 4.0; - public static final double STANDARD_OVERCLOCK_DURATION_DIVISOR = ConfigHolder.machines.overclockDivisor; + public static final double STANDARD_OVERCLOCK_DURATION_DIVISOR = 2.0; public static final double PERFECT_OVERCLOCK_DURATION_DIVISOR = 4.0; public static final int COIL_EUT_DISCOUNT_TEMPERATURE = 900; diff --git a/src/main/java/gregtech/common/ConfigHolder.java b/src/main/java/gregtech/common/ConfigHolder.java index 3a96df68b5f..54863fecb57 100644 --- a/src/main/java/gregtech/common/ConfigHolder.java +++ b/src/main/java/gregtech/common/ConfigHolder.java @@ -83,11 +83,6 @@ public static class MachineOptions { @Config.Comment({ "Minimum distance betweeb Long Distance Fluid Pipe Endpoints", "Default: 50" }) public int ldFluidPipeMinDistance = 50; - @Config.Comment({ "Divisor for Recipe Duration per Overclock.", "Default: 2.0" }) - @Config.RangeDouble(min = 2.0, max = 3.0) - @Config.SlidingOption - public double overclockDivisor = 2.0; - @Config.Comment({ "Whether Steam Multiblocks should use Steel instead of Bronze.", "Default: false" }) public boolean steelSteamMultiblocks = false; From bd7ffd017b1636398f02d3facce7cb910d84bb86 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:44:36 -0500 Subject: [PATCH 49/77] fix fluid colors in TOP with new fluid system (#2242) --- src/main/java/gregtech/api/fluids/FluidBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index c49af6a61bc..88bf5fa5519 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -381,7 +381,8 @@ private static int convertViscosity(double viscosity) { // register cross mod compat for colors if (Loader.isModLoaded(GTValues.MODID_TOP_ADDONS)) { - Colors.FLUID_NAME_COLOR_MAP.put(name, color); + int displayColor = isColorEnabled || material == null ? color : material.getMaterialRGB(); + Colors.FLUID_NAME_COLOR_MAP.put(name, displayColor); } return fluid; From 3c06e54ac731badf95a2150a9e407dcac8311f00 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 1 Dec 2023 20:58:07 -0600 Subject: [PATCH 50/77] Update build script version to 1701481996 (#2239) Co-authored-by: serenibyss --- build.gradle | 10 +++++----- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 3 ++- gradlew | 16 ++++++++++------ settings.gradle | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index ddcf2f8fcdc..62f21b90cb9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1700970468 +//version: 1701481996 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -24,9 +24,9 @@ plugins { id 'eclipse' id 'maven-publish' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24' - id 'net.darkhax.curseforgegradle' version '1.1.16' apply false - id 'com.modrinth.minotaur' version '2.8.4' apply false + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.25' + id 'net.darkhax.curseforgegradle' version '1.1.17' apply false + id 'com.modrinth.minotaur' version '2.8.6' apply false id 'com.diffplug.spotless' version '6.13.0' apply false id 'com.palantir.git-version' version '3.0.0' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false @@ -1027,7 +1027,7 @@ def getChangelog() { // Buildscript updating -def buildscriptGradleVersion = '8.2.1' +def buildscriptGradleVersion = '8.5' tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..033e24c4cdf41af1ab109bc7f253b2b887023340 100644 GIT binary patch delta 26632 zcmY(q1CS;`vo1WgZQIt4ZQHi(cgN;Cw(Xf6+dH;BJ2rNVyWctI|L;8!9bH*ji0 zd@?Ja3f~7$xB-V$mIH^t0D>Z5CgGujVk9xSfc{qv83F_Z#L3l)864#Q_E^XK??xa5 zC?P0DGa0BO+&@JUywiWFrT?eV2m$wBqYpwf*uMe-xdGyzK5!4Wc?R7d^q;u>Pc+Ar z{3kY7V@W{$)7%l9|GV$(<2L^#j0XRw|4DlPpRsNfn*YW&PteqXVPk-Rz`*=_BoPq) za(Fp7Xb=!@R1gpWpa~`+5Sa)XICDq~8Pe?7UxJd_5yu2|~_=yWmbXC`e-Tr8O8x(zdt)iZ1s^ zXT*Y`b0c!6_()7xz{Ccba97RRV&N!!I5C2BK;eg`9)HI2t$mzHOaHDIwTAG^XxEY? zCrY`)|43^CP#-dVtYXuqdPYscy5glEPdB5Mm@dpK<<(bb5$-V$X%ONoA z);JlOSAQV_3EtsVxK5N$n19fOg@s=D9(fdNrfWMS zp)S56N;Ut9i8Uq%aXXm~$tFrm9;U0*XFTw-<1%~IZu5mF-R~cjnc$3ofsRd`ZQUV` zEzh9hzwF|*JgOr>nd|%Me_=!UY9VqRk(wV%!aYx)wm0G_RH{rh_2r&yS_gJPS^ps6 zL1_G?TEycFsK1{xQrij|EDFuB&m?>jww2~K2-3SKAMCO(D~z+o4bV_qhMgiCeYtjY z;NjV}j}No#5_ls@*GJU`7z&wXH$%I7g&dnJsp|G!8s0cl@a8Pxma;J)(YP^sDYtP$ zmlh%T?aKocW%6m~k(xvY+0pV+Z*%(7g+6oWXSUCeEPm%5@weR1jSj&PX}S_Bih+af z*p*(k2WAfh)#eQ@PMsAPGX@R}J%BwlEpMA_ZWuDT?D&cd#Az1;3P2g*(uy?-Cjnu> zsqG>IRKpN>OjnA0uq!uF7b5Cf5St1z8(N=wsj96{ci3%aJt+Hgk(PW*}s9Lwj2?@-Gj^Oq3*V1vWdrv<}12wvu^u=R+ddk zpzaLAOnW*i3CTEh)?vFDxqc%#!&5+Zzs`NeIT2sY>x+t#v9&=-a8^>X(v~<6Drkcw5mA%yj4)) zCq{P+I^2$#@mKuw1K5F9axjn}M(ss-FapfBu~YRHbrix8&^~yfTHufsmPgIe22yJy z$sI0yC_iCfeD>(b+F95Pxps8kdaTRU0~x*ADZI_$DDbUX*p)HLGU6*;TgKNVHAEOABhJuhs|n3O@0%O&Pe6x}H$#by&{i3j7M_uF~J z&BlnU_QMShV4v#=-=3_O*|phe{|T$FVT6(k$4InFXeDzoapWH7HPga~xy1W=tHu_! zV+Y~Lm*0vBqkQMdUAk*jb+Mo~&PrsS4IyK68(JeasonlOXrO57(c zP&{?Mn}bfVn8FvU^s^ilPfVx91YzI$5U0d?5r=FZQk+5P=Kr+Mj6*=7n5Yw1I}0KbV(#5_Ka ziWd_M4YN|2H!2Mk9H{wPIF*8V4vbwdXFbs$;-OpIbSrmU?5r^X)1X`vjXut$h%4Qp zwS_^9G)o+Ix&Lrrz`Q9i$PrHWp8X;6%Spfu5KOcczWKWiu?4Bn{Ekf5%fxK&%5&DQ zAnj7-u>G6_tKkS13>upCf}!di_b5Mi%FC3C*vS8oKmTzeLbJB2m3^lyrT5 zzb^jt6b5Wf?)Wg(l)DR+lnRA1#Y^q}WXyJ`L!|XCODptz)}d`J^q*x59g=sk-c(3l zKw{JW?O4T~7uKjhq)_?TI#1ml)~1-$qA`PPgq6$wt^C~l{5DUJ-Fnb#OS|G8f8C9Z zHQreAA$H%x@{*!*Y?HrM`Rlpw8mVcmP~e@OZkpA;133c8j7c6(g2n;y8i`;Cso6*s=H(OpiZBlODaJ)9jg%|7T8yQ`}}ktIq!b{hIZ{f2RBAWdQqa@%~4;wI%<5V4Zk| zOuh>o1SARy1cV)UXG;K3HgUIBcQx^}aCI}W7qhl7v$JqzGP5^vb4yj%)56!l_zH)x zgb`y_YlNhe^bL~V#Pt=CD{RS7tu3SF5-yc6h;Yuz@nl1v&H2gydXP^7=ua1{K&F*T zf4fd_?UpGhT z4@VoNP&o!lb+N+({LH^)8j*l8G7%g97bBC_x~4E%IZCQd!%WHCb399J6&cqaHkr;H zeX;}emJQMjsXu;QtZ%| z^CLN#tY+%ui;=9KrP0gxEL<)+HGkLYFH(mYnIZh{Fz#8{!&<*LFB~SiiNBPzp=Qz+ zeG{RIiL7{GkO-;}+P-HCKD7?nyF9J!I9ne*$BcD7jzAnhtTQ4`ISS7RyOBgy&IG4& zn7#w=W(Kbsz7HpCL=uHzd89jT(R+53!xf6kNUaweqI)oyQpaY=yCSWR{=ql9nA?LX zZz7sU4n!wy*~BW7L2CqQHo0_bQj$%Nx=1HiB%$eH<07Qi3Zo?onoILGEIiPXzT6^#Zx5V(nn;%Z+;&NUY zHp5pEzV01dE!hc3U6cE+4%^w=Wuo|XzbL(u!N#&$Jf#HZ1ijTYH)yaOZ^2&+t$(!axLY^xAP(+l|4j$Hl2~{zX>ImyTEH zkZ4Yt$!FWt`)k2u(~CCpHZdA*o+;f2%S%DEO(B8j4m5!Ftq}0Z;@&*ZC&HcYDJHj_ z&JtKAM!Zw*L4q1jE?2$HMS=}%K|Vm3@g#EUmv=|M27P;SIp;3n%5i`5dUPt;S^$MI z9Q*(*env5`*%+o!I2d+Q%(Ih&9gzz2-^V6zjA>R!70tv9F1i zMait<$|4nqI&tr}&p5+NJ+b=#EPiKM6e7#@b%_*|Q~_ll-(ypp^YTK_qD`}V%s(?_ z+Z-|fsr$ntn@@OFG-3)l!aT4qrTjQ)tUk zT%F^?)}4~FR@~WE%HA*ZUnc4Qcj+Z@(y9f(KtQ1X1s#I_6L(kvUu`h}TCOI}&K9oX zHg4{&Hl`l#HcpNjuJ&S1j{mHJ`~PPSa@F*d&_yu5%COT`j>wcTQE4Gt7{|$aaqQ$_ zY(-V8Y)Zq&&e+lhEIiqB(H^z-;VF_|Y!95+M%nd3izp}@n@*-W0#4Yh0zcl~5c}!! z%#%iHLPW7(r*r^pH^u|^&^je|bIC;^$sue*{ce>dJ_CsiX;}!Bf1RaRV%1C0eq9I3 zoqBa+CR*0uz42SSGS>Q+$!8j@n|Ny?dTiR+^`gVn+nMjlScGcw-|pBENr?8P5Efg+ z*cWar4ER9W;eRQrAW^kaK8oD^2~RqY38Y}zT;*lNiNq@s;(RyiqG zEG{<@g@>EGxH51yxbYS{>=6r}_o93LVx9qIYKXuKe<$YlabK~0S}tTJi&=4Lkai`H zZ#ly`uD5Yp4`!EN>6#c1m`@>;DX^0b3m;2FQ2S*6lk{j?SmhC7%$SUc&ArFg{z<93 zog5>j{bdH=vD*oYu&^_5xx=YOQ2Ks$#gSx|d@B1z?Vt6i4nU1lnz$W$_|5VsT1y|l zR-=qjerOl-oueko^sK6SJhzL3Y=07Y0Wir)nbQ@>oYlkl?-fQy`dT5H$LHJ{jKHRl zl21`&h+HK34Fo~o(Xu0=kcKC0Vo^N&kZ?v64sZdnCOO^qw^k*I6oxz!rha!2zo$#h zN_x#cFwU;na-kLX2+VG+&my~%S?_U1K-fcp)Wf_*@Gfco$gt?+BNkZB@NKkiP{4LE z0GOA|511!(pNJCLWL5J%sgtwz>-W%&YJTJosQqM1vv`KBj;PB|Az$q0Du3-WyD4Bpgwi;RQqx&gD`Z zOcdK-YHKXV&EvY~;bHZe7$nbBsGrTT_Q3P!kM;|*%`pLDg`iZc4eMw9f)(3*81D$5 zDu}w#jSB9?JK=RN*F@IE$Omyt>VUE)k}n1cP+TFW-;rJrNNiE^a9TQ}?u2ErfKc4qyn*0% z^_-GvOW*LsoFW@bphfph4h!+=Z;P%$2H84;?yB6h_BTnUshi|NyF(@Kt)18ux{K7m z=AVZ>qkC@YYMY$Yv>h@7%~qSxgMxgkToAB73V9Al=_Smm3`Jji>8flZ)h&X2V%AP) z%&`TIx&_r!vTwqhIWWi9_42TR0vHJ4ozpLBA69-+@qbY>CFI*hMLd|eM;VIKTc`in zCFxb41-(h7TOY94*+&rWl9ZdSnEfp!zA8E4nt(57r1IV^e53hzjKEf&zQf5;KtY$oTBA&i~qmB>x3(H04yX32mB*6KHsH2aXrLEDSMy4*OB0}` zrS+UCLjijSW|y0}?w8-w_j%R){9EYz^9!e+_Je}_XGtuuoyLSKQVxx2GGnM4ff$RT zn~{`~JXQi%%Nd|C%GphxMu{s@Vxd2V*vJ6wq9(nANJhS&7Rrj7tDSU5wBt19;7_tY zM54ZLt-+wv_=mz7H-O9+#}4ftVWQi_nZB~Rb=o0(#b$ag2N%kSqjhReDT{Z;nWYr> zL$S39sXTrDxE{b(@g&MGO_#xy-erJ;aI-K$ zLW6xF-j;VO%M@nqAk~DWGr6#hB^FFG@%tkVB0%&b{kX-gai=AM5L_3&7HHy%L z?K;DNk_P@a8+U{MD%ckFt;UAOf6--8G1E34$Z~nb(hh8IOsP_dnuZj;ipD`&9rlzU zYnfwqwE}EUu|6*0X!|Ri=uq#Ujo)hvxaf`0`Q*kqmP=WV_lC4j>=>xWV6yvovQNgu zTjI5bdeBX0S^iPA{XJgiHmOj@ywR^mjvn1>rT9vqzwT5}Yq-QP=%A~I!RC-w!+J#~l^iqn{=lUX1yIzJ|~&(+ns%AqzhfcPAU#N43h8V(L1IQg4*N znqijUD5jgS!BEp7BknZONE7;S%;N+upxwnq>6muAk@LdOCgwniVJ(o9^2r0hrl6s4?#JX;h&cFLW7BK$%k&?9Sa;c z#B|h3#o`DhhfJnh;OIOq)=$5_svTtN36_CcyQNaumzcGL&Qthu4;b8d)egh2m2a-o zS`2FM3~GZu;QPzLUdJ84ohCxV3a3}=8bIU4lWtzCz8a&Wa&P0gdzGZ`1XGd}qSNXs zW8H%A>3AB$e#P6i4)zKV?v~3dSpiB-=@EB-!`-)DzO2x4i7Qi+?ALh%-*b+tub=5G zp3Sz>;(XM6EaC%`6Ax?Z;av{88tQz1ZL5?jx5IVZfUssaI|2tn*RfS~s?)+p17KV4 z3QMfZay7P%E7#q$xxMpz8`oAOR=`DL1h0(3V3+!g2pb^C!un=SSX2)ofGYq_zG>XI zAO~+)_G=k4oK?R10GA{hM*vrnMOL#V^RHMDpa5f6WHPm}Z@vfKi0aStcaZQXw$e?3 z2mV5S7mTI!QrcZyDrx$>B3x-~Jivh<I`kSxDYdxwKdWp z=^R-hFS0u&=^fTsMz%TZ;jlEk58VN#??Y0)jQrdziI7k9K8GRYwuAdV0>F?w*|2`@ z@N9=$GW0Us8HC+C zMzzS<(Us&KHOCG98{*Oi6sr~TWc$sCWI{M);c9;&}2Xzj|x_AQoMP7utAETgCl*{zKO!!nvUop9%{ z&2HPboc#$IXsd0)G0*7f49=c+8Emm?eg{wGk*wz)1!QGPBwnv zBY3G=p?Fh|&trxIjAv?5R$GgXZoB?Ydt5VSUvOOw$2hLHXvxo_edA|~0EVhq5vJ}V zEVrMOVy28S2(sK-b*f!l+XJ!c_rD`0D`hnCT9cjL{^~joxmR@$&LzP5Vo^k2?}9s)m2)ukbB9zj zGz?uIs9@FAptW<4I!}_0uCicHz`ZA@F|bbZQeM-XI*=Mqi>A^pxIBLAIkGXOb}f4a zEDDz3{wVTpFHPU#d;P;Wz~+i$B?^LfIwAm`%VSjlzYR50Jl2mXk5Ubbn2)b5`nw;7 z3HNc!zrbW2&>v7^t&N$+OjAoeXUW6tkt7LTYzK-XBv6&|y z3Z~5xUFXP;B%;F*N2bljO07MK%`r)I9D;~s#u%0uoBNB6tsv$m{D?R$()3)EFdF#Q zruYsw9rZ}0?Q4%6^!UP*($W;OCwImvY(}mA6B5;&PFEX7rK~U{3>Ntj_=Pjr(Cvth zmi{{xAdEDZ<=Y(ej4t{JX$hs5_xbbbky-gGJdfxS;aa5hZrx4XnjHoC6V5>+<6Bf- z-pt%T%o!#)l}zWa7`Y~@xHbmtN<0zP7>t~0j)!TMhm5Dqf}FL2CwqHriaB?PN)yx{ zTlqZv@?UV2s22qezP)%UM%*+fX1>10*2s*kfbE?ORp7asKAGh}$s73_#7Rjfa<285 zq+ucF&t-SjQifjP&DggeWOm!MPZRx3_g(Sr#KmQ`YTg} zz4iTXe+(;LBRCH@?k56xcS4s!`FgTx9#g|sYla7IJ1+F2LBBL1&(59^TBx=c^ z(_}wP@cQ<+&7OpRh<#>i?zKo%y+p}=YSEFt3D>H_dORJ7x1#fMxO!T7_GRY2T6*5B z{@d0^*kh1|iZ|hq9nt|0@Ybq4De^|Xp+5r$CqC#7VvW6MHzom8fvD)m?j>h2dmX}2 zx$DOjpbV76Cm=lTWd%Xh(K``ev=<(thcf}TtEe6jz$I4cPbTtc*4f(jqhuv~J7m0u z8VywNsP`cM83{RrkjnV+M>Mhay)+6jrFqvs?pM{EXN-}Y*_vn)s~Atow+yA+SVMFW z8`*!i-m}p;0R{lRUJJP0zc??5V@ZYsSj$xu^1X}mzk85quD_Zdt$zCt{gqYlOS@pn zku8mR9_A)HkrrwbisT=ro4A>2l_hIv3{#t#e$P8ffyE$AyveGYMnSxd(U7?tI}R`j zmpu=nXUUnW2DXg0`3Sa_+OwAUisIQs{6 zA>4V2g%7QB8H&6TC?g^Tabni~c7c-#zx=*{4mazfZgD_xH%}%_QC%9V%s&3J%Be$H z95x+I_Dcbv#L2BON%|X$0+afcjwf8K*^Rv|4Og+RYPXCg>U^YwjFD4Hfq%1uafQ-q{UlRuO*o0i9v})pp(qI!P%y&S!wq}M5hUqbdl>`$A0qt=wOII`YFDlkAZ&hcqf_nn#s_R@635een?hu_2ei=i3VS z{y8Q>fW(QDK@pO8K+oO+*(wAG*^CTVqeT3n#;HvbM}n_TimiQohn4b-qTv{O$pM%C zb$|+2kG!b$_6`2Of87Oel6k&=DOnB%-~fOTuq;HKIpvqxZ4WLE1u6xJpp!}`7mSJ) z3`+sZ4$D!nAa$P{D{r}=qiw&u5$)M*S{kF<)|$q&U`mgULcbxQ*R>wd7NeJ5zj9qY z{Vep{v!2YlaPuD67btwab+qNz`ptW?1FQ6LF%S`Djr-k`LD#V~WTAg8QZJe%YtxMf zn7vQTw(>g_$x|ED@YjVUJn2|?;mFexh04D!gqTg=2}a`^h36C$v$UMd478a^IcA8P zeNx6`P989|NrMS-bFWJ?kn^aUZ(k9E@0c0-yG0TcN3=0|;(JQ(pEo+`9+(<|b@$rj z8ZwO{T~5Ipg#2wJt-s(bLw zWlmFxh{!uuwBZ^*!{@wSXx|jG>lhQW^9DxbVLHyjwORQzbEHczUKF12?ClF)r(4F% z=n1q$uVN;BRFcr`Yd!po$lG_|b9%ll_0PO)*SBO^^^TaSpI=X5B*eSHsD&;C;3khI zTWV*a+DMkd+WLphbcv59&X^HxjG5$;^Cet-=w`-6Lz@!eowU!uB7cT>U35zw_OSg@ zI-&On%$3|-e)&t(8(qKhipP71h-XxNhwl*xoLN2VHafZR=oPX5Yq|f1mAhN@u<0Jy zHN$=Wft2gC@cPrfTj$Wr)*l`Sn8!uZn{Q3TjnQE(V_(r3vLwSW!d^#5l9(!-o*$Q9 ziXQ0zZEmz$T*)KU+wcR=&Gr>u@d)eKv`5I? zPZ|~G$3sZqU{7t87;J3Ejdx-dgOxi8k&jvVRd2MpyWCb>-s5ypwiEXQ@W$7*$^G~F z>h${Z{2ZaB&EZ@J+xTEcw8)JvLss{FwchDw8})Q+CBD+ulx}mY>+E3XN!VCQ5Bd)c z#xrY&SW*%y>dRxDw0nsQg)LH8&8UEioBvicmuIC!WQoa^S-g%s(POLjyfzD(Wfe|- znRh_1o8gQiPX}2m@+WHz;3o?a#zoquq|9(g;i#hg z8KhN8SnW%mw7Zs(^Hem&fpUNc3qfof%P-B@g7->-K6iLvH6xpO)a5|KG7x9eM&f-c zmsC!l0GC5dZ^~MEbf$z}5HGY0-jWT=-0^)^c7?VmmkS5>Cfo%au*eXg=#j?C4nHkd z?o$B65`R5p)%D3sooXfALcFQ9kqt0y-!~;~LxS#BWh>?0;hQ?z=ccUo+tS z@Q8coVMF4GbUi5Oku`d=@Uo597g71Xgdu35Y#>k^@|7#igBh>ZP1gIl2T=a0){-3Q zGYwc!q=UKs{C1)NP@echTsS*JR65#1s^GRY=tfSMX?j--u|@dSu2R+DfK@JlawY4V z0i4QnlbtbIr)F#1hYt@wdkiX=O+w+2AVSw=rQBE+);cN!ZVEWBYcQ#bM9gQlid7Iz zj~kYW5fyaK2a`e7;)?xsl94zAnb}0&gv}uW#vAEuPcfnZi)1y(;S7|0mPm+EM=CSn z1?DW5YXuDH7@QOywpKij5<_J$X^}efzsS?n#FJb-slp>lg)!}&M&|d2wd*NOQ-;Z1 z*q1EAqz;O8sCC3DX?H;U%Fp%nC`cJHj*n^b%;wnH<$}idnCP$7a|nj2;M7w!&DF>R z^CH1v(|E%HN5RHCW3>BIMWb!D{@J5#b{~RqH_|`A19f>Y!PP!nNvy~km`V+c`IX1P%itNTla1%k3?d& zaZ7a7zF0#DW~WPF{|Xn|Td}T(1!I)RDO$cX;drhC94*1^i61kqVK{IX7ZxZ_|1O$n zjU&@fk~r055jkn8Av_OXE5+KY{DGQI;}jB=h}-tIn8rijm+!i)nFe1?pDq|L=Hd~= zwUcv*(VJd4>0d@ zk~g^oNaRj0yJ1{(LWcBfoJ5bLC<;j%W}tJA?i8^`?99HNe_;x_Irc-~lPBgrHT0Fv ziXgPPI^>&Lqlr%mlR^v>0tg=>kGr?(BL2N_j(8Yj`vo15Xmmkdz zpqieQI4&=Jj^&sw3eue=<+r54Zg}?{5&PhBl-wucP5Y8z-cKzcvA=!zfG-1l>a9LK zxj*S&-Xugt5(Wfhe^yPrxJ||i1xrQmA`J1f+M!^R0LqeKfa*3+X25S#OvEqJVJ(h! zc2W++uW8arbr#sMV2});uF8seF$)E_`{8pCv#HK zMxz6moeM|Z_-PgLJ$RW?6TYno%AS*?mN9X)uWczAGmLlXdnUqcwV_UV`8d)zI>HM0 zd!XI?*2Yn7cWd=y_5bR|9Y)(3m?TW&(47lOW zf6E_#x?J;3tDOQKUOebN{iQjET&Jhb%gpp_YD`yR2i-jBWPZ>;gnK4j;lW9oWjdiX z86EUa>Ceb%tW2b^PZhS%PWCfUALXQtFuv2;^US|W{})a zVwqmhC1@KTTM51QLMtLP+cxyw>`;`Czi$<8s%FXodEwC7P?Zun-9%VImF};^$7(9iuyoKp^&Xv6ofcZpfWq^Jp6&S&L}t)bB{4R`AAI@Qy(<-)m8z z0MJ+T4KnIYTWl2H;ddrxjcn4AyY(k|JxjN)T1XOdtim~1|G8R$Sn^_kdj3^i5_?W+ zuDbE}S@9$5U%g3JN~r2Q7}Ww_GTA~?_xvI2P>$qXH%&{{ti!B=qRJXgRmfV^nwd84 z5*-adnU2Q4i?61H`mMux!sLx-r9TC}k?g=xP~3GCiAMutVMPp>uu3$L$wcXvn(V@P=1$63hP5G$ zt%6*ua{oRMz{*&tH1{bxIQ=N|h9T&2UI2hjaf+`(ha;$>sJQ%vZ0rDL=kUijsvD1R z@$`j)kuqHpd4oI-flhfl0JxUYrEJZ-x4YY53BDJ4KPuL0a;ob+(Fa0PtzHai`-qd8Ul0b)$uD9>Kn{?sWup{j zo-P-xDr1!O&)!#+`hbO;2!5r^_(TX;feo5up$;ah6Ogo`I;*)3PV1z|{e)q(b$!*} z8IjRdRl5))$qP~8l<(k>Y2X&Wr-X%@!vU5J3c|u0Wl42h=@xQ!oyh z)ZgbN%mh;y>>0!>CTq&iO#maTJ%DzW=Tz?YlGxtaSGi=r&w zcpy1#CP%7S66piQ>Ey-N1$@4U$v_!}7W5=;m|bL(8yZh!^38Y>NXSK;w1E8L*&!NO zT~Irrx(^?oxSvChkZ)w|fD7Rx^hZjZd2pvdTtOyvsBnD4BA2+{!CJgpT^S<{NvlpY zA){hyLV{0t=wY9?BRhtxlFENmlv`aX8|F-QMtI5koOkZ z(>2b_OUd8<4dH(6mE$gMz;}q+ptDt^pDq^=zy7{#Ir{-8U0QiM0W#?6?=2Lya=hIF z%R0=8eeIPMO<6<>+3vU=49^(#G_-~)=k)hyGUo)^hWgIf2A;886gG#o>b}96h~8aP z74PO6zjF>gkE4^TRR8MeYVc+Ijz%Nzh(M+Bza#HRJ}l+@D#ExtUNNn!`orVksn(;! zoTHXgB8Q}~6JM&c1K6Q}^p{9Tx~7*^HTpDb=@FFqjHsxWK@X>Oc7XI3AJXzM%7s?n zfI!T#r<(;7P(i;g=iQFyYB;MfBrJsV_z;u9NbLQk1T5NBVbJhStinjabhT2 z1rOCCeXK9D?1Zv;K$PZKB~#sv1oI;_?jSA%2$1-IUzKr(01g;m-aS+9@l}Ex!A_A# zg0>Khi6Fl9&ffPPG0^50rFmw_QG0$?_s2XENxRao&N*yJw>`YNL)Vx5@ZsE^#wNvu z4c>t-kv@3inpy1U71=Gk0W(v9n0R*fWTk*Td<+5kCDC;X{U}Bkq+a|;{wP~GhD|z@ z5Y&iWi8^qX0w|F(1d3AlB9YBEqw4fCKBB+TVv0g}K4H1Af5rwP!KdD_VTwCq@+qnQ zrqE8cRj-`qipyI$#f{5bKIIJs(rLMvVh_5Y6|$gX(pNQCQ;~M3r6aZF%baF3OV6O$ zwLpS?d{9)0N(h3TAWP55i~deOOu|g){Lt-}xz`$)0jTnvE6ufn>hrX+XUW~U;RZ5| z%_4ntTLw>&8zd9;g#1drS1))^n)N)U_((807UY9Rd5v__;(^x{lI&A`{7a{|Ub(Aa zZ@Xqd(r4p*KWD-ta<3h)6WK5h&ZWlT7N>-nie2UrPJ6MQl z9!J45>|K}HSI}iPw$&-H2^grL;Ou(*l3TDLx&Xw50a6VQ9!(E_JAMQ(%}6RmIl8C!zxKeq+uho1RzRhZzDPhno`8KIRuEN#q{|f;G6x%DJhemZyD@@EUwY6o zuwY~K74IH~Lh)sP{mg@BcRNdXr1o~k;A%aollcA3{t4M*NRic7M2*wI>TrRdYEbHX zRSxKz-z6>9Zcl@w8t7FXzyWl?B3;RZiS1`TiEU55S3H-&}$`vh@%N zqU>D0&01nF_jz=O7OC)=q*LD5Rdymjg}L>-O5zB=#D92BstN?*|3snvDY^e(2f_`Bm!p0iRStwYWB*aRQ*UZLIGcml(b@E?el3-YF6fFq2(k;`CRm zBU>%SR2llLGy%%R)hi{$EWLz3u3ZJVh1LBG4qFcbEzC#90oeircQjHl7Jlde2lsU_ zE*Lb3kgP@~C~hN=F#@}^e&cQN!~3+_ORz$fm@RbYPtcoSZgQ+>fY01wET;O5y%0K3) z{v~enBJk?pxsm39tfBvKQNwc2{-1QEa~~rc=RcN5Iy?vn*?*CDzAB*s6s-Tl9MwEi z!_Y$c7VtDNCcqpZ_eP^M(FuY~5I;yFksbyqnk3E2n3@qxPcpG&XQ$7~c<;R_srlp9 z`zMB1yFxqF|4!|zL_Jydd1~+R-Q2!x>D%VRBO5djJ}$K)0v zgcS3grN&r1EVvmCAgQrrl9A-r{lh4RqTWm%*NSDpIC%gP6Fft8J|qT#X?b6Vf2?bg zE^iEes)$`qHY}(G?zb+Ka~LukT$#pYP-QZ*7UmR91I85GlF?!<)+DR@MNuXp3nOiV z$!S%ff>MTJ@Le(3MFzElZ(!dU90!w0UFO7VnOQ>DN>d^u;B)xpRRnEg*go9Mh?SjJ z%Ste)m2_;Hf~_vE)!cMuxmo9oifZUreM;&dyAPX1yEC*k9U1GnC;#oHjGGLb>@QeQ z?p8cAANkY<%2ndEu~yh1>wI8YiUR?g18;J+f{d5Ek_#GsI8QlxryZLii6k!-sKZ>V zOlGNH9)aWvyV48dT zX&~CxSK+_T?fUU`uP!!}+R6NGV-EAE-d&n{vpV6JF#Ix6J1Y%PKLHu6Q-&d)w>p~0 zL%0}65BAu!35s9q8GDw+pi>I|)r+1C@iamQh>K;D__M*cSd1!z>$Qa+)P?=K^DHdT zkwVB%Ezj)8pSS9LF$HIvr9?`sE@o8Ua{92EKbCXrA$Z-9YqK|N-Bl*uQsxO{QnSv& zVmNxXVG)U0wz9BLFcCqF-Lh+`m9LhgXgYIcumB$HF0f z&!X^t7k^>JU(T8>GPo9ZMk$q2is#m2Izz(2hjtfCPa3SMVP06AgkYtqg?T|YPi zNb*Keppu4h_4`>=aYUd_PM2jDHrc~(SmTLVgYsFTjH1j?(}OQZP$@eId4h{Yh;Fd% zafXn2BsnoCwl#PJ6d$J}KVsnF3^5=D0A@o%IHia_U<>58<^jwWpOq{ZA^{zW%Xj=l zy#|fmy5q_$oi*XcPW=G1fPsw!wSjezFyBZ|MDfj-+xmzKCE-uv|D6SDG%sKD{YTry z1`?HX0sawylyOG$n?3013HLrmnNw)ZNC=5dBTZu|B!Pw4>~go)H3X7{EzMU;-{bg9 z97)z3cMI^}G>3kQ@c3p>X%;uUPJVg2@7)6BpAXMt%pmaET!|7o;h6+sI=I)9?ut?p z@efe0+H;NL#vI_iXVKVSdB!-E*SF7GuKpJtfWv4hcaxYOjz3T?$Pj#hnivO|OwU=G zjBo_?GS!dfm?5tV@Z{H>cAJAc8kN++oaqsTFu0m>)XR$+Le{#Cuoq(edW@*ru%&AX z#e5rCeKHb~)$!DZzn<~Pyod1XT#q)lY9IQOd|Xv_e{j@BIBb@Mnv}YC4~bM+5&y_T z2MCyCTn0VbR4G~(J4DbSsSY>~cEaQ^O4+lO$SpeI-v5f+?7HYq<*;yGmT~D-HOXMi z#bwf|Oh`pC76H?Q0(m5g6Pqi7s6|5H3k*gwnM`GhLDo=x*bHJcpP#wQ0>YrDJFgGJ z%w)18ahn*g4SQ_OH4d|QND5Ka?NuQl18_$9W(>JKLkU@9zln=mE8<~&^Iab|N|h6l ztThuot*2BJuZ2&5O_bIg;IaARjt%$Rr}?Sp{3A8pLs{*@ZtR9(G0`UDRPU%0HOMB< zIHaDyWJIb^#EAutc-7a!`zg?t`%BOTqj(lbI?!VgGeOsyFw`eSQfgD&Q5QsI06VOe zEmgL{d_tbT>M?HIyR`H%R(p9 z_f$Y=bJG3>BxwqB3n?^lF*J${2zhM;ZHwe?ieg})I9F7LNXla8+U-kQyXSyc-Cwr7-yJv8l2D;v=LuWSI|efXliv)_@w0vJrPPtuNv-p8 zl-;^nP&RlyOTQKP>RkXRefK5l`u>_kovX5o4AXozGfxZfTL(v)jt>im-G*6+eEEl^ zV2z+?X0UFz8fk6z)EE5oc21tO&JX1Od! zA8q zzz>1$Nx2vwX|7)J6FC9@Oq7nTAuaF9ne#rje8a=%lSSqi@CE&&{p!+pJY*w!H=)!0 zi~CpK9Y$hqX}98tXYVs3f8Y$aU!}s!3pYU8*D0I&lz)F;{>t8TCzvaAQ7Y(| zoB(aUd}4kOLKG-{65$azJe1(;-4{!Ay8!ZUSDo40hYg@|GWLh}vQ&g<{Qk{)(5qvgBmD?k!^GHa7ZnyqwL&Rqxbg zEcQA2OCBJ>hz;clVJjNsY@{GXhK2CF%o=AG3De_j>PEt0?fU{P?>n~f29L#P5Z?Ag zg<^AVd|(Ov?}+jrB#F1TDV)WYH0hf9GG?q(*i6nJWJpXnfOZ4nQ@q+7%UghDLcCaLuME3j(&pZ-&Db$L@co|$ zwN%()WoAquyw4NHJQ>;}?t$wrfB1SSZl<3;rsZeCr4xR06jI`FZ9+kJPOXiCK#lMx zT?<>gkzl1bbuDI|A`jLqx?S6Yf^PYBnOTyUa6uiymSOTzu9*s$TCIB9mXO-ak{uwEN7E7q5GVrj!jQ5#v!@@9m@ zy(Z_k<>hwNvfajN29Y{h=5b<6xs)a?E2i6^itiC~L6I%h(?t5hdMt~>9}XE!Hub z!gy^jLphNkV&StbmAYAvNV+irWjH$X!%u+1EV`F&IVzWJ%UsuX{SJ;mo+D)KW(#t>yrwS%@V24k5f`EzbU>it(+k`-&vg6bC@96%!+= zohHC$U7KqMsF1iWvKICrLR zSe)X%c%itvyKB+n4#lBp@rB|pi_7BfuEn89aSFw)xI>WwrSG=)dCq;#^LwBDkezEX zGnq{CCCTKU)40JEfccp)Q)*c@7p;$J0XcC8hHXi`tOAWgAlOOM>s_yMu}k>!2E$0P%Z12ik;O^y>6PH4A*E5b(tdOaRB>QoH+g09V9|K#b)H6wMAXL?>5`NxTKt+ zKery7p(pOC2jFVCrkT;>apJ%AFpo^XR}UE9gl0eidRS;#C)KN8n(;{^N{MW;ZRr%3 z^oU`d-xcOv9zVtPonO%xxHs1%=GR{w_Yqvmw=Fo^WF|mZ^r2d{`4tM_H(S_Bq~@xn zV%R}p*(aRbrD4P9xON?Tu=%o)W7Ayj#8Uk+gJJA$#INOSs^bvNQKZH#D4J5|yOqCy zc-XMYc1bc{h76B72%zaik~d#2hZK=H(pX8;OEFEOqF2i^@is;3N7krtHjOUhNnP7& znu$7Q=BuRrY{@O2PIEl;F23}BhC~2$sJ4+)k>LlP#l7fwD%e9!q?BJPo%g)q<@<2<8k zCU}}OPPIxr&ROdD%_(W6H5(q?ssOv*`WX^E`5VN`e%0CSpvGkVJ}3N}r^I!`%BO`( z8&BId?$t=$RJTcSQ)I6-vxiP)u9MgBhy~j~=)tQr$ir3_VexCA*bIey9>-76wJZ71 z-jBk1WCGf-CoD7h+Xi!$6f*mYQ$;XO z6$*ohJLd3}%vA(^PZ>0I6e;G_J>15`svlO^=x~7z9hz@XTI}cat*{a<7b`!weh#eB zCekl{V`cM2Uu9NBo4qQ22q2{adIl~7TrxxT+xs-(kJf8UzhbnMS;T2~T5a*@J#}_G zB2m!~l8&db@-)dXdfG;#J4S|0Spm#U;u!nl^p;&uxifmGqNlX9BkNuYVwILzWqLnt zt1TX(ITm|%& zas%A+OmekfsgA~2W=Iuux=BZ$BC>6UhArgdb4>{KX&`@bch${?FWxHv_l%5wG^){{ zV_(Ul%?gYeVpBpr^suYyS zYj92B;j7dXRy|+pCrq9Yd)WK@%UIE}W7G2N=X2$Fb3q}$wlxH=@i2>*ZLgR$P__GB zM3%vibEsCxG`Ic8%^03u>E&YY8Gjs&9dU2eChal#pd!RIN<{Gl6yuv5X(iySy4u%9 z(?y4^FwEUr$5=XELAnTIQC<|^qId0B635r`iqOB^GlYl)Kvg@G73X}6>^tVWk!tGi z;*;v{M)#4teZyY8)LrL2JYWFEyH+z0-jx+2pCjEklu z_3f|LrAW)WnaEMlLA1)STM%EPd(hKbm(5)vy$c<^;fL^5jnE_oyJf>&&|ni2UN61hbsGOz<6$)I1Wi( zgvgmVf;Q}1g}#;94apEu!-^{Wp2y+N38%m$1fr=)7vS)II5}!WOGx}Ab(*);-VwOo)Z0n))B|6rql`f)U zgQqf>g!yj^RUqasSSX>>jz&Yf8Rld{Dyh3|RG+~whIkfu%wE>HH6j1#^Rj4o3TK5A z={1ApUdBR}>o1#>O65~!9CtY`<}@?>P8VZcA?6=idX5HX*A{oK7ROBhl?kzLV)!rtV$g`pfYG7eaY$^>*xn86S6~HJeG1P zL=7T;X#rGjXfaH8I+Fjnp2eY7O4>!!fGfa7nJ?Hbx0jvm>y<<&6>_KCP5b~?j{!3! zy{bX!7KRt6sKGv3vNPVVb33sEFTK4W|JeaG18$n8Wh^bi0rb{{rF>U0YfD@{g_XpD zzh`J0b{s@82t*&{=CrgDxa*Z!aQw&?8^f^}$&-OP+R-dbFli`+9jB71LNl)*E%@Vr zydy3BY#>ecZs!pU+_1WT#`71v`3Yo9%3|vx9NkUx5tYX*-yisn3>iv)q(7DOg)up& zBNVvIHV~DZyc+m+#Oz8q>qcE9CJVWW`b1ybbp_(MO4SjO{ed)(kt-*ZvTBoN0X=t= zFAWOE=LXvy;#Cx~nHH@UD3}y|ikQ#37(7yGn}z=Gil4K`=E;?9$azOy%|@AV>W}xx z|L_7XzTr{cvCpxgo9~!DylltNl(24}+I4&LCPrAHkW`huA(l zy@!aaN71B_Xdh`hEj-b{f6^>d_t=%$tuyV=G+@^FD!J`0>1cElzJV^JLVP@@4J%8$k8JLcwU_IZFJ-)hlP)PGY zcaS{5-FVGDaYXtOG;?B>8GNeBkQtq3#z>a08K2yCPWtf*#*0kO{?H*4BT`!EG$EQE z#>OKtt%GA(Dd4D3-iD@!#|KQjw_>IPLx3+EKm#kt(Z(K5=`K+(~D3eY_`>?Kr z^v16@U_|)Zx>CDQ@{Yf=d^VJTytmC(HQV$1l<~w16jp2;Db$Qq9fD?}oW8IF)T_>I zqy`;2!)9b4`Xw4SJO##^a&c_pegJi~3~;lR>*Y-%r4Xdh+z9q8c&A4RF@=|}LOv`; zRWYOlmIva>iYja8X{|9VR0H!7nw@fe(+L)iu5`c6-7Wf5@l7S_)79mqaUbAdRSL>0 z4V8>D_YX7)yA9hO;D4`@kG%?zCkO-lyFkAfy|%x& z6U=u)Y6gzhbV1Y$C&N)BW_u#K9=OVWTx%*6A1qc2V%9JQCW|M=B2=r4l{em;VT&_+ zWpu*@8zGkZ#u=+8Zbst4KS8Z@*A}CZ?M-=s*@`TuiZ4|CmKd9pq#rAUTjxof2LKDX%`l$_Ei`D2-pt_U7qi zqgTn2@RpVq;}`KdF7Z8_z&5`Y?B58!HHPnd-28kuM{EgsYnfHV-iXZ^P}NWEC6Cgm z8X5Q$5%>r_+2wx*`owBYO*vi;gKy*7F6;$=ZnMxVu^oD>1lE4lD_0V(raHC7Zz-)- z@Xq`e*4Sb>*7}CoP5`7j2F<0RFI;*Vz4($+XC#xc$=W$_jTv`RJ>QN3l8aCxieyX? zA}0(VBc{BPzyUXsak#pWlGGX3#;1k-6E&6B`ok#CiFU`Jh^oior3Nb5d34mjXG**&uX zXg_@%Df1YOp7MaFf^MrtmC1Ctq_kB)+H&nsZJR0voA0B7n`ThOv$F3rx~KH&Ow)Ot zF9nM2CsXYWyPUt%ES0&7rDws&+H05TmP1lAc?;QJ()XhyD2pGlN?$<$r4U#?$P0vI z354iGku*5OW{?*o(i-mKBf)lVa7;V8KqG~~wz>4p%WvVBdFO)SdRo5Z>?X)JKQUa^ zVJqei?!F_Hl~PFT#={h3@qW0?WoNAGiF`(*iKZ}?1LgNf*5e+aK9Kw*>#CKxeLz|e ztlL+7p!-Qt7QsP~B#PS4iZAe7JlBIQv`*;*E~$~QkpQVO^tP%tnl`k{lRHzLTJA;j z9kQ(4$@YCWc&RQBA!^E_K_m`#o*0Nicc>T)%S6t z2kVBiBK#{Amd16jD0A5YYZ!^m8Xoaf+mMdwbgqVrCx()0SIJEfC^6vX8B0=jNn-iX@! zla`3`n}7_8)4xYrX&|SzDH-0)Ipj7Denj>*p(xoj=B)60c-f&=$g-G$0}%zyv?L}9gp^5$Iw`SxXOVe)h~2HJX66sXcHMVn^@N}wqcKH#3W*1{ z(sj{;w~PUVp;%=Gz#!Yaxu5)@LS!=7y?OK?R4kYmgzsb2l;?SrFZI)=c$6bQHVrdo zBMR;MenLLgYMwJ&MmWXL`!d%*sXxWVy;MqQWd0*&YK}uWjVk^lt73PRBZW%q2qb8+ zU!Q*#f508O{ohl41iZ3-8;eKYGpEv5L6&CYufU!!g$Cz)o2@ z=#wT2;j}qxkv{7ONHjJY?W`w6n()%HBgx;LBrY;xK-miOa+5kJi%!ld9CUyK;AJ7Yx0;;^ebG$MOH?uW>8k!v>+3;4Y8&raPL}@ z$PAmM_m0yz(Y5hMx&YkhILdx{Wl|!XL+Z71x`uA8QhArEwp`V`P#o#GTH<5?FHUP>H%QP5*i_>p-u$PE^hH4RNB#k6$?2)#g0J$Q6~Oz}@)T89%(W`O=x+>xASZ zoX|Q$s5GSO{z`32FzDKtgY~)KC?mXaUE9l8X0fc4%Rlqm97Ft69*W^>QDYGLAn!K& zthDt7vE6o~4NGld^{V8@Rm6DRcqu&+^zHU&zUkss49vs4%8M@YDH3msqd;{?}M+Y_OjYnyhoX;}`-- zHJahCOUisSwLa$A84-AS7yIjNA{=~cpiC*N-)9V*#wlEg6LBh^;=c=cQ|3~7>$dV} z>sK=7c*B1gB|ysGo6?J$Y5Yq4xaU(l{{CXuFQotEm6)9Y!E?U2;H)#WM#>(y-{~YZ zXTZklzOmo1WnKevzwyj^$1oA_{(HJ4ZX%Oz1w|^;Ljj+^114P%gJP2%HRr^!KHae= zv>@69rJ{}n=dmC}7Hq;H19tN@dh-Lh4$yFIn1hno6&Se!XiW}c$gKUgkS?SI&S)jZ zTwMGbecRW5ow2p1Jw5!~p@UKGl||cTXBsesH@ zY|m-WiD#v2otKRM3Dg`LoN2F18{D#8f2*#kvZnpM1$7Q>JN6P`Vg~4bFQ7e9RYnt& zfiHRn0@qS!m1Y)twYRCyRfR= zr#pW-&S>a>JUA5y1@_cKT%V*JV6E-o?_%C zj~Gw9Tu`k^1`!((?$$sYN~sl9-`4I&DL#H0U%YrfXXrE#GplMtA6D@(8f7?p7)flK z5R>Xz3P4S=3JP&?;NJ;x6QQzt@tskGei^+Jwrp5vdgqB+X6#HoLwB@dDg2>9!mWpf z_>4cN2=G2HzAtc7a$4xKP+UNi&Zpt}T8D}KXr)J?;^OL`UnXv75CrpIn8D9}IBe6$ zH`8bHJScpJCoh=>ShJihI>ooSUTD{AZfXFu=E(&aw}Gm~0fKn)iB#9Qe1zU?Y-4+U z^#KR{l+Uo+_n495xY~o-xF0|4gM(fpbPHV^_EJahV zGhiH=oQtoOho3{nGf6e?ffb1~iY(#E&Im~KN>HDV2@RaSD7#F@lHQZhdN~5e5%D=# zSat%8m0$_O$qH|~BLP8`(BhCM!Q_n1%)m;}f&pErA>(XG?1fOq4^m>2TVnJ4z)CoS zv6Mu{*_C($!(74BB2e;)xlv|GCNPi!F=wMqxG*&&Cp?jne@c{H za(S`BsCy-}N+uBU`@=@`2X{$LJYr!zgsSfVUteEg{yPJqHaS)H5al-*FaZn<{qK|B zqzfdlGNdN zGPepiv&7ckr?liSh5T0Dz=8U!n#Ej+-Q1(%`B!KP7`4ikKi2?fXH3}hJ;%BKr$^8y z-;KL<(T8urn6NekQPN$CgE_EW`jW85)Z5KCPyDnXiC&}6-Z>GANEe9M&dKlaoRidI z_>^=5EvVM1%wERfgZI{+yqQ38*Zsa;TPt3kwIQuLWL0;QFzZ7*of-ZVQ|q|BzTSQm zpmmB~6mqfNZOp3^DOkVsPme#Y6JbQhc0S#6VfQMKi%oXqZZ5&WW^cPB31|unv2253 zg-6ansz?_MaffIxD7L47*w!=-{iPW{>q6B1!WRAB^i$twhq&=i)f*>Vcngm;vdQ05 zb>sD>A!waONLz>`o_?&C*Vz|$e*Gx^{Yw%4}^$6IlR? z`Zt!#T1k84G>Pg6&_pB$=g5|JEZ5LAmU<&r&{h(unY+%o_;tq(+{`)#tj>424y1y5 zXu6r7blNM5nnsqE)=KL;apu{Xg)by-krlU1O>&-1gUg6lh4_@kXd=bLB_$;YTFcnh z$}BVUIlG$k#f|zx&G4Z{cJ_8YxN}A7+(mTZ&DgLWryU%#+~)L`A9mN8VU|nFJ zgHIwNYUgZu=98V$$@B$P>>BlwKm|U-L>i|!M%g;_v1n|jOI&GqLuWN+u+82NyzR>` zNvu2bVhFcMESD<}^lnw2yX1#kFNlob8ZU1xlS+6?-i|Aa2k&Uw5D0TCPlmjymajz} z@}L5D05vexfxH^^6XqW1u5jQ>N5AlD|1_UjVS80sJPx4ILF%RO_Yt)v(Bk>lBWD;E z;UyeUY;cE@bz9Do@gjXTp`Sxj!j@RY9Z7J;lBe#f_h z3=W`JD~D6c<%>7qc$;#1$4EPadm1HB3Uyr&XyU_0U0$-_bej`tgu3Vr+U{2CJsI^n z^UmEpoKcEDvDK?fQM9u4>aDTrv=Hp3H3e3Ru#IFpNsF}CrS`}yT&fzp;z^?Fi2sB) z*IC%s*=ht>cdYKO1SeJFoV7;f)2ejtHS#T=SiCK)jH}vSNSbd0E1H*NUd7?zFG_sr zMtq_*n#c^~nIiQEJ&Sa(=YW<{zw8~=J??tza4x=ZnS-nf8?olMcksSffH<{iDI|9n z$rot<)F0!eD_#p>sqZ6;R7p-O;wts5_Agy2W){)eu8e*6^-GgY{Cf#7yFW0$wj~#~ zKdmRbfo@gNRqq)$*#vVHksjC#VWVHTz=Xo@eteicM^YRDVI8hG>F@h?PZbG-&sQ$_ ze&ide<(@i7IsDO)iCbpV46ZR_&5y9QO_{i&(gIRDyh_lB;pXAJ#z`SG>%Ln%|4;~n zQ<3y-AAP_|;q^#>p-j&+!Swk$LYX9qC(eyw0cu^`fe~v*)H4;U55o*!+X2>0r_p!U zf)%6hj0Hl5AouhGRl>Ch%8e3k%&SnlSofh>UBw<<-}-RwJDe|3RGF~ab65{0>eGZ6 z1gd>}=%5X}s1iz5-FH)^wbi=eq7P%YRNoDzhrXsEkOtX|68D3VSA%Kh=+9m#c5~@Y z>k!33!h}PU8XcIk?F*+H)D@}gGTDjMgLzmD&{c`pKy~h+#KZ?879{v*1qhcW=H;xCk3=yd#btz|4y|K-H)bj%A{)4-wch#m5AfLHZkM z)h(`5m%Er))*Bs-NA`?lBK3JAD;@V-v)cPL3~jI9EOqHe>sVj+^VSBSqJwoEuZbOv z=kOMkLE8d!YHPMur^G_`H`&c!G(rs`zF1O;Jqoy*^ozi?@h>@qC87m;Hg(O2GhQvvOJ-h!UJ22=Qb4{ z8ek#jnoXBWR2N}ERjXi=0l-isLa0vJKV`w?0{XGEmmOhT;AO-k14OII8hp4;=1VB{u*+=^DNYYIN~X%H3iJA};<>N$aw{F}g^-5M(C1c2 z;QZ*09h2{nWj>YtsiGino=p@(iw0vnCB8gD>=*8ZgbfD~OYf$60e|701E4KO*kM!W z6-cemd-GKU(XOzK%-7eP6t)z3ARk!)plwN_1?tzw0LOsXQ@0_qciRLBA!k+2t_zRe z{?FSIi{>Ct7gRpMc11PufHNfYmK(<`|H|V^KXBWbCBf)=nAzAR@)$jltf77F78 zkzsBZe9Fusaog-S+32|a4)rXB2NG>KR&Foz5l6QaT|H5@7B+d4C_GM|uBzC^8@rj` zH+*Vb8DU!gVb|5ajL-T4CG<5V{dQSTdXv-C8Hf*`ytbnLVHKliZvVmW8|cSpn#8m; zAtUPo+GC~Io#;Rv{fGC$=xR!^06YNPf6%6F*Ixd9)B*@DTBC=q?S2DLZ?BR5Md7Ve z|3#^+GeIfubscCqv#$1s3j_;oi2PL_w?PM`S~iTKCH|%jv<%q%O|NafftHm7K(NY| zAe6c!1%mUpgrU^>)^Dl6mq4)Twj7iy+qQ+4I6H2*|6NG_{gMSZeMc8sd$~gmSmFe4 z(Nlv3zCrzl;&f937J0yZ{0!joZ@;}BhB8+9p$q{qXy^CS8BDv>fD<9`jF2F>=i6^a zB9w6`@<&B{4-x%8w;uk41R9ZgaUl4`9x7l*{4asuHuI%`(5n*v`4t7tfrIvhpxlpp z)Bt+fKfbWblK*9#T>*&pUr}=fXf@UUY9e5t8h~I3J~E((uCSp40c~~D0ti0dM+M+m zLfKSc;K6UWaOMMQ0IxMz{Xi1>kqrGnwFRHs2!Sy+fA`||IAI-Pz^;KQ4xx{U{Q17H zga4~>ESOUXbbGMz;Y-^82J>I|;s4_#^uH)b_O~dh%>Rid{+FNsCmQkp7%K|WaE4kU zA^87;5`%wj;Qzy)f1t?1u>FsTKmHuMfMxXhUH)4S8jiaQwS6e?T{!&E$yLV=1)Bu8^KkTft-&48<%IN>}htbwkw0g(>8I7~)Kh-B=WZ<52#DDbUzgtcJyC=_Ieyb#1Q2s;uKda%t g7Q_E?zh>z_(nw(Q3jz#&7=D;+To{(L52Ty)(*OVf delta 24877 zcmY(q1CVDu@Gd;IZQHhO+qUiB&g|H>ZCg8@9ox2TfBWA5t$XiRb?PMP?o>`ya{B3{ zpTymOhVFraE6IX_!6X60p(o&=0>dOQI0OH$79toB5RjvbB_k-%|Fu{{{~u)%7%)CC zOcM#P1I#}`0<7cz5=;GWr6C;lKczQZB*?!446z>UpB&)?yJ;HL5BOiz{$JG$UE*K0 zsR~0J;-BOW@BH7};S{^+2|p6_pZpi`{eOL3$u$1;Z5pSl1wn%W0)m42_esJ)x<$U2 z3lKm+6v#<8?376c=XiiAtus$lb+n%zj;Z1WVA%v3ac8m9M7O{oUJYCE@@DZG3|a=b zv3P`HR(Ff}ppRb0^6+JNB`{?*CEe=woFW2FzHjv0gPq;I@|S73dGf$!zxxSa$Lp?- z_e8^=w|iWmsaG`#dWSUSFkZ4v>LM&$S?I#M#)vd7MrZ>!i7fyfF}83XnCJ+JU4n9G zjh~G8tRVy{1}XgC@)7+{Ygs3AH4~;FVr*u+qy~J?hbev*hrXU@FGH{w*26%S&2UI> zZ>fPnzb`05L7mXi+h4(>8IRD=iZWg@LJbglgDhS88%#+kxx{}vp^@J0IOVq-WUXV1 zctPaxQ*-QO)^z|RC7i>m5~^8CJ9QZm2!o4tD|V7?n2N=J^oTBHk+j@kRPsXWC-x8e z_{eg@hrmQgsGaqumdN>J7kgp0;E=57sxQF&G~AVBOV-BkW9irPmy!oPIG(6SqspoTczyE+5{k>xStDa&jZ~OPLCG+r07M30*P<#% z?&YGC*2&$z*7w2!XFWXiNHbwV!3cwRq|L(yG|;_?8zb||<7`7uMcl~xD%yNn;rtqB z3cIbiz4aQPF~e1eCv|pNg2H%2B(x!wFyEHz;@ahRlZZm(Fic-HhK0f6wxFU8)bw!}>Pw z&K+9p?RnF<413CVP4o(hA|=4(wJMFUGtucr#bIgzgF1n$V@qRX{gw94{Nd;KyPd@1 zFO@swOPS;fF`4yllI--F?kzQ)l^He^-nbR)F_br*^16>)*3T#g7Ec~DUf^9|8m*a? z+k(3eGl>J?A$QmO91Fnlt4Ckvx1xaOaN7J@oewgQdeDE8Sv><;k#r}X;FgO>^MeqxVT$ycobN)VfZePt&sNiYV1sa&dAzA2kr zF*ZuXYGVm|;rsv!c6ufL9u0AOukP`6{jFty-b87jVS7HfP3heF=d>_<+A`B{r(w~z zuXV0;V}YrS@SM{aE79>$mdGSuNtSfmOwy79Kj41iSDy|Ea|jP$3$N3n07lpqd62U7%ONS6xPF<-Ac#@mFm za)=$1fWscSk(pKAErcf6@Sx5t*v#==M za5Tu2>Y_$T#L!g3(fQFexa&{fWf9lG#wyh~>x!#O-I*Q=uBbTjGHOvrScGYVr8v4b zsEHt%^Dj2RaGN_|ogw1ps5m}Y8viqG*v@*Gl|+ZCGdz(wZ`iYLh^xR>T>h&-axz7n z;f%rbnZ(h*+*l*krsbFBjCt+=uSS%nHNQJ*nqf<&;c!Z=J8bYEP2YAAaw2|x5bLRC zRu!^%4=UU&rorJfR4j22i6BB4fu7mFZNx$NmOBVV7D1K0q%+eOQW%)u15MGz8t$)V zu&4a&k*?i?BeT8Hu+vju=EmRo(FrSa+JX`uNvqy&T!y>6bmx)m(fdIF(4X(4CT%_m zZuVGD4~V+XD0Gs=%zr}Z(Rt@Gj-(@`9h2Hu1m-(_@h8Yl>VTp6S7_eh87z!Hv$SWN ze&n$SkaxTRC;+eT$V5dCm2D4|?5I0*@7gGql!phe-9Ze#IQMpezd_(oqYAf47on(B zDNYAFt{|Ipwy&wFww zfp@-jlln&d9|R6O$8LIIIs6Y9H`&4d!^u4^#Q%yr-p~JlmG~072~uG9KmDoD&A%e) z>JmH23>_!QNCGm6{R+8>R1Eq*ExiQyf88vl3sL?VAzWi8saYZ=37H`^iRvvt{?lNZ zk^VDC>b}NqQnT#*52+EY=l>hxUzm`Te*>2EVT19%Ta>n>nEw}>ySvb>0ziR)u>Qm6 zBx74VfR443s-3kHgQ=adt80jwtmlFR+BZcb>9B?ul*&L+1rC8UTD%TX2pJo=h?TXx zS9&l-aa05=m#Fzz%1H59Y1VhdE27(Ap_{SGx@zZ5-1!;)8W`rJa8yP|T*rwx^%!)xs?z95j;160&J9WKXx5nxPa^R;Hpa3wph|`xBk?rrVH^ zDxF@7z0MGCSWY@RG$&L;gk9Rr`O-RiKhwgYS%A2N$`mu!0qO)?$D5ZZ(n*mM{WVU2DP;BZ1F+MmA^B%nMce=qq zK(ZhP8G{(jn!zD^XMjcbW3b?n@ZTaEC5?#a$|h9DDk#eF&m4o+{>J^38^;Hqum$4` z260DI_@@CKb1s7j(qZ%D?f8iDa;*=+6!ls&JZ8ARj|I^j`!#H|NNm$&9R;GBUY6&Y^Z39Yb-d^+-01g`x6<9$Hu^xOsw@WvkRR}Vm< zyQbB0t-@MaV^6G`GRjG{%BQ0(oC(^JESr>KU-7qDh`4`y{Q^ab*G(`^B-jg0A^T&QFTr|Ts@IKQqGtL?a3frjSBVz%0ynDWFT#qX!erp3eStcNT<>L@}S zlFD#9Fgj#=w`(`m9fg!~X0$4iE&2UUDK?P}Vp%?4BsMUA*`uDhOBSTP!bsV>RH~-K~;pok|hUTrEukSNGFss zo-|D(i&kVuOn+XiZ`6^01u>RS?wv5MwnBqS)L2@=^ysBVYA98X+ilW=M)N|I6&AWqpw*uDA=;tw%0K? zq^?t@8sv#mDeistV8+OEc0u%fmYGC3R3G^G14(3iFloCSSt+!I#81?Y@L#c7ug0nH zT%)i#Fy{Fk;gjF`cyIWFw*1hRZ?JunYQ1HPnC#4W;kK>`Lf5 zz0~nCJ!7~70P>3L0eWa}3hx5G-s_E%Cq(pP1INgB&AK8cu|E?F|?llO7RhYbYWrZA5aST<6j4URfHd?@dXv#HKe(n^w=7h!r| z!;J2#*(|uv^O(2gxlsvGMBs1-)@b+<3yw>j%*p0dOp}clpGoRlww!sc-%znGX&9Xu zQl(&VSF3$XqCj=Ntx{Bq!Px0h9G06kT%abIc?&OBxcugOx?>t5wF|jzpsEK5Sf4Q^ znI^#{^Yg6(6ic5P@J%4QK(1&x8I*pC9_?>L$g}&_cjQyx=TPYDJ%>B(_I`6%^P#`$ zurzVAEQ4IBXW?_WEPy|@S^R!+s6gFFI$aEH>)xp#Y% z$Pt}#Jh^~p8Rk@2&sFcC=UOBhH-$~FX>IZ>PnE?T6^K-Q&bCB~d|n!&Q!0mShV=${ zYQi>F``~?ml?{gb9smEcXbntPMFi;x>ipY z&P)>#)F2`agv!{WQLhn0H49D;Y~Q@jFh*SM;BjVAG;4EH)5G@?*!B(mOuov}vXJIc z3P?J5sNQ~CKORnsts|{AAm$rVIgTJHpSy4_gjrH@FNq3 zHCA37k18TUU@(>*2>>PvEetk?Fdt{@$YE}F$wfV?DP^0fkXIR(i-#zPUZEYO5dgPvP8As@u zwCc=oXWQ6&<`T`PtAzuNxHzZ3icRHUYf7KyX?4ID<&ShIVLXK(^t`k3NZ`A)Bb_Aj zWuUAPRw3SH;y5=@2W|M;VNT*kOp4#lN9M^%>0n=y+bvbKraD+A-5ceS@`t~urriX^&4r^O z^Mp3mA;TQHt(-@;Q(LJeGQ;q=71t0@NbX)UrW8%@3}gNAWC{K_{Lm>sOYa+_XHgTG za}p#SVWT;b%#?2g^czOu0DpWygUb~iurMe430Q?g#jY|z+b=yDf*%hXJeX#QGjyXx zt22#K%*%ZecxpwS6Z z*-%jjH{6v4H{7#5FZP*d4OKrb?1ky=H^SGe!C{M1g9AR)1>e~V47$1dReFgYX15z2 zM0iU&I7>^z^e9jVu)c5Af2i@mS=fZZ*-T?+wk8eww5Q9mwPia!a?dT>wQ=Npzqb!@yuV6 zJYot|89C`%5q^7#X#2HgPG#sw)A8Nq$h2Nc;^iZH0qxH~Qlt{()Gg>{=0@iR?!ng^ zo;AXYxTdS=zLP&t8%5tVK84@6u`~mwfmTG_NyVhxhF+Sj zkz1zyR`K2#lBfPNOXWX|kF}z)?*P$c;a|^P`KqVIu8hK4VF-@}c>!F}q_J?~bt<2n z&Pe2uJtA{Er0~d_#h60$T+X~=9_hZa2Tb5NeKfJNQD8%@R$ZrLZLN`Dg*M(nv(nv{WKN9+-5D}i5#=XrfkyOnCam(9x2i>E^Mmkv_VxH=!dDHq(QE&fef*HKF&@Bu+b z?o>d+p3OTHNF5k=eIHV`6YWq-ixq(TQ^(Xi!}sC1QJyxUP?zHhe4%OR=h$SnPTM^+ zS2|$AZuQ$Z13NlM^dQ)N`63&H0dM%?5nxtSB(0v=o9Or+^DZ{!R@pr;o64}wu`*db z_;nf6A>!bpV>Lf1BTi-%-g9aZo~j>~_%42}_Jxyk$@aT9NzW`AMdWQdx&yGTmW`s9 zlcSQZZs77j0j;*Mp>=f>dXjK*lo_#W?=>-nVNrIS`c~=KfzWW8pG41Tcb=FwU}iw$ zIppcTuw8(?Q`Fv6oVE!ud`REV(wStb1%z`t;tqPn<&Y1W1EG*V(WecET4fARh@CDv zCL}nG^|;wxW4zr5PiLitmJ5hG(?ZOjauTUscY9px2tClH^;@AvN@Mdg*;UXKmPtWB-D+8Dcw!CGY)XIj% zV{EuirWaBtqd(N17KjKx#y6TMuXV<9u|Ce*r-R*v1O=aBb$+81T3f+|_ZBcqeLG~6 z`9^-zFLa8SvNS=bVs8o&u{Hyf7ugZLN=ZD$+lR?KYes&-)4$>~e+o+hPzX*b59Y!a z?mOjW^e8MrxP@HLrvMb&ZBTQVSU2_^KkTvQy9Gpm#m?>KZyPpYKfw3A!}YAt=Er@54GbbpTqwk-Rn)M?PtoBeg5Boe=N8!| zE5+Pc43yumpQJZkldO6kmM~)NiSM=?&O}LYZF!3qPcp5fyGiFjisi(5qgIZx(ijNQ zqzk?o|NpU>gpKmw!hd_>07xJpwj^V3!lau39Du#6syJG}GsPoC8!nDXiCVQ0Mjk;G!E8a zJ0R8-q7VjYSQ0r~^C84RZzwoc78#8sebISM2(cDRYS;AW3Kd_|UC;FNex=5SWrj(~ zt;ePIG9r=Q6*sqBtvD^qjT3JJy~G(Lw+U}TaE2-UJY0^EIT+SKn&lCVUQ%JDS1)Nh zNUO=3T-iFgT{x>80sM?-Kjy`tkd(Xm#P|wOth%2(B*I(PsCJwnByw zGRRx)**e@D&>yW7G=SYU<}s#fA%8!i!}$iGw`D5M(Q__(=YIKR7gc?j?x(|(FS7(h_egU` z^jM7D*)TClLl6&ZT3Er_0lp#HkVW9jWN=Dt>VL(B6scwiXH?h{N(HOplNzn`lOBtX4{7+c$e>Tfu^=j{1C_q5JsDXfp|NY7Y z|5i90pyQ`^(#4U2lNg(bDV&K$_8E%A2t*kL11r55r4 zD`grN7NkdHp##j{9|D639S-Vw&&G@vRUl?u7bfG~sWpi-C?}k+cBH+(XqVy-Gjlh~ zConeX`eufRf8uSD&N%yN!Zj>v?^iicM%~>f8s%LOhH*!N*fSV4?2&;ru3mdPtE)#1 z2&G|Giz<+SYa#H-Qhd2ZF`x-$MKdV9&mhp5p3o=zMn^@zg)ulQ;C!P?x!}{AsTwL+ z0%_FQg9w>9HbZd#gGC@fOG7S;;Xg|sJ_Pl=2x_8UJ?E3RzI>Qcqh-Ry9b9cq!QXt z@0BvwFGxe%-rEzn)?7pKgrnjszl|RkPVublmOY9e9}F6;&nHm!7CVYkkFCU0T~p(( zy?1bSiW~4n-ySV)2_2MZrY;^ek%+eb)-e@|3!7|7;NMdcyV*gDfs=^Qs;0*Ru)-6u zcmuC@Im&P1u?$$$D{_(oDO{YbuFiFon0_1|*9zHMLe8#xoOeB~#}g1#!>7*~dDZ7u z)KjCxX85dbR)_6}j;ArvYi(>cmX_7{`bxUKq)ykyY;@^vWbyiTwzajjwzNQGX7TVY zL!`Ga2{*T=SL8R8m6UYY`sTX>Y*~fOht!%Ys$BIoU5V;@todJ^plDe;L=*aj`){S~ z6Hbk;jMQ!rv0Ho#-~Waq*Vrdz8A;)!lRH3&wp_hK#ovSW_t!g&6dCPKUT&!;v2$V1|Kg1V41{)2qHHbU z<8hEUqZZb|g#NYwRW)5hYs~xmbd;5mEuRn|dP@L@i+{I=FVU>KgUk{fLF(^g)kFXv z*#hsDDJm@GbFVfIG9&+EIIRP2+w@Mdx25D@lvs+HW=_T0qiiTJ2Ex$pj25_S)7s10 z#Ec=ubjwGIy^?m^i(eTAKqc}6lSp-Wjv+%=%e(lN)AhVwwSLTaN+KRu4gprZ*$8pH z=Llg`e`N__w6qaq4pdyNs7;?20?3hNLk&Y~Ah-HI&iw6zwvn#)KFU*7WPu|1n9xi< zbY%!~C*lfM<7^1}8+}2ADrNI$3Qs2CYVNN?3%`EN^KieEy)2U%Kx&KD2k-|8h?)r( z-MnxoJfpwf-&6Tn8_e}#TfkJzZr{l{(ZY6>tf#ewBLiD>)RVg?ARV;+ue!AiyS4(ZP~;OM z7(ABn+{A4Jv3Cz_KxxjN>Lln4F>8ReOy6`nHwtHgw8M)uXhz&uDE&~TQ8!ZR*NtK)>KAYgqN{>KubBDr2WKF0U9DssXNuW zL%Jw(x|afk!6Ft^piWH-q~BEhUunHz9f_t7LSBIA6o`j~WwUl%Xb_041%yUvDA|4_ zoLJi;1*e<#7yM8wR=!B6qN~!kk}h+tn9l zTuf6`6W+fi0eu{}djWF@7+SDhX*AM~B}Ug$ljoiHqz!VrnN~aTR>SY_NDQ#4*#SJN z^3$KG=j0TckKH|7N6=#Xa{{76ypW;oqU|bnc=N9iy~=x8Y~O4<)pzuMRU>(O8|kGd0ICz5o#{5~PwjW51Ky!ag>O8Z zIqIR=Q;qj%iMF{GoGk?=^Dnf&umT0rkb|GzF#@ulR&JbI`EyNfPy*~`nWXHbBrhWl?@4h~NjUbBfK7z#9Jc_<2j3C|(O8t!C zEmE;o0Os;CD&k>SS>29P+YPb8|CHYqeWpv?%=_Yeg$e}6fDbOsGqQi95YE0%e4@wv zp$Q#*gO15NEMxn|Ayj*{j>+4rv;Cyo$z;or3d^a;H@znhdAyl3{mz$KoO=zoeq4b% z4?|P1;u{ZR7Z{jfP8cx75u9;~#tim20fwzjf9Sq?s$RC@)3D7Ndu3Lewv!XWzdrq6?<8Y|zO|Nc?%Dg8s(O8|cz z4x5ehQyL%W#~3>tq*Ni8OM+D{{0i%mV0DYq)z?l>!RC_}P6w)Zt_*@~Hx z*fz3U_NjC}eA9nYe9z>a+Gg`dR@OG=OsE!;rb5#IkJ92|R`ZrPeA;P6Ii0nSR; zaNEafIR;7qg?C*fwdQZ-YxbC^QwD3|CYddG3ZltU)gzVq1e1+@oph9x^wCQU(QgwN zBj-neBW%@}or63Q-XkfW8e7$#(=pYfA@b8@C1;o>7~o>XI$dLs3ruoW7ykLgJzL8^ zWXr)02$d6CQ05fPP7pp83RV*?fSl_BE3>#Kyqt`toWIZfZ=IpPpnl7hTBeyVZ&zE^ z(-1BJgMNufV_*n9X;&t4*)Wyl&(l2??~66@6p!*m_muik+lj;Cr$$|RkS$qv^j}DT z3e;v+)T;tFZFrA{pJr;N$_wydCq8_~02(FJPEGKCi@-*?)F&mquBm#80aWc7v`C;! z`K<>S@A;Sqo4a6#9Ws0T`4v*o}%wXav2WxxeR`{{=Sy|aXC!_yr>5qJo{Jd)N)T8 zy0%JfSHG0)iqA@Fd`^uk0i>P>WxH9N=<)jGdQtZlYub5f3{z?w?PE-|v(Xz}s*s+P zPx(5gp8>EmBy?D|@}5jk4|<41Qp#_V?KBS38v8)!vV6;I!5c$Y3zXf=9Ck>aUC(03 zE8%)l3pDP>AFJtsAR@>^Je|Y zk3SxAPFE6MrvUGBVsv>}Al`^mswEy=s>RjUa3Y`!(wkW2CDzRX_+^ zTeUUKA5?>cfWa^^mbJ;CL@i!(Hu0wQL8VS@WPb~pOtj|i%`+QE09PU4o{ zgyUIx>8jM8KjP*>RXuot1m z#$R~_zcO_-7xgFOabCGtWfuW@M1SBSNW(%_Cp+w|IPH)S1;p9k_jTS2WVm#eK?!`^ zsMTC#1z~m~zl-BvKMbWI3NogZUF6AHf+DR;$XX_O;z`sK|JP%Zgu+UkhuX#`7iWYh zwibxre+?*Qc6o_SoYzPodV)G)ZPCOhj@xzQrT~{?OjuUd_78^1Kv4@GV=L9X?d227 zYyo1pIu7?2$nMzi$99{$hovf^ol{= zs$28>Yp);E-iPwxUR3opK3@-PAFSGvoJbz3p8}vma`DPsTxcGXTU4Zq__*;2Mhh6Pc7U2qTP2qLN7Y3Dd!Vgpshrli-yU2K$@z) z?EoMkYep+uJDM+1P4S2|(OPsOCLsQGozG@0^oyp???q^OiqB86n1vXck(a7E%NR`=aYFrOachfYb2QM>1E0S(-aYm^@`VTTKqVlC40NV zN_kzB*US^RXi-$i%u+-1xXXqpZCjs}H!%nx#?D8*EhnE?=zcKaH`Kh~#q1qEBx0#z zJzypd;rSLo--YeCw*S7+O9`_U4#HUO7`0Nq!J@wg-)mH+xw-8?RZ~8xE`KBjRs#(9 zsk=wcoYg#2Ls#B$7a$l0*(4<`_)mk;SGcAm&pp`W&}hh}`QB@y9oA7jcKF!@O`q!L z=DiTT9<|l~bFn$>*?^O;V&jRXpJ`v~ z*kEj07-0twa-$M($?|RaC4nVoR)C;z6+-k*Sk2k?612^2M{L5mEBWc=xoL9^kMIdz z{xy#{5?+zSVLHXlIv6`Fv~KqWQSknd}t{u91A@8zzvOC1N;c~ z3^zR8&k3c}(c~Cdu8X-j}NhKFDjB?RD@61$pI3!9;5EiYSW#-r*Vk?36-p_@i25@Eo`yfMNrggu-NM{G8>qu@M$+N)A4$SQ_|Pp%6xwINk)q@ze|w5n6pifhQaq3+Lia^q)UD)LV5|u&#{~{|@fCH+qyWhc`YKvGpeJ zO^v0=#};{0Rz|cSm0l70ZpsgIMP|`Qa)zq-kO@9jhf*l0dngE8>wBerx7}0{Et}gh zItDZ2K=@rhmq*>;o5@R7)sGA8YU}y2hk40Ac(kA6eI7Qc>MdDh9yGN=Je|f8ouH!|@^2Y!T&9DV(B*!+S z&V_%}a*<8X1>v*m@cYNqB}G>jIr;I!nD4{($JU>lo0sj}j~h`$P^}Qav@k3k0YHVX zI~_7Bj14h1TEmPCF9CU=KDda*%*@L<`i}$r9y#BiWKV;U!3l4!=|OvzM6Zx&hwj9% zjgwu3?#Mp|^at$iNz&Je&YT9g0~hI!PsH7U<~_J^{kj>q_T7HIU5jS6;;mjPzt6tS0(;J33uA@3wV$eInIgt)Q(XOiVV4_i0iX!qSA?UI*W|3C$SNY3|xDB6qs0~FSznBq4IPodm=~)RaI7ZsSym2Z15>vWE zk;D14MIbK;D>4RT!6wbk1vxMK*15Sa_@})_cA-F>DrZZrT%%!=XVq7BSf+x)gu&9X zch1IRQyPd&n02C;sC*f_4#0r@H>GUWn6;pEA)UHpY6^ws9DidgFg*v^UQ+F4MNSkM zJ!4mVa`2b}3ws2qVfG%$scnDpd~D7}>`1d3!>Ef&OBmY*X&nnYeXc`WsQjSH!BBf% zeX0hc?Ny1EDjw}p1^yh|z`u0&m2{aa>AG|?S$iv&+o;Oh?NZvT1Aq=;)MCHp+<9?z z7J>b!QR+20SQUkU$d*!GQI?C|$y*@ZLBjJH(S~`Mzf4jwy)vmmdMot|3>-qqeTb#C zCPSe)Cg|_^_$uj(7B+9GxA6E$X~Y;5+s0(NaS5~xFPmjwr0i>R5F~S@5w3$;J#rSB z-SM7xyKp~-o%(F32LOB{fm}PJ5-r*|t#3dj++pfeLazxu`XD+e%qjJL-3*@k6|S!B zpb3UxBsgg1?$&$z1EjZnSN63rsBX6krMGnVf~#y7_q8-w63q`bj^>qvg3M2{-}8V-n1Z-+Y8>m%XTjy1 z^|;2TG8d+NyTJ-Y9;CoQUS8LNR{9H<_tW!Jv_B~wsXQyvz;ndyv6zE8*;Jh2@{ouz zw?a$Wm)ZiX7Lbk12C|}W5^EZC}i+QhKGZG2Wkz zB^rBV53Pqvz49#k;aQUFFatWpp7ySxr0DB0P0HK$2q>c`J+SIhv-|~8G-9HY$xxZ% zrcQ3*502i&95tP-x-n^^Ia%DAp42n;P;0V%-$6H{n>hhu_JSwNi=%%eFx3jn7_NVq zA^L4?)7W=@q5V**ZOafk^vS{lB~5LB9ee_Q6fXjeFw#+=#DbZkEa+}1?WcLw;NBTS zI*b@>4k&Rf>ej8wW6wWw-Lxi0VbF@|%jq(*0P%b+9H2rCO-X05htFztelB%C1Z~_S z@pqsxDtJ9SSt3WKg+QPr7Hd&_>fIr_g)saCU zb}i>f;#q2$z`M{D5kUHW3gFFE+{AxuAw-Y2>TNZCqY@j8R90hSiyc@&dX5{|K|+Wo z0n8#H#FDHsL7V{>R`%yGXNCW(~4fN9sPqpClYT;?;;Y z?S~R!Tgv5$31Kr#5Klk7@Zm3De-XLQ1N_=)i&*}4raRZ+3o5{t*W$AlsS>=Li9k7M zXOYx#MMq|{aArp~SH8g)2pbOjvaBBptKUiTkayhPcc!yT6t5|b5tSWnh;3hVtMC3`gN1A%6SzAKyKpei`qX@3*cl2n@w zpHd7$&~z+7BJV~KTcnp(;;b2@W}>wG|hd!d6)x(8aEHGu8@ z68so8l|FOkxP(S^xG z8pe_irx0hf$=uzlhch>}9&@PrCUtC|6)T(@l4bl<9${_TK$L-Jlb@Mf%X#6xSWLP_@y)pzu%+?~O*8tfy!=Md8Fj;gj2k;=c3dZ{wQ&Kl zw7Ih(`q%CFigqwNC-6E6&>HRCYxOqvGu9kdDFn49Oor@V9G+WG{Kkak&D7oQX&=3} z*vt2pOCdHBwpxME7r#g2VuLM1k~fKB&aEzL@M&1o-81*yPn>kU9N${2^jhq$mpe}W z@^zOJddOb{jJ8r6Yfa@{J7u5Wl_>xgtOZTev4f(mDitg?d=b>~%7XS@-S@b=VpomB zk6~}HR9ZON5INqISCjkIDLYDBG76IaFzGdt5Kj0DiGyg20>Kf+Fj#2^EssFt2ndfk z=vLMll*-|>XpA<6&}|4BMWLAN$#0I}qV!D~_LpT7&Z^MbV zUY;#{4Oi_$&wfl7DV7pSIBA3#4ZyI^epz5!hmC+89U{1iQ0oRtu=c%1ykgJ>{QlOi zU{H;o;I+fhv~qx`a#Cl8TRWr@Nr)jrQ$PmcL|!wJS}mlLIY3LvqngeWqD@sm`kEg! zD+kkp#?ciDqBlv@hRJ|8OCJHy3r&$_S7g|6hzR=J8)sm$jr&&YYg+v&u+7UCk2@1_ z>$5fQv!wysDFMJG9J;3F_VHKZ+*Ze9l5R8{6y!F6W@BB;B18}x9Y?26!U@*T?c-TU zh8JO?3SM4$8Ghm?JPc8j=U&)9=cngTB0O`~nE+e2d_0bkK-n+;TbbDZZe#wRe6yvj z`OYdD5D*-;3<*jn^(k0+1R6s zpnqc8*zTyG9{rb#;L0rkhHzzkQYPWsO}l+u@t|XRw5mi<^uR}u{*WDq^VOPp)!3z6uWY3moumwQphx_Y}{ z4e5@vFG(lw<4NRJ;jiukW&dCIu zUa89s+U|=mTG+FYP%n&XvU-!=J$tbBvsDP>TGiPpV$~owxkwJ2Ub3O4JlUY|`q$jy zH%M(-nP;9i*E@*&7___LXh^b)MRQ07-%~5#E+5tQmqq|AG-b(B;2b$MLrE>%Wur3W zYMD(!6Km!pM6Q%Me`R}0b78cmvgGK068reKQ;cGCnV}|iQEc0=#8e}WPKK&AugTdl zF;NqQw_zp7OOVjroC&urA%~t&@Vd16!=HW8Lod`%qVE+CH?J!Hp7KBpYYo{@g&u?% zHB~2XT^I!1$uvZ?7m|DCRvflV3m0kBD+Xt&-uE&i8{-%!#bsz5jXb$)sib!mHw>n; z0)$Oz#@TpCD(n7cEWWy8)e`bevfZR>#7{g4AQ6DNsAk8;{_^G6G)W|QTt%+yWrO^W!nI3QMHck^`{TdnYx$=LLE2I2D_<( z%p&E9tXqpwjH|j_;Af$&YN6V)q+y%&>_L7H(5-Z8S&oBHE`-Z8vwIGHgqkxQ{qCj* zUI->uq1Q|dFT$lSGT*={Qr(j~ux0xWlJI5wCRu2|vLM-9&av%(y5ov>A0es9UW7IGYMeA(N3Dll5ARktZv~b2yG~H_)kjGTnvuG1!O%|dZC5laxxip^0Eq} z;x#*u2{oi?SbvrTurKUY4ar2ho?s%XU#3TrHnx;sv2pcVHK<6436l$AE0XKTp(71W z)+#g&v*<2GGn$y9R6^w3C0BJy&IXl`wjluYD(6g%=CK^&ur+9akDFqJZNu4tl8ddE zJb-;uv7B-;!b6j!BY=i>jck(tyOrwmt_^swZH!gY2=%C-vCcs2GT?H;vdBCF2Z5A+LY zm6NNUdj%$YJ+!z9mF9#AYvSo|8W3&GaTpMGuU-dpGBw{NIt&p0_Uv_1P0xF@XFB z#5aYUmwSDlov9b8CdCtiUf~l1pMO-~l%Sx06LZhrb47jaNN9rSR{IEujOm;bMftAJ`_+uBHRcY;H3*HYZQw75fYf)pvP!D(>_ zT8g`Six)4_0)gW0UPy5$+{Zx9>r@TyxgpOwdDZQE6qX`83d!u|TG>uWllv2N1uCD-fFf z=E-BDWtlxFSBKMUy&`&10SUY?)Z$RgNQj0Q{Y==Xv5neOlxL=0q+NC+=4DFl$d0N`lqrus-EoHm##DET>GK|MIA`|Jr25@xS10- z1YL+1no?aerIvb69BdECG1` ziZ9+YKo^f=-vE)!A$Ztzv5Rw2L!YQJ&-UJ&dHw{mS>ovAKyU1RRE$7fm)+B!{NWd@H9w-cyZTyT$@2M|hE>}%oGJv*pl507_ooaRo4cMrsXykO zSqx`yM(t!YVW>K8lq*+8Q>6^Q?s=L`b#%m&67~`%&&qnUs}KjSJ)`aCGZGgOh>X_U zO!xQ+27au9<$44~JXD>%xUS7uv6xL4{Wt=ix)BPZW~#OV6i*rdh#Yf?2Ci;=wBr;n z@|wJ%O>TcEKl^xXll{Q;Ek}F~;D|;XM)YdR?OV$Ay3|J62T#BBpOt4~KTPvrdr=5e zv71#<8bNj?Ol6ubVVJ;4L)|Y$A{oZrANkCLRp|Xpp z{$YfuZJiHKt+G|ME|}=I{oPEn&!3^Xx0%YYEjb$@H`D5x@L&7c^yVpukda!&P}j1C zergb#5@C6jeV+8q78CVNbysD>!NrTO*Y(`~>h8lz+;gZ#$1SPuHH@8#w`#Quuq^d; zBycHb_iH@q$_CV4j22WA@_8F%Vk%UWRMdJ>(38b=ih?cjS$XHYD&5m&Pv197;>DuI zIBE{O*mH?zP4XKmu|CFA1nb<~Nsi@Ep*5H>-Q@yjbAJnt453n52>#OCsj#z`gIe`Qi1#wT}>Mk^c@6ljCVd?Dm-67sgS0gLLQO}55- z;~3d-#93!rQ|zo-jqLl=se~9C-N@uX+0h;b?`TTOM)2p6%rdR{D#FY`D zgGo_5XGzQeE;||Zs3eelc!u%}JH--#E+esRk9gvN_Wh2aP-;|jt3ticcb8d85K)$b| zdKIRZ=~#wH=Bd>8(GG2l8S<mq5*mc-l8cBUd<(WO?o4^Hp!BmO)S_@7YBqTVJ)LX_EJ{r~0lL@^NK(}6 zyIqSfyxCF^qZH$?=ll|a?QYNhrBK^m(ljhnD~mZWq)WLdN1j>lIfHJFA7QHr`8}a& z3_+5u)QyVV$EK<%#Tprbiu`jLijXKMy?6Jr914Achn1{ZEFPZE9SH2CZQo6Knv$-2 zu4RE2=N~+{Dxy55FyY3>sxLFcB>3i8p*AQp***0O7ssyFEx#$+8|!=hy~@0eD7_b9 zsU~yAs_pxzpvM?~E6Tza(`yi%_>+O6yeV;v1h%U9w)oIn8 z*bj?UaB5J#K@0bkx)Q;q6WQJZ>NV&-exUD2-uZVWK$lcB@fulH5u5R(bPhkz0nMbG znJ>BzUfR`!3cWWiN|xXLR^q4TZsR?imXnWhws9puMDKj>ZxMI$`)BAPgoB2ti0PWm2c{!VS!H1SW3RGiWR5n(Y^=47 zY!AY~WZQ|-vUlA5U8cM{19QzW4$#_AE6TNnFRqRPRErobp2)6bhz|PZM-&&iWjM@S zdHd%$x6H9b2wz;FG#L#<+qPg4#NzI+Bs>r8ayveWhy7>1D!_aBL+VsFIkr+^bKjrQ(sKmpV!h@)E44bfe= z)h>C>!5ggz>q4q8m@H;&Ut*S2<=}R|_sx67y{r~kH@{!^BZ2p@3sKI#}||{p<+El zD+nbr76mv2O1+e&kX^lhoVb@Ih+RgGm4L}y(wFNFl z7r9_nPY=Ckpxgh%9)eRCagLwExc}9M<`Z6@yf(^8&Cw%Lsr=+U$aP?J&U-5a z)N?R9l(yHR-buLi>JoZg(h!<(p>;vwyjQrbzH(PqGOSyNWX4k#F}{AA8rSL3mffjO z?+-ltdR&qk*wj{@Fa}D#x-~PJQp2IQK5MSK5S^P?l(Tyr5fB9mkmfLOQBv-nos)~p zN+KEPr=+-?u+BPS7T*Y%dro_j&kUGjpaElUgiqXpI9P)U)~aYkjm=-zM2+p|yI;v> z$re?O+7}+wDjd{Vv_uT%2NKT&VPE+7PrCn2#AlngOd>(!o?7-CW$i!#;r1%{Ky9QjJNVG{Er!E*St18gr(I8V7`S9& z9Pt_LlWMf%7f4+6qG3TOw=^1;lP=voIBlXiIojr6)|ike9o|Az#an-~kWTz^n73iw zZ1TAGqkupF?PjTB;WkBQ9@GKHK76IHoScZR#homPbKx~pRur1dCGXdIfenBUB!fcR z{HS!Ny{tIO=x`MCGmS$#&>!h;8k{U8v!kDKxp~B8-|D${?@v6z!d4&-@7ZfemnW%3jn)IBJc?|8A_N4HUEXzFc>1Fb?T6v;g#X;0DVs*NgvXjSg z{yKfGALcdgH<9nUu19J73@^YmNH@xD&TAcUmWdpw@~XKB$U$Vcre$BfY}}{)wx|jo zEG`4L*x!{XlPbJZ!kSkYol|c<%GW(A&9hMXlpA)9k33Dgx4r=mKa>eS4qZd$0+U{Zk52d%I$A|mb>O8 zY;3+bcWGgRTpVRT^gMG@7qZ8vh805>Po@~+3c4={c*k*2GMnrK{h~C0=N)o455?lT zjMfRS9mtOOQ*h4|Ws;!ayb6&5ekgjI!<$WXA*SP20w>*R0*a@HOKk$`0 zXmK<0JkNtt7B{cxhX>2Zvu6dmy12d z{hvo?2cBrsUtvj%DA9JidpS*8roW>xvIoS!d;u;$(&bc5MVIl%Ky@Mzq#}3^6>6dJ z>}REIpUY-8d}FpFp6r^9ad3&0Mfcc$?yzp&KOjq}`^yTIsvRA;wqp35_aerptmy&A zLnP6g;3{P5D{2;HJMuMWpd~dnx9deu%QcnTv1gGrnChk>B_PjwmQB)NwnjSuomOQT zz_NlV3G}gkJ1)(#Bhq-|%7U3i6@JRvUlPVQmwBlfE93jxxoVg1S{lEo{j{f!h!#62 zRbgxOLL8^m^5+BUFVevy%tp$A%3oqOpFVB=Ql_E41T^*!bHn)u5I4Aq4ZVEyFXjPR zNV*{@d<~uk`fq&%o*62zsrHmKapbtH{Q}{h_YE-t@j{-wj0R%N1ZlONt5G+=B_m~! z(20my#b$7ID`ITUZ4e6_EHwgiBFtNMw(AhFYuxQPk({48A76d(5z!pwQWigw1xXyI zyOA!oHxeNWajsx=SJ2vij&u#>i*9tDMv496sVX^ymBg0_@ z7j0@x)+2`O3)2BDjQ*vZ$b#8z%$al1#j9ua5 zVEt-+KRn8WbPH{W=oFBCa;eWAafbAG>|_M<*nQO?=C*HZTXoRWJ<}+EOhvb;V^76V zqL|yMo*P(V_=ukg+*dW~sa-Clb2F*K&8?#ybh7g-T;VJD92k+SQcT=It)?#i7O6t1hns;&BKVld_U0j1${(Ou+Cc0J?rscsm8M%HE zKgtygS^JcMK$}A#`+zQ5>gr7qXjjM3mg7ok%STj{b2bLyn_5UbNA7o-jSRALFOd`X z;L1?~>c1QKhPc4R)hyG|gCWxHUY6-irRAKyE3JQC0p9DmG7mxCu#zEdp^Hh}3Ar}F z#}HBrl-{e_>j7}T?hfU2mtmBI@2m1`oAH!;kqtLOW9#S+O%m?{5(!AHk%h7XrITrf zkhztEQHEd1q}|XVl3J4qwMx>l;mPlWJ~B*{;2x5bR8BXaq`TFI(&4fuo??Pme2ZiCBTgLvwVJMEW|euQXe6I|5COH? zykuw&Z_XrtcH~G!U9a8$@I}^MCGXAh2@p8xh_G|PS$`=m*`50#>J*n|b$AQS*Xv2R zH|!c8yh7dU?<3xu8ztw%lW=0SQYh{(KX@m1jZowDxms1+r|9R(8L*;>@r1`8*n6e^5^T}ER@X4t_?{;y%!q`mexZ}aKS0wMPGF) zA$tKa+gLS&85^U`Y=6P_U|oh_cb;%?33PQT{Lxq=j-+y zjqVsd+O0ZHsLG+>|z7Vu)J1tp0v6 zRqZFegh_W7rre>{`?Qtm>g^?Wp~KiJi`w+MCRsJ`EY~8lOo5epPQd*?$_i z3@YV3CES2Mu&7y^`UF3n2P})UfBTV`Y!a0j%k#3(exWEg?Qmv}`%8l-SgoHe&v4WF zWnlugR|2xUs6d$ z$qF8wk>fBxRkf%^8(enAK4OCslUTO}CL_(3fvA%UH>UBKEE?RI3)2ko1hV6MLv?B+R-2vpsXQ8~&e5Rvfmph*6f4 zP6JEeYJO`74~ZC3ma-Df4H6~Ij=?4%(xG$OO_o@nsOa1cJDqOH>NN3=VNPqs2(s3X z3YXVUmiSpB`t<8qz~CCocY!c0(jRI+R0nE(FDYX+(kZzPy8)!&tmt;P#d+&ji(Jbi zD@)%6)k$H-Bp>@ubbo{hFvSo6z&bFNABKZ3bbgS4wPA3Q(x8;?4=g)Ir#(Jk0Xu^~ zwm(CI+UjnRl4NOV9G@I*9J%3(_AzEcn=yu3ukt`c#xVEu9FZ6@K6Zw%`NYO+&wc;2-=~gFJ z)JAYSu^m)81)S5MN@!M^@^War(WdNT<_@RS}EW1Sh8H&!QS#k-}hWAre zF+6FLL=ELbIj;ys)zOqaCLSv=3F&lU-Hh!RG0(~et}=Zlcxw05tH0NMbzv(*5Vp8s z%Jk|ufR?4v>GZHO=!5uv>W2u=mt8Jz4I@ViPW?YU$%cTtT4yyD)NEe{zKaOoYtAUG zvC1vPOm4~eN%JLNDiYJE4v^inAX~}qF>wpXxd6T)Fy1V!}OnHucI*+KLI6-gbh-I&=daxa$dR5o>J_9P^i=RnnD=xzq z9&w~=a#??!Lhr`_hUitD4ym@-9^rRrao~7diOCjIQKL_cmCp$tVEAw&zHp_&sqc3S zw}NegVj+*CPR+&Lkj^YWz2=WAVH1q8_mRZYHsA%vrLl2(T#}0TS6jN&H+ttcdK37v z@<+sEe_I4tJBt zulm#nZi)XH=0ZFcOEA(08f=77tsiKU54t1rS)r*}4rXdInJmXvl%f~C4P`G>E%|sU z$P7xS+x(R7mrd5 zTC6DaU2=OW==n?~;vCrpYSMM~8>P@wkuhj$!jk_-(@F?Myfuf^-$ zi{)hWir$*~ldIw-j4Eh2s_1EJev3$H$TQ@MsLrttXUon4nJ8Ovgf!9+iEAMS zRHC)ipquDFssXN%wRGQ^uAzZQh!s?eWk`Id-%6{k2|5@dDG`+tJf$)XKyR*p0@fYT zEZ3n{Q&z!$D~mbC^qKb?<7@{$mMfXf{<8eXPegg|3%Fk@m@b$AeZ5$+w-C7cV?aD~ z4f-+{fN+~7k}9T}_85zU!rL|N>H;-q%r?_ktljF{M-p1=>HZS=j$8+m2L}x61ECK& z4@eqnh)Bf9|FBZvD%=npYz)ZFCjBqLZ~#PbixvLZ^-CM{)fUxXR?!ylFKc;=18!k# z>%&`%ZH?b305ZBQ@t2=whXrma?wG;b;vEpY#ohg7zueV>x0R#-$nvfz+=5X7Abfk` zaLak`S5z=P0CKvg1h<~-+r!&}eRraNiu_w89Kw2F0QZI*0Fes#A?vI_$nXKYZpe}l z02@A%-&;{gp3rYs&LJv<>M<$g`Qa~J^7SVGh|3`+Qt^|&oWBMK6Z>~wv)JEx7)NAq zH~kS1sX^jzaN-CR=l>b*f6XE!6dq6|{jY#uogNX`%`Y{j*rtmw!PLbxX zQrh4khYB2IfaIy5qWz~c+;2dnF=Gh53G3gGB^+9`fRXz{T5tAFrI?BF#8JzMarB|1+(B2)zDh`r!Mb z5IjeSvkRrjA9}C{C>r-nTF z{_E=7z=38693X+@o-xCLK{(Ly7Q&ay^Y`_mKL;WOXG3HzNFgTY#Q&=CpG6f22n>Im z)FB5RP9^xCB^LiZuYc1X;aa_a&MR8!uSAGz8PWe-j6WD@f1K@0IXvmt?*Qe%zrP@x zUBAawbn#1S_`?MdDWT^#FguKsJVgHY@Tf0=NbY^VJ^Giw?m#y<&_41TpoLQZPaXgK zq4VFxkBO2Xlh8hZdLJ$yy;U6Fo0)qPTucQA1^@o1p diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17a8ddce2d6..1af9e0930b8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d65c..fcb6fca147c 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/settings.gradle b/settings.gradle index 97925052da8..b6371aad5ab 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,9 +19,9 @@ pluginManagement { } plugins { - id 'com.diffplug.blowdryerSetup' version '1.6.0' + id 'com.diffplug.blowdryerSetup' version '1.7.0' // Automatic toolchain provisioning - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' } blowdryerSetup { From 5429ae52a0d20e09729fe54419feac8d1d63873f Mon Sep 17 00:00:00 2001 From: Ko_no <90126004+MrKono@users.noreply.github.com> Date: Sun, 3 Dec 2023 03:02:17 +0900 Subject: [PATCH 51/77] Update ja_jp.lang for 2.8.1 (#2227) --- .../resources/assets/gregtech/lang/ja_jp.lang | 584 +++++++++++++++--- 1 file changed, 509 insertions(+), 75 deletions(-) diff --git a/src/main/resources/assets/gregtech/lang/ja_jp.lang b/src/main/resources/assets/gregtech/lang/ja_jp.lang index 8699cb6837e..28cb715332c 100644 --- a/src/main/resources/assets/gregtech/lang/ja_jp.lang +++ b/src/main/resources/assets/gregtech/lang/ja_jp.lang @@ -1,7 +1,7 @@ # Japanese translate by MrKo_no & GTModpackTeam # 日本語ローカライズ担当: MrKo_no & GTModpackTeam -# Corresponding Version: 2.7.4 - beta -# 対応バージョン: 2.7.4 - beta +# Corresponding Version: 2.8.1 - beta +# 対応バージョン: 2.8.1 - beta death.attack.heat=%s は熱さを感じなくなった。 death.attack.frost=%s のふとんがふっとんだ。 @@ -47,7 +47,7 @@ enchantment.disjunction=ディスジャンクション gregtech.machine.steam_grinder.name=蒸気式破砕機 gregtech.multiblock.steam_grinder.description=蒸気時代のマルチブロック式粉砕機。ブロンズ製外装が最低14個必要。/n通常のハッチ/バスは使えず、専用の蒸気用のものが必要。 gregtech.multiblock.steam.low_steam=蒸気不足! -gregtech.multiblock.steam.steam_stored=蒸気: %s / %s mb +gregtech.multiblock.steam.steam_stored=蒸気: %s gregtech.machine.steam_hatch.name=蒸気用ハッチ gregtech.machine.steam.steam_hatch.tooltip=受入液体: §f蒸気 gregtech.machine.steam_import_bus.name=蒸気用搬入バス @@ -62,12 +62,13 @@ gregtech.top.working_disabled=停止中 gregtech.top.energy_consumption=使用量: gregtech.top.energy_production=発電量: -gregtech.top.of=の gregtech.top.transform_up=昇圧 gregtech.top.transform_down=降圧 gregtech.top.transform_input=入力: gregtech.top.transform_output=出力: +gregtech.top.steam_heating_up=加熱中 +gregtech.top.steam_no_water=水がない gregtech.top.convert_eu=§eEU§rを§cFE§rに変換中 gregtech.top.convert_fe=§cFE§rを§eEU§rに変換中 @@ -132,8 +133,7 @@ gregtech.multiblock.assembly_line.description=アセンブリラインは5から gregtech.multiblock.fusion_reactor.luv.description=核融合炉Mark 1は、元素をより重い元素に融合するために使われる大型マルチブロック機械です。核融合炉Mark 1は、LuVやZPMまたはUVエネルギーハッチを使用できます。ハッチごとに、バッファが1,000万EUずつ増加します。最大開始エネルギーは160,000,000 EUです。 gregtech.multiblock.fusion_reactor.zpm.description=核融合炉Mark 2は、元素をより重い元素に融合するために使われる大型マルチブロック機械です。核融合炉Mark 2は、ZPMまたはUVエネルギーハッチを使用できます。ハッチごとに、バッファが2,000万EUずつ増加します。最大開始エネルギーは320,000,000 EUです。 gregtech.multiblock.fusion_reactor.uv.description=核融合炉Mark 3は、元素をより重い元素に融合するために使われる大型マルチブロック機械です。核融合炉Mark 3はUVエネルギーハッチのみを使用できます。ハッチごとに、バッファが4,000万EUずつ増加します。最大開始エネルギーは640,000,000 EUです。 -gregtech.multiblock.fusion_reactor.energy=EU: %d / %d -gregtech.multiblock.fusion_reactor.heat=熱: %d +gregtech.multiblock.fusion_reactor.heat=熱: %s gregtech.multiblock.large_chemical_reactor.description=大型化学反応炉は化学反応を100%%のエネルギー効率で実現します。オーバークロックは速度とエネルギーの両方を4倍にします。マルチブロックには丁度1つのキュプロニッケルコイルブロックを中央にあるPTFEパイプ外装に隣接して配置する必要があります。 gregtech.multiblock.primitive_water_pump.description=初歩的な揚水ポンプは蒸気時代以前のマルチブロックであり、1秒に1回バイオームに応じた水量を収集します。ポンプ、ULV、またはLV出力ハッチを使用することにより、バイオーム係数*ハッチ係数に従ってティアごとの水の量を増やすことができます。 gregtech.multiblock.primitive_water_pump.extra1=バイオーム係数:/n 海、川: 1000 L/s/n 湿地: 800 L/s/n ジャングル: 350 L/s/n 雪原: 300 L/s/n 草原、森林: 250 L/s/n タイガ: 175 L/s/n 海岸: 170 L/s/n 他: 100 L/s @@ -801,10 +801,17 @@ metaitem.neutron_reflector.name=イリジウム製中性子反射板 metaitem.neutron_reflector.tooltip=破壊不能 metaitem.duct_tape.name=ブレインテック航空宇宙発展強化ダクトテープ FAL-84 metaitem.duct_tape.tooltip=これでも直せない? もっと使おう! +metaitem.basic_tape.name=テープ +metaitem.basic_tape.tooltip=修理に使えるほどの強度はない metaitem.component.grinder.diamond.name=ダイヤモンド製研削ヘッド metaitem.component.grinder.tungsten.name=タングステン製研削ヘッド +metaitem.minecart_wheels.iron.name=鉄製のトロッコ用車輪 +metaitem.minecart_wheels.iron.tooltip=物事を進めるために +metaitem.minecart_wheels.steel.name=スチール製のトロッコ用車輪 +metaitem.minecart_wheels.steel.tooltip=物事を進めるために + metaitem.quantumeye.name=クアンタムアイ metaitem.quantumeye.tooltip=改善したエンダーアイ metaitem.quantumstar.name=クアンタムスター @@ -830,11 +837,11 @@ metaitem.cover.activity.detector_advanced.tooltip=レッドストーン信号と metaitem.cover.fluid.detector.name=液体検出器 metaitem.cover.fluid.detector.tooltip=レッドストーン信号として§f液量§7を検出する§fカバー§7 metaitem.cover.fluid.detector.advanced.name=発展型液体検出器 -metaitem.cover.fluid.detector.advanced.tooltip=§fSRラッチ§7で制御された§f液体保管量§7をレッドストーン信号として与える§fカバー§7 +metaitem.cover.fluid.detector.advanced.tooltip=§f液体保管量§7をレッドストーン信号として与える§fカバー§7。§fSRラッチ制御§7のオプション付き。 metaitem.cover.item.detector.name=アイテム検出器 metaitem.cover.item.detector.tooltip=レッドストーン信号として§fアイテム量§7を検出する§fカバー§7 metaitem.cover.item.detector.advanced.name=発展型アイテム検出器 -metaitem.cover.item.detector.advanced.tooltip=§fSRラッチ§7で制御された§fアイテム保管量§7をレッドストーン信号として与える§fカバー§7 +metaitem.cover.item.detector.advanced.tooltip=§fアイテム保管量§7をレッドストーン信号として与える§fカバー§7。§fSRラッチ制御§7のオプション付き。 metaitem.cover.energy.detector.name=エネルギー検出器 metaitem.cover.energy.detector.tooltip=レッドストーン信号として§fエネルギー量§7を検出する§fカバー§7 metaitem.cover.energy.detector.advanced.name=発展型エネルギー検出器 @@ -1173,7 +1180,7 @@ cover.filter.blacklist.disabled=ホワイトリスト cover.filter.blacklist.enabled=ブラックリスト cover.ore_dictionary_filter.title=鉱石辞書フィルター -cover.ore_dictionary_filter.info=§b論理式対応/n§6a & b§r = AND/n§6a | b§r = OR/n§6a ^ b§r = XOR/n§6! abc§r = NOT/n§6( abc )§r グループ化/n§6*§r ワイルドカード (0文字以上の任意文字列)/n§6?§r 任意の1文字/n§6()§r 空の項目(鉱石辞書がない項目も含む)に適合/n§6$c§r 大文字・小文字を区別する場合に式の先頭に付ける。/n§b例:/n§6dust*Gold | (plate* & !*Double*)/n全てのサイズの金の粉または全てのプレートが該当するが、二重プレートは該当しない。 +cover.ore_dictionary_filter.info=§b論理式の比較演算子/n§6a & b§r = AND/n§6a | b§r = OR/n§6a ^ b§r = XOR/n§6! abc§r = NOT/n§6( abc )§r グループ化/n§6*§r ワイルドカード (0文字以上の任意文字列)/n§6?§r 任意の1文字/n§6()§r 空の項目(鉱石辞書がない項目も含む)に適合/n§6$c§r 大文字・小文字を区別する場合に式の先頭に付ける。/n§b例:/n§6dust*Gold | (plate* & !*Double*)/n全てのサイズの金の粉または全てのプレートが該当するが、二重プレートは該当しない。 cover.ore_dictionary_filter.test_slot.info=フィルタ式に一致するかどうかのテスト用スロット cover.ore_dictionary_filter.test_slot.matches=§a* %s cover.ore_dictionary_filter.test_slot.matches_not=§c* %s @@ -1183,7 +1190,49 @@ cover.ore_dictionary_filter.status.err=§c%s個のエラー cover.ore_dictionary_filter.status.err_warn=§c%s個のエラーと%s個の警告 cover.ore_dictionary_filter.status.warn=§7%s個の警告 cover.ore_dictionary_filter.status.no_issues=§a問題ナシ -cover.ore_dictionary_filter.status.explain=フィルターの状況: +cover.ore_dictionary_filter.status.explain=フィルターの合致状況: + +cover.ore_dictionary_filter.preview.next=の次に右を含むもの: +cover.ore_dictionary_filter.preview.match='%s' +cover.ore_dictionary_filter.preview.match.not=次を含まないもの: '%s' +cover.ore_dictionary_filter.preview.char=1文字 +cover.ore_dictionary_filter.preview.char.not=2文字以上または鉱石辞書なしのどちらか +cover.ore_dictionary_filter.preview.chars=%s文字 +cover.ore_dictionary_filter.preview.chars.not=%s文字超過または未満のどちらか +cover.ore_dictionary_filter.preview.chars_or_more=%s文字以上 +cover.ore_dictionary_filter.preview.chars_or_more.not=%s文字未満 +cover.ore_dictionary_filter.preview.group=次ではない: +cover.ore_dictionary_filter.preview.or=次のうちのどれか... +cover.ore_dictionary_filter.preview.nor=次のうちのいずれかを満たさないもの全て... +cover.ore_dictionary_filter.preview.or.entry= +cover.ore_dictionary_filter.preview.or.entry.start= +cover.ore_dictionary_filter.preview.and=次を全てを満たすもの... +cover.ore_dictionary_filter.preview.nand=次を満たさないもの全て... +cover.ore_dictionary_filter.preview.and.entry= +cover.ore_dictionary_filter.preview.and.entry.start= +cover.ore_dictionary_filter.preview.xor=次のうちの1つのみを満たす... +cover.ore_dictionary_filter.preview.xnor=次を両方満たすまたは満たさない... +cover.ore_dictionary_filter.preview.xor.entry= +cover.ore_dictionary_filter.preview.everything=(任意文字列) +cover.ore_dictionary_filter.preview.impossible=(判断不可能です) +cover.ore_dictionary_filter.preview.nonempty=何か +cover.ore_dictionary_filter.preview.empty=鉱石辞書がない +cover.ore_dictionary_filter.preview.error=エラー! + +cover.ore_dictionary_filter.compile.eof=** End of line ** + +cover.ore_dictionary_filter.compile.error.unexpected_eof=論理式の予期せぬ終了 +cover.ore_dictionary_filter.compile.error.unexpected_token=予期せぬトークン: '%s' +cover.ore_dictionary_filter.compile.error.unexpected_token_after_eof=論理式末端に予期せぬトークン: '%s' +cover.ore_dictionary_filter.compile.error.unexpected_compilation_flag=論理式の途中にコンパイルフラグがあります +cover.ore_dictionary_filter.compile.error.empty_compilation_flag=比較演算子がありません +cover.ore_dictionary_filter.compile.error.unknown_compilation_flag='%s'が不明の比較演算子です +cover.ore_dictionary_filter.compile.error.redundant_compilation_flag=比較演算子'%s'が重複しています +cover.ore_dictionary_filter.compile.error.eof_after_escape=エスケープ記号 ('\') で終わらせないでください +cover.ore_dictionary_filter.compile.error.invalid_char=U+%s('%s') は有効な文字ではありません + +cover.ore_dictionary_filter.compile.warn.nested_negation=入れ子の否定は直感的ではありません。曖昧さをなくすために、グループ化演算子 ( () ) の使用を検討してください。 +cover.ore_dictionary_filter.compile.warn.consecutive_negation=連続否定は直感的でない場合があります。評価結果が望ましいかどうか確認してください。 cover.fluid_filter.title=液体フィルター cover.fluid_filter.config_amount=スクロールで量を調整できる。/nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]/n右クリックで増加して左クリックで減少です。/nShiftで倍/半分。/nホイールクリックで消去。 @@ -1213,6 +1262,8 @@ cover.voiding.tooltip=§c警告!§7 これを"有効"にすると搬入された cover.voiding.message.disabled=消去カバーを無効化 cover.voiding.message.enabled=消去カバーを有効化 +cover.shutter.message.disabled=シャッターを無効化 +cover.shutter.message.enabled=シャッターを有効化 cover.smart_item_filter.title=スマートアイテムフィルター cover.smart_item_filter.filtering_mode.electrolyzer=電解槽 @@ -1274,11 +1325,17 @@ cover.ender_fluid_link.private.tooltip.disabled=個人タンクモードに切 cover.ender_fluid_link.private.tooltip.enabled=公開タンクモードに切り替え cover.ender_fluid_link.incomplete_hex=入力した色が不完全です!/n8桁の16進数すべてが入力されると反映されます。/nGUIを閉じると編集内容が失われます! +cover.generic.advanced_detector.latched=ラッチ +cover.generic.advanced_detector.continuous=連続 +cover.generic.advanced_detector.latch_tooltip=カバーの赤石出力の切り替え /n§e連続§7 - デフォルト; 最小量未満で常に0、 最大量超過で常に15を出力する。最小量以上最大量以下では範囲に応じて0から15を出力する。/n§eラッチ§7 - 最大量を上回るまで15を出力し、上回った後は最小量を下回るまで0を出力する。 +cover.generic.advanced_detector.invert_label=赤石出力: +cover.generic.advanced_detector.latch_label=状態: +cover.generic.advanced_detector.invert_tooltip=赤石ロジックの反転の切替 + cover.advanced_energy_detector.label=発展型エネルギー検出器 cover.advanced_energy_detector.min=最小 cover.advanced_energy_detector.max=最大 cover.advanced_energy_detector.invert_tooltip=赤石ロジックの反転を切り替え/nデフォルトでは、信号は最小EUを下回った時に出力され、最大EUを上回った時に信号出力が停止します。 -cover.advanced_energy_detector.invert_label=反転: cover.advanced_energy_detector.normal=しない cover.advanced_energy_detector.inverted=する cover.advanced_energy_detector.modes_tooltip=装置の蓄電量に対する最大/最小の比較を、EU値を数値で直接指定するまたは最大蓄電量に対する割合を使用するかどうかを切り替える。 @@ -1287,7 +1344,6 @@ cover.advanced_energy_detector.mode_eu=数値 cover.advanced_energy_detector.mode_percent=割合 cover.advanced_fluid_detector.label=発展型液体検出器 -cover.advanced_fluid_detector.invert_tooltip=赤石ロジックの反転を切り替え/nデフォルトでは、最小液体量を下回った時に信号が停止し、最大液体量を上回った時に信号が出力されます。 cover.advanced_fluid_detector.max=最大液体量: cover.advanced_fluid_detector.min=最小液体量: cover.advanced_item_detector.label=発展型アイテム検出器 @@ -1737,6 +1793,7 @@ gregtech.material.antimony_trifluoride=三フッ化アンチモン gregtech.material.enriched_naquadah_sulfate=濃縮ナクアダ硫酸塩 gregtech.material.naquadria_sulfate=ナクアドリア硫酸塩 gregtech.material.pyrochlore=パイロクロア +gregtech.material.rtm_alloy=RTM合金 # Organic Chemistry Materials @@ -2406,7 +2463,7 @@ tile.wire_coil.tooltip_energy_cracking= §aエネルギー使用量: §f%s%% tile.wire_coil.cupronickel.name=キュプロニッケルコイルブロック tile.wire_coil.kanthal.name=カンタルコイルブロック tile.wire_coil.nichrome.name=ニクロムコイルブロック -tile.wire_coil.tungstensteel.name=タングステンスチールコイルブロック +tile.wire_coil.rtm_alloy.name=RTM合金コイルブロック tile.wire_coil.hss_g.name=HSS-Gコイルブロック tile.wire_coil.naquadah.name=ナクアダコイルブロック tile.wire_coil.trinium.name=トリニウムコイルブロック @@ -2439,6 +2496,58 @@ tile.warning_sign_1.causality_hazard.name=標準的因果危害警告ブロッ tile.warning_sign_1.automated_defenses_hazard.name=自動防衛システム危害警告ブロック tile.warning_sign_1.high_pressure_hazard.name=高圧危害警告ブロック +# Decorative Metal Sheets +tile.metal_sheet.white.name=白の板金ブロック +tile.metal_sheet.orange.name=橙色の板金ブロック +tile.metal_sheet.magenta.name=赤紫色の板金ブロック +tile.metal_sheet.light_blue.name=空色の板金ブロック +tile.metal_sheet.yellow.name=黄色の板金ブロック +tile.metal_sheet.lime.name=黄緑色の板金ブロック +tile.metal_sheet.pink.name=桃色の板金ブロック +tile.metal_sheet.gray.name=灰色の板金ブロック +tile.metal_sheet.silver.name=薄灰色の板金ブロック +tile.metal_sheet.cyan.name=青緑色の板金ブロック +tile.metal_sheet.purple.name=紫色の板金ブロック +tile.metal_sheet.blue.name=青の板金ブロック +tile.metal_sheet.brown.name=茶色の板金ブロック +tile.metal_sheet.green.name=緑色の板金ブロック +tile.metal_sheet.red.name=赤の板金ブロック +tile.metal_sheet.black.name=黒の板金ブロック + +tile.large_metal_sheet.white.name=白の大きな板金ブロック +tile.large_metal_sheet.orange.name=橙色の大きな板金ブロック +tile.large_metal_sheet.magenta.name=赤紫色の大きな板金ブロック +tile.large_metal_sheet.light_blue.name=空色の大きな板金ブロック +tile.large_metal_sheet.yellow.name=黄色の大きな板金ブロック +tile.large_metal_sheet.lime.name=黄緑色の大きな板金ブロック +tile.large_metal_sheet.pink.name=桃色の大きな板金ブロック +tile.large_metal_sheet.gray.name=灰色の大きな板金ブロック +tile.large_metal_sheet.silver.name=薄灰色の大きな板金ブロック +tile.large_metal_sheet.cyan.name=青緑色の大きな板金ブロック +tile.large_metal_sheet.purple.name=紫色の大きな板金ブロック +tile.large_metal_sheet.blue.name=青の大きな板金ブロック +tile.large_metal_sheet.brown.name=茶色の大きな板金ブロック +tile.large_metal_sheet.green.name=緑色の大きな板金ブロック +tile.large_metal_sheet.red.name=赤の大きな板金ブロック +tile.large_metal_sheet.black.name=黒の大きな板金ブロック + +tile.studs.white.name=白のスタッド +tile.studs.orange.name=橙色のスタッド +tile.studs.magenta.name=赤紫色のスタッド +tile.studs.light_blue.name=空色のスタッド +tile.studs.yellow.name=黄色のスタッド +tile.studs.lime.name=黄緑色のスタッド +tile.studs.pink.name=桃色のスタッド +tile.studs.gray.name=灰色のスタッド +tile.studs.silver.name=薄灰色のスタッド +tile.studs.cyan.name=黄緑色のスタッド +tile.studs.purple.name=紫色のスタッド +tile.studs.blue.name=青のスタッド +tile.studs.brown.name=茶色のスタッド +tile.studs.green.name=緑色のスタッド +tile.studs.red.name=赤のスタッド +tile.studs.black.name=黒のスタッド + # Lampss(ON) tile.gregtech_lamp.white.name=白のランプ tile.gregtech_lamp.orange.name=橙色のランプ @@ -2584,7 +2693,7 @@ tile.long_distance_fluid_pipeline.name=長距離液体パイプ # Creative tabs itemGroup.gregtech.main=GregTech itemGroup.gregtech.machines=GregTech - 機械 -itemGroup.gregtech.cables=GregTecg - ケーブル +itemGroup.gregtech.cables=GregTech - ケーブル itemGroup.gregtech.pipes=GregTech - パイプ itemGroup.gregtech.tools=GregTech - 道具 itemGroup.gregtech.materials=GregTech - マテリアル @@ -2612,6 +2721,7 @@ gregtech.machine.crate.aluminium.name=アルミニウム製クレート gregtech.machine.crate.stainless_steel.name=ステンレススチール製クレート gregtech.machine.crate.titanium.name=チタン製クレート gregtech.machine.crate.tungstensteel.name=タングステンスチール製クレート +gregtech.crate.tooltip.taped_movement=テープを使うと撤去時に中身を保持できる # Safe gregtech.machine.locked_safe.name=金庫 @@ -3891,6 +4001,9 @@ gregtech.machine.scanner.uxv.name=史上最高のスキャナー IV gregtech.machine.scanner.uxv.tooltip=電子顕微鏡 gregtech.machine.scanner.opv.name=伝説のスキャナー gregtech.machine.scanner.opv.tooltip=電子顕微鏡 +gregtech.scanner.copy_stick_from=§oスキャンしたスティック +gregtech.scanner.copy_stick_to=§oスキャンデータのコピー +gregtech.scanner.copy_stick_empty=§o未スキャンのスティック gregtech.machine.infinite_energy.name=クリエイティブEU電源 gregtech.machine.creative_chest.name=クリエイティブ量子チェスト @@ -4167,6 +4280,9 @@ gregtech.machine.item_collector.ev.name=発展型アイテム収集器 III gregtech.machine.item_collector.gui.collect_range=%s ブロック内のアイテム収集 gregtech.machine.item_collector.tooltip=赤石信号入力時に周囲のアイテムを回収する +gregtech.machine.alarm.name=アラーム +gregtech.machine.alarm.tooltip=赤石信号が入力されているときに音を発する + #Quantum Chests gregtech.machine.quantum_chest.tooltip=Storage Drawersよりも良い gregtech.machine.super_chest.lv.name=スーパーチェスト I @@ -4183,6 +4299,7 @@ gregtech.machine.quantum_chest.items_stored=アイテム量: #Quantum Tanks gregtech.machine.quantum_tank.tooltip=大量の液体を保管するコンパクトな空間 +gregtech.machine.quantum_tank.tooltip.voiding_enabled=超過分の廃棄が§a有効 gregtech.machine.super_tank.lv.name=スーパータンク I gregtech.machine.super_tank.mv.name=スーパータンク II gregtech.machine.super_tank.hv.name=スーパータンク III @@ -4278,19 +4395,24 @@ gregtech.machine.fisher.requirement=%,dx%,d の水槽が必要。設置位置の # World Accelerator gregtech.machine.world_accelerator.lv.name=基本型世界加速機 +gregtech.machine.world_accelerator.lv.tooltip=ティックがブロックを加速させる gregtech.machine.world_accelerator.mv.name=発展型世界加速機 +gregtech.machine.world_accelerator.mv.tooltip=ティックがブロックを加速させる gregtech.machine.world_accelerator.hv.name=発展型世界加速機 II +gregtech.machine.world_accelerator.hv.tooltip=ティックがブロックを加速させる gregtech.machine.world_accelerator.ev.name=発展型世界加速機 III +gregtech.machine.world_accelerator.ev.tooltip=ティックがブロックを加速させる gregtech.machine.world_accelerator.iv.name=精鋭型世界加速機 +gregtech.machine.world_accelerator.iv.tooltip=時の§m瓶§r§7 ver.ブロック gregtech.machine.world_accelerator.luv.name=精鋭型世界加速機 II +gregtech.machine.world_accelerator.luv.tooltip=時の§m瓶§r§7 ver.ブロック gregtech.machine.world_accelerator.zpm.name=精鋭型世界加速機 III +gregtech.machine.world_accelerator.zpm.tooltip=時の§m瓶§r§7 ver.ブロック gregtech.machine.world_accelerator.uv.name=究極型世界加速機 -gregtech.machine.world_accelerator.uhv.name=史上最高の世界加速機 -gregtech.machine.world_accelerator.uev.name=史上最高の世界加速機 II -gregtech.machine.world_accelerator.uiv.name=史上最高の世界加速機 III -gregtech.machine.world_accelerator.uxv.name=史上最高の世界加速機 IV -gregtech.machine.world_accelerator.opv.name=伝説の世界加速機 -gregtech.machine.world_accelerator.description=§fTile Entity§7または§fRandom Tick§7の2つのモードを用いてTickを加速させる。スクリュードライバーでモード変更ができる。 +gregtech.machine.world_accelerator.uv.tooltip=メイド・イン・ヘブン!! +gregtech.machine.world_accelerator.description=§fスクリュードライバー§7で§fRandom Tick§7モードと§fTile Entity§7モードの変更ができる +gregtech.machine.world_accelerator.power_usage=Random Tickモードでは§f%dA§7、Tile Entityモードでは§f%dA§7が必要。 +gregtech.machine.world_accelerator.acceleration=§d加速限界: §f%dx gregtech.machine.world_accelerator.working_area=§b有効範囲: gregtech.machine.world_accelerator.working_area_tile= Tile Entity モード:§f 隣接ブロック gregtech.machine.world_accelerator.working_area_random= Random Tickモード:§f %dx%d @@ -4387,6 +4509,8 @@ gregtech.advancement.steam.87_fluid_pipe_death_heat.name=沸騰しちゃった! gregtech.advancement.steam.87_fluid_pipe_death_heat.desc=高温の液体パイプに接触して死亡する。 gregtech.advancement.steam.90_primitive_pump.name=地盤沈下の始まり gregtech.advancement.steam.90_primitive_pump.desc=序盤の水源確保の為に初歩的な揚水ポンプを作成する。 +gregtech.advancement.steam.91_primitive_blast_furnace.name=用途募集中 +gregtech.advancement.steam.91_primitive_blast_furnace.desc=初歩的な溶鉱炉を作成する。 gregtech.advancement.root_lv.name=LV (Low Voltage) 時代 gregtech.advancement.root_lv.desc=基本型蒸気タービンを作成する。 gregtech.advancement.low_voltage.17_lv_pump.name=手を洗ったら栓を閉めましょう @@ -4487,8 +4611,8 @@ gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.name=ナノCPUを右に90 gregtech.advancement.insane_voltage.55_qbit_cpu_wafer.desc=量子ビットCPUウェハーを生産する。 gregtech.advancement.insane_voltage.56_quantum_processor.name=冷却不要! gregtech.advancement.insane_voltage.56_quantum_processor.desc=量子処理装置を入手する。 -gregtech.advancement.insane_voltage.57_tungstensteel_coil.name=コイルをレベル IVにしよう -gregtech.advancement.insane_voltage.57_tungstensteel_coil.desc=タングステンスチールコイルブロックを作成する。 +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.name=コイルをレベル IVにしよう +gregtech.advancement.insane_voltage.57_rtm_alloy_coil.desc=RTM合金コイルブロックを作成する。 gregtech.advancement.insane_voltage.58_hss_g_coil.name=コイルをレベル Vにしよう gregtech.advancement.insane_voltage.58_hss_g_coil.desc=HSS-Gコイルブロックを作成する。 gregtech.advancement.root_luv.name=LuV (Ludicrous Voltage) 時代 @@ -4629,7 +4753,7 @@ gregtech.machine.miner.multi.modes=シルクタッチとチャンク整列モー gregtech.machine.miner.multi.production=§f粉砕機§7の§f3倍§7以上の砕いた鉱石を生産。 gregtech.machine.miner.fluid_usage=§f%,d L/t§7で§f%s§7を消費する。オーバークロックごとに液体消費が2倍になる。 gregtech.machine.miner.multi.description=広い面積をカバーし、大量の鉱石を生産するマルチブロック採掘機。 -gregtech.machine.miner.multi.needsfluid=掘削油が必要 +gregtech.machine.miner.multi.needsfluid=掘削油がありません! gregtech.machine.miner.startx=開始X: %d gregtech.machine.miner.starty=開始Y: %d @@ -4648,6 +4772,7 @@ gregtech.machine.fluid_drilling_rig.ev.name=発展型液体採掘機 II gregtech.machine.fluid_drilling_rig.description=液体を岩盤下から汲みだします。 gregtech.machine.fluid_drilling_rig.production=§e生産倍率: §f%sx、オーバークロックで%f倍 gregtech.machine.fluid_drilling_rig.depletion=§b枯渇速度: §f%s%% +gregtech.machine.fluid_drilling_rig.shows_depletion=枯渇速度の情報を表示 gregtech.machine.cleanroom.name=クリーンルーム gregtech.machine.cleanroom.tooltip.1=機械を中に設置すると繊細な素材を加工できるようになる。 @@ -4662,9 +4787,10 @@ gregtech.machine.cleanroom.tooltip.8=エネルギーは壁面の§f筐体§7ま gregtech.machine.cleanroom.tooltip.9=アイテム及び液体は壁面の§f通過ハッチ§7を通して送ることができる。 gregtech.machine.cleanroom.tooltip.ae2.channels=§a8 AE2チャンネル§7を壁面の§f筐体§7を通して送信できる。 gregtech.machine.cleanroom.tooltip.ae2.no_channels=§aMEネットワーク§7を壁面の§f筐体§7を通して送信できる。 -gregtech.multiblock.cleanroom.clean_state=状態: §a清潔 -gregtech.multiblock.cleanroom.dirty_state=状態: §4清潔でない -gregtech.multiblock.cleanroom.clean_amount=清潔度: §a%s%% +gregtech.multiblock.cleanroom.clean_status=状態: %s +gregtech.multiblock.cleanroom.clean_state=清潔 (%s%%) +gregtech.multiblock.cleanroom.dirty_state=汚染されている (%s%%) +gregtech.multiblock.cleanroom.warning_contaminated=汚染されている! gregtech.machine.charcoal_pile.name=炭窯 gregtech.machine.charcoal_pile.tooltip.1=§c点火される§7と、時間をかけて原木を§a木炭§7に変化させる。 @@ -4705,6 +4831,7 @@ gregtech.machine.research_station.tooltip.2=§fデータオーブ§7と§fデー gregtech.machine.research_station.tooltip.3=動作には§f計算力§7が必要です。 gregtech.machine.research_station.tooltip.4=計算力をさらに与えると、より早くレシピを実行できる。 gregtech.multiblock.research_station.description=研究ステーションはアセンブリライン用のより複雑な研究を行うマルチブロックです。研究にはデータオーブまたはデータモジュールが必要です。また、動作には高機能計算アレイ (HPCAs) から供給されるComputer Work Units (CWU/t)が必要です。 +gregtech.machine.research_station.researching=研究中 gregtech.machine.network_switch.name=ネットワークスイッチ gregtech.machine.network_switch.tooltip.1=イーサネットハブ @@ -4717,7 +4844,7 @@ gregtech.machine.high_performance_computing_array.name=高機能計算アレイ gregtech.machine.high_performance_computing_array.tooltip.1=ごくごく一般的なスーパーコンピュータ gregtech.machine.high_performance_computing_array.tooltip.2=§f計算力§7 (と熱) を産み出すのに使われる。 gregtech.machine.high_performance_computing_array.tooltip.3=§fCWU/t§7 (Compute Work Units) を産み出すためにはHPCAコンポーネントが必要。 -gregtech.multiblock.high_performance_computing_array.description高機能計算アレイ (HPCA) はより複雑なアセンブリライン用データに必要なCompute Work Units (CWU/t) を生産するマルチブロックです。このマルチブロックには任意のHPCAコンポーネントで構成される可変長の3x3のエリアがあります。組み込むコンポーネントによって供給できる計算力、冷却力、発熱量及びHPCAのエネルギー使用量が異なります。ブリッジコンポーネントを組み込んだ場合、HPCAはネットワークスイッチに接続し、複数の供給元から1つまたは複数の宛先への計算の統合と分配を行うことができます。 +gregtech.multiblock.high_performance_computing_array.description=高機能計算アレイ (HPCA) はより複雑なアセンブリライン用データに必要なCompute Work Units (CWU/t) を生産するマルチブロックです。このマルチブロックには任意のHPCAコンポーネントで構成される可変長の3x3のエリアがあります。組み込むコンポーネントによって供給できる計算力、冷却力、発熱量及びHPCAのエネルギー使用量が異なります。ブリッジコンポーネントを組み込んだ場合、HPCAはネットワークスイッチに接続し、複数の供給元から1つまたは複数の宛先への計算の統合と分配を行うことができます。 gregtech.machine.central_monitor.name=セントラルモニター gregtech.multiblock.central_monitor.low_power=電力不足 @@ -5015,6 +5142,11 @@ gregtech.machine.pump_hatch.tooltip=揚水ポンプ用の初歩的な搬出ハ gregtech.machine.machine_hatch.name=マシンアクセスインターフェース gregtech.machine.machine_hatch.locked=インターフェースはロックされている +gregtech.machine.machine_hatch.machines=対象機械: %s +gregtech.machine.machine_hatch.machines_none=なし +gregtech.machine.machine_hatch.machines_none_hover=動かす機械をアクセスインターフェースに入れてください。 +gregtech.machine.machine_hatch.machines_max=最大機械数: %s +gregtech.machine.machine_hatch.machines_max_eut=最大使用EU/t: %s (%sA %s) gregtech.machine.machine_hatch.tooltip=有効なアイテムのみを保持する専用アクセスバス gregtech.machine.machine_hatch.processing_array=§eプロセッシングアレイ§7に組み込まれた場合、§eプロセッシングアレイ§7で動作するマシンのみを保持します。 @@ -5023,6 +5155,9 @@ gregtech.machine.passthrough_hatch_item.tooltip=一方通行でアイテムを gregtech.machine.passthrough_hatch_fluid.name=液体通過ハッチ gregtech.machine.passthrough_hatch_fluid.tooltip=一方通行で液体を送る +gregtech.machine.reservoir_hatch.name=リザーバーハッチ +gregtech.machine.reservoir_hatch.tooltip=流しじゃないよ + gregtech.machine.data_access_hatch.name=データアクセスハッチ gregtech.machine.data_access_hatch.tooltip.1=マルチブロック用データ搬入出口 gregtech.machine.data_access_hatch.tooltip.2=データ格納アイテム用の§a%s§7スロットを追加する @@ -5141,7 +5276,7 @@ gregtech.universal.tooltip.energy_storage_capacity=§c蓄電量: §f%,d EU gregtech.universal.tooltip.energy_tier_range=§a許容電圧: §f%s §f- %s gregtech.universal.tooltip.item_storage_capacity=§6アイテムスロット数: §f%,d gregtech.universal.tooltip.item_storage_total=§6アイテム容量: §f%,d アイテム -gregtech.universal.tooltip.item_stored=§dアイテム数: §f%s, %,d アイテム +gregtech.universal.tooltip.item_stored=§dアイテム: §f%s, %,d + %,d アイテム gregtech.universal.tooltip.item_transfer_rate=§b運搬速度: §f%,d アイテム/秒 gregtech.universal.tooltip.item_transfer_rate_stacks=§b運搬速度: §f%,d スタック/秒 gregtech.universal.tooltip.fluid_storage_capacity=§9液体容量: §f%,d L @@ -5173,6 +5308,11 @@ gregtech.recipe.duration=処理時間: %s 秒 gregtech.recipe.amperage=電流: %,d gregtech.recipe.not_consumed=このレシピでは消費されない gregtech.recipe.chance=確率: %s%% +%s%%/tier +gregtech.recipe.chance_logic=確率: %s%% +%s%%/tier (%s) +gregtech.chance_logic.or=OR +gregtech.chance_logic.and=AND +gregtech.chance_logic.xor=XOR +gregtech.chance_logic.none=NONE gregtech.recipe.temperature=温度: %,dK (%s) gregtech.recipe.explosive=爆薬: %s gregtech.recipe.eu_to_start=開始エネルギー: %sEU @@ -5181,13 +5321,14 @@ gregtech.recipe.cleanroom=%sが必要 gregtech.recipe.cleanroom.display_name=クリーンルーム gregtech.recipe.cleanroom_sterile.display_name=滅菌クリーンルーム gregtech.recipe.research=研究が必要 +gregtech.recipe.scan_for_research=アセンブリラインのためのスキャン gregtech.recipe.computation_per_tick=最低計算力: %,d CWU/t gregtech.recipe.total_computation=総計算力: %,d gregtech.recipe.research_result=このアイテムは研究成果であり、このレシピでは直接クラフトされません。 -gregtech.fluid.click_to_fill=§7中身の入った液体容器でクリックすると、§b中身をタンクに移す§7。Shiftクリックで1スタック全て移す。 -gregtech.fluid.click_combined=§7液体容器でクリックすると、液体を§c液体容器§7と§b内部タンク§7間をやり取りできる。Shiftクリックで1スタック全て移す。 -gregtech.fluid.click_to_empty=§7液体容器でクリックすると、液体を§c液体容器§7と§b内部タンク§7間をやり取りできる。Shiftクリックで1スタック全て移す。 +gregtech.fluid.click_to_fill=§7中身の入った液体容器で左クリックすると、§b中身をタンクに移す§7。右クリックで1つずつ移す。 +gregtech.fluid.click_combined=§7液体容器で左クリックすると、液体を§c液体容器§7と§b内部タンク§7間をやり取りできる。右クリックで1つずつ移す。 +gregtech.fluid.click_to_empty=§7液体容器で左クリックすると、液体を§c液体容器§7と§b内部タンク§7間をやり取りできる。右クリックで1つずつ移す。 gregtech.tool_action.show_tooltips=SHIFTでツール情報を表示 gregtech.tool_action.screwdriver.auto_output_covers=§8スクリュードライバーで搬出面からの搬入やカバーにアクセスできます。 @@ -5198,6 +5339,7 @@ gregtech.tool_action.screwdriver.auto_output=§8スクリュードライバー gregtech.tool_action.screwdriver.auto_output_down=§8スクリュードライバーで下面からの自動搬出を切替できます。 gregtech.tool_action.screwdriver.toggle_mode=§8スクリュードライバーでモードを切替できます。 gregtech.tool_action.wrench.set_facing=§8レンチを使うと向きを変更できます。 +gregtech.tool_action.wrench.extended_facing=§8レンチを使うと向きの変更または機械の回転ができます。 gregtech.tool_action.wrench.connect=§8レンチで接続を設定できます。 gregtech.tool_action.wrench.connect_and_block=§8レンチで接続を設定でき、スニークで逆流を防止できます。 gregtech.tool_action.wire_cutter.connect=§8ワイヤーカッターで接続を設定できます。 @@ -5208,6 +5350,9 @@ gregtech.tool_action.crowbar=§8バールでカバーを撤去できます。 gregtech.tool_action.tape=§8テープでメンテナンスの問題を解決できます。 gregtech.fluid.generic=%s +gregtech.fluid.liquid_generic=液化%s +gregtech.fluid.gas_generic=%sガス +gregtech.fluid.gas_vapor=%s蒸気 gregtech.fluid.plasma=%sプラズマ gregtech.fluid.empty=空 gregtech.fluid.amount=§9量: %,d/%,d L @@ -5238,6 +5383,8 @@ gregtech.gui.fluid_lock.tooltip.enabled=液体ロックを無効化 (現在は gregtech.gui.fluid_lock.tooltip.disabled=液体ロックを有効化 (現在は無効) gregtech.gui.fluid_voiding.tooltip.enabled=超過分の廃棄を無効化 (現在は有効) gregtech.gui.fluid_voiding.tooltip.disabled=超過分の廃棄を有効化 (現在は無効) +gregtech.gui.item_voiding.tooltip.enabled=超過分の廃棄を無効化 (現在は有効) +gregtech.gui.item_voiding.tooltip.disabled=超過分の廃棄を有効化 (現在は無効) gregtech.gui.multiblock_item_voiding=消去モード/n§6アイテム§7を消去 gregtech.gui.multiblock_fluid_voiding=消去モード/n§6液体§7を消去 gregtech.gui.multiblock_item_fluid_voiding=消去モード/n§6アイテム§7と§6液体§7を消去 @@ -5250,6 +5397,8 @@ gregtech.gui.config_slot=§f設定スロット§r gregtech.gui.config_slot.set=§7クリックで設定スロットを§b設定/選択§7。§r gregtech.gui.config_slot.scroll=§7スクロールで設定量を§a変更§7。§r gregtech.gui.config_slot.remove=§7右クリックで設定スロットを§4初期化§7。§r +gregtech.gui.alarm.radius=半径: + ore.spawnlocation.name=鉱脈情報 gregtech.jei.ore.surface_rock_1=地表にある小石は鉱脈の生成位置を示します。 @@ -5266,6 +5415,10 @@ gregtech.jei.ore.between_1=中層の鉱石 gregtech.jei.ore.between_2=鉱脈の中間%d層に生成される gregtech.jei.ore.sporadic_1=点在する鉱石 gregtech.jei.ore.sporadic_2=鉱脈内に点在するように生成される +gregtech.jei.ore.spawn_range=生成範囲: %d - %d +gregtech.jei.ore.vein_weight=生成頻度: %d +gregtech.jei.ore.dimension=ディメンション: +gregtech.jei.ore.surfacematerial=地表の目印 fluid.spawnlocation.name=液体脈情報 gregtech.jei.fluid.vein_weight=生成頻度: %d @@ -5286,6 +5439,58 @@ gregtech.jei.materials.average_mass=平均質量数: %,d gregtech.jei.materials.average_protons=平均陽子数: %,d gregtech.jei.materials.average_neutrons=平均中性子数: %,d +gregtech.veins.ore.bauxite=ボーキサイト鉱脈 +gregtech.veins.ore.magnetite=磁鉄鉱鉱脈 +gregtech.veins.ore.naquadah=ナクアダ鉱脈 +gregtech.veins.ore.pitchblende=瀝青ウラン鉱鉱脈 +gregtech.veins.ore.scheelite=タングステン鉱脈 +gregtech.veins.ore.sheldonite=プラチナ鉱脈 +gregtech.veins.ore.banded_iron=褐鉄鉱鉱脈 +gregtech.veins.ore.beryllium=ベリリウム鉱脈 +gregtech.veins.ore.certus_quartz=ケルタスクォーツ鉱脈 +gregtech.veins.ore.manganese=マンガン鉱脈 +gregtech.veins.ore.molybdenum=モリブデン鉱脈 +gregtech.veins.ore.monazite=モナザイト鉱脈 +gregtech.veins.ore.nether_quartz=ネザー水晶鉱脈 +gregtech.veins.ore.redstone=赤石鉱脈 +gregtech.veins.ore.saltpeter=硝石鉱脈 +gregtech.veins.ore.sulfur=硫黄鉱脈 +gregtech.veins.ore.tetrahedrite=四面銅鉱鉱脈 +gregtech.veins.ore.topaz=トパーズ鉱脈 +gregtech.veins.ore.apatite=アパタイト鉱脈 +gregtech.veins.ore.basalt_sphere=玄武岩層 +gregtech.veins.ore.black_granite_sphere=黒色花崗岩層 +gregtech.veins.ore.cassiterite=錫鉱脈 +gregtech.veins.ore.coal=石炭鉱脈 +gregtech.veins.ore.copper_tin=銅-錫鉱脈 +gregtech.veins.ore.copper=銅鉱脈 +gregtech.veins.ore.diamond=ダイヤモンド鉱脈 +gregtech.veins.ore.galena=方鉛鉱鉱脈 +gregtech.veins.ore.garnet_tin=ガーネット-錫鉱脈 +gregtech.veins.ore.garnet=ガーネット鉱脈 +gregtech.veins.ore.iron=鉄鉱脈 +gregtech.veins.ore.lapis=ラピス鉱脈 +gregtech.veins.ore.lubricant=石鹸石鉱脈 +gregtech.veins.ore.marble_sphere=大理石層 +gregtech.veins.ore.mica=雲母鉱脈 +gregtech.veins.ore.mineral_sand=石膏鉱脈 +gregtech.veins.ore.nickel=ニッケル鉱脈 +gregtech.veins.ore.oilsands=オイルサンド鉱脈 +gregtech.veins.ore.olivine=オリビン鉱脈 +gregtech.veins.ore.raw_oil_sphere=原料油層 +gregtech.veins.ore.red_granite_sphere=赤色花崗岩層 +gregtech.veins.ore.salts=塩鉱脈 +gregtech.veins.ore.sapphire=サファイア鉱脈 + +gregtech.veins.fluid.lava=溶岩田 (ネザー) +gregtech.veins.fluid.natural_gas_nether=天然ガス田 (ネザー) +gregtech.veins.fluid.heavy_oil=重油田 (オーバーワールド) +gregtech.veins.fluid.light_oil=軽油田 (オーバーワールド) +gregtech.veins.fluid.natural_gas_overworld=天然ガス田 (オーバーワールド) +gregtech.veins.fluid.oil=原油田 (オーバーワールド) +gregtech.veins.fluid.raw_oil=原料油田 (オーバーワールド) +gregtech.veins.fluid.salt_water=塩水田 (オーバーワールド) + gregtech.item_filter.empty_item=指定なし gregtech.item_filter.footer=§eアイテムでクリックすると上書き @@ -5308,34 +5513,39 @@ gregtech.item_pipe.priority=§9優先度: %d gregtech.multiblock.work_paused=一時停止中 gregtech.multiblock.running=完璧に動作中 gregtech.multiblock.idling=停止中 -gregtech.multiblock.not_enough_energy=§c警告:§f エネルギー不足 -gregtech.multiblock.not_enough_energy_output=§eアドバイス:§f ダイナモハッチの電圧が低すぎる! +gregtech.multiblock.not_enough_energy=エネルギー不足! +gregtech.multiblock.not_enough_energy_output=ダイナモハッチの電圧が低すぎる! gregtech.multiblock.progress=進捗: %s%% gregtech.multiblock.invalid_structure=構造が間違っている gregtech.multiblock.invalid_structure.tooltip=このブロックはマルチブロックのコントローラーです。構造はJEIのマルチブロック機械の構造を参考にしてください。 gregtech.multiblock.validation_failed=入力/出力の量が無効です -gregtech.multiblock.max_energy_per_tick=最大 EU/t: §a%s (%s§r) +gregtech.multiblock.max_energy_per_tick=最大 EU/t: %s (%s) +gregtech.multiblock.max_energy_per_tick_hover=運転及びオーバークロックに利用できる最大 EU/tです +gregtech.multiblock.max_energy_per_tick_amps=最大 EU/t: %s (%sA %s) +gregtech.multiblock.max_recipe_tier=最大実行可能電圧: %s +gregtech.multiblock.max_recipe_tier_hover=この機械が実行できるレシピの最大電圧です gregtech.multiblock.generation_eu=出力: §a%s EU/t gregtech.multiblock.universal.no_problems=問題ナシ! gregtech.multiblock.universal.has_problems=問題アリ! gregtech.multiblock.universal.has_problems_header=メンテナンスハッチで以下の問題を修理してください: -gregtech.multiblock.universal.problem.wrench=%s§7パイプが緩い (§aレンチ§7) -gregtech.multiblock.universal.problem.screwdriver=%s§7ネジが緩い (§aスクリュードライバー§7) -gregtech.multiblock.universal.problem.soft_mallet=%s§7何かが詰まっている (§aソフトマレット§7) -gregtech.multiblock.universal.problem.hard_hammer=%s§7メッキがへこんでいる (§aハンマー§7) -gregtech.multiblock.universal.problem.wire_cutter=%s§7ワイヤーが焼き切れている (§aワイヤーカッター§7) -gregtech.multiblock.universal.problem.crowbar=%s§7部品がずれている (§aバール§7) -gregtech.multiblock.universal.muffler_obstructed=§cマフラーハッチがふさがれている!§r/nマフラーハッチの正面は1ブロック空けて下さい。 +gregtech.multiblock.universal.problem.wrench=パイプが緩い (レンチ) +gregtech.multiblock.universal.problem.screwdriver=ネジが緩い (スクリュードライバー) +gregtech.multiblock.universal.problem.soft_mallet=何かが詰まっている (ソフトマレット) +gregtech.multiblock.universal.problem.hard_hammer=メッキがへこんでいる (ハンマー) +gregtech.multiblock.universal.problem.wire_cutter=ワイヤーが焼き切れている (ワイヤーカッター) +gregtech.multiblock.universal.problem.crowbar=部品がずれている (バール) +gregtech.multiblock.universal.muffler_obstructed=マフラーハッチがふさがれている! +gregtech.multiblock.universal.muffler_obstructed_desc=マフラーハッチの正面は何も置いてはいけません。 gregtech.multiblock.universal.distinct_enabled=バスの区別: §a有効§r/n各バスはレシピ参照の時互いに完全に異なるものとして扱われます。プログラム回路や金型を用いるときに便利になるでしょう。 gregtech.multiblock.universal.distinct_disabled=バスの区別: §c無効§r/n各バスはレシピ参照の同じものとして扱われます。 gregtech.multiblock.universal.distinct_not_supported=このマルチブロックはバスの区別に対応していません。 gregtech.multiblock.universal.no_flex_button=このマルチブロックはこのボタンに対応する機能を持っていません。 -gregtech.multiblock.parallel=%d個まで同時に実行できる +gregtech.multiblock.parallel=最大並列処理数: %s gregtech.multiblock.multiple_recipemaps.header=マシンモード: gregtech.multiblock.multiple_recipemaps.tooltip=スクリュードライバーでコントローラーを右クリックすると使う機械を変更できる。 gregtech.multiblock.multiple_recipemaps_recipes.tooltip=マシンモード: §e%s§r gregtech.multiblock.multiple_recipemaps.switch_message=モード変更時は機械をオフにしてください! -gregtech.multiblock.energy_stored=蓄電量: %s EU / %s EU +gregtech.multiblock.energy_stored=蓄電量: %s gregtech.multiblock.preview.zoom=マウスホイールまたは右クリック+ドラッグでズーム gregtech.multiblock.preview.rotate=左クリックとドラッグで回転 @@ -5360,41 +5570,49 @@ gregtech.multiblock.pattern.location_end=§c最後尾§r gregtech.multiblock.pattern.replaceable_air=空気で置換可能 gregtech.multiblock.blast_furnace.max_temperature=最大温度: %s -gregtech.multiblock.multi_furnace.heating_coil_level=コイルレベル: %s -gregtech.multiblock.multi_furnace.heating_coil_discount=コイルのEUブースト: %sx +gregtech.multiblock.multi_furnace.heating_coil_discount=コイルによるEU使用量係数: %s +gregtech.multiblock.multi_furnace.heating_coil_discount_hover=コイルのTierに応じてEU使用量の係数が決定されます。 +gregtech.multiblock.multi_furnace.parallel_hover=コイルのTierに応じてマルチスメルターの並列処理数が変化します。 gregtech.multiblock.distillation_tower.distilling_fluid=%sを蒸留中 +gregtech.multiblock.large_combustion_engine.fuel_amount=燃料: %s gregtech.multiblock.large_combustion_engine.no_lubricant=潤滑剤がありません。 -gregtech.multiblock.large_combustion_engine.lubricant_amount=潤滑剤残量: %sL -gregtech.multiblock.large_combustion_engine.oxygen_amount=酸素残量: %sL -gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount=液体酸素残量: %sL -gregtech.multiblock.large_combustion_engine.oxygen_boosted=§b酸素ブースト中。 -gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted=§b液体酸素ブースト中。 -gregtech.multiblock.large_combustion_engine.boost_disallowed=§bダイナモハッチを強化することで酸素ブーストが利用可能となる。 +gregtech.multiblock.large_combustion_engine.lubricant_amount=潤滑剤残量: %s +gregtech.multiblock.large_combustion_engine.oxygen_amount=酸素残量: %s +gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount=液体酸素残量: %s +gregtech.multiblock.large_combustion_engine.oxygen_boosted=酸素ブースト中 +gregtech.multiblock.large_combustion_engine.liquid_oxygen_boosted=液体酸素ブースト中 +gregtech.multiblock.large_combustion_engine.oxygen_boost_disallowed=ダイナモハッチを強化することで酸素ブーストが利用可能となる。 +gregtech.multiblock.large_combustion_engine.liquid_oxygen_boost_disallowed=ダイナモハッチを強化することで液体酸素ブーストが利用可能となる。 gregtech.multiblock.large_combustion_engine.supply_oxygen_to_boost=酸素を供給することでブースト。 gregtech.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost=液体酸素を供給することでブースト。 -gregtech.multiblock.large_combustion_engine.obstructed=エンジンの吸気口が塞がれている。 +gregtech.multiblock.large_combustion_engine.obstructed=エンジンの吸気口が塞がれている! +gregtech.multiblock.large_combustion_engine.obstructed.desc=吸気口の正面は何も置いてはいけません。 gregtech.multiblock.turbine.fuel_amount=燃料残量: %sL %s gregtech.multiblock.turbine.fuel_needed=%sを%s tick毎に消費します! -gregtech.multiblock.turbine.rotor_speed=ローター速度: %s/%s RPM -gregtech.multiblock.turbine.rotor_durability=ローター耐久値: %s%% +gregtech.multiblock.turbine.rotor_speed=ローター速度: %s +gregtech.multiblock.turbine.rotor_rpm_unit_name=RPM +gregtech.multiblock.turbine.rotor_durability=ローター耐久値: %s gregtech.multiblock.turbine.rotor_durability_low=ローターの耐久値が残り少ないです! -gregtech.multiblock.turbine.no_rotor=ローターホルダーにローターがありません。 -gregtech.multiblock.turbine.efficiency=タービン効率: %s%% +gregtech.multiblock.turbine.no_rotor=ローターホルダーにローターがありません! +gregtech.multiblock.turbine.efficiency=タービン効率: %s gregtech.multiblock.turbine.energy_per_tick=エネルギー出力 EU/t: %s (%s) -gregtech.multiblock.turbine.obstructed=タービン正面が塞がれている。 +gregtech.multiblock.turbine.obstructed=タービン正面が塞がれている! +gregtech.multiblock.turbine.obstructed.desc=タービンの正面3x3には何も置いてはいけません。 gregtech.multiblock.turbine.efficiency_tooltip=%s§7以上のローターホルダーごとに§610%%§7の効率化。 gregtech.multiblock.large_boiler.efficiency=効率: %s -gregtech.multiblock.large_boiler.steam_output=蒸気生産量: %s L/t -gregtech.multiblock.large_boiler.throttle=スロットル: %d +gregtech.multiblock.large_boiler.steam_output=蒸気生産量: %s +gregtech.multiblock.large_boiler.throttle=スロットル: %s gregtech.multiblock.large_boiler.throttle.tooltip=ボイラーはより少ない蒸気を生産し、より少ない燃料を消費する。これにより効率が失われることはなく、予熱時間は影響されない。 gregtech.multiblock.large_boiler.throttle_increment=スロットルを§a+5%%§f上昇§r/n§7ボイラーはより少ない蒸気を生産し、より少ない燃料を消費する。これにより効率が失われることはなく、予熱時間は影響されない。 gregtech.multiblock.large_boiler.throttle_decrement=スロットを§c-5%%§f低下§r/n§7Bボイラーはより少ない蒸気を生産し、より少ない燃料を消費する。これにより効率が失われることはなく、予熱時間は影響されない。 gregtech.multiblock.large_boiler.rate_tooltip=§f石炭1つ§7から§f%d L§7の蒸気を生産 gregtech.multiblock.large_boiler.heat_time_tooltip=§7予熱に§f%,d 秒§7必要 gregtech.multiblock.large_boiler.explosion_tooltip=水がない状態で燃料を入れると爆発する。 +gregtech.multiblock.large_boiler.water_bar_hover=水: %s +gregtech.multiblock.large_boiler.no_water=水がない! gregtech.machine.miner.done=終了! gregtech.machine.miner.working=稼働中... @@ -5409,21 +5627,30 @@ gregtech.multiblock.miner.chunk_mode=チャンクモード: §a有効§r/nシル gregtech.multiblock.miner.silk_touch_mode=チャンクモード: §c無効§r/nシルクタッチ: §a有効§r/n§7切替には機械を一時停止させる必要がある。 gregtech.multiblock.miner.both_modes=チャンクモード: §a有効§r/nシルクタッチ: §a有効§r/n§7切替には機械を一時停止させる必要がある。 -gregtech.multiblock.pyrolyse_oven.speed=処理速度: %s%% +gregtech.multiblock.fluid_rig.drilled_fluid=液体: %s +gregtech.multiblock.fluid_rig.no_fluid_in_area=動作範囲内に液体はありません +gregtech.multiblock.fluid_rig.fluid_amount=採掘速度: %s +gregtech.multiblock.fluid_rig.vein_depletion=大きさ: %s +gregtech.multiblock.fluid_rig.vein_depleted=枯渇しました +gregtech.multiblock.miner.drilling=採掘中 + +gregtech.multiblock.pyrolyse_oven.speed=処理速度: %s +gregtech.multiblock.pyrolyse_oven.speed_hover=組み込んだコイルによって処理速度に係数がかかります。 -gregtech.multiblock.cracking_unit.energy=エネルギー使用量: %s%% +gregtech.multiblock.cracking_unit.energy=エネルギー使用量: %s% +gregtech.multiblock.cracking_unit.energy_hover=組み込んだコイルによってエネルギー使用量に係数がかかります。 -gregtech.multiblock.energy_consumption=エネルギー使用量: %s EU/t -gregtech.multiblock.computation.max=最大計算力: %s CWU/t -gregtech.multiblock.computation.usage=使用量: %s CWU/t +gregtech.multiblock.energy_consumption=エネルギー使用量: %s EU/t (%s) +gregtech.multiblock.computation.max=最大CWU/t: %s +gregtech.multiblock.computation.usage=使用量: %s gregtech.multiblock.computation.non_bridging=非ブリッジ接続を検出 gregtech.multiblock.computation.non_bridging.detailed=受信ハッチがブリッジできない機械にリンクされている。 -gregtech.multiblock.computation.not_enough_computation=§c警告:§f 計算力が不足 +gregtech.multiblock.computation.not_enough_computation=計算力がたりない! -gregtech.multiblock.power_substation.stored=蓄電量: %s EU -gregtech.multiblock.power_substation.capacity=最大蓄電量: %s EU -gregtech.multiblock.power_substation.passive_drain=損失量: %s EU/t -gregtech.multiblock.power_substation.average_io=平均入出力: %s EU/t +gregtech.multiblock.power_substation.stored=蓄電量: %s +gregtech.multiblock.power_substation.capacity=最大蓄電量: %s +gregtech.multiblock.power_substation.passive_drain=損失量: %s +gregtech.multiblock.power_substation.average_io=平均入出力: %s gregtech.multiblock.power_substation.average_io_hover=大型蓄電器の平均エネルギー変化量 gregtech.multiblock.power_substation.time_to_fill=満タンまで: %s gregtech.multiblock.power_substation.time_to_drain=枯渇まで: %s @@ -5435,19 +5662,27 @@ gregtech.multiblock.power_substation.time_years=%s 年 gregtech.multiblock.power_substation.time_forever=永遠 gregtech.multiblock.power_substation.under_one_hour_left=枯渇まで1時間以内! -gregtech.multiblock.hpca.computation=供給: %s / %s CWU/t +gregtech.multiblock.data_bank.providing=研究データを供給中 + +gregtech.multiblock.hpca.computation=供給: %s gregtech.multiblock.hpca.energy=使用エネルギー: %s / %s EU/t (%s) -gregtech.multiblock.hpca.coolant=要求: %s L/t PCBクーラント -gregtech.multiblock.hpca.cooling=冷却P: -gregtech.multiblock.hpca.temperature=温度: -gregtech.multiblock.hpca.error_damaged=構造体中に壊れたコンポーネントがある +gregtech.multiblock.hpca.temperature=温度: %s +gregtech.multiblock.hpca.hover_for_info=ホバーで詳細を表示 +gregtech.multiblock.hpca.error_damaged=構造体中に壊れたコンポーネントがある! gregtech.multiblock.hpca.error_temperature=温度が100 ℃を突破。コンポーネントが壊れてしまう! gregtech.multiblock.hpca.warning_temperature=温度が50 ℃を突破。100 ℃に到達するとコンポーネントが壊れてしまう! gregtech.multiblock.hpca.warning_temperature_active_cool=アクティブクーラーをフル活用 -gregtech.multiblock.hpca.warning_structure_header=構造体のヒント: +gregtech.multiblock.hpca.warning_structure_header=構造体の警告: gregtech.multiblock.hpca.warning_multiple_bridges=- 構造体に複数のブリッジを検出 (意味がない) gregtech.multiblock.hpca.warning_no_computation=- 計算力を供給できない gregtech.multiblock.hpca.warning_low_cooling=- 冷却Pが足りない +gregtech.multiblock.hpca.info_max_computation=最大CWU/t: %s +gregtech.multiblock.hpca.info_max_cooling_demand=必要冷却P: %s +gregtech.multiblock.hpca.info_max_cooling_available=供給冷却P: %s +gregtech.multiblock.hpca.info_max_coolant_required=次のクーラントが必要: %s +gregtech.multiblock.hpca.info_coolant_name=PCBクーラント +gregtech.multiblock.hpca.info_bridging_enabled=ブリッジが有効 +gregtech.multiblock.hpca.info_bridging_disabled=ブリッジが無効 gregtech.command.usage=使い方: /gregtech gregtech.command.worldgen.usage=使い方: /gregtech worldgen @@ -5494,6 +5729,8 @@ gregtech.creative.tank.tpc=Tick毎サイクル gregtech.creative.energy.amperage=電流 gregtech.creative.energy.voltage=電圧 +gregtech.creative.energy.sink=自由設定 +gregtech.creative.energy.source=MAX-V / 21億A gregtech.creative.activity.on=稼働中 gregtech.creative.activity.off=停止中 @@ -5785,3 +6022,200 @@ gregtech.subtitle.maintenance.mechanical=技術的故障 # Debug messaging gregtech.debug.f3_h.enabled=GregTechがデバッグ情報を修正しました! 開発者向け: GregTech.cfgのmisc:debug設定オプションを有効にすることでより多くの情報を見ることができます。 + +### Forestry Integration +# Frames +item.gt.frame_working.name=動きやすい巣枠 +item.gt.frame_mutagenic.name=変異する巣枠 +item.gt.frame_accelerated.name=促進される巣枠 +item.gt.frame_stabilizing.name=安定した巣枠 +item.gt.frame_arborist.name=植木職人の巣枠 +item.gt.frame_decaying.name=崩壊する巣枠 +item.gt.frame_slowing.name=ゆったりとした巣枠 + +# Electrodes +metaitem.electrode.apatite.name=リン灰石の真空管 +metaitem.electrode.blaze.name=ブレイズの真空管 +metaitem.electrode.bronze.name=青銅の真空管 +metaitem.electrode.copper.name=銅の真空管 +metaitem.electrode.diamond.name=ダイヤの真空管 +metaitem.electrode.emerald.name=エメラルドの真空管 +metaitem.electrode.ender.name=エンダーの真空管 +metaitem.electrode.gold.name=金の真空管 +metaitem.electrode.iron.name=鉄の真空管 +metaitem.electrode.lapis.name=ラピスの真空管 +metaitem.electrode.obsidian.name=黒曜石の真空管 +metaitem.electrode.orchid.name=オアチドの真空管 +metaitem.electrode.rubber.name=ゴムの真空管 +metaitem.electrode.tin.name=錫の真空管 + +# Scoop +item.gt.tool.scoop.name=%s製虫取り網 +item.gt.tool.behavior.scoop=§d樹木医: §f左クリックで蝶を捕獲 +gt.tool.class.scoop=虫取り網 +# Drops +item.gt.honey_drop.oil.name=石油の雫 +item.gt.honey_drop.biomass.name=バイオマスの雫 +item.gt.honey_drop.ethanol.name=エタノールの雫 +item.gt.honey_drop.mutagen.name=変異源の雫 + +# Combs +item.gt.comb.coal.name=石炭の巣板 +item.gt.comb.coke.name=コークスの巣板 +item.gt.comb.stickyresin.name=粘性樹脂の巣板 +item.gt.comb.oil.name=石油質の巣板 +item.gt.comb.apatite.name=アパタイトの巣板 +item.gt.comb.ash.name=灰の巣板 +item.gt.comb.biomass.name=バイオマスの巣板 +item.gt.comb.energy.name=エナジーの巣板 +item.gt.comb.lapotron.name=ラポトロンの巣板 +item.gt.comb.redalloy.name=赤合金の巣板 +item.gt.comb.stainlesssteel.name=ステンレスの巣板 +item.gt.comb.stone.name=石の巣板 +item.gt.comb.certus.name=ケルタスの巣板 +item.gt.comb.redstone.name=赤石の巣板 +item.gt.comb.rareearth.name=希土類の巣板 +item.gt.comb.lapis.name=ラピスの巣板 +item.gt.comb.ruby.name=ルビーの巣板 +item.gt.comb.sapphire.name=サファイアの巣板 +item.gt.comb.diamond.name=ダイヤモンドの巣板 +item.gt.comb.olivine.name=オリビンの巣板 +item.gt.comb.emerald.name=エメラルドの巣板 +item.gt.comb.pyrope.name=苦礬柘榴石の巣板 +item.gt.comb.grossular.name=灰礬柘榴石の巣板 +item.gt.comb.sparkling.name=煌めく巣板 +item.gt.comb.slag.name=鉱滓の巣板 +item.gt.comb.copper.name=銅の巣板 +item.gt.comb.tin.name=錫の巣板 +item.gt.comb.lead.name=鉛の巣板 +item.gt.comb.iron.name=鉄の巣板 +item.gt.comb.steel.name=スチールの巣板 +item.gt.comb.nickel.name=ニッケルの巣板 +item.gt.comb.zinc.name=亜鉛の巣板 +item.gt.comb.silver.name=銀の巣板 +item.gt.comb.gold.name=金の巣板 +item.gt.comb.sulfur.name=硫黄の巣板 +item.gt.comb.gallium.name=ガリウムの巣板 +item.gt.comb.arsenic.name=ヒ素の巣板 +item.gt.comb.bauxite.name=ボーキサイトの巣板 +item.gt.comb.aluminium.name=アルミニウムの巣板 +item.gt.comb.manganese.name=マンガンの巣板 +item.gt.comb.magnesium.name=マグネシウムの巣板 +item.gt.comb.titanium.name=チタンの巣板 +item.gt.comb.chrome.name=クロムの巣板 +item.gt.comb.tungsten.name=タングステンの巣板 +item.gt.comb.platinum.name=プラチナの巣板 +item.gt.comb.iridium.name=イリジウムの巣板 +item.gt.comb.molybdenum.name=モリブデンの巣板 +item.gt.comb.osmium.name=オスミウムの巣板 +item.gt.comb.lithium.name=リチウムの巣板 +item.gt.comb.salt.name=塩分豊富な巣板 +item.gt.comb.electrotine.name=エレクトロチンの巣板 +item.gt.comb.almandine.name=鉄礬柘榴石の巣板 +item.gt.comb.uranium.name=ウランの巣板 +item.gt.comb.plutonium.name=プルトニウムの巣板 +item.gt.comb.naquadah.name=ナクアダの巣板 +item.gt.comb.naquadria.name=ナクアドリアの巣板 +item.gt.comb.thorium.name=トリウムの巣板 +item.gt.comb.lutetium.name=ルテチウムの巣板 +item.gt.comb.americium.name=アメリシウムの巣板 +item.gt.comb.neutronium.name=ニュートロニウムの巣板 +item.gt.comb.phosphorus.name=リンの巣板 +item.gt.comb.indium.name=インジウムの巣板 +item.gt.comb.trinium.name=トリニウムの巣板 +item.gt.comb.helium.name=ヘリウムの巣板 +item.gt.comb.argon.name=アルゴンの巣板 +item.gt.comb.xenon.name=キセノンの巣板 +item.gt.comb.neon.name=ネオンの巣板 +item.gt.comb.krypton.name=クリプトンの巣板 +item.gt.comb.nitrogen.name=窒素の巣板 +item.gt.comb.oxygen.name=酸素の巣板 +item.gt.comb.hydrogen.name=水素の巣板 +item.gt.comb.fluorine.name=フッ素の巣板 +item.gt.comb.fluix.name=フルーシュの巣板 + +# Bees +for.bees.species.clay=Clay +for.bees.species.slimeball=Slime Ball +for.bees.species.peat=Peat +for.bees.species.stickyresin=Sticky Resin +for.bees.species.coal=Coal +for.bees.species.oil=Oil +for.bees.species.ash=Ash +for.bees.species.apatite=Apatite +for.bees.species.biomass=Biomass +for.bees.species.redstone=Redstone +for.bees.species.lapis=Lapis +for.bees.species.certus=Certus Quartz +for.bees.species.diamond=Diamond +for.bees.species.ruby=Ruby +for.bees.species.sapphire=Sapphire +for.bees.species.olivine=Olivine +for.bees.species.emerald=Emerald +for.bees.species.copper=Copper +for.bees.species.tin=Tin +for.bees.species.lead=Lead +for.bees.species.iron=Iron +for.bees.species.steel=Steel +for.bees.species.nickel=Nickel +for.bees.species.zinc=Zinc +for.bees.species.silver=Silver +for.bees.species.gold=Gold +for.bees.species.arsenic=Arsenic +for.bees.species.aluminium=Aluminium +for.bees.species.titanium=Titanium +for.bees.species.chrome=Chrome +for.bees.species.manganese=Manganese +for.bees.species.tungsten=Tungsten +for.bees.species.platinum=Platinum +for.bees.species.iridium=Iridium +for.bees.species.osmium=Osmium +for.bees.species.salty=Salt +for.bees.species.lithium=Lithium +for.bees.species.electrotine=Electrotine +for.bees.species.energy=Energy +for.bees.species.lapotron=Lapotron +for.bees.species.redalloy=Red Alloy +for.bees.species.stainlesssteel=Stainless Steel +for.bees.species.uranium=Uranium +for.bees.species.plutonium=Plutonium +for.bees.species.naquadah=Naquadah +for.bees.species.naquadria=Naquadria +for.bees.species.thorium=Thorium +for.bees.species.lutetium=Lutetium +for.bees.species.americium=Americium +for.bees.species.neutronium=Neutronium +for.bees.species.divided=Divided +for.bees.species.sandwich=Sandwich +for.bees.species.sparkling=Nether Star +for.bees.species.fertilizer=Fertilizer +for.bees.species.phosphorus=Phosphorus +for.bees.species.sulfur=Sulfur +for.bees.species.indium=Indium +for.bees.species.explosive=Explosive +for.bees.species.trinium=Trinium +for.bees.species.helium=Helium +for.bees.species.argon=Argon +for.bees.species.neon=Neon +for.bees.species.krypton=Krypton +for.bees.species.xenon=Xenon +for.bees.species.oxygen=Oxygen +for.bees.species.hydrogen=Hydrogen +for.bees.species.nitrogen=Nitrogen +for.bees.species.fluorine=Fluorine +for.bees.species.fluix=Fluix +for.bees.species.silicon=Silicon + +# Bee Descriptions (many more to do) +for.bees.description.clay=勤勉で働き者として知られる有機ミツバチ。噂によると適切なバイオームでは泥を見つけることができるらしい。|Beekeeping 101 + +# Scanner Information +gregtech.scanner.forestry.drone=§o解析済みの雄 +gregtech.scanner.forestry.princess=§o解析済みの新女王 +gregtech.scanner.forestry.queen=§o解析済みの女王 +gregtech.scanner.forestry.sapling=§o解析済みの苗木 +gregtech.scanner.forestry.butterfly=§o解析済みの成虫 +gregtech.scanner.forestry.larvae=§o解析済みの幼虫 +gregtech.scanner.forestry.serum=§o解析済みの漿液 +gregtech.scanner.forestry.caterpillar=§o解析済みの幼虫 +gregtech.scanner.forestry.pollen=§o解析済みの花粉 From a0fa877a8ab96049c7885c2742a8266e93415073 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Sun, 3 Dec 2023 06:45:32 -0700 Subject: [PATCH 52/77] Fix Laser Pipe Client Desync + Small Rework (#2245) --- .../laser/tile/TileEntityLaserPipe.java | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java index ff7e7a8727b..6a11c0503a4 100644 --- a/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java +++ b/src/main/java/gregtech/common/pipelike/laser/tile/TileEntityLaserPipe.java @@ -156,32 +156,29 @@ public boolean isActive() { * @param duration how long the pipe should be active for */ public void setActive(boolean active, int duration) { - boolean stateChanged = false; - if (this.isActive && !active) { - this.isActive = false; - stateChanged = true; - } else if (!this.isActive && active) { - this.isActive = true; - stateChanged = true; - activeDuration = duration; - TaskScheduler.scheduleTask(getWorld(), () -> { - if (++this.ticksActive % activeDuration == 0) { - this.ticksActive = 0; - setActive(false, -1); - return false; - } - return true; - }); - } else if (this.isActive) { + if (this.isActive != active) { + this.isActive = active; + notifyBlockUpdate(); + markDirty(); + writeCustomData(GregtechDataCodes.PIPE_LASER_ACTIVE, buf -> buf.writeBoolean(this.isActive)); + if (active && duration != this.activeDuration) { + TaskScheduler.scheduleTask(getWorld(), this::queueDisconnect); + } + } + + this.activeDuration = duration; + if (duration > 0 && active) { this.ticksActive = 0; - this.activeDuration = duration; } + } - if (stateChanged) { - writeCustomData(GregtechDataCodes.PIPE_LASER_ACTIVE, buf -> buf.writeBoolean(this.isActive)); - notifyBlockUpdate(); - markDirty(); + public boolean queueDisconnect() { + if (++this.ticksActive % activeDuration == 0) { + this.ticksActive = 0; + setActive(false, -1); + return false; } + return true; } @Override @@ -193,6 +190,25 @@ public void receiveCustomData(int discriminator, PacketBuffer buf) { } } + @Override + public void writeInitialSyncData(PacketBuffer buf) { + super.writeInitialSyncData(buf); + buf.writeBoolean(this.isActive); + + // schedule a disconnect on world load, gotta set the duration to something + if (isActive) { + activeDuration = 100; + TaskScheduler.scheduleTask(getWorld(), this::queueDisconnect); + } + } + + @Override + public void receiveInitialSyncData(PacketBuffer buf) { + super.receiveInitialSyncData(buf); + this.isActive = buf.readBoolean(); + scheduleChunkForRenderUpdate(); + } + @NotNull @Override public NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) { From 3315de9a498f7c421753712d2cbefeb2f6ca4613 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:03:58 -0600 Subject: [PATCH 53/77] Add FluidStorageKey ctor for compat (#2244) --- .../java/gregtech/api/fluids/store/FluidStorageKey.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java index ecbc94fe5b7..01f44dcc8da 100644 --- a/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java +++ b/src/main/java/gregtech/api/fluids/store/FluidStorageKey.java @@ -25,6 +25,12 @@ public final class FluidStorageKey { private final int hashCode; private final FluidState defaultFluidState; + public FluidStorageKey(@NotNull ResourceLocation resourceLocation, @NotNull MaterialIconType iconType, + @NotNull UnaryOperator<@NotNull String> registryNameOperator, + @NotNull Function<@NotNull Material, @NotNull String> translationKeyFunction) { + this(resourceLocation, iconType, registryNameOperator, translationKeyFunction, null); + } + public FluidStorageKey(@NotNull ResourceLocation resourceLocation, @NotNull MaterialIconType iconType, @NotNull UnaryOperator<@NotNull String> registryNameOperator, @NotNull Function<@NotNull Material, @NotNull String> translationKeyFunction, From 6c24238c393e9cea9b82de1996bc70e20a699896 Mon Sep 17 00:00:00 2001 From: Tictim Date: Mon, 4 Dec 2023 06:10:12 +0900 Subject: [PATCH 54/77] Revise bloom render ticket API (#2243) --- .../client/particle/GTBloomParticle.java | 10 +- .../client/utils/BloomEffectUtil.java | 185 ++++++++++++------ .../electric/MetaTileEntityFusionReactor.java | 90 +++++---- 3 files changed, 172 insertions(+), 113 deletions(-) diff --git a/src/main/java/gregtech/client/particle/GTBloomParticle.java b/src/main/java/gregtech/client/particle/GTBloomParticle.java index da807b47be4..bf856cc3097 100644 --- a/src/main/java/gregtech/client/particle/GTBloomParticle.java +++ b/src/main/java/gregtech/client/particle/GTBloomParticle.java @@ -10,12 +10,9 @@ public abstract class GTBloomParticle extends GTParticle implements IBloomEffect { - private final BloomEffectUtil.BloomRenderTicket ticket; - public GTBloomParticle(double posX, double posY, double posZ) { super(posX, posY, posZ); - - this.ticket = BloomEffectUtil.registerBloomRender(getBloomRenderSetup(), getBloomType(), this); + BloomEffectUtil.registerBloomRender(getBloomRenderSetup(), getBloomType(), this, this); } @Nullable @@ -23,9 +20,4 @@ public GTBloomParticle(double posX, double posY, double posZ) { @NotNull protected abstract BloomType getBloomType(); - - @Override - protected void onExpired() { - this.ticket.invalidate(); - } } diff --git a/src/main/java/gregtech/client/utils/BloomEffectUtil.java b/src/main/java/gregtech/client/utils/BloomEffectUtil.java index 1b9df83803d..d1ac6f07cc0 100644 --- a/src/main/java/gregtech/client/utils/BloomEffectUtil.java +++ b/src/main/java/gregtech/client/utils/BloomEffectUtil.java @@ -1,5 +1,7 @@ package gregtech.client.utils; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.client.particle.GTParticle; import gregtech.client.renderer.IRenderSetup; import gregtech.client.shader.Shaders; import gregtech.client.shader.postprocessing.BloomEffect; @@ -7,14 +9,16 @@ import gregtech.common.ConfigHolder; import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.shader.Framebuffer; import net.minecraft.entity.Entity; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.world.World; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; @@ -24,7 +28,6 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.CheckReturnValue; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,6 +39,7 @@ import java.util.Map; import java.util.Objects; import java.util.function.Consumer; +import java.util.function.Predicate; @SideOnly(Side.CLIENT) public class BloomEffectUtil { @@ -53,9 +57,6 @@ public class BloomEffectUtil { private static BlockRenderLayer bloom; private static Framebuffer bloomFBO; - @Nullable - private static World currentWorld = null; - /** * @return {@link BlockRenderLayer} instance for the bloom render layer. */ @@ -79,8 +80,8 @@ public static BlockRenderLayer getRealBloomLayer() { * layers can be changed depending on external factors, such as presence of Optifine. If the actual bloom layer is * disabled, {@link BlockRenderLayer#CUTOUT} is returned instead. * - * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if bloom + * layer is disabled * @see #getEffectiveBloomLayer(BlockRenderLayer) */ @NotNull @@ -110,8 +111,8 @@ public static BlockRenderLayer getEffectiveBloomLayer(BlockRenderLayer fallback) * * @param isBloomActive Whether bloom layer should be active. If this value is {@code false}, {@code fallback} layer * will be returned. Has no effect if Optifine is present. - * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if - * bloom layer is disabled + * @return {@link BlockRenderLayer} instance for the bloom render layer, or {@link BlockRenderLayer#CUTOUT} if bloom + * layer is disabled * @see #getEffectiveBloomLayer(boolean, BlockRenderLayer) */ @NotNull @@ -145,42 +146,107 @@ public static Framebuffer getBloomFBO() { /** *

- * Register a custom bloom render callback for subsequent world render. The render call persists until it is - * manually freed by calling {@link BloomRenderTicket#invalidate()}, or automatically freed on client world change. + * Register a custom bloom render callback for subsequent world render. The render call persists until the + * {@code metaTileEntity} is invalidated, or the ticket is manually freed by calling + * {@link BloomRenderTicket#invalidate()}. *

*

- * This method does nothing if Optifine is present. + * This method does not register bloom render ticket when Optifine is present, and {@code null} will be returned + * instead of a ticket instance. + *

+ * + * @param setup Render setup, if exists + * @param bloomType Type of the bloom + * @param render Rendering callback + * @param metaTileEntity Meta tile entity instance + * @return Ticket for the registered bloom render callback + * @throws NullPointerException if {@code bloomType == null || render == null || metaTileEntity == null} + */ + @Nullable + public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup, + @NotNull BloomType bloomType, + @NotNull IBloomEffect render, + @NotNull MetaTileEntity metaTileEntity) { + Objects.requireNonNull(metaTileEntity, "metaTileEntity == null"); + return registerBloomRender(setup, bloomType, render, t -> metaTileEntity.isValid()); + } + + /** + *

+ * Register a custom bloom render callback for subsequent world render. The render call persists until the + * {@code particle} is invalidated, or the ticket is manually freed by calling + * {@link BloomRenderTicket#invalidate()}. + *

+ *

+ * This method does not register bloom render ticket when Optifine is present, and {@code null} will be returned + * instead of a ticket instance. *

* * @param setup Render setup, if exists * @param bloomType Type of the bloom * @param render Rendering callback + * @param particle Particle instance + * @return Ticket for the registered bloom render callback + * @throws NullPointerException if {@code bloomType == null || render == null || metaTileEntity == null} + */ + @Nullable + public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup, + @NotNull BloomType bloomType, + @NotNull IBloomEffect render, + @NotNull GTParticle particle) { + Objects.requireNonNull(particle, "particle == null"); + return registerBloomRender(setup, bloomType, render, t -> particle.isAlive()); + } + + /** + *

+ * Register a custom bloom render callback for subsequent world render. The render call persists until it is + * manually freed by calling {@link BloomRenderTicket#invalidate()}, or invalidated by validity checker. + *

+ *

+ * This method does not register bloom render ticket when Optifine is present, and {@code null} will be returned + * instead of a ticket instance. + *

+ * + * @param setup Render setup, if exists + * @param bloomType Type of the bloom + * @param render Rendering callback + * @param validityChecker Optional validity checker; returning {@code false} causes the ticket to be invalidated. + * Checked on both pre/post render each frame. * @return Ticket for the registered bloom render callback * @throws NullPointerException if {@code bloomType == null || render == null} */ - @NotNull - @CheckReturnValue + @Nullable public static BloomRenderTicket registerBloomRender(@Nullable IRenderSetup setup, @NotNull BloomType bloomType, - @NotNull IBloomEffect render) { - BloomRenderTicket ticket = new BloomRenderTicket(setup, bloomType, render); - if (Shaders.isOptiFineShaderPackLoaded()) { - ticket.invalidate(); - } else { - SCHEDULED_BLOOM_RENDERS.add(ticket); - } + @NotNull IBloomEffect render, + @Nullable Predicate validityChecker) { + if (Shaders.isOptiFineShaderPackLoaded()) return null; + BloomRenderTicket ticket = new BloomRenderTicket(setup, bloomType, render, validityChecker); + SCHEDULED_BLOOM_RENDERS.add(ticket); return ticket; } /** - * @deprecated use ticket-based bloom render hook - * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hooks */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") public static void requestCustomBloom(IBloomRenderFast handler, Consumer render) { BloomType bloomType = BloomType.fromValue(handler.customBloomStyle()); - registerBloomRender(handler, bloomType, (b, c) -> render.accept(b)).legacy = true; + var validityChecker = new Predicate() { + + boolean invalid; + + @Override + public boolean test(BloomRenderTicket bloomRenderTicket) { + return !invalid; + } + }; + registerBloomRender(handler, bloomType, (b, c) -> { + render.accept(b); + validityChecker.invalid = true; + }, validityChecker); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -375,12 +441,22 @@ public static int renderBloomBlockLayer(RenderGlobal renderGlobal, return result; } + private static void preDraw() { + for (BloomRenderTicket ticket : SCHEDULED_BLOOM_RENDERS) { + if (!ticket.isValid()) continue; + BLOOM_RENDERS.computeIfAbsent(new BloomRenderKey(ticket.renderSetup, ticket.bloomType), + k -> new ArrayList<>()).add(ticket); + } + SCHEDULED_BLOOM_RENDERS.clear(); + } + private static void draw(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context, @NotNull List tickets) { boolean initialized = false; @Nullable IRenderSetup renderSetup = null; for (BloomRenderTicket ticket : tickets) { + ticket.checkValidity(); if (!ticket.isValid() || !ticket.render.shouldRenderBloomEffect(context)) continue; if (!initialized) { initialized = true; @@ -390,45 +466,21 @@ private static void draw(@NotNull BufferBuilder buffer, @NotNull EffectRenderCon } } ticket.render.renderBloomEffect(buffer, context); - if (ticket.legacy) ticket.invalidate(); } if (initialized && renderSetup != null) { renderSetup.postDraw(buffer); } } - private static void preDraw() { - WorldClient world = Minecraft.getMinecraft().world; - if (currentWorld != world) { - for (List list : BLOOM_RENDERS.values()) { - for (BloomRenderTicket ticket : list) { - ticket.invalidate(); - } - } - BLOOM_RENDERS.clear(); - if (currentWorld != null) { - for (BloomRenderTicket ticket : SCHEDULED_BLOOM_RENDERS) { - ticket.invalidate(); - } - SCHEDULED_BLOOM_RENDERS.clear(); - } - currentWorld = world; - } - - for (BloomRenderTicket ticket : SCHEDULED_BLOOM_RENDERS) { - if (!ticket.isValid()) continue; - BLOOM_RENDERS.computeIfAbsent(new BloomRenderKey(ticket.renderSetup, ticket.bloomType), - k -> new ArrayList<>()).add(ticket); - } - SCHEDULED_BLOOM_RENDERS.clear(); - } - private static void postDraw() { for (var it = BLOOM_RENDERS.values().iterator(); it.hasNext();) { List list = it.next(); if (!list.isEmpty()) { - if (!list.removeIf(ticket -> !ticket.isValid()) || !list.isEmpty()) continue; + if (!list.removeIf(ticket -> { + ticket.checkValidity(); + return !ticket.isValid(); + }) || !list.isEmpty()) continue; } it.remove(); @@ -444,19 +496,17 @@ public static final class BloomRenderTicket { private final IRenderSetup renderSetup; private final BloomType bloomType; private final IBloomEffect render; + @Nullable + private final Predicate validityChecker; - private boolean valid = true; - /** - * Used to mark bloom tickets made by legacy API; this ticket will be automatically expired after 1 render call. - * Remove this method in 2.9 as well as the deprecated method. - */ - private boolean legacy; + private boolean invalidated; BloomRenderTicket(@Nullable IRenderSetup renderSetup, @NotNull BloomType bloomType, - @NotNull IBloomEffect render) { + @NotNull IBloomEffect render, @Nullable Predicate validityChecker) { this.renderSetup = renderSetup; this.bloomType = Objects.requireNonNull(bloomType, "bloomType == null"); this.render = Objects.requireNonNull(render, "render == null"); + this.validityChecker = validityChecker; } @Nullable @@ -470,17 +520,22 @@ public BloomType getBloomType() { } public boolean isValid() { - return this.valid; + return !this.invalidated; } public void invalidate() { - this.valid = false; + this.invalidated = true; + } + + private void checkValidity() { + if (!this.invalidated && this.validityChecker != null && !this.validityChecker.test(this)) { + invalidate(); + } } } /** - * @deprecated use ticket-based bloom render hook - * {@link #registerBloomRender(IRenderSetup, BloomType, IBloomEffect)} + * @deprecated use ticket-based bloom render hooks */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.9") diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java index f3ab155bac6..8e667bedfcb 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFusionReactor.java @@ -3,7 +3,11 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.IEnergyContainer; -import gregtech.api.capability.impl.*; +import gregtech.api.capability.impl.EnergyContainerHandler; +import gregtech.api.capability.impl.EnergyContainerList; +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.capability.impl.ItemHandlerList; +import gregtech.api.capability.impl.MultiblockRecipeLogic; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.resources.TextureArea; @@ -14,7 +18,11 @@ import gregtech.api.metatileentity.IFastRenderMetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.metatileentity.multiblock.*; +import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; +import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.pattern.MultiblockShapeInfo; @@ -31,7 +39,11 @@ import gregtech.client.renderer.texture.Textures; import gregtech.client.shader.postprocessing.BloomEffect; import gregtech.client.shader.postprocessing.BloomType; -import gregtech.client.utils.*; +import gregtech.client.utils.BloomEffectUtil; +import gregtech.client.utils.EffectRenderContext; +import gregtech.client.utils.IBloomEffect; +import gregtech.client.utils.RenderBufferHelper; +import gregtech.client.utils.RenderUtil; import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockFusionCasing; import gregtech.common.blocks.BlockGlassCasing; @@ -68,21 +80,21 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.function.DoubleSupplier; public class MetaTileEntityFusionReactor extends RecipeMapMultiblockController implements IFastRenderMetaTileEntity, IBloomEffect { + protected static final int NO_COLOR = 0; + private final int tier; private EnergyContainerList inputEnergyContainers; private long heat = 0; // defined in TileEntityFusionReactor but serialized in FusionRecipeLogic - @Nullable - private Integer color; + private int fusionRingColor = NO_COLOR; private final FusionProgressSupplier progressBarSupplier; @SideOnly(Side.CLIENT) - private BloomEffectUtil.BloomRenderTicket bloomRenderTicket; + private boolean registeredBloomRenderTicket; public MetaTileEntityFusionReactor(ResourceLocation metaTileEntityId, int tier) { super(metaTileEntityId, RecipeMaps.FUSION_RECIPES); @@ -215,6 +227,21 @@ private IBlockState getCoilState() { return MetaBlocks.FUSION_CASING.getState(BlockFusionCasing.CasingType.FUSION_COIL); } + protected int getFusionRingColor() { + return this.fusionRingColor; + } + + protected boolean hasFusionRingColor() { + return this.fusionRingColor != NO_COLOR; + } + + protected void setFusionRingColor(int fusionRingColor) { + if (this.fusionRingColor != fusionRingColor) { + this.fusionRingColor = fusionRingColor; + writeCustomData(GregtechDataCodes.UPDATE_COLOR, buf -> buf.writeVarInt(fusionRingColor)); + } + } + @Override protected void formStructure(PatternMatchContext context) { long energyStored = this.energyContainer.getEnergyStored(); @@ -236,6 +263,7 @@ public String getName() { }; this.inputEnergyContainers = new EnergyContainerList(Lists.newArrayList()); this.heat = 0; + this.setFusionRingColor(NO_COLOR); } @Override @@ -268,50 +296,35 @@ protected void updateFormedValid() { if (energyAdded > 0) this.inputEnergyContainers.removeEnergy(energyAdded); } super.updateFormedValid(); - if (recipeMapWorkable.isWorking() && color == null) { + if (recipeMapWorkable.isWorking() && fusionRingColor == NO_COLOR) { if (recipeMapWorkable.getPreviousRecipe() != null && !recipeMapWorkable.getPreviousRecipe().getFluidOutputs().isEmpty()) { - int newColor = 0xFF000000 | - recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor(); - if (!Objects.equals(color, newColor)) { - color = newColor; - writeCustomData(GregtechDataCodes.UPDATE_COLOR, this::writeColor); - } + setFusionRingColor(0xFF000000 | + recipeMapWorkable.getPreviousRecipe().getFluidOutputs().get(0).getFluid().getColor()); } - } else if (!recipeMapWorkable.isWorking() && isStructureFormed() && color != null) { - color = null; - writeCustomData(GregtechDataCodes.UPDATE_COLOR, this::writeColor); + } else if (!recipeMapWorkable.isWorking() && isStructureFormed()) { + setFusionRingColor(NO_COLOR); } } @Override public void writeInitialSyncData(PacketBuffer buf) { super.writeInitialSyncData(buf); - writeColor(buf); + buf.writeVarInt(this.fusionRingColor); } @Override public void receiveInitialSyncData(PacketBuffer buf) { super.receiveInitialSyncData(buf); - readColor(buf); + this.fusionRingColor = buf.readVarInt(); } @Override public void receiveCustomData(int dataId, PacketBuffer buf) { - super.receiveCustomData(dataId, buf); if (dataId == GregtechDataCodes.UPDATE_COLOR) { - readColor(buf); - } - } - - private void readColor(PacketBuffer buf) { - color = buf.readBoolean() ? buf.readVarInt() : null; - } - - private void writeColor(PacketBuffer buf) { - buf.writeBoolean(color != null); - if (color != null) { - buf.writeVarInt(color); + this.fusionRingColor = buf.readVarInt(); + } else { + super.receiveCustomData(dataId, buf); } } @@ -643,18 +656,17 @@ protected void setActive(boolean active) { @Override @SideOnly(Side.CLIENT) public void renderMetaTileEntity(double x, double y, double z, float partialTicks) { - if (this.color != null && this.bloomRenderTicket == null) { - this.bloomRenderTicket = BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), - this); + if (this.hasFusionRingColor() && !this.registeredBloomRenderTicket) { + this.registeredBloomRenderTicket = true; + BloomEffectUtil.registerBloomRender(FusionBloomSetup.INSTANCE, getBloomType(), this, this); } } @Override @SideOnly(Side.CLIENT) public void renderBloomEffect(@NotNull BufferBuilder buffer, @NotNull EffectRenderContext context) { - Integer c = color; - if (c == null) return; - int color = RenderUtil.interpolateColor(c, -1, Eases.QUAD_IN.getInterpolation( + if (!this.hasFusionRingColor()) return; + int color = RenderUtil.interpolateColor(this.getFusionRingColor(), -1, Eases.QUAD_IN.getInterpolation( Math.abs((Math.abs(getOffsetTimer() % 50) + context.partialTicks()) - 25) / 25)); float a = (float) (color >> 24 & 255) / 255.0F; float r = (float) (color >> 16 & 255) / 255.0F; @@ -676,7 +688,7 @@ public void renderBloomEffect(@NotNull BufferBuilder buffer, @NotNull EffectRend @Override @SideOnly(Side.CLIENT) public boolean shouldRenderBloomEffect(@NotNull EffectRenderContext context) { - return this.color != null; + return this.hasFusionRingColor(); } @Override From 6082ac23cd94f09ad7fe86fb94e8c1f134865c52 Mon Sep 17 00:00:00 2001 From: serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:15:22 -0600 Subject: [PATCH 55/77] 2.8.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 562713469f6..e7b28291e09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ modGroup = gregtech # Version of your mod. # This field can be left empty if you want your mod's version to be determined by the latest git tag instead. -modVersion = 2.8.1-beta +modVersion = 2.8.2-beta # Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) includeMCVersionJar = true From b0bc5386372919e4ae384526af15d1d70eadeb95 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Mon, 4 Dec 2023 01:12:38 -0600 Subject: [PATCH 56/77] Add IControllable to creative energy emitter (#2248) --- .../storage/MetaTileEntityCreativeEnergy.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java index 7b76fa8e57f..ec6afb97341 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeEnergy.java @@ -2,7 +2,9 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechCapabilities; +import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.IControllable; import gregtech.api.capability.IEnergyContainer; import gregtech.api.capability.ILaserContainer; import gregtech.api.gui.GuiTextures; @@ -35,6 +37,7 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -42,9 +45,10 @@ import static gregtech.api.GTValues.MAX; import static gregtech.api.GTValues.V; +import static gregtech.api.capability.GregtechDataCodes.UPDATE_ACTIVE; import static gregtech.api.capability.GregtechDataCodes.UPDATE_IO_SPEED; -public class MetaTileEntityCreativeEnergy extends MetaTileEntity implements ILaserContainer { +public class MetaTileEntityCreativeEnergy extends MetaTileEntity implements ILaserContainer, IControllable { private long voltage = 0; private int amps = 1; @@ -89,6 +93,8 @@ public T getCapability(Capability capability, EnumFacing side) { return GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER.cast(this); } else if (capability == GregtechTileCapabilities.CAPABILITY_LASER) { return GregtechTileCapabilities.CAPABILITY_LASER.cast(this); + } else if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) { + return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this); } else { return super.getCapability(capability, side); } @@ -126,7 +132,7 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { builder.dynamicLabel(7, 110, () -> "Energy I/O per sec: " + this.lastEnergyIOPerSec, 0x232323); - builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, value -> active = value, + builder.widget(new CycleButtonWidget(7, 139, 77, 20, () -> active, this::setActive, "gregtech.creative.activity.off", "gregtech.creative.activity.on")); builder.widget(new CycleButtonWidget(85, 139, 77, 20, () -> source, value -> { source = value; @@ -144,6 +150,13 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { return builder.build(getHolder(), entityPlayer); } + public void setActive(boolean active) { + this.active = active; + if (!getWorld().isRemote) { + writeCustomData(GregtechDataCodes.UPDATE_ACTIVE, buf -> buf.writeBoolean(active)); + } + } + @Override public void addToolUsages(ItemStack stack, @Nullable World world, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.tool_action.screwdriver.access_covers")); @@ -297,13 +310,27 @@ public void setIOSpeed(long energyIOPerSec) { } @Override - public void receiveCustomData(int dataId, PacketBuffer buf) { + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == UPDATE_IO_SPEED) { this.lastEnergyIOPerSec = buf.readLong(); + } else if (dataId == UPDATE_ACTIVE) { + this.active = buf.readBoolean(); } } + @Override + public void writeInitialSyncData(@NotNull PacketBuffer buf) { + super.writeInitialSyncData(buf); + buf.writeBoolean(active); + } + + @Override + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { + super.receiveInitialSyncData(buf); + this.active = buf.readBoolean(); + } + public static Function getTextFieldValidator() { return val -> { if (val.isEmpty()) { @@ -321,4 +348,14 @@ public static Function getTextFieldValidator() { return val; }; } + + @Override + public boolean isWorkingEnabled() { + return active; + } + + @Override + public void setWorkingEnabled(boolean isWorkingAllowed) { + setActive(isWorkingAllowed); + } } From 62e5fec16c19afe29f0c8e7b98fcdde141c5588f Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:14:38 -0500 Subject: [PATCH 57/77] fix using client only method for harder bed recipe names (#2253) --- .../java/gregtech/loaders/recipe/VanillaOverrideRecipes.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java index b057a3e3b0d..dbf9b401b47 100644 --- a/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/VanillaOverrideRecipes.java @@ -649,7 +649,7 @@ private static void miscRecipes() { } private static void addBedRecipe(int meta) { - String colorName = EnumDyeColor.byMetadata(meta).getDyeColorName(); + String colorName = EnumDyeColor.byMetadata(meta).getName(); if ("silver".equals(colorName)) { // thank you mojang colorName = "light_gray"; From 071793cc0ad21ca4f66a677f7d31657e684b36ad Mon Sep 17 00:00:00 2001 From: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Tue, 5 Dec 2023 21:31:49 -0700 Subject: [PATCH 58/77] Fix plasma temps all being the default temp (#2256) --- src/main/java/gregtech/api/fluids/FluidBuilder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/fluids/FluidBuilder.java b/src/main/java/gregtech/api/fluids/FluidBuilder.java index 88bf5fa5519..757369b75ae 100644 --- a/src/main/java/gregtech/api/fluids/FluidBuilder.java +++ b/src/main/java/gregtech/api/fluids/FluidBuilder.java @@ -427,7 +427,12 @@ private void determineTemperature(@Nullable Material material) { yield ROOM_TEMPERATURE; } case GAS -> ROOM_TEMPERATURE; - case PLASMA -> BASE_PLASMA_TEMPERATURE; + case PLASMA -> { + if (material.hasFluid()) { + yield BASE_PLASMA_TEMPERATURE + material.getFluid().getTemperature(); + } + yield BASE_PLASMA_TEMPERATURE; + } }; } else { temperature = property.getBlastTemperature() + switch (state) { From cbadcbbbf11415cec0cebfcaece89b08258927f4 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:57:52 -0600 Subject: [PATCH 59/77] Update build script version to 1701739812 (#2257) Co-authored-by: DStrand1 --- build.gradle | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 62f21b90cb9..5e4447c6c45 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1701481996 +//version: 1701739812 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -222,6 +222,16 @@ if (enableSpotless.toBoolean()) { //noinspection GroovyAssignabilityCheck eclipse('4.19.0').configFile(formatFile) } + kotlin { + target 'src/*/kotlin/**/*.kt' + + toggleOffOn() + ktfmt('0.39') + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } scala { target 'src/*/scala/**/*.scala' scalafmt('3.7.1') From 09a4e64024d2c9c307b2493a5cc990d5f46b6367 Mon Sep 17 00:00:00 2001 From: Tictim Date: Thu, 7 Dec 2023 11:52:27 +0900 Subject: [PATCH 60/77] Re-implement walking speed bonus (#2251) --- .../api/block/IWalkingSpeedBonus.java | 8 ++ .../api/block/VariantActiveBlock.java | 2 +- .../java/gregtech/api/block/VariantBlock.java | 30 ++---- .../java/gregtech/api/util/BlockUtility.java | 49 ++++++++++ .../java/gregtech/common/EventHandlers.java | 98 ++++++++++++++++++- .../gregtech/common/blocks/BlockAsphalt.java | 10 -- .../common/blocks/BlockBatteryPart.java | 2 +- .../gregtech/common/blocks/BlockColored.java | 24 ++--- .../common/blocks/BlockSteamCasing.java | 2 +- .../gregtech/common/blocks/BlockWireCoil.java | 2 +- .../gregtech/common/blocks/MetaBlocks.java | 51 +++++++++- .../common/blocks/StoneVariantBlock.java | 48 +++------ src/main/java/gregtech/core/CoreModule.java | 23 ++++- 13 files changed, 246 insertions(+), 103 deletions(-) diff --git a/src/main/java/gregtech/api/block/IWalkingSpeedBonus.java b/src/main/java/gregtech/api/block/IWalkingSpeedBonus.java index 508b5c9e416..4b932286cdb 100644 --- a/src/main/java/gregtech/api/block/IWalkingSpeedBonus.java +++ b/src/main/java/gregtech/api/block/IWalkingSpeedBonus.java @@ -3,6 +3,14 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; +import org.jetbrains.annotations.ApiStatus; + +/** + * @deprecated use {@link gregtech.api.util.BlockUtility#setWalkingSpeedBonus(IBlockState, double)} + */ +@SuppressWarnings("DeprecatedIsStillUsed") +@Deprecated +@ApiStatus.ScheduledForRemoval(inVersion = "2.9") public interface IWalkingSpeedBonus { default double getWalkingSpeedBonus() { diff --git a/src/main/java/gregtech/api/block/VariantActiveBlock.java b/src/main/java/gregtech/api/block/VariantActiveBlock.java index e2fd7864005..4818c4a933a 100644 --- a/src/main/java/gregtech/api/block/VariantActiveBlock.java +++ b/src/main/java/gregtech/api/block/VariantActiveBlock.java @@ -120,7 +120,7 @@ public int getMetaFromState(IBlockState state) { @NotNull @Override protected BlockStateContainer createBlockState() { - Class enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class, 0); + Class enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class); this.VARIANT = PropertyEnum.create("variant", enumClass); this.VALUES = enumClass.getEnumConstants(); return new ExtendedBlockState(this, new IProperty[] { VARIANT, ACTIVE_DEPRECATED }, diff --git a/src/main/java/gregtech/api/block/VariantBlock.java b/src/main/java/gregtech/api/block/VariantBlock.java index 25b2ebbe389..5b0310263ef 100644 --- a/src/main/java/gregtech/api/block/VariantBlock.java +++ b/src/main/java/gregtech/api/block/VariantBlock.java @@ -11,11 +11,9 @@ import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -28,11 +26,13 @@ import java.util.Collections; import java.util.List; +@SuppressWarnings("deprecation") public class VariantBlock & IStringSerializable> extends Block implements IWalkingSpeedBonus { protected PropertyEnum VARIANT; protected T[] VALUES; + @SuppressWarnings("DataFlowIssue") public VariantBlock(Material materialIn) { super(materialIn); if (VALUES.length > 0 && VALUES[0] instanceof IStateHarvestLevel) { @@ -77,7 +77,7 @@ public ItemStack getItemVariant(T variant, int amount) { @NotNull @Override protected BlockStateContainer createBlockState() { - Class enumClass = getActualTypeParameter(getClass(), VariantBlock.class, 0); + Class enumClass = getActualTypeParameter(getClass(), VariantBlock.class); this.VARIANT = PropertyEnum.create("variant", enumClass); this.VALUES = enumClass.getEnumConstants(); return new BlockStateContainer(this, VARIANT); @@ -85,7 +85,7 @@ protected BlockStateContainer createBlockState() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack stack, @Nullable World player, List tooltip, + public void addInformation(@NotNull ItemStack stack, @Nullable World player, @NotNull List tooltip, @NotNull ITooltipFlag advanced) { // tier less tooltip like: tile.turbine_casing.tooltip String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip"; @@ -114,27 +114,9 @@ public int getMetaFromState(IBlockState state) { return state.getValue(VARIANT).ordinal(); } - @Override - public void onEntityWalk(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) { - // Short circuit if there is no bonus speed - if (getWalkingSpeedBonus() == 1.0D) { - return; - } - - IBlockState below = entityIn.getEntityWorld() - .getBlockState(new BlockPos(entityIn.posX, entityIn.posY - (1 / 16D), entityIn.posZ)); - if (checkApplicableBlocks(below)) { - if (bonusSpeedCondition(entityIn)) { - entityIn.motionX *= getWalkingSpeedBonus(); - entityIn.motionZ *= getWalkingSpeedBonus(); - } - } - } - // magic is here @SuppressWarnings("unchecked") - protected static Class getActualTypeParameter(Class thisClass, Class declaringClass, - int index) { + protected static Class getActualTypeParameter(Class thisClass, Class declaringClass) { Type type = thisClass.getGenericSuperclass(); while (!(type instanceof ParameterizedType) || ((ParameterizedType) type).getRawType() != declaringClass) { @@ -144,6 +126,6 @@ protected static Class getActualTypeParameter(Class thisC type = ((Class) type).getGenericSuperclass(); } } - return (Class) ((ParameterizedType) type).getActualTypeArguments()[index]; + return (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; } } diff --git a/src/main/java/gregtech/api/util/BlockUtility.java b/src/main/java/gregtech/api/util/BlockUtility.java index e84e996b92d..77b816da15a 100644 --- a/src/main/java/gregtech/api/util/BlockUtility.java +++ b/src/main/java/gregtech/api/util/BlockUtility.java @@ -2,15 +2,45 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; +import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +import it.unimi.dsi.fastutil.objects.Object2DoubleMaps; +import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap; import org.jetbrains.annotations.NotNull; +import java.util.Objects; +import java.util.UUID; + public class BlockUtility { private static final BlockWrapper WRAPPER = new BlockWrapper(); + private static final Object2DoubleMap walkingSpeedBonusInternal = new Object2DoubleOpenHashMap<>(); + /** + * View-only collection of block states that give speed bonus when walking over it. The bonus value is a percentage + * value that gets added to the player speed; for example, a bonus value of {@link 0.25} will add 25% of extra speed + * to the player. + */ + public static final Object2DoubleMap WALKING_SPEED_BONUS = Object2DoubleMaps.unmodifiable( + walkingSpeedBonusInternal); + + /** + * UUID of the walking speed bonus attribute applied to players. + */ + public static final UUID WALKING_SPEED_UUID = UUID.fromString("415ac431-8339-4150-965c-e673a8a328be"); + + /** + * Walking speed bonus applied to asphalt and concrete blocks. + */ + public static final double ASPHALT_WALKING_SPEED_BONUS = 0.6; + /** + * Walking speed bonus applied to studs. + */ + public static final double STUDS_WALKING_SPEED_BONUS = 0.25; + private static class BlockWrapper extends Block { public BlockWrapper() { @@ -31,4 +61,23 @@ public static void startCaptureDrops() { public static NonNullList stopCaptureDrops() { return WRAPPER.captureDrops(false); } + + /** + * Set walking speed bonus for the block state. The bonus value is a percentage value that gets added to the player + * speed; for example, a bonus value of {@link 0.25} will add 25% of extra speed to the player. + * + * @param state block state + * @param amount amount of walking speed bonus + */ + public static void setWalkingSpeedBonus(@NotNull IBlockState state, double amount) { + Objects.requireNonNull(state, "state == null"); + if (!Double.isFinite(amount)) { + throw new IllegalArgumentException("Haha funny i put NaN and Infinity in your API method haha no"); + } + if (amount == 0) { + walkingSpeedBonusInternal.remove(state); + } else { + walkingSpeedBonusInternal.put(state, amount); + } + } } diff --git a/src/main/java/gregtech/common/EventHandlers.java b/src/main/java/gregtech/common/EventHandlers.java index a25b6b99716..da32dd83ca5 100644 --- a/src/main/java/gregtech/common/EventHandlers.java +++ b/src/main/java/gregtech/common/EventHandlers.java @@ -1,6 +1,7 @@ package gregtech.common; import gregtech.api.GTValues; +import gregtech.api.block.IWalkingSpeedBonus; import gregtech.api.items.armor.ArmorMetaItem; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.items.toolitem.ToolHelper; @@ -8,6 +9,7 @@ import gregtech.api.pipenet.longdist.LongDistanceNetwork; import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.unification.material.Materials; +import gregtech.api.util.BlockUtility; import gregtech.api.util.CapesRegistry; import gregtech.api.util.GTUtility; import gregtech.api.util.VirtualTankRegistry; @@ -18,8 +20,12 @@ import gregtech.common.items.behaviors.ToggleEnergyConsumerBehavior; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; @@ -31,7 +37,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumDifficulty; +import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.EnderTeleportEvent; import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent; @@ -148,8 +156,7 @@ public static void onDestroySpeed(net.minecraftforge.event.entity.player.PlayerE @SubscribeEvent(priority = EventPriority.LOW) public static void onEntityLivingFallEvent(LivingFallEvent event) { - if (event.getEntity() instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) event.getEntity(); + if (event.getEntity() instanceof EntityPlayerMP player) { ItemStack armor = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); ItemStack jet = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); @@ -206,9 +213,94 @@ public static void onLivingEquipmentChangeEvent(LivingEquipmentChangeEvent event } } + @SuppressWarnings({ "ConstantValue", "deprecation" }) @SubscribeEvent - @SideOnly(Side.CLIENT) public static void onPlayerTick(TickEvent.PlayerTickEvent event) { + EntityPlayer player = event.player; + if (event.phase == TickEvent.Phase.START && !player.world.isRemote) { + IAttributeInstance movementSpeed = player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); + if (movementSpeed == null) return; + AttributeModifier modifier = movementSpeed.getModifier(BlockUtility.WALKING_SPEED_UUID); + + double speedBonus; + if (!player.onGround || player.isInWater() || player.isSneaking()) { + speedBonus = 0; + } else { + IBlockState state = player.world.getBlockState(new BlockPos( + player.posX, player.getEntityBoundingBox().minY - 1, player.posZ)); + speedBonus = BlockUtility.WALKING_SPEED_BONUS.getDouble(state); + // { remove this bit while removing IWalkingSpeedBonus + if (speedBonus == 0 && + state.getBlock() instanceof IWalkingSpeedBonus walkingSpeedBonus && + walkingSpeedBonus.getWalkingSpeedBonus() != 1 && + walkingSpeedBonus.bonusSpeedCondition(player) && + walkingSpeedBonus.checkApplicableBlocks(state)) { + speedBonus = walkingSpeedBonus.getWalkingSpeedBonus() - 1; + } + // } + } + if (modifier != null) { + if (speedBonus == modifier.getAmount()) return; + else movementSpeed.removeModifier(BlockUtility.WALKING_SPEED_UUID); + } else { + if (speedBonus == 0) return; + } + if (speedBonus != 0) { + movementSpeed.applyModifier(new AttributeModifier(BlockUtility.WALKING_SPEED_UUID, + "Walking Speed Bonus", speedBonus, 2)); + } + } + } + + @SuppressWarnings({ "lossy-conversions", "ConstantValue" }) + @SubscribeEvent + @SideOnly(Side.CLIENT) + public static void onFOVUpdate(FOVUpdateEvent event) { // this event SUCKS + EntityPlayer player = event.getEntity(); + IAttributeInstance movementSpeed = player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); + if (movementSpeed == null || movementSpeed.getModifier(BlockUtility.WALKING_SPEED_UUID) == null) return; + + float originalFov = player.capabilities.isFlying ? 1.1f : 1.0f; + originalFov *= (movementSpeed.getAttributeValue() / player.capabilities.getWalkSpeed() + 1) / 2; + + if (player.capabilities.getWalkSpeed() == 0 || Float.isNaN(originalFov) || Float.isInfinite(originalFov)) { + return; + } + + float newFov = player.capabilities.isFlying ? 1.1f : 1.0f; + newFov *= (computeValueWithoutWalkingSpeed(movementSpeed) / player.capabilities.getWalkSpeed() + 1) / 2; + + event.setNewfov(newFov / originalFov * event.getNewfov()); + } + + /** + * Computes walking speed without boost from {@link BlockUtility#WALKING_SPEED_BONUS}. Skipping parent check stuff + * because movement speed attribute does not have any parent modifier. + */ + private static double computeValueWithoutWalkingSpeed(IAttributeInstance attrib) { + double base = attrib.getBaseValue(); + + for (AttributeModifier m : attrib.getModifiersByOperation(0)) { + base += m.getAmount(); + } + + double applied = base; + + for (AttributeModifier m : attrib.getModifiersByOperation(1)) { + applied += base * m.getAmount(); + } + + for (AttributeModifier m : attrib.getModifiersByOperation(2)) { + if (m.getID() == BlockUtility.WALKING_SPEED_UUID) continue; + applied *= 1 + m.getAmount(); + } + + return attrib.getAttribute().clampValue(applied); + } + + @SubscribeEvent + @SideOnly(Side.CLIENT) + public static void onPlayerTickClient(TickEvent.PlayerTickEvent event) { if (event.phase == TickEvent.Phase.START && !event.player.isSpectator() && !(event.player instanceof EntityOtherPlayerMP) && !(event.player instanceof FakePlayer)) { ItemStack feetEquip = event.player.getItemStackFromSlot(EntityEquipmentSlot.FEET); diff --git a/src/main/java/gregtech/common/blocks/BlockAsphalt.java b/src/main/java/gregtech/common/blocks/BlockAsphalt.java index 2b27036768e..281e47c76b8 100644 --- a/src/main/java/gregtech/common/blocks/BlockAsphalt.java +++ b/src/main/java/gregtech/common/blocks/BlockAsphalt.java @@ -32,16 +32,6 @@ public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAcces return false; } - @Override - public double getWalkingSpeedBonus() { - return 1.6D; - } - - @Override - public boolean checkApplicableBlocks(IBlockState state) { - return state == getState(BlockType.ASPHALT); - } - public enum BlockType implements IStringSerializable, IStateHarvestLevel { ASPHALT("asphalt", 0); diff --git a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java index e89734051b1..1f8548a56af 100644 --- a/src/main/java/gregtech/common/blocks/BlockBatteryPart.java +++ b/src/main/java/gregtech/common/blocks/BlockBatteryPart.java @@ -41,7 +41,7 @@ public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAcces } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World world, List tooltip, + public void addInformation(@NotNull ItemStack stack, @Nullable World world, @NotNull List tooltip, @NotNull ITooltipFlag advanced) { super.addInformation(stack, world, tooltip, advanced); diff --git a/src/main/java/gregtech/common/blocks/BlockColored.java b/src/main/java/gregtech/common/blocks/BlockColored.java index 9f84069c345..db2f2049e9f 100644 --- a/src/main/java/gregtech/common/blocks/BlockColored.java +++ b/src/main/java/gregtech/common/blocks/BlockColored.java @@ -12,12 +12,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockColored extends VariantBlock { +import org.jetbrains.annotations.NotNull; - public BlockColored() { - this(net.minecraft.block.material.Material.IRON, "block_colored", 2.0f, 5.0f, SoundType.METAL, - EnumDyeColor.WHITE); - } +public class BlockColored extends VariantBlock { public BlockColored(Material material, String translationKey, float hardness, float resistance, SoundType soundType, EnumDyeColor defaultColor) { @@ -30,23 +27,14 @@ public BlockColored(Material material, String translationKey, float hardness, fl } @Override - public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, - EntityLiving.SpawnPlacementType type) { + public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, + @NotNull EntityLiving.SpawnPlacementType type) { return false; } @Override - public double getWalkingSpeedBonus() { - return 1.25; - } - - @Override - public boolean checkApplicableBlocks(IBlockState state) { - return this == MetaBlocks.STUDS; - } - - @Override - public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeColor color) { + public boolean recolorBlock(World world, @NotNull BlockPos pos, @NotNull EnumFacing side, + @NotNull EnumDyeColor color) { if (world.getBlockState(pos) != getState(color)) { world.setBlockState(pos, getState(color)); return true; diff --git a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java index c3e1fdc251b..58188233370 100644 --- a/src/main/java/gregtech/common/blocks/BlockSteamCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockSteamCasing.java @@ -39,7 +39,7 @@ public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAcces } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable World player, List tooltip, + public void addInformation(@NotNull ItemStack stack, @Nullable World player, @NotNull List tooltip, @NotNull ITooltipFlag advanced) { int ordinal = getState(stack).ordinal(); if (ordinal < 2) { diff --git a/src/main/java/gregtech/common/blocks/BlockWireCoil.java b/src/main/java/gregtech/common/blocks/BlockWireCoil.java index 312e8e4d9c0..2496bba9267 100644 --- a/src/main/java/gregtech/common/blocks/BlockWireCoil.java +++ b/src/main/java/gregtech/common/blocks/BlockWireCoil.java @@ -49,7 +49,7 @@ public BlockRenderLayer getRenderLayer() { @Override @SideOnly(Side.CLIENT) - public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn, List lines, + public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn, @NotNull List lines, @NotNull ITooltipFlag tooltipFlag) { super.addInformation(itemStack, worldIn, lines, tooltipFlag); diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index 9395fdec645..ada71a669ac 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -11,17 +11,30 @@ import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.ore.StoneType; +import gregtech.api.util.BlockUtility; import gregtech.api.util.GTUtility; import gregtech.api.util.function.TriConsumer; import gregtech.client.model.SimpleStateMapper; import gregtech.client.model.modelfactories.BakedModelHandler; import gregtech.client.renderer.handler.MetaTileEntityRenderer; import gregtech.client.renderer.handler.MetaTileEntityTESR; -import gregtech.client.renderer.pipe.*; +import gregtech.client.renderer.pipe.CableRenderer; +import gregtech.client.renderer.pipe.FluidPipeRenderer; +import gregtech.client.renderer.pipe.ItemPipeRenderer; +import gregtech.client.renderer.pipe.LaserPipeRenderer; +import gregtech.client.renderer.pipe.OpticalPipeRenderer; import gregtech.common.ConfigHolder; import gregtech.common.blocks.foam.BlockFoam; import gregtech.common.blocks.foam.BlockPetrifiedFoam; -import gregtech.common.blocks.wood.*; +import gregtech.common.blocks.wood.BlockGregFence; +import gregtech.common.blocks.wood.BlockGregFenceGate; +import gregtech.common.blocks.wood.BlockGregPlanks; +import gregtech.common.blocks.wood.BlockGregWoodSlab; +import gregtech.common.blocks.wood.BlockRubberDoor; +import gregtech.common.blocks.wood.BlockRubberLeaves; +import gregtech.common.blocks.wood.BlockRubberLog; +import gregtech.common.blocks.wood.BlockRubberSapling; +import gregtech.common.blocks.wood.BlockWoodenDoor; import gregtech.common.items.MetaItems; import gregtech.common.pipelike.cable.BlockCable; import gregtech.common.pipelike.cable.Insulation; @@ -44,9 +57,15 @@ import gregtech.common.pipelike.optical.OpticalPipeType; import gregtech.common.pipelike.optical.tile.TileEntityOpticalPipe; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockLog; import net.minecraft.block.BlockLog.EnumAxis; +import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockSlab.EnumBlockHalf; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -73,8 +92,14 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -333,7 +358,8 @@ public static void init() { } /** - * Deterministically populates a category of MetaBlocks based on the unique registry ID of each qualifying Material. + * Deterministically populates a category of MetaBlocks based on the unique registry ID of each qualifying + * Material. * * @param materialPredicate a filter for determining if a Material qualifies for generation in the category. * @param blockGenerator a function which accepts a Materials set to pack into a MetaBlock, and the ordinal this @@ -601,6 +627,21 @@ public static void registerColors() { itemColors.registerItemColorHandler((s, i) -> ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); } + public static void registerWalkingSpeedBonus() { + for (IBlockState state : ASPHALT.getBlockState().getValidStates()) { + BlockUtility.setWalkingSpeedBonus(state, BlockUtility.ASPHALT_WALKING_SPEED_BONUS); + } + for (IBlockState state : STUDS.getBlockState().getValidStates()) { + BlockUtility.setWalkingSpeedBonus(state, BlockUtility.STUDS_WALKING_SPEED_BONUS); + } + for (StoneVariantBlock block : STONE_BLOCKS.values()) { + BlockUtility.setWalkingSpeedBonus(block.getState(StoneVariantBlock.StoneType.CONCRETE_DARK), + BlockUtility.ASPHALT_WALKING_SPEED_BONUS); + BlockUtility.setWalkingSpeedBonus(block.getState(StoneVariantBlock.StoneType.CONCRETE_LIGHT), + BlockUtility.ASPHALT_WALKING_SPEED_BONUS); + } + } + public static void registerOreDict() { OreDictUnifier.registerOre(new ItemStack(RUBBER_LEAVES), "treeLeaves"); OreDictUnifier.registerOre(new ItemStack(RUBBER_SAPLING), "treeSapling"); diff --git a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java index aac7f85a066..39194eea2a0 100644 --- a/src/main/java/gregtech/common/blocks/StoneVariantBlock.java +++ b/src/main/java/gregtech/common/blocks/StoneVariantBlock.java @@ -57,16 +57,6 @@ public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAcces return false; } - @Override - public double getWalkingSpeedBonus() { - return 1.6D; - } - - @Override - public boolean checkApplicableBlocks(@NotNull IBlockState state) { - return state == getState(StoneType.CONCRETE_DARK) || state == getState(StoneType.CONCRETE_LIGHT); - } - @Override protected boolean canSilkHarvest() { return this.stoneVariant == StoneVariant.SMOOTH; @@ -103,36 +93,20 @@ public String getName() { } public OrePrefix getOrePrefix() { - switch (this) { - case BLACK_GRANITE: - case RED_GRANITE: - case MARBLE: - case BASALT: - return OrePrefix.stone; - case CONCRETE_LIGHT: - case CONCRETE_DARK: - return OrePrefix.block; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case BLACK_GRANITE, RED_GRANITE, MARBLE, BASALT -> OrePrefix.stone; + case CONCRETE_LIGHT, CONCRETE_DARK -> OrePrefix.block; + }; } public Material getMaterial() { - switch (this) { - case BLACK_GRANITE: - return Materials.GraniteBlack; - case RED_GRANITE: - return Materials.GraniteRed; - case MARBLE: - return Materials.Marble; - case BASALT: - return Materials.Basalt; - case CONCRETE_LIGHT: - case CONCRETE_DARK: - return Materials.Concrete; - default: - throw new IllegalStateException("Unreachable"); - } + return switch (this) { + case BLACK_GRANITE -> Materials.GraniteBlack; + case RED_GRANITE -> Materials.GraniteRed; + case MARBLE -> Materials.Marble; + case BASALT -> Materials.Basalt; + case CONCRETE_LIGHT, CONCRETE_DARK -> Materials.Concrete; + }; } } diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index 9c4d019cbae..c063eec5c15 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -48,7 +48,19 @@ import gregtech.core.advancement.internal.AdvancementManager; import gregtech.core.command.internal.CommandManager; import gregtech.core.network.internal.NetworkHandler; -import gregtech.core.network.packets.*; +import gregtech.core.network.packets.PacketBlockParticle; +import gregtech.core.network.packets.PacketClipboard; +import gregtech.core.network.packets.PacketClipboardNBTUpdate; +import gregtech.core.network.packets.PacketClipboardUIWidgetUpdate; +import gregtech.core.network.packets.PacketFluidVeinList; +import gregtech.core.network.packets.PacketKeysPressed; +import gregtech.core.network.packets.PacketNotifyCapeChange; +import gregtech.core.network.packets.PacketPluginSynced; +import gregtech.core.network.packets.PacketRecoverMTE; +import gregtech.core.network.packets.PacketReloadShaders; +import gregtech.core.network.packets.PacketUIClientAction; +import gregtech.core.network.packets.PacketUIOpen; +import gregtech.core.network.packets.PacketUIWidgetUpdate; import gregtech.core.sound.GTSoundEvents; import gregtech.core.sound.internal.SoundManager; import gregtech.core.unification.material.internal.MaterialRegistryManager; @@ -62,7 +74,13 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.*; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartedEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.event.FMLServerStoppedEvent; import net.minecraftforge.fml.relauncher.Side; import org.apache.logging.log4j.LogManager; @@ -235,6 +253,7 @@ public void init(FMLInitializationEvent event) { /* End Cover Definition Registration */ DungeonLootLoader.init(); + MetaBlocks.registerWalkingSpeedBonus(); } @Override From 3f8d6f1ba4f5835db60e69928b844a22f39c85c1 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Wed, 6 Dec 2023 19:53:37 -0700 Subject: [PATCH 61/77] =?UTF-8?q?Rework=20Generators=202.0=20=E2=84=A2?= =?UTF-8?q?=EF=B8=8F=20=20(#2255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/capability/impl/FuelRecipeLogic.java | 5 ++ .../SimpleGeneratorMetaTileEntity.java | 6 -- .../MetaTileEntityLargeCombustionEngine.java | 75 +++++++++++-------- 3 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java index 1222349e113..64e305fb20a 100644 --- a/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/FuelRecipeLogic.java @@ -46,4 +46,9 @@ public int getParallelLimit() { // parallel is limited by voltage return Integer.MAX_VALUE; } + + @Override + public boolean isAllowOverclocking() { + return false; + } } diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 3cac1149fcb..ee42074ecaa 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -8,7 +8,6 @@ import gregtech.api.capability.impl.RecipeLogicEnergy; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.CycleButtonWidget; import gregtech.api.gui.widgets.LabelWidget; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; @@ -111,11 +110,6 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { builder.widget(new LabelWidget(6, 6, getMetaFullName())) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); - builder.widget(new CycleButtonWidget(7, 62 + yOffset, 18, 18, - workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier) - .setTooltipHoverString("gregtech.gui.overclock.description") - .setButtonTexture(GuiTextures.BUTTON_OVERCLOCK)); - return builder; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java index 64f7bedd107..4b298f25cd0 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java @@ -344,7 +344,8 @@ public LargeCombustionEngineWorkableHandler(RecipeMapMultiblockController tileEn @Override protected void updateRecipeProgress() { if (canRecipeProgress && drawEnergy(recipeEUt, true)) { - + drainLubricant(); + drainOxygen(); drawEnergy(recipeEUt, false); // as recipe starts with progress on 1 this has to be > only not => to compensate for it @@ -354,11 +355,49 @@ protected void updateRecipeProgress() { } } + protected void checkOxygen() { + // check oxygen if present to boost production, and if the dynamo hatch supports it + if (combustionEngine.isBoostAllowed()) { + IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); + FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; + isOxygenBoosted = boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false)); + } + } + + protected void drainOxygen() { + if (isOxygenBoosted && totalContinuousRunningTime % 20 == 0) { + FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; + combustionEngine.getInputFluidInventory().drain(boosterStack, true); + } + } + + protected boolean checkLubricant() { + // check lubricant and invalidate if it fails + IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); + if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { + return true; + } else { + invalidate(); + return false; + } + } + + protected void drainLubricant() { + if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { + IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); + inputTank.drain(LUBRICANT_STACK, true); + } + } + @Override protected boolean shouldSearchForRecipes() { - return super.shouldSearchForRecipes() && - LUBRICANT_STACK.isFluidStackIdentical(((RecipeMapMultiblockController) metaTileEntity) - .getInputFluidInventory().drain(LUBRICANT_STACK, false)); + checkOxygen(); + return super.shouldSearchForRecipes() && checkLubricant(); + } + + @Override + protected boolean canProgressRecipe() { + return super.canProgressRecipe() && checkLubricant(); } @Override @@ -388,33 +427,5 @@ public void invalidate() { isOxygenBoosted = false; super.invalidate(); } - - @Override - protected boolean canProgressRecipe() { - // drain lubricant and invalidate if it fails - if (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 72 == 0) { - IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); - if (LUBRICANT_STACK.isFluidStackIdentical(inputTank.drain(LUBRICANT_STACK, false))) { - inputTank.drain(LUBRICANT_STACK, true); - } else { - invalidate(); - return false; - } - } - - // drain oxygen if present to boost production, and if the dynamo hatch supports it - if (combustionEngine.isBoostAllowed() && - (totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0)) { - IMultipleTankHandler inputTank = combustionEngine.getInputFluidInventory(); - FluidStack boosterStack = isExtreme ? LIQUID_OXYGEN_STACK : OXYGEN_STACK; - if (boosterStack.isFluidStackIdentical(inputTank.drain(boosterStack, false))) { - isOxygenBoosted = true; - inputTank.drain(boosterStack, true); - } else { - isOxygenBoosted = false; - } - } - return super.canProgressRecipe(); - } } } From f835f802656c99124f0492ae6ca44dbdd11ec4ac Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:06:22 -0600 Subject: [PATCH 62/77] Fix issues with ore byproduct page (#2262) --- .../java/gregtech/integration/jei/basic/OreByProduct.java | 3 ++- .../gregtech/integration/jei/basic/OreByProductCategory.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java index 825747c51e6..fb1af11438b 100755 --- a/src/main/java/gregtech/integration/jei/basic/OreByProduct.java +++ b/src/main/java/gregtech/integration/jei/basic/OreByProduct.java @@ -9,6 +9,7 @@ import gregtech.api.unification.material.properties.OreProperty; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; +import gregtech.client.utils.TooltipHelper; import gregtech.common.metatileentities.MetaTileEntities; import net.minecraft.client.resources.I18n; @@ -296,7 +297,7 @@ public void addTooltip(int slotIndex, boolean input, Object ingredient, List 0); } From e8494bda106bd46f282f491991d2bfc7ffbb894d Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:26:56 -0600 Subject: [PATCH 63/77] Clean up and add particle effects for machines (#2249) --- .../SimpleMachineMetaTileEntity.java | 28 ++- .../metatileentity/SteamMetaTileEntity.java | 33 ++- .../multiblock/MultiblockWithDisplayBase.java | 5 +- .../particle/IMachineParticleEffect.java | 10 + .../particle/VanillaParticleEffects.java | 204 ++++++++++++++++++ .../metatileentities/MetaTileEntities.java | 6 +- .../MetaTileEntitySingleCombustion.java | 11 + .../SimpleMachineMetaTileEntityResizable.java | 23 +- .../multi/MetaTileEntityCokeOven.java | 28 +-- .../MetaTileEntityPrimitiveBlastFurnace.java | 42 +--- .../MetaTileEntityMufflerHatch.java | 33 +-- .../steam/MetaTileEntitySteamGrinder.java | 10 + .../multi/steam/MetaTileEntitySteamOven.java | 15 ++ .../steam/SteamAlloySmelter.java | 9 +- .../steam/SteamExtractor.java | 7 +- .../metatileentities/steam/SteamFurnace.java | 20 +- .../metatileentities/steam/SteamHammer.java | 5 +- .../steam/SteamMacerator.java | 21 +- .../steam/SteamRockBreaker.java | 7 +- .../steam/boiler/SteamBoiler.java | 35 ++- .../steam/boiler/SteamLavaBoiler.java | 19 +- 21 files changed, 416 insertions(+), 155 deletions(-) create mode 100644 src/main/java/gregtech/client/particle/IMachineParticleEffect.java create mode 100644 src/main/java/gregtech/client/particle/VanillaParticleEffects.java diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index b5746f071c0..d479ec233f0 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -15,6 +15,7 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; +import gregtech.client.particle.IMachineParticleEffect; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.RenderUtil; @@ -77,6 +78,11 @@ public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity private static final int FONT_HEIGHT = 9; // Minecraft's FontRenderer FONT_HEIGHT value + @Nullable // particle run every tick when the machine is active + protected final IMachineParticleEffect tickingParticle; + @Nullable // particle run in randomDisplayTick() when the machine is active + protected final IMachineParticleEffect randomParticle; + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing) { this(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, GTUtility.defaultTankSizeFunction); @@ -85,15 +91,25 @@ public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap< public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, ICubeRenderer renderer, int tier, boolean hasFrontFacing, Function tankScalingFunction) { + this(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, tankScalingFunction, null, null); + } + + public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recipeMap, + ICubeRenderer renderer, int tier, boolean hasFrontFacing, + Function tankScalingFunction, + @Nullable IMachineParticleEffect tickingParticle, + @Nullable IMachineParticleEffect randomParticle) { super(metaTileEntityId, recipeMap, renderer, tier, tankScalingFunction); this.hasFrontFacing = hasFrontFacing; this.chargerInventory = new GTItemStackHandler(this, 1); + this.tickingParticle = tickingParticle; + this.randomParticle = randomParticle; } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new SimpleMachineMetaTileEntity(metaTileEntityId, workable.getRecipeMap(), renderer, getTier(), - hasFrontFacing, getTankScalingFunction()); + hasFrontFacing, getTankScalingFunction(), tickingParticle, randomParticle); } @Override @@ -189,6 +205,16 @@ public void update() { pushItemsIntoNearbyHandlers(getOutputFacingItems()); } } + } else if (this.tickingParticle != null && isActive()) { + tickingParticle.runEffect(this); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick() { + if (this.randomParticle != null && isActive()) { + randomParticle.runEffect(this); } } diff --git a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java index a2c53bda0f1..c6e879fffc0 100644 --- a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java @@ -10,6 +10,7 @@ import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTUtility; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; @@ -35,6 +36,7 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -143,32 +145,21 @@ public SoundEvent getSound() { @Override public void randomDisplayTick() { if (this.isActive()) { - final BlockPos pos = getPos(); - float x = pos.getX() + 0.5F; - float z = pos.getZ() + 0.5F; - - final EnumFacing facing = getFrontFacing(); - final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - final float y = pos.getY() + GTValues.RNG.nextFloat() * 0.375F; - - if (facing.getAxis() == EnumFacing.Axis.X) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) x += 0.52F; - else x -= 0.52F; - z += horizontalOffset; - } else if (facing.getAxis() == EnumFacing.Axis.Z) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) z += 0.52F; - else z -= 0.52F; - x += horizontalOffset; - } + EnumParticleTypes smokeParticle = isHighPressure ? EnumParticleTypes.SMOKE_LARGE : + EnumParticleTypes.SMOKE_NORMAL; + VanillaParticleEffects.defaultFrontEffect(this, smokeParticle, EnumParticleTypes.FLAME); + if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, - false); + BlockPos pos = getPos(); + getWorld().playSound(pos.getX(), pos.getY(), pos.getZ(), + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } - randomDisplayTick(x, y, z, EnumParticleTypes.FLAME, - isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL); } } + /** @deprecated No longer used, look at {@link VanillaParticleEffects#defaultFrontEffect} to see old logic. */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @SideOnly(Side.CLIENT) protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes flame, EnumParticleTypes smoke) { getWorld().spawnParticle(smoke, x, y, z, 0, 0, 0); diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java index c065b166997..a94c78ccdff 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java @@ -33,6 +33,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -274,8 +275,10 @@ public boolean isMufflerFaceFree() { } /** - * Produces the muffler particles + * @deprecated Use {@link gregtech.client.particle.VanillaParticleEffects#MUFFLER_SMOKE} instead. */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated @SideOnly(Side.CLIENT) public void runMufflerEffect(float xPos, float yPos, float zPos, float xSpd, float ySpd, float zSpd) { getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd); diff --git a/src/main/java/gregtech/client/particle/IMachineParticleEffect.java b/src/main/java/gregtech/client/particle/IMachineParticleEffect.java new file mode 100644 index 00000000000..aad4a0af202 --- /dev/null +++ b/src/main/java/gregtech/client/particle/IMachineParticleEffect.java @@ -0,0 +1,10 @@ +package gregtech.client.particle; + +import gregtech.api.metatileentity.MetaTileEntity; + +import org.jetbrains.annotations.NotNull; + +public interface IMachineParticleEffect { + + void runEffect(@NotNull MetaTileEntity metaTileEntity); +} diff --git a/src/main/java/gregtech/client/particle/VanillaParticleEffects.java b/src/main/java/gregtech/client/particle/VanillaParticleEffects.java new file mode 100644 index 00000000000..2765d3945d9 --- /dev/null +++ b/src/main/java/gregtech/client/particle/VanillaParticleEffects.java @@ -0,0 +1,204 @@ +package gregtech.client.particle; + +import gregtech.api.GTValues; +import gregtech.api.metatileentity.MetaTileEntity; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import org.jetbrains.annotations.NotNull; + +import java.util.function.Consumer; + +public enum VanillaParticleEffects implements IMachineParticleEffect { + + TOP_SMOKE_SMALL(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + if (mte.getFrontFacing() == EnumFacing.UP || mte.hasCover(EnumFacing.UP)) return; + + BlockPos pos = mte.getPos(); + float x = pos.getX() + 0.8F - GTValues.RNG.nextFloat() * 0.6F; + float y = pos.getY() + 0.9F + GTValues.RNG.nextFloat() * 0.2F; + float z = pos.getZ() + 0.8F - GTValues.RNG.nextFloat() * 0.6F; + mte.getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0, 0, 0); + }), + + MUFFLER_SMOKE(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + + BlockPos pos = mte.getPos(); + EnumFacing facing = mte.getFrontFacing(); + float xPos = facing.getXOffset() * 0.76F + pos.getX() + 0.25F; + float yPos = facing.getYOffset() * 0.76F + pos.getY() + 0.25F; + float zPos = facing.getZOffset() * 0.76F + pos.getZ() + 0.25F; + + float ySpd = facing.getYOffset() * 0.1F + 0.2F + 0.1F * GTValues.RNG.nextFloat(); + float xSpd; + float zSpd; + + if (facing.getYOffset() == -1) { + float temp = GTValues.RNG.nextFloat() * 2 * (float) Math.PI; + xSpd = (float) Math.sin(temp) * 0.1F; + zSpd = (float) Math.cos(temp) * 0.1F; + } else { + xSpd = facing.getXOffset() * (0.1F + 0.2F * GTValues.RNG.nextFloat()); + zSpd = facing.getZOffset() * (0.1F + 0.2F * GTValues.RNG.nextFloat()); + } + + xPos += GTValues.RNG.nextFloat() * 0.5F; + yPos += GTValues.RNG.nextFloat() * 0.5F; + zPos += GTValues.RNG.nextFloat() * 0.5F; + + mte.getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd); + }), + + PBF_SMOKE(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + + BlockPos pos = mte.getPos(); + EnumFacing facing = mte.getFrontFacing().getOpposite(); + float xPos = facing.getXOffset() * 0.76F + pos.getX() + 0.5F; + float yPos = facing.getYOffset() * 0.76F + pos.getY() + 0.25F; + float zPos = facing.getZOffset() * 0.76F + pos.getZ() + 0.5F; + + float ySpd = facing.getYOffset() * 0.1F + 0.2F + 0.1F * GTValues.RNG.nextFloat(); + mte.getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, 0, ySpd, 0); + }), + + RANDOM_LAVA_SMOKE(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + + EnumFacing facing = mte.getFrontFacing(); + if (facing.getAxis() == EnumFacing.Axis.Y || mte.hasCover(facing)) return; + BlockPos pos = mte.getPos(); + + final double offX = pos.getX() + facing.getXOffset() + 0.5D; + final double offY = pos.getY() + facing.getYOffset(); + final double offZ = pos.getZ() + facing.getZOffset() + 0.5D; + final double offset = -0.48D; + final double horizontal = GTValues.RNG.nextFloat() * 0.625D - 0.3125D; + + double x, z; + double y = offY + GTValues.RNG.nextFloat() * 0.375D; + + if (facing == EnumFacing.WEST) { + x = offX - offset; + z = offZ + horizontal; + } else if (facing == EnumFacing.EAST) { + x = offX + offset; + z = offZ + horizontal; + } else if (facing == EnumFacing.NORTH) { + x = offX + horizontal; + z = offZ - offset; + } else { // south + x = offX + horizontal; + z = offZ + offset; + } + + mte.getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0, 0, 0); + mte.getWorld().spawnParticle(EnumParticleTypes.LAVA, x, y, z, 0, 0, 0); + }), + + RANDOM_SPARKS(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + + EnumFacing facing = mte.getFrontFacing(); + if (facing.getAxis() == EnumFacing.Axis.Y || mte.hasCover(facing)) return; + + if (GTValues.RNG.nextInt(3) == 0) { + BlockPos pos = mte.getPos(); + + final double offset = 0.02D; + final double horizontal = 0.5D + GTValues.RNG.nextFloat() * 0.5D - 0.25D; + + double x, z, mX, mZ; + double y = pos.getY() + GTValues.RNG.nextFloat() * 0.625D + 0.3125D; + if (facing == EnumFacing.WEST) { + x = pos.getX() - offset; + mX = -0.05D; + z = pos.getZ() + horizontal; + mZ = 0.0D; + } else if (facing == EnumFacing.EAST) { + x = pos.getX() + offset; + mX = 0.05D; + z = pos.getZ() + horizontal; + mZ = 0.0D; + } else if (facing == EnumFacing.NORTH) { + x = pos.getX() + horizontal; + mX = 0.0D; + z = pos.getZ() - offset; + mZ = -0.05D; + } else { // south + x = pos.getX() + horizontal; + mX = 0.0D; + z = pos.getZ() + offset; + mZ = 0.05D; + } + + mte.getWorld().spawnParticle(EnumParticleTypes.LAVA, x, y, z, mX, 0, mZ); + } + }), + + COMBUSTION_SMOKE(mte -> { + if (mte.getWorld() == null || mte.getPos() == null) return; + if (mte.hasCover(EnumFacing.UP)) return; + BlockPos pos = mte.getPos(); + + float x = pos.getX() + 0.125F + GTValues.RNG.nextFloat() * 0.875F; + float y = pos.getY() + 1.03125F; + float z = pos.getZ() + 0.125F + GTValues.RNG.nextFloat() * 0.875F; + + mte.getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0, 0, 0); + }); + + // Wrap for client-sided stuff + private final Consumer effectConsumer; + + VanillaParticleEffects(Consumer effectConsumer) { + this.effectConsumer = effectConsumer; + } + + @Override + public void runEffect(@NotNull MetaTileEntity metaTileEntity) { + effectConsumer.accept(metaTileEntity); + } + + @SideOnly(Side.CLIENT) + public static void defaultFrontEffect(MetaTileEntity mte, EnumParticleTypes... particles) { + defaultFrontEffect(mte, 0.0F, particles); + } + + @SideOnly(Side.CLIENT) + public static void defaultFrontEffect(MetaTileEntity mte, float yOffset, EnumParticleTypes... particles) { + if (particles == null || particles.length == 0) return; + if (mte.getWorld() == null || mte.getPos() == null) return; + + BlockPos pos = mte.getPos(); + EnumFacing facing = mte.getFrontFacing(); + + if (facing.getAxis() == EnumFacing.Axis.Y || mte.hasCover(facing)) return; + + float x = pos.getX() + 0.5F; + float z = pos.getZ() + 0.5F; + + float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F + yOffset; + float y = pos.getY() + GTValues.RNG.nextFloat() * 0.375F; + + if (facing.getAxis() == EnumFacing.Axis.X) { + if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) x += 0.52F; + else x -= 0.52F; + z += horizontalOffset; + } else if (facing.getAxis() == EnumFacing.Axis.Z) { + if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) z += 0.52F; + else z -= 0.52F; + x += horizontalOffset; + } + + for (EnumParticleTypes particle : particles) { + mte.getWorld().spawnParticle(particle, x, y, z, 0, 0, 0); + } + } +} diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index 912811fa70a..a6ff769f8ec 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -13,6 +13,7 @@ import gregtech.api.unification.material.Materials; import gregtech.api.util.GTLog; import gregtech.api.util.GTUtility; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; @@ -406,7 +407,10 @@ public static void init() { default -> 4; }, tier <= GTValues.MV ? Textures.MACERATOR_OVERLAY : Textures.PULVERIZER_OVERLAY, - tier)); + tier, + true, + GTUtility.defaultTankSizeFunction, + VanillaParticleEffects.TOP_SMOKE_SMALL, null)); // Alloy Smelter, IDs 80-94 registerSimpleMetaTileEntity(ALLOY_SMELTER, 80, "alloy_smelter", RecipeMaps.ALLOY_SMELTER_RECIPES, diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java index 2c2c8fd360d..b18412bbabd 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntitySingleCombustion.java @@ -4,10 +4,13 @@ import gregtech.api.metatileentity.SimpleGeneratorMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; @@ -46,4 +49,12 @@ protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IV super.renderOverlays(renderState, translation, pipeline); } } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick() { + if (isActive()) { + VanillaParticleEffects.COMBUSTION_SMOKE.runEffect(this); + } + } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java index be43ffb1ab0..fa9d64c2897 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java +++ b/src/main/java/gregtech/common/metatileentities/electric/SimpleMachineMetaTileEntityResizable.java @@ -5,11 +5,14 @@ import gregtech.api.metatileentity.SimpleMachineMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; +import gregtech.client.particle.IMachineParticleEffect; import gregtech.client.renderer.ICubeRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.Nullable; + import java.util.function.Function; /** @@ -58,6 +61,23 @@ public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, initializeInventory(); } + public SimpleMachineMetaTileEntityResizable(ResourceLocation metaTileEntityId, + RecipeMap recipeMap, + int inputAmount, + int outputAmount, + ICubeRenderer renderer, + int tier, + boolean hasFrontFacing, + Function tankScalingFunction, + @Nullable IMachineParticleEffect tickingParticle, + @Nullable IMachineParticleEffect randomParticle) { + super(metaTileEntityId, recipeMap, renderer, tier, hasFrontFacing, tankScalingFunction, tickingParticle, + randomParticle); + this.inputAmount = inputAmount; + this.outputAmount = outputAmount; + initializeInventory(); + } + @Override protected IItemHandlerModifiable createImportItemHandler() { if (inputAmount != -1) { @@ -77,7 +97,8 @@ protected IItemHandlerModifiable createExportItemHandler() { @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new SimpleMachineMetaTileEntityResizable(metaTileEntityId, workable.getRecipeMap(), inputAmount, - outputAmount, renderer, getTier()); + outputAmount, renderer, getTier(), hasFrontFacing(), + getTankScalingFunction(), tickingParticle, randomParticle); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index 8d54fc54adb..781ae14b7e3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -12,6 +12,7 @@ import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.common.ConfigHolder; @@ -47,6 +48,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityCokeOven(metaTileEntityId); } + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -112,29 +114,13 @@ protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) { @Override public void randomDisplayTick() { if (this.isActive()) { - final BlockPos pos = getPos(); - float x = pos.getX() + 0.5F; - float z = pos.getZ() + 0.5F; - - final EnumFacing facing = getFrontFacing(); - final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - final float y = pos.getY() + GTValues.RNG.nextFloat() * 0.375F + 0.3F; - - if (facing.getAxis() == EnumFacing.Axis.X) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) x += 0.52F; - else x -= 0.52F; - z += horizontalOffset; - } else if (facing.getAxis() == EnumFacing.Axis.Z) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) z += 0.52F; - else z -= 0.52F; - x += horizontalOffset; - } + VanillaParticleEffects.defaultFrontEffect(this, 0.3F, EnumParticleTypes.SMOKE_LARGE, + EnumParticleTypes.FLAME); if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, - false); + BlockPos pos = getPos(); + getWorld().playSound(pos.getX(), pos.getY(), pos.getZ(), + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } - getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); - getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java index 0dad1c14ee1..90078eaf604 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java @@ -16,6 +16,7 @@ import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.recipes.RecipeMaps; import gregtech.api.util.GTUtility; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.ColourOperation; @@ -58,6 +59,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityPrimitiveBlastFurnace(metaTileEntityId); } + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -137,24 +139,13 @@ public void update() { if (this.isActive()) { if (getWorld().isRemote) { - pollutionParticles(); + VanillaParticleEffects.PBF_SMOKE.runEffect(this); } else { damageEntitiesAndBreakSnow(); } } } - private void pollutionParticles() { - BlockPos pos = this.getPos(); - EnumFacing facing = this.getFrontFacing().getOpposite(); - float xPos = facing.getXOffset() * 0.76F + pos.getX() + 0.5F; - float yPos = facing.getYOffset() * 0.76F + pos.getY() + 0.25F; - float zPos = facing.getZOffset() * 0.76F + pos.getZ() + 0.5F; - - float ySpd = facing.getYOffset() * 0.1F + 0.2F + 0.1F * GTValues.RNG.nextFloat(); - runMufflerEffect(xPos, yPos, zPos, 0, ySpd, 0); - } - private void damageEntitiesAndBreakSnow() { BlockPos middlePos = this.getPos(); middlePos = middlePos.offset(getFrontFacing().getOpposite()); @@ -167,32 +158,17 @@ private void damageEntitiesAndBreakSnow() { } } + @SideOnly(Side.CLIENT) @Override public void randomDisplayTick() { if (this.isActive()) { - final BlockPos pos = getPos(); - float x = pos.getX() + 0.5F; - float z = pos.getZ() + 0.5F; - - final EnumFacing facing = getFrontFacing(); - final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - final float y = pos.getY() + GTValues.RNG.nextFloat() * 0.375F + 0.3F; - - if (facing.getAxis() == EnumFacing.Axis.X) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) x += 0.52F; - else x -= 0.52F; - z += horizontalOffset; - } else if (facing.getAxis() == EnumFacing.Axis.Z) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) z += 0.52F; - else z -= 0.52F; - x += horizontalOffset; - } + VanillaParticleEffects.defaultFrontEffect(this, 0.3F, EnumParticleTypes.SMOKE_LARGE, + EnumParticleTypes.FLAME); if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, - false); + BlockPos pos = getPos(); + getWorld().playSound(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } - getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, x, y, z, 0, 0, 0); - getWorld().spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0); } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java index fd934d13813..4b3e75a4c2c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMufflerHatch.java @@ -14,6 +14,7 @@ import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; @@ -22,7 +23,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -33,6 +33,7 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -68,7 +69,7 @@ public void update() { if (getWorld().isRemote && getController() instanceof MultiblockWithDisplayBase controller && controller.isActive()) { - pollutionParticles(); + VanillaParticleEffects.MUFFLER_SMOKE.runEffect(this); } } @@ -111,32 +112,12 @@ private boolean checkFrontFaceFree() { return blockState.getBlock().isAir(blockState, getWorld(), frontPos) || GTUtility.isBlockSnow(blockState); } + /** @deprecated Use {@link VanillaParticleEffects#MUFFLER_SMOKE} instead. */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @SideOnly(Side.CLIENT) public void pollutionParticles() { - BlockPos pos = this.getPos(); - EnumFacing facing = this.getFrontFacing(); - float xPos = facing.getXOffset() * 0.76F + pos.getX() + 0.25F; - float yPos = facing.getYOffset() * 0.76F + pos.getY() + 0.25F; - float zPos = facing.getZOffset() * 0.76F + pos.getZ() + 0.25F; - - float ySpd = facing.getYOffset() * 0.1F + 0.2F + 0.1F * GTValues.RNG.nextFloat(); - float xSpd; - float zSpd; - - if (facing.getYOffset() == -1) { - float temp = GTValues.RNG.nextFloat() * 2 * (float) Math.PI; - xSpd = (float) Math.sin(temp) * 0.1F; - zSpd = (float) Math.cos(temp) * 0.1F; - } else { - xSpd = facing.getXOffset() * (0.1F + 0.2F * GTValues.RNG.nextFloat()); - zSpd = facing.getZOffset() * (0.1F + 0.2F * GTValues.RNG.nextFloat()); - } - if (getController() instanceof MultiblockWithDisplayBase) - ((MultiblockWithDisplayBase) getController()).runMufflerEffect( - xPos + GTValues.RNG.nextFloat() * 0.5F, - yPos + GTValues.RNG.nextFloat() * 0.5F, - zPos + GTValues.RNG.nextFloat() * 0.5F, - xSpd, ySpd, zSpd); + VanillaParticleEffects.MUFFLER_SMOKE.runEffect(this); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java index 2707e903afa..804980f7952 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamGrinder.java @@ -8,6 +8,7 @@ import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; @@ -18,6 +19,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -95,4 +97,12 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.universal.tooltip.parallel", PARALLEL_LIMIT)); tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("gregtech.multiblock.require_steam_parts")); } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick() { + if (isActive()) { + VanillaParticleEffects.defaultFrontEffect(this, 0.4F, EnumParticleTypes.SMOKE_NORMAL); + } + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java index c800f3d1a54..b3a3e5fa039 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java @@ -1,5 +1,6 @@ package gregtech.common.metatileentities.multi.steam; +import gregtech.api.GTValues; import gregtech.api.capability.impl.SteamMultiWorkable; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -8,6 +9,7 @@ import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.utils.TooltipHelper; @@ -19,6 +21,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -44,6 +47,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntitySteamOven(metaTileEntityId); } + @NotNull @Override protected BlockPattern createStructurePattern() { return FactoryBlockPattern.start() @@ -118,4 +122,15 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.universal.tooltip.parallel", MAX_PARALLELS)); tooltip.add(TooltipHelper.BLINKING_ORANGE + I18n.format("gregtech.multiblock.require_steam_parts")); } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick() { + if (isActive()) { + VanillaParticleEffects.defaultFrontEffect(this, EnumParticleTypes.SMOKE_LARGE, EnumParticleTypes.FLAME); + if (GTValues.RNG.nextBoolean()) { + VanillaParticleEffects.defaultFrontEffect(this, 0.5F, EnumParticleTypes.SMOKE_NORMAL); + } + } + } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java index c75459c8df7..b0ed0494fed 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamAlloySmelter.java @@ -9,6 +9,7 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import net.minecraft.entity.player.EntityPlayer; @@ -60,10 +61,10 @@ public ModularUI createUI(EntityPlayer player) { @SideOnly(Side.CLIENT) @Override - protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes flame, EnumParticleTypes smoke) { - super.randomDisplayTick(x, y, z, flame, smoke); - if (GTValues.RNG.nextBoolean()) { - getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y + 0.5F, z, 0, 0, 0); + public void randomDisplayTick() { + super.randomDisplayTick(); + if (isActive() && GTValues.RNG.nextBoolean()) { + VanillaParticleEffects.defaultFrontEffect(this, 0.5F, EnumParticleTypes.SMOKE_NORMAL); } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java index e71cc0d1201..efd65e3c499 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamExtractor.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import net.minecraft.entity.player.EntityPlayer; @@ -52,7 +53,9 @@ public ModularUI createUI(EntityPlayer player) { @SideOnly(Side.CLIENT) @Override - protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes flame, EnumParticleTypes smoke) { - getWorld().spawnParticle(EnumParticleTypes.CLOUD, x, y, z, 0, 0, 0); + public void randomDisplayTick() { + if (isActive()) { + VanillaParticleEffects.defaultFrontEffect(this, EnumParticleTypes.CLOUD); + } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java index ec1bfb1b2e9..30e3fb89850 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamFurnace.java @@ -1,5 +1,6 @@ package gregtech.common.metatileentities.steam; +import gregtech.api.GTValues; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -8,11 +9,16 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; @@ -57,7 +63,17 @@ public ModularUI createUI(EntityPlayer player) { @SideOnly(Side.CLIENT) @Override - protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes flame, EnumParticleTypes smoke) { - super.randomDisplayTick(x, y + 0.5F, z, flame, smoke); + public void randomDisplayTick() { + if (this.isActive()) { + EnumParticleTypes smokeParticle = isHighPressure ? EnumParticleTypes.SMOKE_LARGE : + EnumParticleTypes.SMOKE_NORMAL; + VanillaParticleEffects.defaultFrontEffect(this, 0.5F, smokeParticle, EnumParticleTypes.FLAME); + + if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { + BlockPos pos = getPos(); + getWorld().playSound(pos.getX(), pos.getY(), pos.getZ(), + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + } + } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java index f31bc66214f..576b8e6f180 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamHammer.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import net.minecraft.entity.player.EntityPlayer; @@ -53,6 +54,8 @@ public ModularUI createUI(EntityPlayer player) { @SideOnly(Side.CLIENT) @Override public void randomDisplayTick() { - // steam hammers do not make particles + if (isActive()) { + VanillaParticleEffects.RANDOM_SPARKS.runEffect(this); + } } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java index 51a3716025d..869839f8c39 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamMacerator.java @@ -1,6 +1,5 @@ package gregtech.common.metatileentities.steam; -import gregtech.api.GTValues; import gregtech.api.capability.impl.NotifiableItemStackHandler; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; @@ -9,12 +8,11 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandlerModifiable; @@ -58,16 +56,17 @@ public int getItemOutputLimit() { return 1; } + @Override + public void update() { + super.update(); + if (isActive() && getWorld().isRemote) { + VanillaParticleEffects.TOP_SMOKE_SMALL.runEffect(this); + } + } + @SideOnly(Side.CLIENT) @Override public void randomDisplayTick() { - if (isActive()) { - final BlockPos pos = getPos(); - final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + horizontalOffset, pos.getY() + 0.52F, - pos.getZ() + horizontalOffset, - GTValues.RNG.nextFloat() * 0.125F, GTValues.RNG.nextFloat() * 0.375F, - GTValues.RNG.nextFloat() * 0.125F); - } + // steam macerators do not make particles in this way } } diff --git a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java index 5dbf91b5d8e..21ba4e49276 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/steam/SteamRockBreaker.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.RecipeMaps; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; import net.minecraft.block.Block; @@ -116,8 +117,10 @@ public void readFromNBT(NBTTagCompound data) { @SideOnly(Side.CLIENT) @Override - protected void randomDisplayTick(float x, float y, float z, EnumParticleTypes flame, EnumParticleTypes smoke) { - getWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y + 0.4F, z, 0, 0, 0); + public void randomDisplayTick() { + if (isActive()) { + VanillaParticleEffects.defaultFrontEffect(this, 0.4F, EnumParticleTypes.SMOKE_NORMAL); + } } protected class SteamRockBreakerRecipeLogic extends RecipeLogicSteam { diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index cd9356f0825..a39ebdfff58 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -18,6 +18,7 @@ import gregtech.api.util.GTTransferUtils; import gregtech.api.util.GTUtility; import gregtech.api.util.TextFormattingUtil; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; @@ -48,6 +49,7 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -386,32 +388,21 @@ public List getDataInfo() { @Override public void randomDisplayTick() { if (this.isActive()) { - final BlockPos pos = getPos(); - float x = pos.getX() + 0.5F; - float z = pos.getZ() + 0.5F; - - if (GTValues.RNG.nextDouble() < 0.1) { - getWorld().playSound(x, pos.getY(), z + 0.5F, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, - SoundCategory.BLOCKS, 1.0F, 1.0F, false); - } - - final EnumFacing facing = getFrontFacing(); - final float horizontalOffset = GTValues.RNG.nextFloat() * 0.6F - 0.3F; - final float y = pos.getY() + GTValues.RNG.nextFloat() * 0.375F; - - if (facing.getAxis() == EnumFacing.Axis.X) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) x += 0.52F; - else x -= 0.52F; - z += horizontalOffset; - } else if (facing.getAxis() == EnumFacing.Axis.Z) { - if (facing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) z += 0.52F; - else z -= 0.52F; - x += horizontalOffset; + EnumParticleTypes smokeParticle = isHighPressure ? EnumParticleTypes.SMOKE_LARGE : + EnumParticleTypes.SMOKE_NORMAL; + VanillaParticleEffects.defaultFrontEffect(this, smokeParticle, EnumParticleTypes.FLAME); + + if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { + BlockPos pos = getPos(); + getWorld().playSound(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } - randomDisplayTick(x, y, z); } } + /** @deprecated No longer used, look at {@link VanillaParticleEffects#defaultFrontEffect} to see old logic. */ + @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") @SideOnly(Side.CLIENT) protected void randomDisplayTick(float x, float y, float z) { getWorld().spawnParticle(isHighPressure ? EnumParticleTypes.SMOKE_LARGE : EnumParticleTypes.SMOKE_NORMAL, x, y, diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java index 421cc9843df..1269bf30450 100755 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamLavaBoiler.java @@ -11,11 +11,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.unification.material.Materials; +import gregtech.client.particle.VanillaParticleEffects; import gregtech.client.renderer.texture.Textures; +import gregtech.common.ConfigHolder; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumParticleTypes; +import net.minecraft.init.SoundEvents; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -126,11 +130,14 @@ protected ModularUI createUI(EntityPlayer entityPlayer) { @SideOnly(Side.CLIENT) @Override - public void randomDisplayTick(float x, float y, float z) { - super.randomDisplayTick(x, y, z); - if (GTValues.RNG.nextFloat() < 0.3F) { - getWorld().spawnParticle(EnumParticleTypes.LAVA, x + GTValues.RNG.nextFloat(), y, - z + GTValues.RNG.nextFloat(), 0.0F, 0.0F, 0.0F); + public void randomDisplayTick() { + if (this.isActive()) { + VanillaParticleEffects.RANDOM_LAVA_SMOKE.runEffect(this); + if (ConfigHolder.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { + BlockPos pos = getPos(); + getWorld().playSound(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, + SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); + } } } } From 909aa5b4543d91853419c0318585712b203c7ecd Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Thu, 7 Dec 2023 21:12:48 -0600 Subject: [PATCH 64/77] ModularUI setup (#2264) --- dependencies.gradle | 1 + src/main/java/gregtech/GregTechMod.java | 7 +- src/main/java/gregtech/api/GregTechAPI.java | 1 + .../gregtech/api/cover/CoverUIFactory.java | 1 + .../java/gregtech/api/cover/CoverWithUI.java | 45 ++- .../java/gregtech/api/gui/GuiTextures.java | 2 + .../java/gregtech/api/gui/package-info.java | 2 + .../gregtech/api/items/gui/ItemUIFactory.java | 32 +- .../items/gui/PlayerInventoryUIFactory.java | 1 + .../api/metatileentity/MetaTileEntity.java | 42 ++- .../MetaTileEntityUIFactory.java | 1 + .../java/gregtech/api/mui/GTGuiTextures.java | 75 +++++ .../java/gregtech/api/mui/GTGuiTheme.java | 274 ++++++++++++++++++ src/main/java/gregtech/api/mui/GTGuis.java | 135 +++++++++ .../gregtech/api/mui/GregTechGuiScreen.java | 26 ++ .../gregtech/common/covers/CoverStorage.java | 47 ++- .../gregtech/common/gui/package-info.java | 2 + .../items/behaviors/IntCircuitBehaviour.java | 74 +++-- .../metatileentities/MetaTileEntities.java | 14 +- .../storage/MetaTileEntityCrate.java | 55 +++- src/main/java/gregtech/core/CoreModule.java | 6 + 21 files changed, 775 insertions(+), 68 deletions(-) create mode 100644 src/main/java/gregtech/api/gui/package-info.java create mode 100644 src/main/java/gregtech/api/mui/GTGuiTextures.java create mode 100644 src/main/java/gregtech/api/mui/GTGuiTheme.java create mode 100644 src/main/java/gregtech/api/mui/GTGuis.java create mode 100644 src/main/java/gregtech/api/mui/GregTechGuiScreen.java create mode 100644 src/main/java/gregtech/common/gui/package-info.java diff --git a/dependencies.gradle b/dependencies.gradle index 3af530e782d..fbcaa5e2dfb 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -25,6 +25,7 @@ dependencies { // the CCL deobf jar uses very old MCP mappings, making it error at runtime in runClient/runServer // therefore we manually deobf the regular jar implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358 + implementation "curse.maven:modularui-624243:4856895-deobf-4856896-sources-4856897" // MUI 2.3.1 // Soft Dependencies // Can change any of these from compileOnlyApi -> implementation to test them in-game. diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index 1942c3a0c9f..aa770c26ed6 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -22,9 +22,10 @@ acceptedMinecraftVersions = "[1.12.2,1.13)", version = GTInternalTags.VERSION, dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + - "after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + - "after:genetics;" + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + - "after:groovyscript@[0.7.0,);" + "after:theoneprobe;" + "after:hwyla;") + "required-after:modularui@[2.3,);" + "required-after:mixinbooter@[8.0,);" + "after:appliedenergistics2;" + + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + "after:genetics;" + "after:magicbees;" + + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[0.7.0,);" + + "after:theoneprobe;" + "after:hwyla;") public class GregTechMod { // Hold this so that we can reference non-interface methods without diff --git a/src/main/java/gregtech/api/GregTechAPI.java b/src/main/java/gregtech/api/GregTechAPI.java index 14188ff6bfa..f3279eb5b3b 100644 --- a/src/main/java/gregtech/api/GregTechAPI.java +++ b/src/main/java/gregtech/api/GregTechAPI.java @@ -67,6 +67,7 @@ public class GregTechAPI { public static final GTControlledRegistry MTE_REGISTRY = new GTControlledRegistry<>( Short.MAX_VALUE); + @Deprecated public static final GTControlledRegistry UI_FACTORY_REGISTRY = new GTControlledRegistry<>( Short.MAX_VALUE); public static final GTControlledRegistry COVER_REGISTRY = new GTControlledRegistry<>( diff --git a/src/main/java/gregtech/api/cover/CoverUIFactory.java b/src/main/java/gregtech/api/cover/CoverUIFactory.java index a21cd057d44..1716cbeda27 100644 --- a/src/main/java/gregtech/api/cover/CoverUIFactory.java +++ b/src/main/java/gregtech/api/cover/CoverUIFactory.java @@ -13,6 +13,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +@Deprecated public final class CoverUIFactory extends UIFactory { public static final CoverUIFactory INSTANCE = new CoverUIFactory(); diff --git a/src/main/java/gregtech/api/cover/CoverWithUI.java b/src/main/java/gregtech/api/cover/CoverWithUI.java index eb7dfcad582..029f82f058c 100644 --- a/src/main/java/gregtech/api/cover/CoverWithUI.java +++ b/src/main/java/gregtech/api/cover/CoverWithUI.java @@ -2,17 +2,56 @@ import gregtech.api.gui.IUIHolder; import gregtech.api.gui.ModularUI; +import gregtech.api.mui.GTGuiTheme; +import gregtech.api.mui.GTGuis; +import gregtech.api.mui.GregTechGuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -public interface CoverWithUI extends Cover, IUIHolder { +import com.cleanroommc.modularui.api.IGuiHolder; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import org.jetbrains.annotations.ApiStatus; + +public interface CoverWithUI extends Cover, IUIHolder, IGuiHolder { + + @ApiStatus.Experimental + default boolean usesMui2() { + return false; + } default void openUI(EntityPlayerMP player) { - CoverUIFactory.INSTANCE.openUI(this, player); + if (usesMui2()) { + GTGuis.getCoverUiInfo(getAttachedSide()) + .open(player, getCoverableView().getWorld(), getCoverableView().getPos()); + } else { + CoverUIFactory.INSTANCE.openUI(this, player); + } + } + + @Deprecated + default ModularUI createUI(EntityPlayer player) { + return null; + } + + @ApiStatus.NonExtendable + @Override + default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { + return new GregTechGuiScreen(mainPanel, getUITheme()); + } + + default GTGuiTheme getUITheme() { + return GTGuiTheme.STANDARD; } - ModularUI createUI(EntityPlayer player); + @Override + default ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + return null; + } @Override default boolean isValid() { diff --git a/src/main/java/gregtech/api/gui/GuiTextures.java b/src/main/java/gregtech/api/gui/GuiTextures.java index 20936a052b2..698540b1e6e 100644 --- a/src/main/java/gregtech/api/gui/GuiTextures.java +++ b/src/main/java/gregtech/api/gui/GuiTextures.java @@ -21,8 +21,10 @@ public class GuiTextures { // BASE TEXTURES public static final TextureArea BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/background.png", 176, 166, 3, 3); + // todo try to remove public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea .fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4); + // todo try to remove public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea .fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11); public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("textures/gui/base/background_%s.png", diff --git a/src/main/java/gregtech/api/gui/package-info.java b/src/main/java/gregtech/api/gui/package-info.java new file mode 100644 index 00000000000..f17b0c3af12 --- /dev/null +++ b/src/main/java/gregtech/api/gui/package-info.java @@ -0,0 +1,2 @@ +@Deprecated +package gregtech.api.gui; diff --git a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java index 796cfeaf535..dd8b5027fa0 100644 --- a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java +++ b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java @@ -2,14 +2,42 @@ import gregtech.api.gui.ModularUI; import gregtech.api.items.metaitem.stats.IItemComponent; +import gregtech.api.mui.GTGuiTheme; +import gregtech.api.mui.GregTechGuiScreen; import net.minecraft.entity.player.EntityPlayer; -public interface ItemUIFactory extends IItemComponent { +import com.cleanroommc.modularui.api.IGuiHolder; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import org.jetbrains.annotations.ApiStatus; + +public interface ItemUIFactory extends IItemComponent, IGuiHolder { /** * Creates new UI basing on given holder. Holder contains information * about item stack and hand, and also player */ - ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer); + @Deprecated + default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { + return null; + } + + @ApiStatus.NonExtendable + @Override + default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { + return new GregTechGuiScreen(mainPanel, getUITheme()); + } + + default GTGuiTheme getUITheme() { + return GTGuiTheme.STANDARD; + } + + @Override + default ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + return null; + } } diff --git a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java index e9be886107d..146d3bcb54c 100644 --- a/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java +++ b/src/main/java/gregtech/api/items/gui/PlayerInventoryUIFactory.java @@ -19,6 +19,7 @@ /** * {@link UIFactory} implementation for {@link MetaItem}s */ +@Deprecated public class PlayerInventoryUIFactory extends UIFactory { public static final PlayerInventoryUIFactory INSTANCE = new PlayerInventoryUIFactory(); diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 1412a674817..1bcf47c1a2d 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -15,6 +15,9 @@ import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.interfaces.ISyncedTileEntity; +import gregtech.api.mui.GTGuiTheme; +import gregtech.api.mui.GTGuis; +import gregtech.api.mui.GregTechGuiScreen; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.GTLog; import gregtech.api.util.GTTransferUtils; @@ -66,6 +69,11 @@ import codechicken.lib.texture.TextureUtils; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.IGuiHolder; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -82,7 +90,7 @@ import static gregtech.api.capability.GregtechDataCodes.*; -public abstract class MetaTileEntity implements ISyncedTileEntity, CoverHolder, IVoidable { +public abstract class MetaTileEntity implements ISyncedTileEntity, CoverHolder, IVoidable, IGuiHolder { public static final IndexedCuboid6 FULL_CUBE_COLLISION = new IndexedCuboid6(null, Cuboid6.full); @@ -412,12 +420,36 @@ protected boolean openGUIOnRightClick() { * @param entityPlayer player opening inventory * @return freshly created UI instance */ - protected abstract ModularUI createUI(EntityPlayer entityPlayer); + @Deprecated + protected ModularUI createUI(EntityPlayer entityPlayer) { + return null; + } + @Deprecated public ModularUI getModularUI(EntityPlayer entityPlayer) { return createUI(entityPlayer); } + @ApiStatus.Experimental + public boolean usesMui2() { + return false; + } + + @Override + public final ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { + return new GregTechGuiScreen(mainPanel, getUITheme()); + } + + public GTGuiTheme getUITheme() { + return GTGuiTheme.STANDARD; + } + + @Override + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + return null; + } + public final void onCoverLeftClick(EntityPlayer playerIn, CuboidRayTraceResult result) { Cover cover = getCoverAtSide(result.sideHit); if (cover == null || !cover.onLeftClick(playerIn, result)) { @@ -435,7 +467,11 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac ItemStack heldStack = playerIn.getHeldItem(hand); if (!playerIn.isSneaking() && openGUIOnRightClick()) { if (getWorld() != null && !getWorld().isRemote) { - MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn); + if (usesMui2()) { + GTGuis.MTE.open(playerIn, getWorld(), getPos()); + } else { + MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn); + } } return true; } else { diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java index 43dd60efea2..8486ddf30c4 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntityUIFactory.java @@ -15,6 +15,7 @@ /** * {@link UIFactory} implementation for {@link MetaTileEntity} */ +@Deprecated public class MetaTileEntityUIFactory extends UIFactory { public static final MetaTileEntityUIFactory INSTANCE = new MetaTileEntityUIFactory(); diff --git a/src/main/java/gregtech/api/mui/GTGuiTextures.java b/src/main/java/gregtech/api/mui/GTGuiTextures.java new file mode 100644 index 00000000000..b590d0daf50 --- /dev/null +++ b/src/main/java/gregtech/api/mui/GTGuiTextures.java @@ -0,0 +1,75 @@ +package gregtech.api.mui; + +import gregtech.api.GTValues; + +import com.cleanroommc.modularui.drawable.UITexture; + +// TODO: Move primitive slot and background to "textures/gui/base" +public class GTGuiTextures { + + // Keys used for GT assets registered for use in Themes + public static class IDs { + + public static final String STANDARD_BACKGROUND = "gregtech_standard_bg"; + public static final String BRONZE_BACKGROUND = "gregtech_bronze_bg"; + public static final String STEEL_BACKGROUND = "gregtech_steel_bg"; + public static final String PRIMITIVE_BACKGROUND = "gregtech_primitive_bg"; + + public static final String BRONZE_SLOT = "gregtech_bronze_slot"; + public static final String STEEL_SLOT = "gregtech_steel_slot"; + public static final String PRIMITIVE_SLOT = "gregtech_primitive_slot"; + } + + // BACKGROUNDS + public static final UITexture BACKGROUND = UITexture.builder() + .location(GTValues.MODID, "textures/gui/base/background.png") + .imageSize(176, 166) + .adaptable(3) + .registerAsBackground(IDs.STANDARD_BACKGROUND, true) + .build(); + + public static final UITexture BACKGROUND_BRONZE = UITexture.builder() + .location(GTValues.MODID, "textures/gui/base/background_bronze.png") + .imageSize(176, 166) + .adaptable(3) + .registerAsBackground(IDs.BRONZE_BACKGROUND) + .build(); + + public static final UITexture BACKGROUND_STEEL = UITexture.builder() + .location(GTValues.MODID, "textures/gui/base/background_steel.png") + .imageSize(176, 166) + .adaptable(3) + .registerAsBackground(IDs.STEEL_BACKGROUND) + .build(); + + public static final UITexture BACKGROUND_PRIMITIVE = UITexture.builder() + .location(GTValues.MODID, "textures/gui/primitive/primitive_background.png") + .imageSize(176, 166) + .adaptable(3) + .registerAsBackground(IDs.PRIMITIVE_BACKGROUND) + .build(); + + // SLOTS + public static final UITexture SLOT_BRONZE = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/slot_bronze.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsBackground(IDs.BRONZE_SLOT) + .build(); + + public static final UITexture SLOT_STEEL = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/slot_steel.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsBackground(IDs.STEEL_SLOT) + .build(); + + public static final UITexture SLOT_PRIMITIVE = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/primitive/primitive_slot.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsBackground(IDs.PRIMITIVE_SLOT) + .build(); + + public static void init() {/**/} +} diff --git a/src/main/java/gregtech/api/mui/GTGuiTheme.java b/src/main/java/gregtech/api/mui/GTGuiTheme.java new file mode 100644 index 00000000000..cf1d5819cb7 --- /dev/null +++ b/src/main/java/gregtech/api/mui/GTGuiTheme.java @@ -0,0 +1,274 @@ +package gregtech.api.mui; + +import gregtech.common.ConfigHolder; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import com.cleanroommc.modularui.api.IThemeApi; +import com.cleanroommc.modularui.theme.ReloadThemeEvent; +import com.cleanroommc.modularui.utils.JsonBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +public class GTGuiTheme { + + private static final List THEMES = new ArrayList<>(); + + public static final GTGuiTheme STANDARD = new Builder("gregtech_standard") + .panel(GTGuiTextures.IDs.STANDARD_BACKGROUND) + .color(ConfigHolder.client.defaultUIColor) + .build(); + + public static final GTGuiTheme BRONZE = new Builder("gregtech_bronze") + .panel(GTGuiTextures.IDs.BRONZE_BACKGROUND) + .itemSlot(GTGuiTextures.IDs.BRONZE_SLOT) + .build(); + + public static final GTGuiTheme STEEL = new Builder("gregtech_steel") + .panel(GTGuiTextures.IDs.STEEL_BACKGROUND) + .itemSlot(GTGuiTextures.IDs.STEEL_SLOT) + .build(); + + public static final GTGuiTheme PRIMITIVE = new Builder("gregtech_primitive") + .panel(GTGuiTextures.IDs.PRIMITIVE_BACKGROUND) + .itemSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT) + .build(); + + private final String themeId; + + private final List> elementBuilder; + private final JsonBuilder jsonBuilder; + + private GTGuiTheme(String themeId) { + this.themeId = themeId; + this.jsonBuilder = new JsonBuilder(); + this.elementBuilder = new ArrayList<>(); + THEMES.add(this); + } + + public String getId() { + return themeId; + } + + private void register() { + buildJson(); + IThemeApi.get().registerTheme(themeId, jsonBuilder); + } + + private void buildJson() { + elementBuilder.forEach(c -> c.accept(jsonBuilder)); + } + + public static void registerThemes() { + MinecraftForge.EVENT_BUS.register(GTGuiTheme.class); + THEMES.forEach(GTGuiTheme::register); + } + + @SubscribeEvent + public static void onReloadThemes(ReloadThemeEvent.Pre event) { + THEMES.forEach(GTGuiTheme::buildJson); + } + + public static class Builder { + + private final GTGuiTheme theme; + + public Builder(String themeId) { + theme = new GTGuiTheme(themeId); + } + + /** + * Set a parent theme for this theme, which unset values will inherit from. + * If not set, it will use the default theme as the parent (VANILLA). + */ + public Builder parent(String parentId) { + theme.elementBuilder.add(b -> b.add("parent", parentId)); + return this; + } + + /** + * Set a background fallback for when specific widgets do not set their own. + */ + public Builder globalBackground(String backgroundId) { + theme.elementBuilder.add(b -> b.add("background", backgroundId)); + return this; + } + + /** + * Set a tooltip hover background fallback for when specific widgets do not set their own. + */ + public Builder globalHoverBackground(String hoverBackgroundId) { + theme.elementBuilder.add(b -> b.add("hoverBackground", hoverBackgroundId)); + return this; + } + + /** Set a global UI coloration for this theme. */ + public Builder color(int color) { + theme.elementBuilder.add(b -> b.add("color", color)); + return this; + } + + /** Set a global UI text coloration for this theme. */ + public Builder textColor(int textColor) { + theme.elementBuilder.add(b -> b.add("textColor", textColor)); + return this; + } + + /** Enable text shadow for the global UI text for this theme. */ + public Builder textShadow() { + theme.elementBuilder.add(b -> b.add("textShadow", true)); + return this; + } + + /** + * Set a custom panel (background texture) for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerBackground}! + */ + public Builder panel(String panelId) { + theme.elementBuilder.add(b -> b + .add("panel", new JsonBuilder() + .add("background", new JsonBuilder() + .add("type", "texture") + .add("id", panelId)))); + return this; + } + + /** + * Set a custom button texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + */ + public Builder button(String buttonId) { + return button(buttonId, 0xFFFFFFFF, false); + } + + /** + * Set a custom button texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + * + * @param buttonId The ID of the button texture + * @param textColor The color of text overlaid on this button + * @param textShadow If text overlaid on this button should have a text shadow + */ + public Builder button(String buttonId, int textColor, boolean textShadow) { + theme.elementBuilder.add(b -> b + .add("button", new JsonBuilder() + .add("background", new JsonBuilder() + .add("type", "texture") + .add("id", buttonId)) + .add("textColor", textColor) + .add("textShadow", textShadow))); + return this; + } + + /** + * Set a custom item slot texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + */ + public Builder itemSlot(String itemSlotId) { + return itemSlot(itemSlotId, 0x60FFFFFF); + } + + /** + * Set a custom item slot texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + * + * @param itemSlotId The ID of the item slot texture + * @param hoverColor The color of the tooltip hover box for this widget + */ + public Builder itemSlot(String itemSlotId, int hoverColor) { + theme.elementBuilder.add(b -> b + .add("itemSlot", new JsonBuilder() + .add("background", new JsonBuilder() + .add("type", "texture") + .add("id", itemSlotId)) + .add("slotHoverColor", hoverColor))); + return this; + } + + /** + * Set a custom fluid slot texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + */ + public Builder fluidSlot(String fluidSlotId) { + return fluidSlot(fluidSlotId, 0x60FFFFFF); + } + + /** + * Set a custom fluid slot texture for UIs with this theme. + * This ID must correspond with a {@link com.cleanroommc.modularui.drawable.UITexture} that is + * registered using {@link com.cleanroommc.modularui.drawable.GuiTextures#registerIcon}! + * + * @param fluidSlotId The ID of the fluid slot texture + * @param hoverColor The color of the tooltip hover box for this widget + */ + public Builder fluidSlot(String fluidSlotId, int hoverColor) { + theme.elementBuilder.add(b -> b + .add("fluidSlot", new JsonBuilder() + .add("background", new JsonBuilder() + .add("type", "texture") + .add("id", fluidSlotId)) + .add("slotHoverColor", hoverColor))); + return this; + } + + /** + * Set the text color for text fields in UIs with this theme. + */ + public Builder textField(int textColor) { + return textField(textColor, 0xFF2F72A8); + } + + /** + * Set the text color for text fields in UIs with this theme. + * + * @param textColor Text color + * @param markedColor Color of the highlight on selected text + */ + public Builder textField(int textColor, int markedColor) { + theme.elementBuilder.add(b -> b + .add("textField", new JsonBuilder() + .add("textColor", textColor) + .add("markedColor", markedColor))); + return this; + } + + public Builder toggleButton(String toggleButtonId, String selectedBackgroundId) { + return toggleButton(toggleButtonId, selectedBackgroundId, 0xFFFFFFFF, true); + } + + public Builder toggleButton(String toggleButtonId, String selectedBackgroundId, int textColor, + boolean textShadow) { + return toggleButton(toggleButtonId, selectedBackgroundId, textColor, textShadow, null, 0xFFBBBBBB); + } + + public Builder toggleButton(String toggleButtonId, String selectedBackgroundId, int textColor, + boolean textShadow, String selectedHoverBackgroundId, int selectedColor) { + theme.elementBuilder.add(b -> b + .add("toggleButton", new JsonBuilder() + .add("background", new JsonBuilder() + .add("type", "texture") + .add("id", toggleButtonId)) + .add("textColor", textColor) + .add("textShadow", textShadow) + .add("selectedBackground", new JsonBuilder() + .add("type", "texture") + .add("id", selectedBackgroundId)) + .add("selectedHoverBackground", selectedHoverBackgroundId) + .add("selectedColor", selectedColor))); + return this; + } + + public GTGuiTheme build() { + return theme; + } + } +} diff --git a/src/main/java/gregtech/api/mui/GTGuis.java b/src/main/java/gregtech/api/mui/GTGuis.java new file mode 100644 index 00000000000..35893a3908e --- /dev/null +++ b/src/main/java/gregtech/api/mui/GTGuis.java @@ -0,0 +1,135 @@ +package gregtech.api.mui; + +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.cover.Cover; +import gregtech.api.cover.CoverHolder; +import gregtech.api.cover.CoverWithUI; +import gregtech.api.items.metaitem.MetaItem; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GTUtility; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; + +import com.cleanroommc.modularui.api.IGuiHolder; +import com.cleanroommc.modularui.manager.GuiInfo; +import com.cleanroommc.modularui.screen.ModularPanel; + +import java.util.EnumMap; + +public class GTGuis { + + private static final EnumMap COVERS = new EnumMap<>(EnumFacing.class); + + public static final GuiInfo MTE = GuiInfo.builder() + .clientGui((context, mainPanel) -> { + MetaTileEntity mte = GTUtility.getMetaTileEntity(context.getWorld(), context.getBlockPos()); + if (mte != null) { + return mte.createScreen(context, mainPanel); + } + throw new UnsupportedOperationException(); + }) + .commonGui((context, syncHandler) -> { + MetaTileEntity mte = GTUtility.getMetaTileEntity(context.getWorld(), context.getBlockPos()); + if (mte != null) { + return mte.buildUI(context, syncHandler, context.getWorld().isRemote); + } + throw new UnsupportedOperationException(); + }) + .build(); + + public static final GuiInfo PLAYER_META_ITEM_MAIN_HAND = GuiInfo.builder() + .clientGui((context, mainPanel) -> { + ItemStack itemStack = context.getMainHandItem(); + return getGuiHolder(itemStack).createScreen(context.with(EnumHand.MAIN_HAND), mainPanel); + + }) + .commonGui((context, guiSyncHandler) -> { + ItemStack itemStack = context.getMainHandItem(); + return getGuiHolder(itemStack).buildUI(context.with(EnumHand.MAIN_HAND), guiSyncHandler, + context.getWorld().isRemote); + }) + .build(); + + public static final GuiInfo PLAYER_META_ITEM_OFF_HAND = GuiInfo.builder() + .clientGui((context, mainPanel) -> { + ItemStack itemStack = context.getOffHandItem(); + return getGuiHolder(itemStack).createScreen(context.with(EnumHand.OFF_HAND), mainPanel); + + }) + .commonGui((context, guiSyncHandler) -> { + ItemStack itemStack = context.getOffHandItem(); + return getGuiHolder(itemStack).buildUI(context.with(EnumHand.OFF_HAND), guiSyncHandler, + context.getWorld().isRemote); + }) + .build(); + + public static GuiInfo getMetaItemUiInfo(EnumHand hand) { + return hand == EnumHand.MAIN_HAND ? PLAYER_META_ITEM_MAIN_HAND : PLAYER_META_ITEM_OFF_HAND; + } + + public static GuiInfo getCoverUiInfo(EnumFacing facing) { + return COVERS.get(facing); + } + + public static ModularPanel createPanel(String name, int width, int height) { + return ModularPanel.defaultPanel(name, width, height); + } + + public static ModularPanel createPanel(MetaTileEntity mte, int width, int height) { + return createPanel(mte.metaTileEntityId.getPath(), width, height); + } + + public static ModularPanel createPanel(Cover cover, int width, int height) { + return createPanel(cover.getDefinition().getResourceLocation().getPath(), width, height); + } + + public static ModularPanel createPanel(ItemStack stack, int width, int height) { + MetaItem.MetaValueItem valueItem = ((MetaItem) stack.getItem()).getItem(stack); + if (valueItem == null) throw new IllegalArgumentException("Item must be a meta item!"); + return createPanel(valueItem.unlocalizedName, width, height); + } + + static { + for (EnumFacing facing : EnumFacing.values()) { + COVERS.put(facing, makeCoverUiInfo(facing)); + } + } + + private static GuiInfo makeCoverUiInfo(EnumFacing facing) { + return GuiInfo.builder() + .clientGui((context, mainPanel) -> { + TileEntity te = context.getTileEntity(); + if (te == null) throw new IllegalStateException(); + CoverHolder coverHolder = te.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing); + if (coverHolder == null) throw new IllegalStateException(); + Cover cover = coverHolder.getCoverAtSide(facing); + if (!(cover instanceof CoverWithUI)) throw new IllegalStateException(); + return ((CoverWithUI) cover).createScreen(context, mainPanel); + }) + .commonGui((context, syncHandler) -> { + TileEntity te = context.getTileEntity(); + if (te == null) throw new IllegalStateException(); + CoverHolder coverHolder = te.getCapability(GregtechTileCapabilities.CAPABILITY_COVER_HOLDER, + facing); + if (coverHolder == null) throw new IllegalStateException(); + Cover cover = coverHolder.getCoverAtSide(facing); + if (!(cover instanceof CoverWithUI)) throw new IllegalStateException(); + return ((CoverWithUI) cover).buildUI(context, syncHandler, context.getWorld().isRemote); + }) + .build(); + } + + private static IGuiHolder getGuiHolder(ItemStack stack) { + if (stack.getItem() instanceof MetaItem) { + MetaItem.MetaValueItem valueItem = ((MetaItem) stack.getItem()).getItem(stack); + if (valueItem != null && valueItem.getUIManager() != null) { + return valueItem.getUIManager(); + } + } + throw new IllegalStateException(); + } +} diff --git a/src/main/java/gregtech/api/mui/GregTechGuiScreen.java b/src/main/java/gregtech/api/mui/GregTechGuiScreen.java new file mode 100644 index 00000000000..010ca17af4b --- /dev/null +++ b/src/main/java/gregtech/api/mui/GregTechGuiScreen.java @@ -0,0 +1,26 @@ +package gregtech.api.mui; + +import gregtech.api.GTValues; + +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.ModularScreen; + +public class GregTechGuiScreen extends ModularScreen { + + public GregTechGuiScreen(ModularPanel mainPanel) { + this(mainPanel, GTGuiTheme.STANDARD); + } + + public GregTechGuiScreen(ModularPanel mainPanel, GTGuiTheme theme) { + this(GTValues.MODID, mainPanel, theme); + } + + public GregTechGuiScreen(String owner, ModularPanel mainPanel, GTGuiTheme theme) { + this(owner, mainPanel, theme.getId()); + } + + public GregTechGuiScreen(String owner, ModularPanel mainPanel, String themeId) { + super(owner, mainPanel); + useTheme(themeId); + } +} diff --git a/src/main/java/gregtech/common/covers/CoverStorage.java b/src/main/java/gregtech/common/covers/CoverStorage.java index 5d34cb33b17..a91caa74cb2 100644 --- a/src/main/java/gregtech/common/covers/CoverStorage.java +++ b/src/main/java/gregtech/common/covers/CoverStorage.java @@ -4,8 +4,7 @@ import gregtech.api.cover.CoverDefinition; import gregtech.api.cover.CoverWithUI; import gregtech.api.cover.CoverableView; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; +import gregtech.api.mui.GTGuis; import gregtech.client.renderer.texture.Textures; import net.minecraft.entity.player.EntityPlayer; @@ -23,9 +22,20 @@ import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.layout.Grid; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; +import java.util.List; + public class CoverStorage extends CoverBase implements CoverWithUI { private final ItemStackHandler storageHandler = new ItemStackHandler(9); @@ -73,17 +83,30 @@ public void onRemoval() { } @Override - public ModularUI createUI(EntityPlayer player) { - ModularUI.Builder builder = new ModularUI.Builder(GuiTextures.BACKGROUND, MAX_WIDTH, MAX_HEIGHT); - builder.label(5, 5, "cover.storage.title"); - for (int index = 0; index < storageHandler.getSlots(); index++) { - builder.slot(storageHandler, index, (index * SLOT_SIZE) + 7, (MAX_HEIGHT - SLOT_SIZE * 5) / 2, true, true, - GuiTextures.SLOT); - } - - builder.bindPlayerInventory(player.inventory, (MAX_HEIGHT - SLOT_SIZE * 2) / 2 - 1); + public boolean usesMui2() { + return true; + } - return builder.build(this, player); + @Override + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + guiSyncManager.registerSlotGroup("item_inv", this.storageHandler.getSlots()); + + int rowSize = this.storageHandler.getSlots(); + List> widgets = new ArrayList<>(); + widgets.add(new ArrayList<>()); + for (int i = 0; i < rowSize; i++) { + widgets.get(0) + .add(new ItemSlot().slot(SyncHandlers.itemSlot(this.storageHandler, i).slotGroup("item_inv"))); + } + return GTGuis.createPanel(this, MAX_WIDTH, MAX_HEIGHT) + .child(IKey.lang("cover.storage.title").asWidget().pos(5, 5)) + .bindPlayerInventory() + .child(new Grid() + .top((MAX_HEIGHT - SLOT_SIZE * 5) / 2).left(7).right(7).height(18) + .minElementMargin(0, 0) + .minColWidth(18).minRowHeight(18) + .matrix(widgets)); } /** diff --git a/src/main/java/gregtech/common/gui/package-info.java b/src/main/java/gregtech/common/gui/package-info.java new file mode 100644 index 00000000000..00cc7c2ad0b --- /dev/null +++ b/src/main/java/gregtech/common/gui/package-info.java @@ -0,0 +1,2 @@ +@Deprecated +package gregtech.common.gui; diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index 0588cfc1b83..06422a7a77b 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -1,15 +1,11 @@ package gregtech.common.items.behaviors; import gregtech.api.capability.IGhostSlotConfigurable; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.ClickButtonWidget; -import gregtech.api.gui.widgets.DynamicLabelWidget; import gregtech.api.items.gui.ItemUIFactory; -import gregtech.api.items.gui.PlayerInventoryHolder; import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.mui.GTGuis; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; @@ -21,6 +17,18 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import com.cleanroommc.modularui.api.drawable.IDrawable; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.drawable.ItemDrawable; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.value.sync.InteractionSyncHandler; +import com.cleanroommc.modularui.widgets.ButtonWidget; +import com.cleanroommc.modularui.widgets.layout.Grid; + +import java.util.ArrayList; import java.util.List; public class IntCircuitBehaviour implements IItemBehaviour, ItemUIFactory, ISubItemHandler { @@ -49,28 +57,50 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack heldItem = player.getHeldItem(hand); if (!world.isRemote) { - PlayerInventoryHolder holder = new PlayerInventoryHolder(player, hand); - holder.openUI(); + GTGuis.getMetaItemUiInfo(hand).open(player); } return ActionResult.newResult(EnumActionResult.SUCCESS, heldItem); } @Override - public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) { - return ModularUI.builder(GuiTextures.BACKGROUND, 176, 60) - .label(9, 8, "metaitem.circuit.integrated.gui") - .widget(new DynamicLabelWidget(82, 30, - () -> Integer.toString(IntCircuitIngredient.getCircuitConfiguration(holder.getCurrentItem())), - 0x4D4040)) - .widget(new ClickButtonWidget(15, 24, 20, 20, "-5", - data -> IntCircuitIngredient.adjustConfiguration(holder, -5))) - .widget(new ClickButtonWidget(50, 24, 20, 20, "-1", - data -> IntCircuitIngredient.adjustConfiguration(holder, -1))) - .widget(new ClickButtonWidget(104, 24, 20, 20, "+1", - data -> IntCircuitIngredient.adjustConfiguration(holder, +1))) - .widget(new ClickButtonWidget(141, 24, 20, 20, "+5", - data -> IntCircuitIngredient.adjustConfiguration(holder, +5))) - .build(holder, entityPlayer); + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + ItemDrawable circuitPreview = new ItemDrawable(guiCreationContext.getUsedItemStack()); + for (int i = 0; i <= 32; i++) { + int finalI = i; + guiSyncManager.syncValue("config", i, new InteractionSyncHandler() + .setOnMousePressed(b -> { + ItemStack item = IntCircuitIngredient.getIntegratedCircuit(finalI); + item.setCount(guiCreationContext.getUsedItemStack().getCount()); + circuitPreview.setItem(item); + guiCreationContext.getPlayer().setHeldItem(guiCreationContext.getUsedHand(), item); + })); + } + + List> options = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + options.add(new ArrayList<>()); + for (int j = 0; j < 9; j++) { + int index = i * 9 + j; + if (index > 32) break; + options.get(i).add(new ButtonWidget<>() + .size(18) + .background(com.cleanroommc.modularui.drawable.GuiTextures.SLOT, + new ItemDrawable(IntCircuitIngredient.getIntegratedCircuit(index)).asIcon().size(16)) + .syncHandler("config", index)); + } + } + return GTGuis.createPanel(guiCreationContext.getUsedItemStack(), 176, 120) + .child(IKey.lang("metaitem.circuit.integrated.gui").asWidget().pos(5, 5)) + .child(new IDrawable.DrawableWidget(circuitPreview.asIcon().size(16)) + .size(18) + .top(19).alignX(0.5f) + .background(com.cleanroommc.modularui.drawable.GuiTextures.SLOT)) + .child(new Grid() + .left(7).right(7).top(41).height(4 * 18) + .matrix(options) + .minColWidth(18).minRowHeight(18) + .minElementMargin(0, 0)); } @Override diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index a6ff769f8ec..dcee3394859 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -1009,19 +1009,19 @@ public static void init() { // Crates, IDs 1625-1639 WOODEN_CRATE = registerMetaTileEntity(1625, - new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27)); + new MetaTileEntityCrate(gregtechId("crate.wood"), Materials.Wood, 27, 9)); BRONZE_CRATE = registerMetaTileEntity(1626, - new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54)); + new MetaTileEntityCrate(gregtechId("crate.bronze"), Materials.Bronze, 54, 9)); STEEL_CRATE = registerMetaTileEntity(1627, - new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72)); + new MetaTileEntityCrate(gregtechId("crate.steel"), Materials.Steel, 72, 9)); ALUMINIUM_CRATE = registerMetaTileEntity(1628, - new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90)); + new MetaTileEntityCrate(gregtechId("crate.aluminium"), Materials.Aluminium, 90, 10)); STAINLESS_STEEL_CRATE = registerMetaTileEntity(1629, - new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108)); + new MetaTileEntityCrate(gregtechId("crate.stainless_steel"), Materials.StainlessSteel, 108, 12)); TITANIUM_CRATE = registerMetaTileEntity(1630, - new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126)); + new MetaTileEntityCrate(gregtechId("crate.titanium"), Materials.Titanium, 126, 14)); TUNGSTENSTEEL_CRATE = registerMetaTileEntity(1631, - new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144)); + new MetaTileEntityCrate(gregtechId("crate.tungstensteel"), Materials.TungstenSteel, 144, 16)); // Rotor Holder, IDs 1640-1645 ROTOR_HOLDER[0] = registerMetaTileEntity(1640, diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index 1a7d5c00752..a3680aadfd1 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -1,12 +1,10 @@ package gregtech.common.metatileentities.storage; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.ModularUI.Builder; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.mui.GTGuis; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; @@ -33,9 +31,18 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.layout.Grid; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import static gregtech.api.capability.GregtechDataCodes.IS_TAPED; @@ -45,20 +52,22 @@ public class MetaTileEntityCrate extends MetaTileEntity { private final Material material; private final int inventorySize; + private final int rowSize; protected ItemStackHandler inventory; private boolean isTaped; private final String TAPED_NBT = "Taped"; - public MetaTileEntityCrate(ResourceLocation metaTileEntityId, Material material, int inventorySize) { + public MetaTileEntityCrate(ResourceLocation metaTileEntityId, Material material, int inventorySize, int rowSize) { super(metaTileEntityId); this.material = material; this.inventorySize = inventorySize; + this.rowSize = rowSize; initializeInventory(); } @Override public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityCrate(metaTileEntityId, material, inventorySize); + return new MetaTileEntityCrate(metaTileEntityId, material, inventorySize, rowSize); } @Override @@ -132,18 +141,32 @@ public int getDefaultPaintingColor() { } @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - int factor = inventorySize / 9 > 8 ? 18 : 9; - Builder builder = ModularUI - .builder(GuiTextures.BACKGROUND, 176 + (factor == 18 ? 176 : 0), 8 + inventorySize / factor * 18 + 104) - .label(5, 5, getMetaFullName()); - for (int i = 0; i < inventorySize; i++) { - builder.slot(inventory, i, 7 * (factor == 18 ? 2 : 1) + i % factor * 18, 18 + i / factor * 18, - GuiTextures.SLOT); + public boolean usesMui2() { + return true; + } + + @Override + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + guiSyncManager.registerSlotGroup("item_inv", rowSize); + + int rows = inventorySize / rowSize; + List> widgets = new ArrayList<>(); + for (int i = 0; i < rows; i++) { + widgets.add(new ArrayList<>()); + for (int j = 0; j < this.rowSize; j++) { + widgets.get(i).add(new ItemSlot().slot(SyncHandlers.itemSlot(inventory, i * rowSize + j) + .slotGroup("item_inv"))); + } } - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7 + (factor == 18 ? 88 : 0), - 18 + inventorySize / factor * 18 + 11); - return builder.build(getHolder(), entityPlayer); + return GTGuis.createPanel(this, rowSize * 18 + 14, 18 + 4 * 18 + 5 + 14 + 18 * rows) + .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) + .bindPlayerInventory() + .child(new Grid() + .top(18).left(7).right(7).height(rows * 18) + .minElementMargin(0, 0) + .minColWidth(18).minRowHeight(18) + .matrix(widgets)); } @Override diff --git a/src/main/java/gregtech/core/CoreModule.java b/src/main/java/gregtech/core/CoreModule.java index c063eec5c15..56c1196049e 100644 --- a/src/main/java/gregtech/core/CoreModule.java +++ b/src/main/java/gregtech/core/CoreModule.java @@ -13,6 +13,8 @@ import gregtech.api.metatileentity.MetaTileEntityUIFactory; import gregtech.api.modules.GregTechModule; import gregtech.api.modules.IGregTechModule; +import gregtech.api.mui.GTGuiTextures; +import gregtech.api.mui.GTGuiTheme; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.TemperatureProperty; @@ -128,6 +130,10 @@ public void preInit(FMLPreInitializationEvent event) { GregTechAPI.soundManager = SoundManager.getInstance(); GTSoundEvents.register(); + /* MUI Initialization */ + GTGuiTextures.init(); + GTGuiTheme.registerThemes(); + /* Start UI Factory Registration */ UI_FACTORY_REGISTRY.unfreeze(); logger.info("Registering GTCEu UI Factories"); From 5ff7f4b7505bed0b260986c03ecca9d646415ed7 Mon Sep 17 00:00:00 2001 From: Tictim Date: Fri, 8 Dec 2023 12:15:19 +0900 Subject: [PATCH 65/77] editorconfig edit (#2263) --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 61a63aa508c..b0a6ecee059 100644 --- a/.editorconfig +++ b/.editorconfig @@ -125,7 +125,7 @@ ij_java_keep_first_column_comment = false ij_java_keep_indents_on_empty_lines = false ij_java_keep_line_breaks = true ij_java_keep_multiple_expressions_in_one_line = false -ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = true ij_java_keep_simple_classes_in_one_line = true ij_java_keep_simple_lambdas_in_one_line = true ij_java_keep_simple_methods_in_one_line = true From e9e093721a65c6bd4930c6013309f5a3a57fdb3c Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Thu, 7 Dec 2023 21:18:46 -0600 Subject: [PATCH 66/77] Add MUI and mixinbooter to CF mod deps (#2265) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e7b28291e09..2cc4c9a9e46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -117,7 +117,7 @@ curseForgeProjectId = # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], # and the name is the CurseForge project slug of the other mod. # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft -curseForgeRelations = requiredDependency:codechicken-lib-1-8;incompatible:gregtechce +curseForgeRelations = requiredDependency:codechicken-lib-1-8;requiredDependency:modularui;requiredDependency:mixin-booter;incompatible:gregtechce # This project's release type on CurseForge and/or Modrinth # Allowed types: release, beta, alpha From ad7c6c236e50ad5b1931292b4df8e0eb9783ed1d Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:49:12 -0600 Subject: [PATCH 67/77] Fix fluid output trim losing some fluids (#2268) --- src/main/java/gregtech/api/recipes/Recipe.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/api/recipes/Recipe.java b/src/main/java/gregtech/api/recipes/Recipe.java index e09519f4dde..b291f994301 100644 --- a/src/main/java/gregtech/api/recipes/Recipe.java +++ b/src/main/java/gregtech/api/recipes/Recipe.java @@ -562,23 +562,24 @@ public Pair, List> getFluidAndChanceOutputs outputs.addAll(GTUtility.copyFluidList(getFluidOutputs())); } // If just the regular outputs would satisfy the outputLimit - else if (getOutputs().size() >= outputLimit) { + else if (getFluidOutputs().size() >= outputLimit) { outputs.addAll( - GTUtility.copyFluidList(getFluidOutputs()).subList(0, Math.min(outputLimit, getOutputs().size()))); + GTUtility.copyFluidList(getFluidOutputs()).subList(0, + Math.min(outputLimit, getFluidOutputs().size()))); // clear the chanced outputs, as we are only getting regular outputs chancedOutputs.clear(); } // If the regular outputs and chanced outputs are required to satisfy the outputLimit - else if (!getOutputs().isEmpty() && (getOutputs().size() + chancedOutputs.size()) >= outputLimit) { + else if (!getFluidOutputs().isEmpty() && (getFluidOutputs().size() + chancedOutputs.size()) >= outputLimit) { outputs.addAll(GTUtility.copyFluidList(getFluidOutputs())); // Calculate the number of chanced outputs after adding all the regular outputs - int numChanced = outputLimit - getOutputs().size(); + int numChanced = outputLimit - getFluidOutputs().size(); chancedOutputs = chancedOutputs.subList(0, Math.min(numChanced, chancedOutputs.size())); } // There are only chanced outputs to satisfy the outputLimit - else if (getOutputs().isEmpty()) { + else if (getFluidOutputs().isEmpty()) { chancedOutputs = chancedOutputs.subList(0, Math.min(outputLimit, chancedOutputs.size())); } // The number of outputs + chanced outputs is lower than the trim number, so just add everything From 7cb9d7be96bb0bb4d24f0036398ff8970e0a03f0 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 9 Dec 2023 19:30:35 -0600 Subject: [PATCH 68/77] MUI for multiblock I/O buses (#2266) --- .../java/gregtech/api/mui/GTGuiTextures.java | 38 ++++ .../java/gregtech/api/mui/GTGuiTheme.java | 8 + .../mui/widget/GhostCircuitSlotWidget.java | 212 ++++++++++++++++++ .../items/behaviors/IntCircuitBehaviour.java | 8 +- .../multiblockpart/MetaTileEntityItemBus.java | 166 ++++++++------ .../MetaTileEntitySteamItemBus.java | 60 +++-- .../resources/assets/gregtech/lang/en_us.lang | 10 +- .../gregtech/textures/gui/widget/button.png | Bin 0 -> 1794 bytes .../widget/button_auto_collapse_overlay.png | Bin 0 -> 217 bytes .../textures/gui/widget/button_x_overlay.png | Bin 0 -> 1849 bytes 10 files changed, 405 insertions(+), 97 deletions(-) create mode 100644 src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java create mode 100644 src/main/resources/assets/gregtech/textures/gui/widget/button.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/widget/button_auto_collapse_overlay.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/widget/button_x_overlay.png diff --git a/src/main/java/gregtech/api/mui/GTGuiTextures.java b/src/main/java/gregtech/api/mui/GTGuiTextures.java index b590d0daf50..7116772755b 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTextures.java +++ b/src/main/java/gregtech/api/mui/GTGuiTextures.java @@ -15,11 +15,18 @@ public static class IDs { public static final String STEEL_BACKGROUND = "gregtech_steel_bg"; public static final String PRIMITIVE_BACKGROUND = "gregtech_primitive_bg"; + public static final String STANDARD_SLOT = "gregtech_standard_slot"; public static final String BRONZE_SLOT = "gregtech_bronze_slot"; public static final String STEEL_SLOT = "gregtech_steel_slot"; public static final String PRIMITIVE_SLOT = "gregtech_primitive_slot"; + + public static final String STANDARD_BUTTON = "gregtech_standard_button"; } + // GT LOGOS + public static final UITexture GREGTECH_LOGO = UITexture.fullImage(GTValues.MODID, + "textures/gui/icon/gregtech_logo.png"); + // BACKGROUNDS public static final UITexture BACKGROUND = UITexture.builder() .location(GTValues.MODID, "textures/gui/base/background.png") @@ -50,6 +57,13 @@ public static class IDs { .build(); // SLOTS + public static final UITexture SLOT = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/slot.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsBackground(IDs.STANDARD_SLOT, true) + .build(); + public static final UITexture SLOT_BRONZE = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/base/slot_bronze.png") .imageSize(18, 18) @@ -71,5 +85,29 @@ public static class IDs { .registerAsBackground(IDs.PRIMITIVE_SLOT) .build(); + // SLOT OVERLAYS + + public static final UITexture INT_CIRCUIT_OVERLAY = UITexture.fullImage(GTValues.MODID, + "textures/gui/overlay/int_circuit_overlay.png", true); + + // BUTTONS + + public static final UITexture BUTTON = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/widget/button.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsIcon(IDs.STANDARD_BUTTON) + .canApplyTheme() + .build(); + + public static final UITexture BUTTON_ITEM_OUTPUT = UITexture.fullImage(GTValues.MODID, + "textures/gui/widget/button_item_output_overlay.png"); + + public static final UITexture BUTTON_AUTO_COLLAPSE = UITexture.fullImage(GTValues.MODID, + "textures/gui/widget/button_auto_collapse_overlay.png"); + + public static final UITexture BUTTON_X = UITexture.fullImage(GTValues.MODID, + "textures/gui/widget/button_x_overlay.png", true); + public static void init() {/**/} } diff --git a/src/main/java/gregtech/api/mui/GTGuiTheme.java b/src/main/java/gregtech/api/mui/GTGuiTheme.java index cf1d5819cb7..42999e3d1a3 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTheme.java +++ b/src/main/java/gregtech/api/mui/GTGuiTheme.java @@ -19,7 +19,11 @@ public class GTGuiTheme { public static final GTGuiTheme STANDARD = new Builder("gregtech_standard") .panel(GTGuiTextures.IDs.STANDARD_BACKGROUND) + .itemSlot(GTGuiTextures.IDs.STANDARD_SLOT) .color(ConfigHolder.client.defaultUIColor) + .toggleButton(GTGuiTextures.IDs.STANDARD_BUTTON, + GTGuiTextures.IDs.STANDARD_SLOT, + ConfigHolder.client.defaultUIColor) .build(); public static final GTGuiTheme BRONZE = new Builder("gregtech_bronze") @@ -245,6 +249,10 @@ public Builder toggleButton(String toggleButtonId, String selectedBackgroundId) return toggleButton(toggleButtonId, selectedBackgroundId, 0xFFFFFFFF, true); } + public Builder toggleButton(String toggleButtonId, String selectedBackgroundId, int selectedColor) { + return toggleButton(toggleButtonId, selectedBackgroundId, 0xFFFFFFFF, true, null, selectedColor); + } + public Builder toggleButton(String toggleButtonId, String selectedBackgroundId, int textColor, boolean textShadow) { return toggleButton(toggleButtonId, selectedBackgroundId, textColor, textShadow, null, 0xFFBBBBBB); diff --git a/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java b/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java new file mode 100644 index 00000000000..bab12d1013b --- /dev/null +++ b/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java @@ -0,0 +1,212 @@ +package gregtech.api.mui.widget; + +import gregtech.api.capability.impl.GhostCircuitItemStackHandler; +import gregtech.api.mui.GTGuiTextures; +import gregtech.api.mui.GTGuis; +import gregtech.api.recipes.ingredients.IntCircuitIngredient; +import gregtech.client.utils.TooltipHelper; + +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraftforge.items.IItemHandler; + +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.drawable.ItemDrawable; +import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.screen.Tooltip; +import com.cleanroommc.modularui.utils.MouseData; +import com.cleanroommc.modularui.value.sync.ItemSlotSH; +import com.cleanroommc.modularui.widgets.ButtonWidget; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ModularSlot; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class GhostCircuitSlotWidget extends ItemSlot { + + private static final int SYNC_CIRCUIT_INDEX = 10; + + public GhostCircuitSlotWidget() { + tooltipBuilder(this::getCircuitSlotTooltip); + } + + @Override + public @NotNull Result onMousePressed(int mouseButton) { + if (!isSelectorPanelOpen()) { + if (mouseButton == 0 && TooltipHelper.isShiftDown()) { + createSelectorPanel(); + } else { + MouseData mouseData = MouseData.create(mouseButton); + getSyncHandler().syncToServer(2, mouseData::writeToPacket); + } + } + return Result.SUCCESS; + } + + @Override + public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) { + if (isSelectorPanelOpen()) return true; + MouseData mouseData = MouseData.create(scrollDirection.modifier); + getSyncHandler().syncToServer(3, mouseData::writeToPacket); + return false; + } + + @Override + public ItemSlot slot(ModularSlot slot) { + ItemSlotSH sh = new GhostCircuitSyncHandler(slot); + isValidSyncHandler(sh); + setSyncHandler(sh); + return this; + } + + @Override + protected List getItemTooltip(ItemStack stack) { + // we don't want the item tooltip + return Collections.emptyList(); + } + + protected void getCircuitSlotTooltip(@NotNull Tooltip tooltip) { + String configString; + int value = getSyncHandler().getGhostCircuitHandler().getCircuitValue(); + if (value == GhostCircuitItemStackHandler.NO_CONFIG) { + configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText(); + } else { + configString = String.valueOf(value); + } + + tooltip.addLine(IKey.lang("gregtech.gui.configurator_slot.tooltip", configString)); + } + + @Override + public @NotNull GhostCircuitSyncHandler getSyncHandler() { + return (GhostCircuitSyncHandler) super.getSyncHandler(); + } + + @Override + public void onMouseDrag(int mouseButton, long timeSinceClick) {} + + @Override + public boolean onMouseRelease(int mouseButton) { + return true; + } + + private boolean isSelectorPanelOpen() { + return getPanel().getScreen().isPanelOpen("circuit_selector"); + } + + private void createSelectorPanel() { + ItemDrawable circuitPreview = new ItemDrawable(getSyncHandler().getSlot().getStack()); + + List> options = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + options.add(new ArrayList<>()); + for (int j = 0; j < 9; j++) { + int index = i * 9 + j; + if (index > 32) break; + options.get(i).add(new ButtonWidget<>() + .size(18) + .background(GTGuiTextures.SLOT, new ItemDrawable( + IntCircuitIngredient.getIntegratedCircuit(index)).asIcon()) + .onMousePressed(mouseButton -> { + getSyncHandler().syncToServer(SYNC_CIRCUIT_INDEX, buf -> buf.writeShort(index)); + circuitPreview.setItem(IntCircuitIngredient.getIntegratedCircuit(index)); + return true; + })); + } + } + + getPanel().getScreen().openPanel(GTGuis.createPanel("circuit_selector", 176, 120) + .child(IKey.lang("metaitem.circuit.integrated.gui").asWidget().pos(5, 5)) + .child(circuitPreview.asIcon().size(16).asWidget() + .size(18) + .top(19).alignX(0.5f) + .background(GTGuiTextures.SLOT, GTGuiTextures.INT_CIRCUIT_OVERLAY)) + .child(new Grid() + .left(7).right(7).top(41).height(4 * 18) + .matrix(options) + .minColWidth(18).minRowHeight(18) + .minElementMargin(0, 0))); + } + + private static class GhostCircuitSyncHandler extends ItemSlotSH { + + public GhostCircuitSyncHandler(ModularSlot slot) { + super(slot); + } + + @Override + protected void phantomClick(MouseData mouseData) { + if (mouseData.mouseButton == 0) { + // increment on left-click + setCircuitValue(getNextCircuitValue(1)); + } else if (mouseData.mouseButton == 1 && mouseData.shift) { + // clear on shift-right-click + setCircuitValue(GhostCircuitItemStackHandler.NO_CONFIG); + } else if (mouseData.mouseButton == 1) { + // decrement on right-click + setCircuitValue(getNextCircuitValue(-1)); + } + } + + @Override + protected void phantomScroll(MouseData mouseData) { + setCircuitValue(getNextCircuitValue(mouseData.mouseButton)); + } + + private void setCircuitValue(int value) { + GhostCircuitItemStackHandler handler = getGhostCircuitHandler(); + if (handler.getCircuitValue() != value) { + handler.setCircuitValue(value); + syncToClient(1, buf -> { + buf.writeBoolean(false); + buf.writeItemStack(handler.getStackInSlot(0)); + buf.writeBoolean(false); + }); + } + } + + @Override + public void readOnServer(int id, PacketBuffer buf) throws IOException { + if (id == SYNC_CIRCUIT_INDEX) { + setCircuitValue(buf.readShort()); + } else { + super.readOnServer(id, buf); + } + } + + private int getNextCircuitValue(int delta) { + GhostCircuitItemStackHandler handler = getGhostCircuitHandler(); + + // if no circuit, skip 0 and return 32 if decrementing, + // or, skip 0 and return 1 when incrementing + if (!handler.hasCircuitValue()) { + return delta == 1 ? 1 : IntCircuitIngredient.CIRCUIT_MAX; + // if at max, loop around to no circuit + } else if (handler.getCircuitValue() + delta > IntCircuitIngredient.CIRCUIT_MAX) { + return GhostCircuitItemStackHandler.NO_CONFIG; + // if at 1, skip 0 and return to no circuit + } else if (handler.getCircuitValue() + delta < 1) { + return GhostCircuitItemStackHandler.NO_CONFIG; + } + + // normal case: change by "delta" which is either 1 or -1 + return handler.getCircuitValue() + delta; + } + + public GhostCircuitItemStackHandler getGhostCircuitHandler() { + IItemHandler handler = getSlot().getItemHandler(); + if (!(handler instanceof GhostCircuitItemStackHandler ghostHandler)) { + throw new IllegalStateException( + "GhostCircuitSyncHandler has IItemHandler that is not GhostCircuitItemStackHandler"); + } + return ghostHandler; + } + } +} diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index 06422a7a77b..82a492eaa7b 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -5,6 +5,7 @@ import gregtech.api.items.metaitem.stats.IItemBehaviour; import gregtech.api.items.metaitem.stats.ISubItemHandler; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.mui.GTGuiTextures; import gregtech.api.mui.GTGuis; import gregtech.api.recipes.ingredients.IntCircuitIngredient; import gregtech.api.util.GTUtility; @@ -17,7 +18,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import com.cleanroommc.modularui.api.drawable.IDrawable; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.drawable.ItemDrawable; @@ -85,17 +85,17 @@ public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManage if (index > 32) break; options.get(i).add(new ButtonWidget<>() .size(18) - .background(com.cleanroommc.modularui.drawable.GuiTextures.SLOT, + .background(GTGuiTextures.SLOT, new ItemDrawable(IntCircuitIngredient.getIntegratedCircuit(index)).asIcon().size(16)) .syncHandler("config", index)); } } return GTGuis.createPanel(guiCreationContext.getUsedItemStack(), 176, 120) .child(IKey.lang("metaitem.circuit.integrated.gui").asWidget().pos(5, 5)) - .child(new IDrawable.DrawableWidget(circuitPreview.asIcon().size(16)) + .child(circuitPreview.asIcon().size(16).asWidget() .size(18) .top(19).alignX(0.5f) - .background(com.cleanroommc.modularui.drawable.GuiTextures.SLOT)) + .background(GTGuiTextures.SLOT)) .child(new Grid() .left(7).right(7).top(41).height(4 * 18) .matrix(options) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index e44a0953d4e..ecaf71dce93 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -4,18 +4,15 @@ import gregtech.api.capability.impl.GhostCircuitItemStackHandler; import gregtech.api.capability.impl.ItemHandlerList; import gregtech.api.capability.impl.NotifiableItemStackHandler; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.ModularUI.Builder; -import gregtech.api.gui.resources.TextureArea; -import gregtech.api.gui.widgets.GhostCircuitSlotWidget; -import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.mui.GTGuiTextures; +import gregtech.api.mui.GTGuis; +import gregtech.api.mui.widget.GhostCircuitSlotWidget; import gregtech.api.util.GTHashMaps; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; @@ -38,6 +35,20 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.value.BoolValue; +import com.cleanroommc.modularui.value.sync.BooleanSyncValue; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widget.Widget; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.ToggleButton; +import com.cleanroommc.modularui.widgets.layout.Column; +import com.cleanroommc.modularui.widgets.layout.Grid; import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -126,8 +137,8 @@ public void update() { // Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits // from the slot IItemHandlerModifiable inventory = (isExportHatch ? this.getExportItems() : super.getImportItems()); - if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : - this.getNotifiedItemInputList().contains(inventory)) { + if (!isAttachedToMultiBlock() || (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : + this.getNotifiedItemInputList().contains(inventory))) { collapseInventorySlotContents(inventory); } } @@ -249,44 +260,84 @@ public void registerAbilities(List abilityList) { } @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - int rowSize = (int) Math.sqrt(getInventorySize()); - return createUITemplate(entityPlayer, rowSize) - .build(getHolder(), entityPlayer); + public boolean usesMui2() { + return true; } - private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { - int backgroundWidth = gridSize > 6 ? 176 + (gridSize - 6) * 18 : 176; - int center = backgroundWidth / 2; - - int gridStartX = center - (gridSize * 9); - - int inventoryStartX = center - 9 - 4 * 18; - int inventoryStartY = 18 + 18 * gridSize + 12; - - Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, backgroundWidth, 18 + 18 * gridSize + 94) - .label(10, 5, getMetaFullName()); - - for (int y = 0; y < gridSize; y++) { - for (int x = 0; x < gridSize; x++) { - int index = y * gridSize + x; - - builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, - gridStartX + x * 18, 18 + y * 18, true, !isExportHatch) - .setBackgroundTexture(GuiTextures.SLOT)); + @Override + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + int rowSize = (int) Math.sqrt(getInventorySize()); + guiSyncManager.registerSlotGroup("item_inv", rowSize); + + int backgroundWidth = Math.max( + 9 * 18 + 18 + 14 + 5, // Player Inv width + rowSize * 18 + 14); // Bus Inv width + int backgroundHeight = 18 + 18 * rowSize + 94; + + List> widgets = new ArrayList<>(); + for (int i = 0; i < rowSize; i++) { + widgets.add(new ArrayList<>()); + for (int j = 0; j < rowSize; j++) { + widgets.get(i) + .add(new ItemSlot() + .slot(SyncHandlers.itemSlot(isExportHatch ? exportItems : importItems, i * rowSize + j) + .slotGroup("item_inv") + .accessibility(!isExportHatch, true))); } } - if (hasGhostCircuitInventory() && this.circuitInventory != null) { - int circuitX = gridSize > 6 ? gridStartX + gridSize * 18 + 9 : inventoryStartX + 8 * 18; - int circuitY = gridSize * 18; - - SlotWidget circuitSlot = new GhostCircuitSlotWidget(circuitInventory, 0, circuitX, circuitY) - .setBackgroundTexture(GuiTextures.SLOT, getCircuitSlotOverlay()); - builder.widget(circuitSlot.setConsumer(this::getCircuitSlotTooltip)); - } - - return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, inventoryStartX, inventoryStartY); + BooleanSyncValue workingStateValue = new BooleanSyncValue(() -> workingEnabled, val -> workingEnabled = val); + guiSyncManager.syncValue("working_state", workingStateValue); + BooleanSyncValue collapseStateValue = new BooleanSyncValue(() -> autoCollapse, val -> autoCollapse = val); + guiSyncManager.syncValue("collapse_state", collapseStateValue); + + boolean hasGhostCircuit = hasGhostCircuitInventory() && this.circuitInventory != null; + + ToggleButton workingButton = new ToggleButton(); + workingButton.value( + new BoolValue.Dynamic(workingStateValue::getBoolValue, val -> { + workingStateValue.setBoolValue(val); + workingButton.markTooltipDirty(); + })) + .overlay(GTGuiTextures.BUTTON_ITEM_OUTPUT) + .tooltipBuilder(t -> t.addLine(workingStateValue.getBoolValue() ? + IKey.lang("gregtech.gui.item_auto_output.tooltip.enabled") : + IKey.lang("gregtech.gui.item_auto_output.tooltip.disabled"))); + + ToggleButton collapseButton = new ToggleButton(); + collapseButton.value( + new BoolValue.Dynamic(collapseStateValue::getBoolValue, val -> { + collapseStateValue.setBoolValue(val); + collapseButton.markTooltipDirty(); + })) + .overlay(GTGuiTextures.BUTTON_AUTO_COLLAPSE) + .tooltipBuilder(t -> t.addLine(collapseStateValue.getBoolValue() ? + IKey.lang("gregtech.gui.item_auto_collapse.tooltip.enabled") : + IKey.lang("gregtech.gui.item_auto_collapse.tooltip.disabled"))); + + return GTGuis.createPanel(this, backgroundWidth, backgroundHeight) + .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) + .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(new Grid() + .top(18).height(rowSize * 18) + .minElementMargin(0, 0) + .minColWidth(18).minRowHeight(18) + .alignX(0.5f) + .matrix(widgets)) + .child(new Column() + .pos(backgroundWidth - 7 - 18, backgroundHeight - 18 * 4 - 7 - 5) + .width(18).height(18 * 4 + 5) + .child(GTGuiTextures.GREGTECH_LOGO.asWidget().size(17).top(18 * 3 + 5)) + .child(workingButton.top(18 * 2)) + .child(collapseButton.top(18)) + .childIf(hasGhostCircuit, new GhostCircuitSlotWidget() + .slot(SyncHandlers.itemSlot(circuitInventory, 0)) + .background(GTGuiTextures.SLOT, GTGuiTextures.INT_CIRCUIT_OVERLAY)) + .childIf(!hasGhostCircuit, new Widget<>() + .background(GTGuiTextures.SLOT, GTGuiTextures.BUTTON_X) + .tooltip(t -> t.addLine( + IKey.lang("gregtech.gui.configurator_slot.unavailable.tooltip"))))); } @Override @@ -294,23 +345,6 @@ public boolean hasGhostCircuitInventory() { return !this.isExportHatch; } - // Method provided to override - protected TextureArea getCircuitSlotOverlay() { - return GuiTextures.INT_CIRCUIT_OVERLAY; - } - - // Method provided to override - protected void getCircuitSlotTooltip(@NotNull SlotWidget widget) { - String configString; - if (circuitInventory == null || circuitInventory.getCircuitValue() == GhostCircuitItemStackHandler.NO_CONFIG) { - configString = new TextComponentTranslation("gregtech.gui.configurator_slot.no_value").getFormattedText(); - } else { - configString = String.valueOf(circuitInventory.getCircuitValue()); - } - - widget.setTooltipText("gregtech.gui.configurator_slot.tooltip", configString); - } - private static void collapseInventorySlotContents(IItemHandlerModifiable inventory) { // Gather a snapshot of the provided inventory Object2IntMap inventoryContents = GTHashMaps.fromItemHandler(inventory, true); @@ -352,21 +386,13 @@ private static void collapseInventorySlotContents(IItemHandlerModifiable invento @Override public boolean onScrewdriverClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { - boolean isAttached = false; - if (this.isAttachedToMultiBlock()) { - setAutoCollapse(!this.autoCollapse); - isAttached = true; - } + setAutoCollapse(!this.autoCollapse); if (!getWorld().isRemote) { - if (isAttached) { - if (this.autoCollapse) { - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.bus.collapse_true"), true); - } else { - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.bus.collapse_false"), true); - } + if (this.autoCollapse) { + playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.bus.collapse_true"), true); } else { - playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.bus.collapse.error"), true); + playerIn.sendStatusMessage(new TextComponentTranslation("gregtech.bus.collapse_false"), true); } } return true; diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java index 37159f0c00d..acc41bc21c1 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java @@ -1,11 +1,11 @@ package gregtech.common.metatileentities.steam.multiblockpart; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.mui.GTGuiTheme; +import gregtech.api.mui.GTGuis; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; @@ -14,7 +14,6 @@ import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -23,9 +22,18 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.manager.GuiCreationContext; +import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.value.sync.SyncHandlers; +import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.layout.Grid; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class MetaTileEntitySteamItemBus extends MetaTileEntityItemBus { @@ -77,28 +85,42 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } } + @Override + public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager, + boolean isClient) { + guiSyncManager.registerSlotGroup("item_inv", 2); + + List> widgets = new ArrayList<>(); + for (int i = 0; i < 2; i++) { + widgets.add(new ArrayList<>()); + for (int j = 0; j < 2; j++) { + widgets.get(i) + .add(new ItemSlot() + .slot(SyncHandlers.itemSlot(isExportHatch ? exportItems : importItems, i * 2 + j) + .slotGroup("item_inv") + .accessibility(!isExportHatch, true))); + } + } + + return GTGuis.createPanel(this, 176, 166) + .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) + .bindPlayerInventory() + .child(new Grid() + .top(29).height(36) + .minElementMargin(0, 0) + .minColWidth(18).minRowHeight(18) + .alignX(0.5f) + .matrix(widgets)); + } + @Override public int getDefaultPaintingColor() { return 0xFFFFFF; } - // Override UI to make it a Steam UI @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND_STEAM.get(IS_STEEL), 176, 166) - .label(6, 6, getMetaFullName()); - - for (int y = 0; y < 2; y++) { - for (int x = 0; x < 2; x++) { - int index = y * 2 + x; - builder.slot(isExportHatch ? exportItems : importItems, index, 70 + x * 18, 31 + y * 18, true, - !isExportHatch, - GuiTextures.SLOT_STEAM.get(IS_STEEL)); - } - } - builder.shouldColor(false); - builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT_STEAM.get(IS_STEEL), 7, 83); - return builder.build(getHolder(), entityPlayer); + public GTGuiTheme getUITheme() { + return IS_STEEL ? GTGuiTheme.STEEL : GTGuiTheme.BRONZE; } @Override diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 38f6999c437..b5fd935ad7b 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -45,8 +45,8 @@ gregtech.multiblock.steam.low_steam=Not enough Steam to run! gregtech.multiblock.steam.steam_stored=Steam: %s gregtech.machine.steam_hatch.name=Steam Hatch gregtech.machine.steam.steam_hatch.tooltip=§eAccepted Fluid: §fSteam -gregtech.machine.steam_import_bus.name=Input Bus (Steam) -gregtech.machine.steam_export_bus.name=Output Bus (Steam) +gregtech.machine.steam_import_bus.name=Steam Input Bus +gregtech.machine.steam_export_bus.name=Steam Output Bus gregtech.machine.steam_bus.tooltip=Does not work with non-steam multiblocks gregtech.machine.steam_oven.name=Steam Oven gregtech.multiblock.steam_oven.description=A Multi Smelter at the Steam Age. Requires at least 6 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch. Steam Hatch must be on the bottom layer, no more than one. @@ -4938,7 +4938,6 @@ gregtech.machine.item_bus.export.uhv.name=UHV Output Bus gregtech.bus.collapse_true=Bus will collapse Items gregtech.bus.collapse_false=Bus will not collapse Items -gregtech.bus.collapse.error=Bus must be attached to multiblock first gregtech.machine.fluid_hatch.import.tooltip=Fluid Input for Multiblocks @@ -5371,9 +5370,12 @@ gregtech.gui.fluid_auto_output.tooltip.enabled=Fluid Auto-Output Enabled gregtech.gui.fluid_auto_output.tooltip.disabled=Fluid Auto-Output Disabled gregtech.gui.item_auto_output.tooltip.enabled=Item Auto-Output Enabled gregtech.gui.item_auto_output.tooltip.disabled=Item Auto-Output Disabled +gregtech.gui.item_auto_collapse.tooltip.enabled=Item Auto-Collapse Enabled +gregtech.gui.item_auto_collapse.tooltip.disabled=Item Auto-Collapse Disabled gregtech.gui.charger_slot.tooltip=§fCharger Slot§r/n§7Draws power from %s batteries§r/n§7Charges %s tools and batteries -gregtech.gui.configurator_slot.tooltip=§fProgrammed Circuit Slot§r/n§aConfigured Value: §f%d§7/n/n§7LMB/RMB/Scroll to cycle through the list/n§7Shift-right-click to clear +gregtech.gui.configurator_slot.tooltip=§fProgrammed Circuit Slot§r\n§aConfigured Value: §f%d§7\n\n§7LMB/RMB/Scroll to cycle through the list\n§7Shift-left-click to open selector\n§7Shift-right-click to clear gregtech.gui.configurator_slot.no_value=None +gregtech.gui.configurator_slot.unavailable.tooltip=Programmed Circuit slot unavailable gregtech.gui.fluid_lock.tooltip.enabled=Fluid Locking Enabled gregtech.gui.fluid_lock.tooltip.disabled=Fluid Locking Disabled gregtech.gui.fluid_voiding.tooltip.enabled=Excess Fluid Voiding Enabled diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/button.png b/src/main/resources/assets/gregtech/textures/gui/widget/button.png new file mode 100644 index 0000000000000000000000000000000000000000..9f9c76a301fc0bfca47c68a666359eb7744d7536 GIT binary patch literal 1794 zcmZux4Qvx-815LtHZtXBAp;XQZdt<5uJ_Zs-OtwH)^=+Ho!!>B2}rn~uie?7JMM04 zhZbONb(<*(5O$5RCzcN(Kv&00V-Ff(p*>x^|9)CfDBg^?9D} zeV^}r-=0uoLvhjkB8S6K9PoRa;qPqwnVJv3_g#2ZaX9k2RgWhW@OY4rp+(duc)qA0I4PI(PN{9eGW&R&41mC|Xp%dH3M?Ej@Leb2`f^cXl6Gck%sO ztwU|Gn7FK=Xd};LU zxz8^0=I8ARvghymD=GtL{^)AhB4}kF&K+AF{Gj}&P4k24p_5e)UG!ZXI9#{()z(6=UUt=dw6n0P=gxk;t?fkklcs^+`sKn$3R3S?tiC#ZdwJuM zwXJc`dTMvgnN54kpNXux(qB~??Or0amwwz|w{yxYKGC#h#8`M>M7w>DTt9DQ)j-KN zrF?}o-1qm3!{ z(%7!)-yh4n+zL(&ZR`!UKX>xl)*CAh_vc@skL~)FJymz2nEviHtYc)))0KHC<%?r=;URl{voTX3ZyYYC^QXcBOy6FNjY9M#Lyx+uqhg-9T(Cf(@G zqhFzjs<_csCP)Nz4`^5Y8w}90p)o9Ph{?QyF0Uyrs!j_~AptBANhjh-Q%JkfjIaRT z?QI-IG7u}~M%#iR#G@Gip`EmozawyL}>QbXGP%3jka5sF5q}7m2#$B zPR)qoB+v6WLE#jIK?G)YB`q-n$!PPsA zcqR))#z7n;Ak2iPkrPKX1cIRnw4HTSP3Rd0ba(<~sgeJ^xi233pG^3=NM zPa6o$5WJe)VaF5jx>5U3LD6JY5i+lgXqFK%PEsl{7Y|69WO38PH%d8)>@pM=tq6p=(UoelBc0t1s|nCziMDZMrHkV!j%O*FAQ+y`BAx(-2`kH% zA_*r2W4C=5VCc|5(Jnej%_Jmv3?N#X5!ST08?|FVY)-CLVYQCC?^jKT>dN#1lKEu1 zp#`j;w3V&xxQb*dQV`|wqfD_AC}?(5ZWohL09zJT%Q#GZz>Uy^#7aEr!bpacp_3Ac zNfb|E97`%>gqA=hE9Lm67O_&I0cxW#JD3D4j!Y8B;*4uca=27Guq`1d5+f;$V8awC z5R?FKoL~e3dX7)Zr5d-}a&msv_=Bt%$4zSI@llas!&w1Wke3@j_G)5;fh07+fCGy0 zZybTcZC=1z8!r7(ej%@ZT77N7%=!B&7L^mB<|&S%KMRiwqrr3b2n_fdy$9>ob^izX Ce_@LN literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/button_auto_collapse_overlay.png b/src/main/resources/assets/gregtech/textures/gui/widget/button_auto_collapse_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..70a6316ec79847de651df13d55d5546365cb8cc5 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaFeV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G~10G|-o1_y@!K+M4Ke@{7(jL0la1X8ReL4Lvifq>!nHojn>0B3Ealo5xn%ACm(|X2eZS9KmX4vZBjYqS-o*4!^9`2%qOOYif>a< zOqX!%P!vf#C=u23rS$gNNEIO4o46lfZQr>mdKI;Vst02y*Z A8~^|S literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/widget/button_x_overlay.png b/src/main/resources/assets/gregtech/textures/gui/widget/button_x_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..9046977fd32f6560d91a10a6bdd7074a5df05692 GIT binary patch literal 1849 zcmZux4Qvx-816QHwwWn|Ne~Sjw=5Zq>;3d@?cLVRt?kwVo!!>B3P^T8U)y7C@3`K& z4*$X=$~0q&g7`y#7!^^#EFlCzag)R-e;NdbLgp3}$FG(+eL?>0e3Qvk;Bh;f;Cs69`6S3=e-7b!zSQlBa@8NBb&fg}UYo;aMN|)o#izWTTDCN3^-SMwA=3$yE=HEbTA)Y8Jat zAL{-4`JpqPj{f_3(|f+6i(Bp2KD)2$C*RpW4(=&FQ8veMWybO!!E;xqy-?*GTF|y- z>bD28F0_DSgKJ*)hMzflY5mp3d;4-m>4RIou^y{EQa~SnL;Gj{h4XW!Z#Z?HxqQXZ zQMVHJzj}bI2LmY|*5ZX+e3Cxw06BG(b5TsI*f?SicE=>Y=b~LQ(Du?48 z9UbNli&@b^ILWdsPEa^SVGx1EJ7YSZ#A5N{F_JWm6U0SLR&`m4AqFikDDAo(g>j4p z7*)OAarRg|tpij9Px2~Gnh87_HKIir8+%<8j(i<4{ggL|NieOGdCrRyt_I1eOsnnt|H$LCJ>MNLmU~ zRtsaZFc}_CEUxo05g0s>*(^g6Ymk;`qTGsENQS~_E5lBNO8>cqGUpkQSSb3DQ{5Vv#Uf2vQhpV;PKLL>ocUR^BF*qlhGOb&3|{;g!iz zJ_K+z7D5q2S+2(Cv7?lkNN;@+UJpX39bF>F+LLLkUyg!ioi~Id%PlsRvawc*CJ2V5 z(}>4`7KfE(P?3b0g0UOAb1-x$Aa4{MbWJ71IW)lQiso08h#fUzKn$Nut-@*@Q{OGe zA*wUg2T1Cd>V{^pYJw?U+YuQ_RV2rYV@JjL1d!0QQ4I635P&TUt7Qx(-{VGTLa+)f zX~9T_6rqv=i3t=-VKyr%kwIDj=mzeQzal=DWfZw@!vzsEzE7 z*H>x#e;=$U%l>-Z*%zCR_wL-Bc<}i8Nw2kfPcqd-WY(VStjU2#u-}Yv>2WnUch|Od F{Rd# Date: Sat, 9 Dec 2023 20:34:49 -0500 Subject: [PATCH 69/77] fix crash with fluid filters with null delegate containers (#2273) --- .../capability/impl/FluidHandlerDelegate.java | 3 ++- .../gregtech/common/covers/CoverFluidFilter.java | 14 ++++++++------ .../java/gregtech/common/covers/CoverPump.java | 16 +++++++++++++--- .../MetaTileEntityLDFluidEndpoint.java | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java b/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java index f6e2a369aba..0449a6b3dfb 100644 --- a/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java +++ b/src/main/java/gregtech/api/capability/impl/FluidHandlerDelegate.java @@ -4,13 +4,14 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class FluidHandlerDelegate implements IFluidHandler { public final IFluidHandler delegate; - public FluidHandlerDelegate(IFluidHandler delegate) { + public FluidHandlerDelegate(@NotNull IFluidHandler delegate) { this.delegate = delegate; } diff --git a/src/main/java/gregtech/common/covers/CoverFluidFilter.java b/src/main/java/gregtech/common/covers/CoverFluidFilter.java index c746215c983..cd5d06ee5a4 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidFilter.java +++ b/src/main/java/gregtech/common/covers/CoverFluidFilter.java @@ -110,13 +110,15 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra } @Override - public T getCapability(@NotNull Capability capability, T defaultValue) { + public T getCapability(@NotNull Capability capability, @Nullable T defaultValue) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { - IFluidHandler delegate = (IFluidHandler) defaultValue; - if (fluidHandler == null || fluidHandler.delegate != delegate) { - this.fluidHandler = new FluidHandlerFiltered(delegate); + if (defaultValue instanceof IFluidHandler delegate) { + if (fluidHandler == null || fluidHandler.delegate != delegate) { + this.fluidHandler = new FluidHandlerFiltered(delegate); + } + return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); } - return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler); + return null; } return defaultValue; } @@ -141,7 +143,7 @@ public void readFromNBT(@NotNull NBTTagCompound tagCompound) { private class FluidHandlerFiltered extends FluidHandlerDelegate { - public FluidHandlerFiltered(IFluidHandler delegate) { + public FluidHandlerFiltered(@NotNull IFluidHandler delegate) { super(delegate); } diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index ebd53eefe50..961e349be6b 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -11,7 +11,12 @@ import gregtech.api.cover.CoverableView; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.*; +import gregtech.api.gui.widgets.CycleButtonWidget; +import gregtech.api.gui.widgets.ImageWidget; +import gregtech.api.gui.widgets.IncrementButtonWidget; +import gregtech.api.gui.widgets.LabelWidget; +import gregtech.api.gui.widgets.TextFieldWidget2; +import gregtech.api.gui.widgets.WidgetGroup; import gregtech.api.util.GTTransferUtils; import gregtech.client.renderer.texture.Textures; import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; @@ -23,7 +28,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.ITickable; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; @@ -397,7 +407,7 @@ public String getName() { private class CoverableFluidHandlerWrapper extends FluidHandlerDelegate { - public CoverableFluidHandlerWrapper(IFluidHandler delegate) { + public CoverableFluidHandlerWrapper(@NotNull IFluidHandler delegate) { super(delegate); } diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java index 3602e89f3f8..55ddb9d3ba1 100644 --- a/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java +++ b/src/main/java/gregtech/common/pipelike/fluidpipe/longdistance/MetaTileEntityLDFluidEndpoint.java @@ -27,6 +27,7 @@ import codechicken.lib.vec.Matrix4; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class MetaTileEntityLDFluidEndpoint extends MetaTileEntityLongDistanceEndpoint { @@ -101,7 +102,7 @@ public Pair getParticleTexture() { private static class FluidHandlerWrapper extends FluidHandlerDelegate { - public FluidHandlerWrapper(IFluidHandler delegate) { + public FluidHandlerWrapper(@NotNull IFluidHandler delegate) { super(delegate); } From c1a7aa8b26103f9f7544005e5f1093d576687a48 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 9 Dec 2023 20:18:20 -0600 Subject: [PATCH 70/77] SideOnly for modular screen methods (#2274) --- src/main/java/gregtech/api/cover/CoverWithUI.java | 3 +++ src/main/java/gregtech/api/items/gui/ItemUIFactory.java | 3 +++ src/main/java/gregtech/api/metatileentity/MetaTileEntity.java | 1 + src/main/java/gregtech/api/mui/GregTechGuiScreen.java | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/src/main/java/gregtech/api/cover/CoverWithUI.java b/src/main/java/gregtech/api/cover/CoverWithUI.java index 029f82f058c..a504a7484d0 100644 --- a/src/main/java/gregtech/api/cover/CoverWithUI.java +++ b/src/main/java/gregtech/api/cover/CoverWithUI.java @@ -8,6 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import com.cleanroommc.modularui.api.IGuiHolder; import com.cleanroommc.modularui.manager.GuiCreationContext; @@ -38,6 +40,7 @@ default ModularUI createUI(EntityPlayer player) { } @ApiStatus.NonExtendable + @SideOnly(Side.CLIENT) @Override default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { return new GregTechGuiScreen(mainPanel, getUITheme()); diff --git a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java index dd8b5027fa0..998bca5dec7 100644 --- a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java +++ b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java @@ -6,6 +6,8 @@ import gregtech.api.mui.GregTechGuiScreen; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import com.cleanroommc.modularui.api.IGuiHolder; import com.cleanroommc.modularui.manager.GuiCreationContext; @@ -26,6 +28,7 @@ default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlay } @ApiStatus.NonExtendable + @SideOnly(Side.CLIENT) @Override default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { return new GregTechGuiScreen(mainPanel, getUITheme()); diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 1bcf47c1a2d..aa223d66de7 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -435,6 +435,7 @@ public boolean usesMui2() { return false; } + @SideOnly(Side.CLIENT) @Override public final ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) { return new GregTechGuiScreen(mainPanel, getUITheme()); diff --git a/src/main/java/gregtech/api/mui/GregTechGuiScreen.java b/src/main/java/gregtech/api/mui/GregTechGuiScreen.java index 010ca17af4b..ad5c48449c5 100644 --- a/src/main/java/gregtech/api/mui/GregTechGuiScreen.java +++ b/src/main/java/gregtech/api/mui/GregTechGuiScreen.java @@ -2,9 +2,13 @@ import gregtech.api.GTValues; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.screen.ModularScreen; +@SideOnly(Side.CLIENT) public class GregTechGuiScreen extends ModularScreen { public GregTechGuiScreen(ModularPanel mainPanel) { From 163b7aca8067a53b1ad644b191d4f659ead0fd9d Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:29:49 -0500 Subject: [PATCH 71/77] update to groovyscript 0.7.1 (#2275) --- dependencies.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index fbcaa5e2dfb..a1254cf48a9 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -32,7 +32,9 @@ dependencies { implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.684" implementation rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31 - implementation rfg.deobf("curse.maven:groovyscript-687577:4905039") // GRS 0.7.0 + implementation ("com.cleanroommc:groovyscript:0.7.1") { + transitive = false + } implementation rfg.deobf("curse.maven:ae2-extended-life-570458:4402048") // AE2UEL 0.55.6 compileOnlyApi rfg.deobf("curse.maven:opencomputers-223008:4526246") // OpenComputers 1.8.0+9833087 From 23a40938714c9a99f5daa6b76734ccb85c67bf58 Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:30:42 -0600 Subject: [PATCH 72/77] GuiTextures port (partial) (#2277) --- .../java/gregtech/api/mui/GTGuiTextures.java | 363 +++++++++++++++++- .../java/gregtech/api/mui/GTGuiTheme.java | 1 + .../multiblockpart/MetaTileEntityItemBus.java | 2 +- 3 files changed, 352 insertions(+), 14 deletions(-) diff --git a/src/main/java/gregtech/api/mui/GTGuiTextures.java b/src/main/java/gregtech/api/mui/GTGuiTextures.java index 7116772755b..434c90e9ce3 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTextures.java +++ b/src/main/java/gregtech/api/mui/GTGuiTextures.java @@ -3,11 +3,18 @@ import gregtech.api.GTValues; import com.cleanroommc.modularui.drawable.UITexture; +import org.jetbrains.annotations.ApiStatus; -// TODO: Move primitive slot and background to "textures/gui/base" +/** + * GT MUI textures.
+ * Marked experimental as some of these textures may disappear or be renamed at some point + * while MUI port is still ongoing. When MUI port is done, this annotation will be removed. + */ +// TODO ^ +@ApiStatus.Experimental public class GTGuiTextures { - // Keys used for GT assets registered for use in Themes + /** Keys used for GT assets registered for use in Themes */ public static class IDs { public static final String STANDARD_BACKGROUND = "gregtech_standard_bg"; @@ -20,12 +27,25 @@ public static class IDs { public static final String STEEL_SLOT = "gregtech_steel_slot"; public static final String PRIMITIVE_SLOT = "gregtech_primitive_slot"; + public static final String STANDARD_FLUID_SLOT = "gregtech_standard_fluid_slot"; + public static final String STANDARD_BUTTON = "gregtech_standard_button"; } - // GT LOGOS - public static final UITexture GREGTECH_LOGO = UITexture.fullImage(GTValues.MODID, - "textures/gui/icon/gregtech_logo.png"); + // ICONS + /** @apiNote You may want {@link GTGuiTextures#getLogo()} instead. */ + public static final UITexture GREGTECH_LOGO = fullImage("textures/gui/icon/gregtech_logo.png"); + /** @apiNote You may want {@link GTGuiTextures#getLogo()} instead. */ + public static final UITexture GREGTECH_LOGO_XMAS = fullImage("textures/gui/icon/gregtech_logo_xmas.png"); + public static final UITexture GREGTECH_LOGO_DARK = fullImage("textures/gui/icon/gregtech_logo_dark.png"); + // todo blinking GT logos + + public static final UITexture INDICATOR_NO_ENERGY = fullImage("textures/gui/base/indicator_no_energy.png"); + public static final UITexture INDICATOR_NO_STEAM_BRONZE = fullImage( + "textures/gui/base/indicator_no_steam_bronze.png"); + public static final UITexture INDICATOR_NO_STEAM_STEEL = fullImage( + "textures/gui/base/indicator_no_steam_steel.png"); + public static final UITexture TANK_ICON = fullImage("textures/gui/base/tank_icon.png"); // BACKGROUNDS public static final UITexture BACKGROUND = UITexture.builder() @@ -35,6 +55,8 @@ public static class IDs { .registerAsBackground(IDs.STANDARD_BACKGROUND, true) .build(); + // todo BORDERED/BOXED backgrounds will not be ported, if possible + public static final UITexture BACKGROUND_BRONZE = UITexture.builder() .location(GTValues.MODID, "textures/gui/base/background_bronze.png") .imageSize(176, 166) @@ -49,6 +71,7 @@ public static class IDs { .registerAsBackground(IDs.STEEL_BACKGROUND) .build(); + // todo move to textures/gui/base public static final UITexture BACKGROUND_PRIMITIVE = UITexture.builder() .location(GTValues.MODID, "textures/gui/primitive/primitive_background.png") .imageSize(176, 166) @@ -56,6 +79,30 @@ public static class IDs { .registerAsBackground(IDs.PRIMITIVE_BACKGROUND) .build(); + // todo clipboard backgrounds, may deserve some redoing + + // DISPLAYS + public static final UITexture DISPLAY = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/display.png") + .imageSize(143, 75) + .adaptable(2) + .canApplyTheme() + .build(); + + public static final UITexture DISPLAY_BRONZE = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/display_bronze.png") + .imageSize(143, 75) + .adaptable(2) + .build(); + + public static final UITexture DISPLAY_STEEL = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/display_steel.png") + .imageSize(143, 75) + .adaptable(2) + .build(); + + // todo primitive display? + // SLOTS public static final UITexture SLOT = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/base/slot.png") @@ -78,6 +125,7 @@ public static class IDs { .registerAsBackground(IDs.STEEL_SLOT) .build(); + // todo move to textures/gui/base public static final UITexture SLOT_PRIMITIVE = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/primitive/primitive_slot.png") .imageSize(18, 18) @@ -85,10 +133,119 @@ public static class IDs { .registerAsBackground(IDs.PRIMITIVE_SLOT) .build(); - // SLOT OVERLAYS + public static final UITexture FLUID_SLOT = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/base/fluid_slot.png") + .imageSize(18, 18) + .adaptable(1) + .registerAsBackground(IDs.STANDARD_FLUID_SLOT, true) + .build(); + + // todo bronze/steel/primitive fluid slots? - public static final UITexture INT_CIRCUIT_OVERLAY = UITexture.fullImage(GTValues.MODID, - "textures/gui/overlay/int_circuit_overlay.png", true); + // SLOT OVERLAYS + public static final UITexture ATOMIC_OVERLAY_1 = fullImage("textures/gui/overlay/atomic_overlay_1.png", true); + public static final UITexture ATOMIC_OVERLAY_2 = fullImage("textures/gui/overlay/atomic_overlay_2.png", true); + public static final UITexture ARROW_INPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_input_overlay.png", true); + public static final UITexture ARROW_OUTPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_output_overlay.png", + true); + public static final UITexture BATTERY_OVERLAY = fullImage("textures/gui/overlay/battery_overlay.png", true); + public static final UITexture BEAKER_OVERLAY_1 = fullImage("textures/gui/overlay/beaker_overlay_1.png", true); + public static final UITexture BEAKER_OVERLAY_2 = fullImage("textures/gui/overlay/beaker_overlay_2.png", true); + public static final UITexture BEAKER_OVERLAY_3 = fullImage("textures/gui/overlay/beaker_overlay_3.png", true); + public static final UITexture BEAKER_OVERLAY_4 = fullImage("textures/gui/overlay/beaker_overlay_4.png", true); + public static final UITexture BENDER_OVERLAY = fullImage("textures/gui/overlay/bender_overlay.png", true); + public static final UITexture BOX_OVERLAY = fullImage("textures/gui/overlay/box_overlay.png", true); + public static final UITexture BOXED_OVERLAY = fullImage("textures/gui/overlay/boxed_overlay.png", true); + public static final UITexture BREWER_OVERLAY = fullImage("textures/gui/overlay/brewer_overlay.png", true); + public static final UITexture CANNER_OVERLAY = fullImage("textures/gui/overlay/canner_overlay.png", true); + public static final UITexture CHARGER_OVERLAY = fullImage("textures/gui/overlay/charger_slot_overlay.png", true); + public static final UITexture CANISTER_OVERLAY = fullImage("textures/gui/overlay/canister_overlay.png", true); + public static final UITexture CANISTER_OVERLAY_BRONZE = fullImage( + "textures/gui/overlay/canister_overlay_bronze.png"); + public static final UITexture CANISTER_OVERLAY_STEEL = fullImage("textures/gui/overlay/canister_overlay_steel.png"); + public static final UITexture CENTRIFUGE_OVERLAY = fullImage("textures/gui/overlay/centrifuge_overlay.png", true); + public static final UITexture CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/circuit_overlay.png", true); + public static final UITexture COAL_OVERLAY_BRONZE = fullImage("textures/gui/overlay/coal_overlay_bronze.png"); + public static final UITexture COAL_OVERLAY_STEEL = fullImage("textures/gui/overlay/coal_overlay_steel.png"); + public static final UITexture COMPRESSOR_OVERLAY = fullImage("textures/gui/overlay/compressor_overlay.png", true); + public static final UITexture COMPRESSOR_OVERLAY_BRONZE = fullImage( + "textures/gui/overlay/compressor_overlay_bronze.png"); + public static final UITexture COMPRESSOR_OVERLAY_STEEL = fullImage( + "textures/gui/overlay/compressor_overlay_steel.png"); + public static final UITexture CRACKING_OVERLAY_1 = fullImage("textures/gui/overlay/cracking_overlay_1.png", true); + public static final UITexture CRACKING_OVERLAY_2 = fullImage("textures/gui/overlay/cracking_overlay_2.png", true); + public static final UITexture CRUSHED_ORE_OVERLAY = fullImage("textures/gui/overlay/crushed_ore_overlay.png", true); + public static final UITexture CRUSHED_ORE_OVERLAY_BRONZE = fullImage( + "textures/gui/overlay/crushed_ore_overlay_bronze.png"); + public static final UITexture CRUSHED_ORE_OVERLAY_STEEL = fullImage( + "textures/gui/overlay/crushed_ore_overlay_steel.png"); + public static final UITexture CRYSTAL_OVERLAY = fullImage("textures/gui/overlay/crystal_overlay.png", true); + public static final UITexture CUTTER_OVERLAY = fullImage("textures/gui/overlay/cutter_overlay.png", true); + public static final UITexture DARK_CANISTER_OVERLAY = fullImage("textures/gui/overlay/dark_canister_overlay.png", + true); + public static final UITexture DUST_OVERLAY = fullImage("textures/gui/overlay/dust_overlay.png", true); + public static final UITexture DUST_OVERLAY_BRONZE = fullImage("textures/gui/overlay/dust_overlay_bronze.png"); + public static final UITexture DUST_OVERLAY_STEEL = fullImage("textures/gui/overlay/dust_overlay_steel.png"); + public static final UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png", true); + public static final UITexture EXTRACTOR_OVERLAY_BRONZE = fullImage( + "textures/gui/overlay/extractor_overlay_bronze.png"); + public static final UITexture EXTRACTOR_OVERLAY_STEEL = fullImage( + "textures/gui/overlay/extractor_overlay_steel.png"); + public static final UITexture FILTER_SLOT_OVERLAY = fullImage("textures/gui/overlay/filter_slot_overlay.png", true); + public static final UITexture FURNACE_OVERLAY_1 = fullImage("textures/gui/overlay/furnace_overlay_1.png", true); + public static final UITexture FURNACE_OVERLAY_2 = fullImage("textures/gui/overlay/furnace_overlay_2.png", true); + public static final UITexture FURNACE_OVERLAY_BRONZE = fullImage("textures/gui/overlay/furnace_overlay_bronze.png"); + public static final UITexture FURNACE_OVERLAY_STEEL = fullImage("textures/gui/overlay/furnace_overlay_steel.png"); + public static final UITexture HAMMER_OVERLAY = fullImage("textures/gui/overlay/hammer_overlay.png", true); + public static final UITexture HAMMER_OVERLAY_BRONZE = fullImage("textures/gui/overlay/hammer_overlay_bronze.png"); + public static final UITexture HAMMER_OVERLAY_STEEL = fullImage("textures/gui/overlay/hammer_overlay_steel.png"); + public static final UITexture HEATING_OVERLAY_1 = fullImage("textures/gui/overlay/heating_overlay_1.png", true); + public static final UITexture HEATING_OVERLAY_2 = fullImage("textures/gui/overlay/heating_overlay_2.png", true); + public static final UITexture IMPLOSION_OVERLAY_1 = fullImage("textures/gui/overlay/implosion_overlay_1.png", true); + public static final UITexture IMPLOSION_OVERLAY_2 = fullImage("textures/gui/overlay/implosion_overlay_2.png", true); + public static final UITexture IN_SLOT_OVERLAY = fullImage("textures/gui/overlay/in_slot_overlay.png", true); + public static final UITexture IN_SLOT_OVERLAY_BRONZE = fullImage("textures/gui/overlay/in_slot_overlay_bronze.png"); + public static final UITexture IN_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/in_slot_overlay_steel.png"); + public static final UITexture INGOT_OVERLAY = fullImage("textures/gui/overlay/ingot_overlay.png", true); + public static final UITexture INT_CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/int_circuit_overlay.png", true); + public static final UITexture LENS_OVERLAY = fullImage("textures/gui/overlay/lens_overlay.png", true); + public static final UITexture LIGHTNING_OVERLAY_1 = fullImage("textures/gui/overlay/lightning_overlay_1.png", true); + public static final UITexture LIGHTNING_OVERLAY_2 = fullImage("textures/gui/overlay/lightning_overlay_2.png", true); + public static final UITexture MOLD_OVERLAY = fullImage("textures/gui/overlay/mold_overlay.png", true); + public static final UITexture MOLECULAR_OVERLAY_1 = fullImage("textures/gui/overlay/molecular_overlay_1.png", true); + public static final UITexture MOLECULAR_OVERLAY_2 = fullImage("textures/gui/overlay/molecular_overlay_2.png", true); + public static final UITexture MOLECULAR_OVERLAY_3 = fullImage("textures/gui/overlay/molecular_overlay_3.png", true); + public static final UITexture MOLECULAR_OVERLAY_4 = fullImage("textures/gui/overlay/molecular_overlay_4.png", true); + public static final UITexture OUT_SLOT_OVERLAY = fullImage("textures/gui/overlay/out_slot_overlay.png", true); + public static final UITexture OUT_SLOT_OVERLAY_BRONZE = fullImage( + "textures/gui/overlay/out_slot_overlay_bronze.png"); + public static final UITexture OUT_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/out_slot_overlay_steel.png"); + public static final UITexture PAPER_OVERLAY = fullImage("textures/gui/overlay/paper_overlay.png", true); + public static final UITexture PRINTED_PAPER_OVERLAY = fullImage("textures/gui/overlay/printed_paper_overlay.png", + true); + public static final UITexture PIPE_OVERLAY_2 = fullImage("textures/gui/overlay/pipe_overlay_2.png", true); + public static final UITexture PIPE_OVERLAY_1 = fullImage("textures/gui/overlay/pipe_overlay_1.png", true); + public static final UITexture PRESS_OVERLAY_1 = fullImage("textures/gui/overlay/press_overlay_1.png", true); + public static final UITexture PRESS_OVERLAY_2 = fullImage("textures/gui/overlay/press_overlay_2.png", true); + public static final UITexture PRESS_OVERLAY_3 = fullImage("textures/gui/overlay/press_overlay_3.png", true); + public static final UITexture PRESS_OVERLAY_4 = fullImage("textures/gui/overlay/press_overlay_4.png", true); + public static final UITexture SAWBLADE_OVERLAY = fullImage("textures/gui/overlay/sawblade_overlay.png", true); + public static final UITexture SOLIDIFIER_OVERLAY = fullImage("textures/gui/overlay/solidifier_overlay.png", true); + public static final UITexture STRING_SLOT_OVERLAY = fullImage("textures/gui/overlay/string_slot_overlay.png", true); + public static final UITexture TOOL_SLOT_OVERLAY = fullImage("textures/gui/overlay/tool_slot_overlay.png", true); + public static final UITexture TURBINE_OVERLAY = fullImage("textures/gui/overlay/turbine_overlay.png", true); + public static final UITexture VIAL_OVERLAY_1 = fullImage("textures/gui/overlay/vial_overlay_1.png", true); + public static final UITexture VIAL_OVERLAY_2 = fullImage("textures/gui/overlay/vial_overlay_2.png", true); + public static final UITexture WIREMILL_OVERLAY = fullImage("textures/gui/overlay/wiremill_overlay.png", true); + public static final UITexture POSITIVE_MATTER_OVERLAY = fullImage( + "textures/gui/overlay/positive_matter_overlay.png", true); + public static final UITexture NEUTRAL_MATTER_OVERLAY = fullImage("textures/gui/overlay/neutral_matter_overlay.png", + true); + public static final UITexture DATA_ORB_OVERLAY = fullImage("textures/gui/overlay/data_orb_overlay.png", true); + public static final UITexture SCANNER_OVERLAY = fullImage("textures/gui/overlay/scanner_overlay.png", true); + public static final UITexture DUCT_TAPE_OVERLAY = fullImage("textures/gui/overlay/duct_tape_overlay.png", true); + public static final UITexture RESEARCH_STATION_OVERLAY = fullImage( + "textures/gui/overlay/research_station_overlay.png", true); // BUTTONS @@ -100,14 +257,194 @@ public static class IDs { .canApplyTheme() .build(); - public static final UITexture BUTTON_ITEM_OUTPUT = UITexture.fullImage(GTValues.MODID, - "textures/gui/widget/button_item_output_overlay.png"); + // BUTTON OVERLAYS - public static final UITexture BUTTON_AUTO_COLLAPSE = UITexture.fullImage(GTValues.MODID, + public static final UITexture BUTTON_ITEM_OUTPUT = fullImage("textures/gui/widget/button_item_output_overlay.png"); + public static final UITexture BUTTON_FLUID_OUTPUT = fullImage( + "textures/gui/widget/button_fluid_output_overlay.png"); + public static final UITexture BUTTON_AUTO_COLLAPSE = fullImage( "textures/gui/widget/button_auto_collapse_overlay.png"); + public static final UITexture BUTTON_X = fullImage("textures/gui/widget/button_x_overlay.png", true); + + // PROGRESS BARS + public static final UITexture PROGRESS_BAR_ARC_FURNACE = progressBar( + "textures/gui/progress_bar/progress_bar_arc_furnace.png", true); + public static final UITexture PROGRESS_BAR_ARROW = progressBar("textures/gui/progress_bar/progress_bar_arrow.png", + true); + public static final UITexture PROGRESS_BAR_ARROW_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_arrow_bronze.png"); + public static final UITexture PROGRESS_BAR_ARROW_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_arrow_steel.png"); + public static final UITexture PROGRESS_BAR_ARROW_MULTIPLE = progressBar( + "textures/gui/progress_bar/progress_bar_arrow_multiple.png", true); + public static final UITexture PROGRESS_BAR_BATH = progressBar("textures/gui/progress_bar/progress_bar_bath.png", + true); + public static final UITexture PROGRESS_BAR_BENDING = progressBar( + "textures/gui/progress_bar/progress_bar_bending.png", true); + public static final UITexture PROGRESS_BAR_CANNER = progressBar("textures/gui/progress_bar/progress_bar_canner.png", + true); + public static final UITexture PROGRESS_BAR_CIRCUIT = progressBar( + "textures/gui/progress_bar/progress_bar_circuit.png", true); + public static final UITexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = progressBar( + "textures/gui/progress_bar/progress_bar_circuit_assembler.png", true); + public static final UITexture PROGRESS_BAR_COMPRESS = progressBar( + "textures/gui/progress_bar/progress_bar_compress.png", true); + public static final UITexture PROGRESS_BAR_COMPRESS_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_compress_bronze.png"); + public static final UITexture PROGRESS_BAR_COMPRESS_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_compress_steel.png"); + public static final UITexture PROGRESS_BAR_CRACKING = progressBar( + "textures/gui/progress_bar/progress_bar_cracking.png", true); + public static final UITexture PROGRESS_BAR_CRACKING_INPUT = progressBar( + "textures/gui/progress_bar/progress_bar_cracking_2.png", 21, 38, true); + public static final UITexture PROGRESS_BAR_CRYSTALLIZATION = progressBar( + "textures/gui/progress_bar/progress_bar_crystallization.png", true); + public static final UITexture PROGRESS_BAR_EXTRACT = progressBar( + "textures/gui/progress_bar/progress_bar_extract.png", true); + public static final UITexture PROGRESS_BAR_EXTRACT_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_extract_bronze.png"); + public static final UITexture PROGRESS_BAR_EXTRACT_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_extract_steel.png"); + public static final UITexture PROGRESS_BAR_EXTRUDER = progressBar( + "textures/gui/progress_bar/progress_bar_extruder.png", true); + public static final UITexture PROGRESS_BAR_FUSION = progressBar("textures/gui/progress_bar/progress_bar_fusion.png", + true); + public static final UITexture PROGRESS_BAR_GAS_COLLECTOR = progressBar( + "textures/gui/progress_bar/progress_bar_gas_collector.png", true); + public static final UITexture PROGRESS_BAR_HAMMER = progressBar("textures/gui/progress_bar/progress_bar_hammer.png", + true); + public static final UITexture PROGRESS_BAR_HAMMER_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_hammer_bronze.png"); + public static final UITexture PROGRESS_BAR_HAMMER_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_hammer_steel.png"); + public static final UITexture PROGRESS_BAR_HAMMER_BASE = fullImage( + "textures/gui/progress_bar/progress_bar_hammer_base.png", true); + public static final UITexture PROGRESS_BAR_HAMMER_BASE_BRONZE = fullImage( + "textures/gui/progress_bar/progress_bar_hammer_base_bronze.png"); + public static final UITexture PROGRESS_BAR_HAMMER_BASE_STEEL = fullImage( + "textures/gui/progress_bar/progress_bar_hammer_base_steel.png"); + public static final UITexture PROGRESS_BAR_LATHE = progressBar("textures/gui/progress_bar/progress_bar_lathe.png", + true); + public static final UITexture PROGRESS_BAR_LATHE_BASE = fullImage( + "textures/gui/progress_bar/progress_bar_lathe_base.png", true); + public static final UITexture PROGRESS_BAR_MACERATE = progressBar( + "textures/gui/progress_bar/progress_bar_macerate.png", true); + public static final UITexture PROGRESS_BAR_MACERATE_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_macerate_bronze.png"); + public static final UITexture PROGRESS_BAR_MACERATE_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_macerate_steel.png"); + public static final UITexture PROGRESS_BAR_MAGNET = progressBar("textures/gui/progress_bar/progress_bar_magnet.png", + true); + public static final UITexture PROGRESS_BAR_MASS_FAB = progressBar( + "textures/gui/progress_bar/progress_bar_mass_fab.png", true); + public static final UITexture PROGRESS_BAR_MIXER = progressBar("textures/gui/progress_bar/progress_bar_mixer.png", + true); + public static final UITexture PROGRESS_BAR_PACKER = progressBar("textures/gui/progress_bar/progress_bar_packer.png", + true); + public static final UITexture PROGRESS_BAR_RECYCLER = progressBar( + "textures/gui/progress_bar/progress_bar_recycler.png", true); + public static final UITexture PROGRESS_BAR_REPLICATOR = progressBar( + "textures/gui/progress_bar/progress_bar_replicator.png", true); + public static final UITexture PROGRESS_BAR_SIFT = progressBar("textures/gui/progress_bar/progress_bar_sift.png", + true); + public static final UITexture PROGRESS_BAR_SLICE = progressBar("textures/gui/progress_bar/progress_bar_slice.png", + true); + public static final UITexture PROGRESS_BAR_UNPACKER = progressBar( + "textures/gui/progress_bar/progress_bar_unpacker.png", true); + public static final UITexture PROGRESS_BAR_WIREMILL = progressBar( + "textures/gui/progress_bar/progress_bar_wiremill.png", true); - public static final UITexture BUTTON_X = UITexture.fullImage(GTValues.MODID, - "textures/gui/widget/button_x_overlay.png", true); + // more custom progress bars + // todo these boiler empty bars can probably be replaced by using a resized steam slot texture + public static final UITexture PROGRESS_BAR_BOILER_EMPTY_BRONZE = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/progress_bar/progress_bar_boiler_empty_bronze.png") + .imageSize(10, 54) + .adaptable(1) + .build(); + public static final UITexture PROGRESS_BAR_BOILER_EMPTY_STEEL = new UITexture.Builder() + .location(GTValues.MODID, "textures/gui/progress_bar/progress_bar_boiler_empty_steel.png") + .imageSize(10, 54) + .adaptable(1) + .build(); + public static final UITexture PROGRESS_BAR_BOILER_FUEL_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_boiler_fuel_bronze.png", 18, 36); + public static final UITexture PROGRESS_BAR_BOILER_FUEL_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_boiler_fuel_steel.png", 18, 36); + public static final UITexture PROGRESS_BAR_BOILER_HEAT = progressBar( + "textures/gui/progress_bar/progress_bar_boiler_heat.png", true); + public static final UITexture PROGRESS_BAR_ASSEMBLY_LINE = progressBar( + "textures/gui/progress_bar/progress_bar_assembly_line.png", 54, 144, true); + public static final UITexture PROGRESS_BAR_ASSEMBLY_LINE_ARROW = progressBar( + "textures/gui/progress_bar/progress_bar_assembly_line_arrow.png", 10, 36, true); + public static final UITexture PROGRESS_BAR_COKE_OVEN = progressBar( + "textures/gui/progress_bar/progress_bar_coke_oven.png", 36, 36, true); + public static final UITexture PROGRESS_BAR_DISTILLATION_TOWER = progressBar( + "textures/gui/progress_bar/progress_bar_distillation_tower.png", 66, 116, true); + public static final UITexture PROGRESS_BAR_SOLAR_BRONZE = progressBar( + "textures/gui/progress_bar/progress_bar_solar_bronze.png", 10, 20); + public static final UITexture PROGRESS_BAR_SOLAR_STEEL = progressBar( + "textures/gui/progress_bar/progress_bar_solar_steel.png", 10, 20); + public static final UITexture PROGRESS_BAR_RESEARCH_STATION_1 = progressBar( + "textures/gui/progress_bar/progress_bar_research_station_1.png", 54, 10, true); + public static final UITexture PROGRESS_BAR_RESEARCH_STATION_2 = progressBar( + "textures/gui/progress_bar/progress_bar_research_station_2.png", 10, 36, true); + public static final UITexture PROGRESS_BAR_RESEARCH_STATION_BASE = fullImage( + "textures/gui/progress_bar/progress_bar_research_station_base.png", true); + public static final UITexture PROGRESS_BAR_FUSION_ENERGY = progressBar( + "textures/gui/progress_bar/progress_bar_fusion_energy.png", 94, 14); + public static final UITexture PROGRESS_BAR_FUSION_HEAT = progressBar( + "textures/gui/progress_bar/progress_bar_fusion_heat.png", 94, 14); + public static final UITexture PROGRESS_BAR_MULTI_ENERGY_YELLOW = progressBar( + "textures/gui/progress_bar/progress_bar_multi_energy_yellow.png", 190, 14); + public static final UITexture PROGRESS_BAR_HPCA_COMPUTATION = progressBar( + "textures/gui/progress_bar/progress_bar_hpca_computation.png", 94, 14); + public static final UITexture PROGRESS_BAR_LCE_FUEL = progressBar( + "textures/gui/progress_bar/progress_bar_lce_fuel.png", 62, 14); + public static final UITexture PROGRESS_BAR_LCE_LUBRICANT = progressBar( + "textures/gui/progress_bar/progress_bar_lce_lubricant.png", 62, 14); + public static final UITexture PROGRESS_BAR_LCE_OXYGEN = progressBar( + "textures/gui/progress_bar/progress_bar_lce_oxygen.png", 62, 14); + public static final UITexture PROGRESS_BAR_TURBINE_ROTOR_SPEED = progressBar( + "textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png", 62, 14); + public static final UITexture PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = progressBar( + "textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png", 62, 14); + public static final UITexture PROGRESS_BAR_FLUID_RIG_DEPLETION = progressBar( + "textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png", 190, 14); + + // MISC public static void init() {/**/} + + private static UITexture fullImage(String path) { + return fullImage(path, false); + } + + private static UITexture fullImage(String path, boolean canApplyTheme) { + return UITexture.fullImage(GTValues.MODID, path, canApplyTheme); + } + + private static UITexture progressBar(String path) { + return progressBar(path, 20, 40, false); + } + + private static UITexture progressBar(String path, boolean canApplyTheme) { + return progressBar(path, 20, 40, canApplyTheme); + } + + private static UITexture progressBar(String path, int width, int height) { + return progressBar(path, width, height, false); + } + + private static UITexture progressBar(String path, int width, int height, boolean canApplyTheme) { + UITexture.Builder builder = new UITexture.Builder() + .location(GTValues.MODID, path) + .imageSize(width, height); + if (canApplyTheme) builder.canApplyTheme(); + return builder.build(); + } + + // todo steam logos? multi indicator blinking logos? + public static UITexture getLogo() { + return GTValues.XMAS.get() ? GREGTECH_LOGO_XMAS : GREGTECH_LOGO; + } } diff --git a/src/main/java/gregtech/api/mui/GTGuiTheme.java b/src/main/java/gregtech/api/mui/GTGuiTheme.java index 42999e3d1a3..c23754eea94 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTheme.java +++ b/src/main/java/gregtech/api/mui/GTGuiTheme.java @@ -20,6 +20,7 @@ public class GTGuiTheme { public static final GTGuiTheme STANDARD = new Builder("gregtech_standard") .panel(GTGuiTextures.IDs.STANDARD_BACKGROUND) .itemSlot(GTGuiTextures.IDs.STANDARD_SLOT) + .fluidSlot(GTGuiTextures.IDs.STANDARD_FLUID_SLOT) .color(ConfigHolder.client.defaultUIColor) .toggleButton(GTGuiTextures.IDs.STANDARD_BUTTON, GTGuiTextures.IDs.STANDARD_SLOT, diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index ecaf71dce93..2b5ffaddc4d 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -328,7 +328,7 @@ public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManage .child(new Column() .pos(backgroundWidth - 7 - 18, backgroundHeight - 18 * 4 - 7 - 5) .width(18).height(18 * 4 + 5) - .child(GTGuiTextures.GREGTECH_LOGO.asWidget().size(17).top(18 * 3 + 5)) + .child(GTGuiTextures.getLogo().asWidget().size(17).top(18 * 3 + 5)) .child(workingButton.top(18 * 2)) .child(collapseButton.top(18)) .childIf(hasGhostCircuit, new GhostCircuitSlotWidget() From 7e1595598bcb728febda1c7527cb96a8ca7a2f0a Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Sat, 9 Dec 2023 22:31:24 -0500 Subject: [PATCH 73/77] Remove the GT Safe (#2276) --- .../api/capability/GregtechDataCodes.java | 4 - .../java/gregtech/api/gui/GuiTextures.java | 2 - .../client/renderer/texture/Textures.java | 16 +- .../renderer/texture/custom/SafeRenderer.java | 94 ---- .../metatileentities/MetaTileEntities.java | 91 +++- .../storage/MetaTileEntityLockedSafe.java | 432 ------------------ .../resources/assets/gregtech/lang/en_us.lang | 5 - .../resources/assets/gregtech/lang/ja_jp.lang | 5 - .../resources/assets/gregtech/lang/ru_ru.lang | 5 - .../resources/assets/gregtech/lang/zh_cn.lang | 5 - .../loot_tables/chests/abandoned_safe_1.json | 212 --------- .../blocks/storage/safe/base_bottom.png | Bin 420 -> 0 bytes .../blocks/storage/safe/base_front.png | Bin 179 -> 0 bytes .../blocks/storage/safe/base_side.png | Bin 411 -> 0 bytes .../textures/blocks/storage/safe/base_top.png | Bin 418 -> 0 bytes .../blocks/storage/safe/door_back.png | Bin 411 -> 0 bytes .../blocks/storage/safe/door_front.png | Bin 394 -> 0 bytes .../blocks/storage/safe/door_side.png | Bin 156 -> 0 bytes .../gui/progress_bar/progress_bar_unlock.png | Bin 1136 -> 0 bytes 19 files changed, 96 insertions(+), 775 deletions(-) delete mode 100644 src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java delete mode 100644 src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java delete mode 100644 src/main/resources/assets/gregtech/loot_tables/chests/abandoned_safe_1.json delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_bottom.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_front.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_side.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_top.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_back.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_front.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_side.png delete mode 100644 src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_unlock.png diff --git a/src/main/java/gregtech/api/capability/GregtechDataCodes.java b/src/main/java/gregtech/api/capability/GregtechDataCodes.java index b8720654da1..e425d3339e4 100644 --- a/src/main/java/gregtech/api/capability/GregtechDataCodes.java +++ b/src/main/java/gregtech/api/capability/GregtechDataCodes.java @@ -26,10 +26,6 @@ public static int assignId() { // Drum public static final int UPDATE_AUTO_OUTPUT = assignId(); - // Safe - public static final int UPDATE_LOCKED_STATE = assignId(); - public static final int UPDATE_CONTENTS_SEED = assignId(); - // Steam Machines public static final int NEEDS_VENTING = assignId(); public static final int VENTING_SIDE = assignId(); diff --git a/src/main/java/gregtech/api/gui/GuiTextures.java b/src/main/java/gregtech/api/gui/GuiTextures.java index 698540b1e6e..fb073716142 100644 --- a/src/main/java/gregtech/api/gui/GuiTextures.java +++ b/src/main/java/gregtech/api/gui/GuiTextures.java @@ -378,8 +378,6 @@ public class GuiTextures { .fullImage("textures/gui/progress_bar/progress_bar_slice.png"); public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture .fullImage("textures/gui/progress_bar/progress_bar_solar_%s.png"); - public static final TextureArea PROGRESS_BAR_UNLOCK = TextureArea - .fullImage("textures/gui/progress_bar/progress_bar_unlock.png"); public static final TextureArea PROGRESS_BAR_UNPACKER = TextureArea .fullImage("textures/gui/progress_bar/progress_bar_unpacker.png"); public static final TextureArea PROGRESS_BAR_WIREMILL = TextureArea diff --git a/src/main/java/gregtech/client/renderer/texture/Textures.java b/src/main/java/gregtech/client/renderer/texture/Textures.java index 09de1dbb6ef..39db1d4f0e2 100644 --- a/src/main/java/gregtech/client/renderer/texture/Textures.java +++ b/src/main/java/gregtech/client/renderer/texture/Textures.java @@ -7,8 +7,19 @@ import gregtech.client.renderer.CubeRendererState; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.cclop.UVMirror; -import gregtech.client.renderer.texture.cube.*; -import gregtech.client.renderer.texture.custom.*; +import gregtech.client.renderer.texture.cube.AlignedOrientedOverlayRenderer; +import gregtech.client.renderer.texture.cube.LDPipeOverlayRenderer; +import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; +import gregtech.client.renderer.texture.cube.SidedCubeRenderer; +import gregtech.client.renderer.texture.cube.SimpleOrientedCubeRenderer; +import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; +import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer; +import gregtech.client.renderer.texture.custom.ClipboardRenderer; +import gregtech.client.renderer.texture.custom.CrateRenderer; +import gregtech.client.renderer.texture.custom.DrumRenderer; +import gregtech.client.renderer.texture.custom.FireboxActiveRenderer; +import gregtech.client.renderer.texture.custom.LargeTurbineRenderer; +import gregtech.client.renderer.texture.custom.QuantumStorageRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; @@ -49,7 +60,6 @@ public class Textures { public static final CrateRenderer METAL_CRATE = new CrateRenderer("storage/crates/metal_crate"); public static final DrumRenderer WOODEN_DRUM = new DrumRenderer("storage/drums/wooden_drum"); public static final DrumRenderer DRUM = new DrumRenderer("storage/drums/drum"); - public static final SafeRenderer SAFE = new SafeRenderer("storage/safe"); public static final LargeTurbineRenderer LARGE_TURBINE_ROTOR_RENDERER = new LargeTurbineRenderer(); public static final QuantumStorageRenderer QUANTUM_STORAGE_RENDERER = new QuantumStorageRenderer(); diff --git a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java b/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java deleted file mode 100644 index 9e213bfa27d..00000000000 --- a/src/main/java/gregtech/client/renderer/texture/custom/SafeRenderer.java +++ /dev/null @@ -1,94 +0,0 @@ -package gregtech.client.renderer.texture.custom; - -import gregtech.api.GTValues; -import gregtech.client.renderer.texture.Textures; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import codechicken.lib.vec.Rotation; - -import java.util.Arrays; -import java.util.List; - -public class SafeRenderer implements IIconRegister { - - private static final Cuboid6 mainBoxOuter = new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, - 13 / 16.0); - private static final Cuboid6 mainBoxInner = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, - 12 / 16.0); - private static final Cuboid6 doorBox = new Cuboid6(4 / 16.0, 1 / 16.0, 3 / 16.0, 12 / 16.0, 13 / 16.0, 4 / 16.0); - private static final List rotations = Arrays.asList(EnumFacing.NORTH, EnumFacing.WEST, EnumFacing.SOUTH, - EnumFacing.EAST); - - private final String basePath; - - @SideOnly(Side.CLIENT) - private TextureAtlasSprite[] textures; - - public SafeRenderer(String basePath) { - this.basePath = basePath; - Textures.iconRegisters.add(this); - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getParticleTexture() { - return textures[1]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(TextureMap textureMap) { - String formattedBase = GTValues.MODID + ":blocks/" + basePath; - this.textures = new TextureAtlasSprite[7]; - this.textures[0] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/base_bottom")); - this.textures[1] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/base_top")); - this.textures[2] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/base_side")); - this.textures[3] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/base_front")); - - this.textures[4] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/door_side")); - this.textures[5] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/door_back")); - this.textures[6] = textureMap.registerSprite(new ResourceLocation(formattedBase + "/door_front")); - } - - @SideOnly(Side.CLIENT) - public void render(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing rotation, - float capRotation) { - translation.translate(0.5, 0.5, 0.5); - translation.rotate(Math.toRadians(90.0 * rotations.indexOf(rotation)), Rotation.axes[1]); - translation.translate(-0.5, -0.5, -0.5); - - for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite baseSprite = renderSide.getAxis() == Axis.Y ? - textures[renderSide.getIndex()] : - renderSide == EnumFacing.NORTH ? textures[3] : textures[2]; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxOuter, baseSprite, - BlockRenderLayer.CUTOUT_MIPPED); - if (renderSide == EnumFacing.NORTH) continue; - Textures.renderFace(renderState, translation, pipeline, renderSide, mainBoxInner, baseSprite, - BlockRenderLayer.CUTOUT_MIPPED); - } - - translation.translate(4 / 16.0, 7 / 16.0, 3 / 16.0); - translation.rotate(Math.toRadians(capRotation), Rotation.axes[1]); - translation.translate(-4 / 16.0, -7 / 16.0, -3 / 16.0); - - for (EnumFacing renderSide : EnumFacing.VALUES) { - TextureAtlasSprite doorSprite = renderSide == EnumFacing.NORTH ? textures[6] : - renderSide == EnumFacing.SOUTH ? textures[5] : textures[4]; - Textures.renderFace(renderState, translation, pipeline, renderSide, doorBox, doorSprite, - BlockRenderLayer.CUTOUT_MIPPED); - } - } -} diff --git a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java index dcee3394859..d35d77f79d8 100644 --- a/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java +++ b/src/main/java/gregtech/common/metatileentities/MetaTileEntities.java @@ -20,14 +20,76 @@ import gregtech.common.blocks.BlockTurbineCasing; import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.converter.MetaTileEntityConverter; -import gregtech.common.metatileentities.electric.*; -import gregtech.common.metatileentities.multi.*; -import gregtech.common.metatileentities.multi.electric.*; +import gregtech.common.metatileentities.electric.MetaTileEntityAlarm; +import gregtech.common.metatileentities.electric.MetaTileEntityBatteryBuffer; +import gregtech.common.metatileentities.electric.MetaTileEntityBlockBreaker; +import gregtech.common.metatileentities.electric.MetaTileEntityCharger; +import gregtech.common.metatileentities.electric.MetaTileEntityDiode; +import gregtech.common.metatileentities.electric.MetaTileEntityFisher; +import gregtech.common.metatileentities.electric.MetaTileEntityGasCollector; +import gregtech.common.metatileentities.electric.MetaTileEntityHull; +import gregtech.common.metatileentities.electric.MetaTileEntityItemCollector; +import gregtech.common.metatileentities.electric.MetaTileEntityMagicEnergyAbsorber; +import gregtech.common.metatileentities.electric.MetaTileEntityMiner; +import gregtech.common.metatileentities.electric.MetaTileEntityPump; +import gregtech.common.metatileentities.electric.MetaTileEntityRockBreaker; +import gregtech.common.metatileentities.electric.MetaTileEntitySingleCombustion; +import gregtech.common.metatileentities.electric.MetaTileEntitySingleTurbine; +import gregtech.common.metatileentities.electric.MetaTileEntityTransformer; +import gregtech.common.metatileentities.electric.MetaTileEntityWorldAccelerator; +import gregtech.common.metatileentities.electric.SimpleMachineMetaTileEntityResizable; +import gregtech.common.metatileentities.multi.BoilerType; +import gregtech.common.metatileentities.multi.MetaTileEntityCokeOven; +import gregtech.common.metatileentities.multi.MetaTileEntityCokeOvenHatch; +import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler; +import gregtech.common.metatileentities.multi.MetaTileEntityMultiblockTank; +import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveBlastFurnace; +import gregtech.common.metatileentities.multi.MetaTileEntityPrimitiveWaterPump; +import gregtech.common.metatileentities.multi.MetaTileEntityPumpHatch; +import gregtech.common.metatileentities.multi.MetaTileEntityTankValve; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityActiveTransformer; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityAssemblyLine; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityCleanroom; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityCrackingUnit; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityDataBank; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityDistillationTower; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityElectricBlastFurnace; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityFluidDrill; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityFusionReactor; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityImplosionCompressor; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityLargeChemicalReactor; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityLargeMiner; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityMultiSmelter; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityNetworkSwitch; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityPowerSubstation; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityProcessingArray; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityPyrolyseOven; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityResearchStation; +import gregtech.common.metatileentities.multi.electric.MetaTileEntityVacuumFreezer; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor; import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen; import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeCombustionEngine; import gregtech.common.metatileentities.multi.electric.generator.MetaTileEntityLargeTurbine; -import gregtech.common.metatileentities.multi.multiblockpart.*; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityAutoMaintenanceHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityCleaningMaintenanceHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityComputationHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityDataAccessHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityEnergyHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFluidHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityItemBus; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityLaserHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMachineHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMaintenanceHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMufflerHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiFluidHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityObjectHolder; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityOpticalDataHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityPassthroughHatchFluid; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityPassthroughHatchItem; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityReservoirHatch; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityRotorHolder; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntitySubstationEnergyHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputBus; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEInputHatch; import gregtech.common.metatileentities.multi.multiblockpart.appeng.MetaTileEntityMEOutputBus; @@ -39,13 +101,28 @@ import gregtech.common.metatileentities.multi.steam.MetaTileEntitySteamGrinder; import gregtech.common.metatileentities.multi.steam.MetaTileEntitySteamOven; import gregtech.common.metatileentities.primitive.MetaTileEntityCharcoalPileIgniter; -import gregtech.common.metatileentities.steam.*; +import gregtech.common.metatileentities.steam.SteamAlloySmelter; +import gregtech.common.metatileentities.steam.SteamCompressor; +import gregtech.common.metatileentities.steam.SteamExtractor; +import gregtech.common.metatileentities.steam.SteamFurnace; +import gregtech.common.metatileentities.steam.SteamHammer; +import gregtech.common.metatileentities.steam.SteamMacerator; +import gregtech.common.metatileentities.steam.SteamMiner; +import gregtech.common.metatileentities.steam.SteamRockBreaker; import gregtech.common.metatileentities.steam.boiler.SteamCoalBoiler; import gregtech.common.metatileentities.steam.boiler.SteamLavaBoiler; import gregtech.common.metatileentities.steam.boiler.SteamSolarBoiler; import gregtech.common.metatileentities.steam.multiblockpart.MetaTileEntitySteamHatch; import gregtech.common.metatileentities.steam.multiblockpart.MetaTileEntitySteamItemBus; -import gregtech.common.metatileentities.storage.*; +import gregtech.common.metatileentities.storage.MetaTileEntityBuffer; +import gregtech.common.metatileentities.storage.MetaTileEntityCrate; +import gregtech.common.metatileentities.storage.MetaTileEntityCreativeChest; +import gregtech.common.metatileentities.storage.MetaTileEntityCreativeEnergy; +import gregtech.common.metatileentities.storage.MetaTileEntityCreativeTank; +import gregtech.common.metatileentities.storage.MetaTileEntityDrum; +import gregtech.common.metatileentities.storage.MetaTileEntityQuantumChest; +import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank; +import gregtech.common.metatileentities.storage.MetaTileEntityWorkbench; import gregtech.common.pipelike.fluidpipe.longdistance.MetaTileEntityLDFluidEndpoint; import gregtech.common.pipelike.itempipe.longdistance.MetaTileEntityLDItemEndpoint; import gregtech.integration.jei.multiblock.MultiblockInfoCategory; @@ -302,7 +379,6 @@ public class MetaTileEntities { public static MetaTileEntityActiveTransformer ACTIVE_TRANSFORMER; // STORAGE SECTION - public static MetaTileEntityLockedSafe LOCKED_SAFE; public static MetaTileEntityTankValve WOODEN_TANK_VALVE; public static MetaTileEntityTankValve STEEL_TANK_VALVE; public static MetaTileEntityMultiblockTank WOODEN_TANK; @@ -1038,7 +1114,6 @@ public static void init() { new MetaTileEntityRotorHolder(gregtechId("rotor_holder.uv"), GTValues.UV)); // Misc, IDs 1646-1999 - LOCKED_SAFE = registerMetaTileEntity(1646, new MetaTileEntityLockedSafe(gregtechId("locked_safe"))); WORKBENCH = registerMetaTileEntity(1647, new MetaTileEntityWorkbench(gregtechId("workbench"))); PRIMITIVE_WATER_PUMP = registerMetaTileEntity(1648, new MetaTileEntityPrimitiveWaterPump(gregtechId("primitive_water_pump"))); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java deleted file mode 100644 index d8230181390..00000000000 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityLockedSafe.java +++ /dev/null @@ -1,432 +0,0 @@ -package gregtech.common.metatileentities.storage; - -import gregtech.api.GTValues; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.LabelWidget; -import gregtech.api.gui.widgets.ProgressWidget; -import gregtech.api.gui.widgets.ProgressWidget.MoveType; -import gregtech.api.gui.widgets.ServerWidgetGroup; -import gregtech.api.gui.widgets.SlotWidget; -import gregtech.api.items.itemhandlers.GTItemStackHandler; -import gregtech.api.metatileentity.IFastRenderMetaTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtech.api.recipes.ingredients.GTRecipeInput; -import gregtech.api.recipes.ingredients.GTRecipeItemInput; -import gregtech.api.recipes.ingredients.GTRecipeOreInput; -import gregtech.api.util.GTUtility; -import gregtech.client.renderer.texture.Textures; -import gregtech.common.worldgen.LootTableHelper; -import gregtech.loaders.recipe.CraftingComponent; -import gregtech.loaders.recipe.CraftingComponent.Component; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.world.WorldServer; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootTable; -import net.minecraftforge.common.util.Constants.NBT; -import net.minecraftforge.items.ItemStackHandler; -import net.minecraftforge.oredict.OreDictionary; - -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.ColourMultiplier; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Matrix4; -import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; - -import java.util.List; -import java.util.Random; -import java.util.function.DoubleSupplier; - -import static gregtech.api.capability.GregtechDataCodes.UPDATE_CONTENTS_SEED; -import static gregtech.api.capability.GregtechDataCodes.UPDATE_LOCKED_STATE; - -public class MetaTileEntityLockedSafe extends MetaTileEntity implements IFastRenderMetaTileEntity { - - private static final int MAX_UNLOCK_PROGRESS = 100; - private static Component[] ALLOWED_COMPONENTS; - private static final IndexedCuboid6 COLLISION_BOX = new IndexedCuboid6(null, - new Cuboid6(3 / 16.0, 0 / 16.0, 3 / 16.0, 13 / 16.0, 14 / 16.0, 13 / 16.0)); - - private int unlockProgress = -1; - private int unlockComponentTier = 1; - private boolean isSafeUnlocked = false; - - private long unlockComponentsSeed = 0L; - private final ItemStackHandler unlockComponents = new GTItemStackHandler(this, 2); - private final ItemStackHandler unlockInventory = new GTItemStackHandler(this, 2) { - - @NotNull - @Override - public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { - int maxStackSize = canPutUnlockItemInSlot(slot, stack); - if (maxStackSize == 0) return stack; - int maxAmount = Math.min(maxStackSize, stack.getCount()); - int remainder = stack.getCount() - maxAmount; - stack = stack.copy(); - stack.setCount(maxAmount); - int addAmount = super.insertItem(slot, stack, simulate).getCount(); - int totalAmount = remainder + addAmount; - return totalAmount == 0 ? ItemStack.EMPTY : GTUtility.copy(totalAmount, stack); - } - - @Override - protected void onContentsChanged(int slot) { - super.onContentsChanged(slot); - recheckUnlockItemsAndUnlock(); - } - }; - private final ItemStackHandler safeLootInventory = new GTItemStackHandler(this, 27); - private float doorAngle = 0.0f; - private float prevDoorAngle = 0.0f; - - public MetaTileEntityLockedSafe(ResourceLocation metaTileEntityId) { - super(metaTileEntityId); - } - - @Override - public void clearMachineInventory(NonNullList itemBuffer) { - if (isSafeUnlocked()) { - clearInventory(itemBuffer, safeLootInventory); - } - } - - @Override - public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { - return new MetaTileEntityLockedSafe(metaTileEntityId); - } - - @Override - public void update() { - super.update(); - updateOpenVisualAnimation(); - updateOpenProgress(); - } - - @Override - public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, - CuboidRayTraceResult hitResult) { - generateUnlockComponents(); - return super.onRightClick(playerIn, hand, facing, hitResult); - } - - @Override - public void addCollisionBoundingBox(List collisionList) { - collisionList.add(COLLISION_BOX); - } - - @Override - public boolean shouldDropWhenDestroyed() { - return false; - } - - @Override - public float getBlockHardness() { - return isSafeUnlocked() ? 6.0f : -1.0f; - } - - @Override - public float getBlockResistance() { - return 6000000.0F; - } - - private void generateUnlockComponents() { - if (!getWorld().isRemote && unlockComponentsSeed == 0L) { - setUnlockComponentsSeed(new Random().nextLong()); - } - } - - private void updateDisplayUnlockComponents() { - GTRecipeInput[] unlockComponents = getUnlockComponents(); - for (int i = 0; i < Math.min(this.unlockComponents.getSlots(), unlockComponents.length); i++) { - if (unlockComponents[i].isOreDict()) { - this.unlockComponents.setStackInSlot(i, - OreDictionary.getOres(OreDictionary.getOreName(unlockComponents[i].getOreDict())).get(0)); - } else { - this.unlockComponents.setStackInSlot(i, (unlockComponents[i].getInputStacks()[0])); - } - } - } - - private GTRecipeInput[] getUnlockComponents() { - if (ALLOWED_COMPONENTS == null) - ALLOWED_COMPONENTS = new Component[] { CraftingComponent.PUMP, CraftingComponent.CONVEYOR, - CraftingComponent.EMITTER, CraftingComponent.SENSOR }; - - Random random = new Random(unlockComponentsSeed); - return new GTRecipeInput[] { - new GTRecipeOreInput(CraftingComponent.CIRCUIT.getIngredient(unlockComponentTier).toString()), - new GTRecipeItemInput((ItemStack) ALLOWED_COMPONENTS[random.nextInt(ALLOWED_COMPONENTS.length)] - .getIngredient(unlockComponentTier)), - }; - } - - private void recheckUnlockItemsAndUnlock() { - if (getWorld() != null && !getWorld().isRemote && !isSafeUnlocked() && - checkUnlockedItems() && unlockProgress == -1) { - this.unlockProgress++; - markDirty(); - } - } - - private int canPutUnlockItemInSlot(int slot, ItemStack itemStack) { - if (itemStack.isEmpty()) { - return 0; - } - boolean isRequiredItem = false; - int amountRequired = 0; - GTRecipeInput[] unlockComponents = getUnlockComponents(); - for (GTRecipeInput stack : unlockComponents) { - if (stack == null) continue; - if (!stack.acceptsStack(itemStack)) continue; - amountRequired = stack.getAmount(); - isRequiredItem = true; - break; - } - if (!isRequiredItem) { - return 0; - } - for (int i = 0; i < unlockInventory.getSlots(); i++) { - ItemStack componentStack = unlockInventory.getStackInSlot(i); - if (componentStack.isEmpty()) continue; - if (!componentStack.isItemEqual(itemStack)) continue; - return slot == i ? amountRequired - componentStack.getCount() : 0; - } - return amountRequired; - } - - private boolean checkUnlockedItems() { - GTRecipeInput[] unlockComponents = getUnlockComponents(); - for (GTRecipeInput stack : unlockComponents) { - if (stack == null) continue; - int itemLeftToCheck = stack.getAmount(); - for (int i = 0; i < unlockInventory.getSlots(); i++) { - ItemStack otherStack = unlockInventory.getStackInSlot(i); - if (otherStack.isEmpty()) continue; - if (stack.acceptsStack(otherStack)) continue; - itemLeftToCheck -= otherStack.getCount(); - } - if (itemLeftToCheck > 0) return false; - } - return true; - } - - private void updateOpenProgress() { - if (!getWorld().isRemote && unlockProgress >= 0 && unlockProgress < MAX_UNLOCK_PROGRESS) { - ++this.unlockProgress; - if (unlockProgress >= MAX_UNLOCK_PROGRESS) { - generateChestContents(); - setSafeUnlocked(true); - } - } - } - - private void generateChestContents() { - ResourceLocation lootTableLocation = GTUtility.gregtechId("chests/abandoned_safe_" + unlockComponentTier); - WorldServer worldServer = (WorldServer) getWorld(); - LootTable lootTable = worldServer.getLootTableManager().getLootTableFromLocation(lootTableLocation); - LootContext lootContext = new LootContext.Builder(worldServer).build(); - Random random = new Random(); - List loots = lootTable.generateLootForPools(random, lootContext); - LootTableHelper.fillInventory(safeLootInventory, random, loots); - } - - private void updateOpenVisualAnimation() { - this.prevDoorAngle = doorAngle; - if ((!isSafeUnlocked && this.doorAngle > 0.0F) || - (isSafeUnlocked && this.doorAngle < 1.0F)) { - if (isSafeUnlocked) { - this.doorAngle += 0.1F; - } else { - this.doorAngle -= 0.1F; - } - if (this.doorAngle > 1.0F) { - this.doorAngle = 1.0F; - } else if (this.doorAngle < 0.0F) { - this.doorAngle = 0.0F; - } - } - } - - public boolean isSafeUnlocked() { - return isSafeUnlocked; - } - - public void setSafeUnlocked(boolean safeUnlocked) { - this.isSafeUnlocked = safeUnlocked; - if (getWorld() != null && !getWorld().isRemote) { - writeCustomData(UPDATE_LOCKED_STATE, buf -> buf.writeBoolean(safeUnlocked)); - notifyBlockUpdate(); - markDirty(); - } - } - - protected void setUnlockComponentsSeed(long unlockComponentsSeed) { - this.unlockComponentsSeed = unlockComponentsSeed; - if (getWorld() != null && !getWorld().isRemote) { - updateDisplayUnlockComponents(); - writeCustomData(UPDATE_CONTENTS_SEED, buf -> buf.writeVarLong(unlockComponentsSeed)); - markDirty(); - } - } - - @Override - public void writeInitialSyncData(PacketBuffer buf) { - super.writeInitialSyncData(buf); - buf.writeVarInt(unlockComponentTier); - buf.writeBoolean(isSafeUnlocked); - buf.writeFloat(doorAngle); - buf.writeVarLong(unlockComponentsSeed); - } - - @Override - public void receiveInitialSyncData(PacketBuffer buf) { - super.receiveInitialSyncData(buf); - this.unlockComponentTier = buf.readVarInt(); - this.isSafeUnlocked = buf.readBoolean(); - this.doorAngle = buf.readFloat(); - this.prevDoorAngle = doorAngle; - this.unlockComponentsSeed = buf.readVarLong(); - } - - @Override - public void receiveCustomData(int dataId, PacketBuffer buf) { - super.receiveCustomData(dataId, buf); - if (dataId == UPDATE_LOCKED_STATE) { - this.isSafeUnlocked = buf.readBoolean(); - } else if (dataId == UPDATE_CONTENTS_SEED) { - this.unlockComponentsSeed = buf.readVarLong(); - } - } - - @Override - public void initFromItemStackData(NBTTagCompound itemStack) { - super.initFromItemStackData(itemStack); - if (itemStack.hasKey("ComponentTier", NBT.TAG_ANY_NUMERIC)) { - this.unlockComponentTier = itemStack.getInteger("ComponentTier"); - } - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound data) { - data = super.writeToNBT(data); - data.setInteger("UnlockProgress", unlockProgress); - data.setInteger("ComponentTier", unlockComponentTier); - data.setBoolean("Unlocked", isSafeUnlocked); - - data.setLong("UnlockComponentsSeed", unlockComponentsSeed); - data.setTag("UnlockInventory", unlockInventory.serializeNBT()); - data.setTag("LootInventory", safeLootInventory.serializeNBT()); - return data; - } - - @Override - public void readFromNBT(NBTTagCompound data) { - super.readFromNBT(data); - this.unlockProgress = data.getInteger("UnlockProgress"); - this.unlockComponentTier = data.getInteger("ComponentTier"); - this.isSafeUnlocked = data.getBoolean("Unlocked"); - - this.unlockComponentsSeed = data.getLong("UnlockComponentsSeed"); - this.unlockInventory.deserializeNBT(data.getCompoundTag("UnlockInventory")); - this.safeLootInventory.deserializeNBT(data.getCompoundTag("LootInventory")); - updateDisplayUnlockComponents(); - } - - @Override - public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {} - - @Override - public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) { - ColourMultiplier colourMultiplier = new ColourMultiplier( - GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier])); - float angle = prevDoorAngle + (doorAngle - prevDoorAngle) * partialTicks; - angle = 1.0f - (1.0f - angle) * (1.0f - angle) * (1.0f - angle); - float resultDoorAngle = angle * 120.0f; - Textures.SAFE.render(renderState, translation, new IVertexOperation[] { colourMultiplier }, getFrontFacing(), - resultDoorAngle); - } - - @Override - public Pair getParticleTexture() { - return Pair.of(Textures.SAFE.getParticleTexture(), GTValues.VC[unlockComponentTier]); - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public int getLightOpacity() { - return 1; - } - - @Override - public AxisAlignedBB getRenderBoundingBox() { - return new AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 1, 2)); - } - - @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - DoubleSupplier supplier = () -> 0.2 + (unlockProgress / (MAX_UNLOCK_PROGRESS * 1.0)) * 0.8; - ModularUI.Builder builder = ModularUI.defaultBuilder() - .widget(new ProgressWidget(supplier, 5, 5, 166, 74, - GuiTextures.PROGRESS_BAR_UNLOCK, - MoveType.VERTICAL_INVERTED)) - .bindPlayerInventory(entityPlayer.inventory); - - ServerWidgetGroup lockedGroup = new ServerWidgetGroup(() -> !isSafeUnlocked && unlockProgress < 0); - lockedGroup.addWidget(new LabelWidget(5, 20, "gregtech.machine.locked_safe.malfunctioning")); - lockedGroup.addWidget(new LabelWidget(5, 30, "gregtech.machine.locked_safe.requirements")); - - lockedGroup.addWidget( - new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); - lockedGroup.addWidget( - new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT)); - - lockedGroup.addWidget(new SlotWidget(unlockComponents, 0, 70, 58, false, false)); - lockedGroup.addWidget(new SlotWidget(unlockComponents, 1, 70 + 18, 58, false, false)); - - ServerWidgetGroup unlockedGroup = new ServerWidgetGroup(() -> isSafeUnlocked); - for (int row = 0; row < 3; row++) { - for (int col = 0; col < 9; col++) { - unlockedGroup.addWidget(new SlotWidget(safeLootInventory, col + row * 9, - 8 + col * 18, 15 + row * 18, true, false)); - } - } - - return builder.widget(unlockedGroup) - .widget(lockedGroup) - .build(getHolder(), entityPlayer); - } - - @Override - public boolean canPlaceCoverOnSide(@NotNull EnumFacing side) { - return false; - } - - @Override - public boolean canRenderMachineGrid(@NotNull ItemStack mainHandStack, @NotNull ItemStack offHandStack) { - return false; - } - - @Override - public boolean showToolUsages() { - return false; - } -} diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index b5fd935ad7b..f34849c4bdd 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -2718,11 +2718,6 @@ gregtech.machine.crate.titanium.name=Titanium Crate gregtech.machine.crate.tungstensteel.name=Tungstensteel Crate gregtech.crate.tooltip.taped_movement=Can be Taped to keep inventory contents when broken -# Safe -gregtech.machine.locked_safe.name=Locked Safe -gregtech.machine.locked_safe.malfunctioning=§cMalfunctioning! -gregtech.machine.locked_safe.requirements=§7Replacements required: - # Workbench gregtech.machine.workbench.name=Crafting Station gregtech.machine.workbench.tooltip1=Better than Forestry diff --git a/src/main/resources/assets/gregtech/lang/ja_jp.lang b/src/main/resources/assets/gregtech/lang/ja_jp.lang index 28cb715332c..648aa40ec41 100644 --- a/src/main/resources/assets/gregtech/lang/ja_jp.lang +++ b/src/main/resources/assets/gregtech/lang/ja_jp.lang @@ -2723,11 +2723,6 @@ gregtech.machine.crate.titanium.name=チタン製クレート gregtech.machine.crate.tungstensteel.name=タングステンスチール製クレート gregtech.crate.tooltip.taped_movement=テープを使うと撤去時に中身を保持できる -# Safe -gregtech.machine.locked_safe.name=金庫 -gregtech.machine.locked_safe.malfunctioning=§c故障中! -gregtech.machine.locked_safe.requirements=§7要交換部品: - # Workbench gregtech.machine.workbench.name=クラフティングステーション gregtech.machine.workbench.tooltip1=Forestryのワークベンチより優秀 diff --git a/src/main/resources/assets/gregtech/lang/ru_ru.lang b/src/main/resources/assets/gregtech/lang/ru_ru.lang index 349a33f2169..6150191749e 100644 --- a/src/main/resources/assets/gregtech/lang/ru_ru.lang +++ b/src/main/resources/assets/gregtech/lang/ru_ru.lang @@ -2454,11 +2454,6 @@ gregtech.machine.crate.stainless_steel.name=Ящик из нержавеющей gregtech.machine.crate.titanium.name=Титановый ящик gregtech.machine.crate.tungstensteel.name=Ящик из вольфрамовой стали -# Safe -gregtech.machine.locked_safe.name=Закрытый сейф -gregtech.machine.locked_safe.malfunctioning=§cСломан! -gregtech.machine.locked_safe.requirements=§7Требуется замена: - # Workbench gregtech.machine.workbench.name=Инженерный верстак gregtech.machine.workbench.tooltip1=Лучше, чем в Forestry diff --git a/src/main/resources/assets/gregtech/lang/zh_cn.lang b/src/main/resources/assets/gregtech/lang/zh_cn.lang index f410418bbce..88906474bcf 100644 --- a/src/main/resources/assets/gregtech/lang/zh_cn.lang +++ b/src/main/resources/assets/gregtech/lang/zh_cn.lang @@ -2718,11 +2718,6 @@ gregtech.machine.crate.titanium.name=钛板条箱 gregtech.machine.crate.tungstensteel.name=钨钢板条箱 gregtech.crate.tooltip.taped_movement=可以用胶带打包库存,在破坏时一起带走 -# Safe -gregtech.machine.locked_safe.name=上锁的保险柜 -gregtech.machine.locked_safe.malfunctioning=§c运行故障! -gregtech.machine.locked_safe.requirements=§7替换部件需求: - # Workbench gregtech.machine.workbench.name=合成站 gregtech.machine.workbench.tooltip1=比林业的好 diff --git a/src/main/resources/assets/gregtech/loot_tables/chests/abandoned_safe_1.json b/src/main/resources/assets/gregtech/loot_tables/chests/abandoned_safe_1.json deleted file mode 100644 index 7accc9b7c68..00000000000 --- a/src/main/resources/assets/gregtech/loot_tables/chests/abandoned_safe_1.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "pools": [ - { - "name": "resources_pool", - "rolls": { - "min": 7, - "max": 12 - }, - "entries": [ - { - "type": "gregtech:ore_dict", - "name": "ingotSteel", - "functions": [ - { - "function": "set_count", - "count": { - "min": 4, - "max": 6 - } - } - ], - "weight": 10 - }, - { - "type": "gregtech:ore_dict", - "name": "plateSteel", - "functions": [ - { - "function": "set_count", - "count": { - "min": 4, - "max": 6 - } - } - ], - "weight": 10 - }, - { - "type": "gregtech:ore_dict", - "name": "ingotBronze", - "functions": [ - { - "function": "set_count", - "count": { - "min": 3, - "max": 8 - } - } - ], - "weight": 10 - }, - { - "type": "gregtech:ore_dict", - "name": "ingotAluminium", - "functions": [ - { - "function": "set_count", - "count": { - "min": 3, - "max": 9 - } - } - ], - "weight": 5 - }, - { - "type": "gregtech:ore_dict", - "name": "plateAluminium", - "functions": [ - { - "function": "set_count", - "count": { - "min": 3, - "max": 9 - } - } - ], - "weight": 5 - }, - { - "type": "item", - "name": "minecraft:redstone", - "functions": [ - { - "function": "set_count", - "count": { - "min": 7, - "max": 11 - } - } - ], - "weight": 5 - }, - { - "type": "item", - "name": "minecraft:gold_ingot", - "functions": [ - { - "function": "set_count", - "count": { - "min": 2, - "max": 5 - } - } - ], - "weight": 5 - }, - { - "type": "item", - "name": "minecraft:diamond", - "functions": [ - { - "function": "set_count", - "count": { - "min": 1, - "max": 2 - } - } - ], - "weight": 2 - } - ] - }, - { - "name": "components_pool", - "rolls": 3, - "entries": [ - { - "type": "gregtech:meta_item", - "name": "electric.motor.lv", - "functions": [ - { - "function": "set_count", - "count": { - "min": 2, - "max": 3 - } - } - ], - "weight": 20 - }, - { - "type": "gregtech:meta_item", - "name": "conveyor.module.lv", - "functions": [ - { - "function": "set_count", - "count": { - "min": 1, - "max": 2 - } - } - ], - "weight": 15 - }, - { - "type": "gregtech:meta_item", - "name": "electric.pump.lv", - "functions": [ - { - "function": "set_count", - "count": { - "min": 1, - "max": 2 - } - } - ], - "weight": 12 - }, - { - "type": "gregtech:meta_item", - "name": "robot.arm.lv", - "functions": [ - { - "function": "set_count", - "count": 1 - } - ], - "weight": 11 - }, - { - "type": "gregtech:meta_item", - "name": "emitter.lv", - "functions": [ - { - "function": "set_count", - "count": { - "min": 1, - "max": 2 - } - } - ], - "weight": 9 - }, - { - "type": "gregtech:meta_item", - "name": "sensor.lv", - "functions": [ - { - "function": "set_count", - "count": { - "min": 1, - "max": 2 - } - } - ], - "weight": 9 - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_bottom.png b/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_bottom.png deleted file mode 100644 index d02d5b81f6fa39db7dab1e3b0a175eb3757029e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 420 zcmV;V0bBlwP)N2bZe?^J zG%hhNHvLWs=l}o#B1uF+R5(wilFM$wFc3xgZ#L~BB1kRa(f(04mAWXR5QmUb9(gz~ zLVnsT^P9Jw&Jg O0000!lvI6;>1s;*b z3=DjGL736~_k^`TL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3(J+r@loG*ZC3_V>O zLoEE0fBgS%?<%ocK~thNIQ0If`4T;A*bg(L*qPa69azDrU?aq%z^44=PdWp`x7E)+ U8}BGe0%~UPboFyt=akR{01e$Wk^lez diff --git a/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_side.png b/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_side.png deleted file mode 100644 index ac0793f747be42020de511159a56989d8bf9555e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 411 zcmV;M0c8G(P)N2bZe?^J zG%hhNHvLWs=l}o#8A(JzR5(wijoVJbP!L7=ZeD!x5AcQ{EiF|lwn8v5UNFXMj7Ec$ zLb;<+Q9waHV4InwNTbO)#)p;ZnRKlQ0r(fcF8@N{5uTfe471LUKxZ;Rd;A%gt z*Y7%AT-O`8bgMWkmE{8T)4AjFWfF;ta)kpY#gaH+?-yY09rE$0pd@9BHRD~002ovPDHLk FV1g1{r}F>+ diff --git a/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_top.png b/src/main/resources/assets/gregtech/textures/blocks/storage/safe/base_top.png deleted file mode 100644 index e9361efca6ffbb79b0fc64e4fdd2b1dfa6627b70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 418 zcmV;T0bTxyP)<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNHvLWs=l}o#AW1|)R5(wil3P#0KoEub;rgHtisB^}DgGi8eN#f%#TIM;q4$ft zA7=(h+PDRZ4=2-|&iQ6$+ZKR-$(U>+W3q`Vhtu;*bgUk3y0$@mdB-(nPX*AiY^dcI zwC_U)K}Cvk!}*LLHkH-@xXU;U@ewC*k`!*5NgPM9Nck(7r0g*QR1k`RL9FfbXvKg7 zCeUF--DvDz5T7}YXuX{)+&=c<#1U!J)k!D{j6f8Ji-lZd+4BeBl4+V3m=*;-i*HQw z9Fr`En`N}Za^D0`RGf<0TdyUuk@tU}&GDiXuI{^3S_6PqO`KcpZ*>zJBOQ=k}e2ld}sdtpOY(W3q{i$-{-#56&STQn)YD1^@s6 M07*qoM6N<$g6W>BO8@`> diff --git a/src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_back.png b/src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_back.png deleted file mode 100644 index c12c82dda048ff6095d947079fc49553e708b8bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 411 zcmV;M0c8G(P)N2bZe?^J zG%hhNHvLWs=l}o#8A(JzR5(wijoVJbP!L7=ZeD!x5AcQ{EiF|lwn8v5UNFXMj7Ec$ zLb;<+Q9waHV4InwNTbO)#)p;ZnRKlQ0r(fcF8@N{5uTfe471LUKxZ;Rd;A%gt z*Y7%AT-O`8bgMWkmE{8T)4AjFWfF;ta)kpY#gaH+?-yY09rE$0pd@9BHRD~002ovPDHLk FV1jl(r+xqc diff --git a/src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_front.png b/src/main/resources/assets/gregtech/textures/blocks/storage/safe/door_front.png deleted file mode 100644 index 7470109b0a39345ee31c6adea66e390de3b47091..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 394 zcmV;50d@X~P)N2bZe?^J zG%hhNHvLWs=l}o#2uVaiR5(wijmt_xQ51&vtN11d0^z(;lP0}^UA&}6Jyu@O2!hDl zpqexZyp*J%VuMsPG9TdAf59Pdu(ve$SZ6KH_iY8>U+g^Y!`gCqbPN+#ovlEBK1Xl% zyEeN&GjyikXbnf^0pf}8UqjRepLp%|%mSU|dAx-3L0`c?R(Sbn3)(!6@Lt7d`R0@n#m_PnKnE!N6m!p$`;_6%qKeZQC-r-;}DzKa}->%-y{Rls&k| z(m6pJa0|C0Fhn_&ypo+Wl1l3XPBt&XCc(s|pbdoGYn((AICET_$5SHlb!lvI6;>1s;*b z3=DjGK$vmro+3}6phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?p4neN&KE#6Ql2i3 sAr}70D^}$za`t8^uz@hI74KJFhGxrJfrJ>J8lWl$Pgg&ebxsLQ0Gd!IC;$Ke diff --git a/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_unlock.png b/src/main/resources/assets/gregtech/textures/gui/progress_bar/progress_bar_unlock.png deleted file mode 100644 index 25b60223437923dea90fd39754f040aa1056bdc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1136 zcmeAS@N?(olHy`uVBq!ia0vp^%Yb+S2OE%VS}kxKNU@|l`Z_W&Z0zU$lgJ9>a~60+ z7BevL?F3=Q9c<$Jfr1hxt`Q}{`DrEPiAAXl1&Nt?C3<kneVc088NA;>&v%uivo!Qk`IigIf2?{KSZZ%}cg*&v2Ny_WJL?)9U#8 zf~1Edy8U{;{rd7hzt3muez&Xt_xJnxH#@nj-#uC{=f2^qM#A~np4WvoH|wr++Ljw` z`hRlqz8l5j&DApeM;G&byL0q|-0^RL-}v88e|^L5)V$plPW$85E8FUn$+*S>)dm0h z`p@d#&C)Bf)$fvm_S?m~Z~Cl}bUxPS_4RMn?sIPziwpmLeBbc=#4bI${NV zoLXJqpV=R~rRq;<;FdlvppS~`e;>_}`wDc7&-;(vH^Bkm(ywfzvrUE-szfHar7zjOY>OZZ}2Ri?O+;QiRE1H3-_8i|>JLT`;-%qW! z^>2EvH}Asw>#sfdyJg)2#ewRk)a~8hS6(JtdVJpQ8CTYyzdrGeO&8F}%fGh%y%(4c zRB`0q{p4H8;%nvVV@1|3J_J;D=YE~xZ1-A_s_H*UU{mETKIY)>)^&FTnK?u5xb*G5 zU7+xMRmc+E&jb|PA$NT8Tlcv@J<7l5+q~)qI&8=Bj{!EXfQfi-XQJNw=) z2F8;5m)BpdE*(xf9(bh{sBUTe`}L3K#=76#_*_rz>+8>@D%SlJJYD@<);T3K0RYpAC8q!Y From 5d64ceb1df519d5294cf588266909e929cc6a2c1 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Sat, 9 Dec 2023 22:58:37 -0500 Subject: [PATCH 74/77] pull UI code out of RecipeMap (#2271) --- .../SimpleGeneratorMetaTileEntity.java | 8 +- .../SimpleMachineMetaTileEntity.java | 16 +- .../java/gregtech/api/recipes/RecipeMap.java | 395 ++++--- .../api/recipes/RecipeMapBuilder.java | 265 +++++ .../java/gregtech/api/recipes/RecipeMaps.java | 1010 ++++++++++------- .../machines/RecipeMapAssemblyLine.java | 67 +- .../machines/RecipeMapCrackerUnit.java | 73 -- .../machines/RecipeMapFluidCanner.java | 12 +- .../machines/RecipeMapFormingPress.java | 35 +- .../recipes/machines/RecipeMapFurnace.java | 12 +- .../machines/RecipeMapResearchStation.java | 43 +- .../recipes/machines/RecipeMapScanner.java | 11 +- .../gregtech/api/recipes/ui/RecipeMapUI.java | 477 ++++++++ .../api/recipes/ui/RecipeMapUIFunction.java | 18 + .../api/recipes/ui/impl/AssemblyLineUI.java | 72 ++ .../impl/CokeOvenUI.java} | 21 +- .../api/recipes/ui/impl/CrackerUnitUI.java | 59 + .../impl/DistillationTowerUI.java} | 37 +- .../api/recipes/ui/impl/FormingPressUI.java | 41 + .../recipes/ui/impl/ResearchStationUI.java | 49 + .../java/gregtech/api/util/GTUtility.java | 27 +- .../jei/JustEnoughItemsModule.java | 27 +- .../jei/recipe/RecipeMapCategory.java | 4 +- 23 files changed, 1953 insertions(+), 826 deletions(-) create mode 100644 src/main/java/gregtech/api/recipes/RecipeMapBuilder.java delete mode 100644 src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java create mode 100644 src/main/java/gregtech/api/recipes/ui/RecipeMapUI.java create mode 100644 src/main/java/gregtech/api/recipes/ui/RecipeMapUIFunction.java create mode 100644 src/main/java/gregtech/api/recipes/ui/impl/AssemblyLineUI.java rename src/main/java/gregtech/api/recipes/{machines/RecipeMapCokeOven.java => ui/impl/CokeOvenUI.java} (58%) create mode 100644 src/main/java/gregtech/api/recipes/ui/impl/CrackerUnitUI.java rename src/main/java/gregtech/api/recipes/{machines/RecipeMapDistillationTower.java => ui/impl/DistillationTowerUI.java} (75%) create mode 100644 src/main/java/gregtech/api/recipes/ui/impl/FormingPressUI.java create mode 100644 src/main/java/gregtech/api/recipes/ui/impl/ResearchStationUI.java diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index ee42074ecaa..e4443e15cd5 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -103,9 +103,11 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { yOffset = FONT_HEIGHT; ModularUI.Builder builder; - if (handlesRecipeOutputs) builder = workableRecipeMap.createUITemplate(workable::getProgressPercent, - importItems, exportItems, importFluids, exportFluids, yOffset); - else builder = workableRecipeMap.createUITemplateNoOutputs(workable::getProgressPercent, importItems, + if (handlesRecipeOutputs) + builder = workableRecipeMap.getRecipeMapUI().createUITemplate(workable::getProgressPercent, + importItems, exportItems, importFluids, exportFluids, yOffset); + else builder = workableRecipeMap.getRecipeMapUI().createUITemplateNoOutputs(workable::getProgressPercent, + importItems, exportItems, importFluids, exportFluids, yOffset); builder.widget(new LabelWidget(6, 6, getMetaFullName())) .bindPlayerInventory(player.inventory, GuiTextures.SLOT, yOffset); diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index d479ec233f0..4547f5eaac0 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -4,12 +4,22 @@ import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; import gregtech.api.capability.IGhostSlotConfigurable; -import gregtech.api.capability.impl.*; +import gregtech.api.capability.impl.EnergyContainerHandler; +import gregtech.api.capability.impl.FluidHandlerProxy; +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.capability.impl.GhostCircuitItemStackHandler; +import gregtech.api.capability.impl.ItemHandlerList; +import gregtech.api.capability.impl.ItemHandlerProxy; import gregtech.api.cover.Cover; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.gui.widgets.*; +import gregtech.api.gui.widgets.CycleButtonWidget; +import gregtech.api.gui.widgets.GhostCircuitSlotWidget; +import gregtech.api.gui.widgets.ImageWidget; +import gregtech.api.gui.widgets.LabelWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.gui.widgets.ToggleButtonWidget; import gregtech.api.items.itemhandlers.GTItemStackHandler; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.recipes.RecipeMap; @@ -478,7 +488,7 @@ protected ModularUI.Builder createGuiTemplate(EntityPlayer player) { yOffset = FONT_HEIGHT; } - ModularUI.Builder builder = workableRecipeMap + ModularUI.Builder builder = workableRecipeMap.getRecipeMapUI() .createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids, yOffset) .widget(new LabelWidget(5, 5, getMetaFullName())) diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index c73fc20bb74..2f9417afe27 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -4,21 +4,30 @@ import gregtech.api.GregTechAPI; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.FluidTankList; -import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.ProgressWidget.MoveType; -import gregtech.api.gui.widgets.RecipeProgressWidget; -import gregtech.api.gui.widgets.SlotWidget; -import gregtech.api.gui.widgets.TankWidget; import gregtech.api.recipes.category.GTRecipeCategory; import gregtech.api.recipes.chance.boost.ChanceBoostFunction; import gregtech.api.recipes.ingredients.GTRecipeInput; import gregtech.api.recipes.ingredients.IntCircuitIngredient; -import gregtech.api.recipes.map.*; +import gregtech.api.recipes.map.AbstractMapIngredient; +import gregtech.api.recipes.map.Branch; +import gregtech.api.recipes.map.Either; +import gregtech.api.recipes.map.MapFluidIngredient; +import gregtech.api.recipes.map.MapItemStackIngredient; +import gregtech.api.recipes.map.MapItemStackNBTIngredient; +import gregtech.api.recipes.map.MapOreDictIngredient; +import gregtech.api.recipes.map.MapOreDictNBTIngredient; +import gregtech.api.recipes.ui.RecipeMapUI; +import gregtech.api.recipes.ui.RecipeMapUIFunction; import gregtech.api.unification.material.Material; import gregtech.api.unification.ore.OrePrefix; -import gregtech.api.util.*; +import gregtech.api.util.EnumValidationResult; +import gregtech.api.util.GTLog; +import gregtech.api.util.GTUtility; +import gregtech.api.util.LocalizationUtils; +import gregtech.api.util.ValidationResult; import gregtech.common.ConfigHolder; import gregtech.integration.crafttweaker.CTRecipeHelper; import gregtech.integration.crafttweaker.recipe.CTRecipe; @@ -42,8 +51,6 @@ import crafttweaker.api.item.IItemStack; import crafttweaker.api.liquid.ILiquidStack; import crafttweaker.api.minecraft.CraftTweakerMC; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -51,13 +58,25 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import stanhebben.zenscript.annotations.*; import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenGetter; +import stanhebben.zenscript.annotations.ZenMethod; +import stanhebben.zenscript.annotations.ZenSetter; import java.lang.ref.WeakReference; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; import java.util.function.Consumer; import java.util.function.DoubleSupplier; +import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -74,6 +93,7 @@ public class RecipeMap> { private static boolean foundInvalidRecipe = false; public static final ChanceBoostFunction DEFAULT_CHANCE_FUNCTION = ChanceBoostFunction.OVERCLOCK; + protected RecipeMapUI recipeMapUI; public ChanceBoostFunction chanceFunction = DEFAULT_CHANCE_FUNCTION; @@ -84,16 +104,13 @@ public class RecipeMap> { private int maxOutputs; private int maxFluidInputs; private int maxFluidOutputs; - private final boolean modifyItemInputs; - private final boolean modifyItemOutputs; - private final boolean modifyFluidInputs; - private final boolean modifyFluidOutputs; - protected final Byte2ObjectMap slotOverlays; - protected TextureArea specialTexture; - protected int[] specialTexturePosition; - protected TextureArea progressBarTexture; - protected MoveType moveType; - public final boolean isHidden; + + /** + * @deprecated {@link RecipeMapUI#isJEIVisible()} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated + public final boolean isHidden = false; private boolean allowEmptyOutput; @@ -121,7 +138,11 @@ public class RecipeMap> { * @param maxFluidOutputs the maximum fluid outputs * @param defaultRecipeBuilder the default RecipeBuilder for the RecipeMap * @param isHidden if the RecipeMap should have a category in JEI + * + * @deprecated {@link #RecipeMap(String, RecipeBuilder, Function, int, int, int, int)} */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public RecipeMap(@NotNull String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, @@ -146,7 +167,11 @@ public RecipeMap(@NotNull String unlocalizedName, * @param modifyFluidOutputs if modification of the maximum fluid output is permitted * @param defaultRecipeBuilder the default RecipeBuilder for the RecipeMap * @param isHidden if the RecipeMap should have a category in JEI + * + * @deprecated {@link #RecipeMap(String, RecipeBuilder, Function, int, int, int, int)} */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public RecipeMap(@NotNull String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, boolean modifyItemOutputs, @@ -155,21 +180,49 @@ public RecipeMap(@NotNull String unlocalizedName, @NotNull R defaultRecipeBuilder, boolean isHidden) { this.unlocalizedName = unlocalizedName; - this.slotOverlays = new Byte2ObjectOpenHashMap<>(); - this.progressBarTexture = GuiTextures.PROGRESS_BAR_ARROW; - this.moveType = MoveType.HORIZONTAL; this.maxInputs = maxInputs; this.maxFluidInputs = maxFluidInputs; this.maxOutputs = maxOutputs; this.maxFluidOutputs = maxFluidOutputs; - this.modifyItemInputs = modifyItemInputs; - this.modifyItemOutputs = modifyItemOutputs; - this.modifyFluidInputs = modifyFluidInputs; - this.modifyFluidOutputs = modifyFluidOutputs; + defaultRecipeBuilder.setRecipeMap(this); + defaultRecipeBuilder + .category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); + this.recipeBuilderSample = defaultRecipeBuilder; + + this.recipeMapUI = new RecipeMapUI<>(this, modifyItemInputs, modifyItemOutputs, modifyFluidInputs, + modifyFluidOutputs); + this.recipeMapUI.setJEIVisible(!isHidden); + + RECIPE_MAP_REGISTRY.put(unlocalizedName, this); + + this.grsVirtualizedRecipeMap = GregTechAPI.moduleManager.isModuleEnabled(GregTechModules.MODULE_GRS) ? + new VirtualizedRecipeMap(this) : null; + } + + /** + * Create and register new instance of RecipeMap with specified properties. + * + * @param unlocalizedName the unlocalized name for the RecipeMap + * @param defaultRecipeBuilder the default RecipeBuilder for the RecipeMap + * @param recipeMapUI the ui to represent this recipemap + * @param maxInputs the maximum item inputs + * @param maxOutputs the maximum item outputs + * @param maxFluidInputs the maximum fluid inputs + * @param maxFluidOutputs the maximum fluid outputs + */ + public RecipeMap(@NotNull String unlocalizedName, @NotNull R defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI, int maxInputs, int maxOutputs, int maxFluidInputs, + int maxFluidOutputs) { + this.unlocalizedName = unlocalizedName; + this.recipeMapUI = recipeMapUI.apply(this); + + this.maxInputs = maxInputs; + this.maxFluidInputs = maxFluidInputs; + this.maxOutputs = maxOutputs; + this.maxFluidOutputs = maxFluidOutputs; - this.isHidden = isHidden; defaultRecipeBuilder.setRecipeMap(this); defaultRecipeBuilder .category(GTRecipeCategory.create(GTValues.MODID, unlocalizedName, getTranslationKey(), this)); @@ -181,12 +234,12 @@ public RecipeMap(@NotNull String unlocalizedName, } @ZenMethod - public static List> getRecipeMaps() { + public static List>> getRecipeMaps() { return ImmutableList.copyOf(RECIPE_MAP_REGISTRY.values()); } @ZenMethod - public static RecipeMap getByName(String unlocalizedName) { + public static RecipeMap> getByName(String unlocalizedName) { return RECIPE_MAP_REGISTRY.get(unlocalizedName); } @@ -200,7 +253,7 @@ public static boolean isFoundInvalidRecipe() { } public static void setFoundInvalidRecipe(boolean foundInvalidRecipe) { - RecipeMap.foundInvalidRecipe |= foundInvalidRecipe; + RecipeMap.foundInvalidRecipe = RecipeMap.foundInvalidRecipe || foundInvalidRecipe; OrePrefix currentOrePrefix = OrePrefix.getCurrentProcessingPrefix(); if (currentOrePrefix != null) { Material currentMaterial = OrePrefix.getCurrentMaterial(); @@ -211,19 +264,39 @@ public static void setFoundInvalidRecipe(boolean foundInvalidRecipe) { } } + /** + * @deprecated {@link RecipeMapUI#setProgressBar(TextureArea, MoveType)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public RecipeMap setProgressBar(TextureArea progressBar, MoveType moveType) { - this.progressBarTexture = progressBar; - this.moveType = moveType; + this.recipeMapUI.setProgressBar(progressBar, moveType); return this; } + /** + * @deprecated {@link RecipeMapUI#setItemSlotOverlay(TextureArea, boolean, boolean)} + * {@link RecipeMapUI#setFluidSlotOverlay(TextureArea, boolean, boolean)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, TextureArea slotOverlay) { return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, slotOverlay); } + /** + * @deprecated {@link RecipeMapUI#setItemSlotOverlay(TextureArea, boolean, boolean)} + * {@link RecipeMapUI#setFluidSlotOverlay(TextureArea, boolean, boolean)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, TextureArea slotOverlay) { - this.slotOverlays.put((byte) ((isOutput ? 2 : 0) + (isFluid ? 1 : 0) + (isLast ? 4 : 0)), slotOverlay); + if (isFluid) { + this.recipeMapUI.setFluidSlotOverlay(slotOverlay, isOutput, isLast); + } else { + this.recipeMapUI.setItemSlotOverlay(slotOverlay, isOutput, isLast); + } return this; } @@ -252,7 +325,7 @@ public RecipeMap setSmallRecipeMap(RecipeMap recipeMap) { return this; } - public RecipeMap getSmallRecipeMap() { + public RecipeMap> getSmallRecipeMap() { return smallRecipeMap; } @@ -791,153 +864,82 @@ private Recipe diveIngredientTreeFindRecipeCollisions(@NotNull List= 6 && fluidHandler.getTanks() >= 2 && !isOutputs) startInputsY -= 9; - for (int i = 0; i < itemSlotsToDown; i++) { - for (int j = 0; j < itemSlotsToLeft; j++) { - int slotIndex = i * itemSlotsToLeft + j; - if (slotIndex >= itemInputsCount) break; - int x = startInputsX + 18 * j; - int y = startInputsY + 18 * i; - addSlot(builder, x, y, slotIndex, itemHandler, fluidHandler, invertFluids, isOutputs); - } - } - if (wasGroup) startInputsY += 2; - if (fluidInputsCount > 0 || invertFluids) { - if (itemSlotsToDown >= fluidInputsCount && itemSlotsToLeft < 3) { - int startSpecX = isOutputs ? startInputsX + itemSlotsToLeft * 18 : startInputsX - 18; - for (int i = 0; i < fluidInputsCount; i++) { - int y = startInputsY + 18 * i; - addSlot(builder, startSpecX, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs); - } - } else { - int startSpecY = startInputsY + itemSlotsToDown * 18; - for (int i = 0; i < fluidInputsCount; i++) { - int x = isOutputs ? startInputsX + 18 * (i % 3) : - startInputsX + itemSlotsToLeft * 18 - 18 - 18 * (i % 3); - int y = startSpecY + (i / 3) * 18; - addSlot(builder, x, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs); - } - } - } - } + FluidTankList fluidHandler, boolean isOutputs, int yOffset) {} + /** + * @deprecated {@link RecipeMapUI#addSlot(ModularUI.Builder, int, int, int, IItemHandlerModifiable, FluidTankList, boolean, boolean)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, - FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { - if (!isFluid) { - builder.widget(new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs).setBackgroundTexture( - getOverlaysForSlot(isOutputs, false, slotIndex == itemHandler.getSlots() - 1))); - } else { - builder.widget(new TankWidget(fluidHandler.getTankAt(slotIndex), x, y, 18, 18).setAlwaysShowFull(true) - .setBackgroundTexture(getOverlaysForSlot(isOutputs, true, slotIndex == fluidHandler.getTanks() - 1)) - .setContainerClicking(true, !isOutputs)); - } - } + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) {} + /** + * @deprecated {@link RecipeMapUI#getOverlaysForSlot(boolean, boolean, boolean)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated protected TextureArea[] getOverlaysForSlot(boolean isOutput, boolean isFluid, boolean isLast) { - TextureArea base = isFluid ? GuiTextures.FLUID_SLOT : GuiTextures.SLOT; - byte overlayKey = (byte) ((isOutput ? 2 : 0) + (isFluid ? 1 : 0) + (isLast ? 4 : 0)); - if (slotOverlays.containsKey(overlayKey)) { - return new TextureArea[] { base, slotOverlays.get(overlayKey) }; - } - return new TextureArea[] { base }; - } - - protected static int[] determineSlotsGrid(int itemInputsCount) { - int itemSlotsToLeft; - int itemSlotsToDown; - double sqrt = Math.sqrt(itemInputsCount); - // if the number of input has an integer root - // return it. - if (sqrt % 1 == 0) { - itemSlotsToLeft = itemSlotsToDown = (int) sqrt; - } else if (itemInputsCount == 3) { - itemSlotsToLeft = 3; - itemSlotsToDown = 1; - } else { - // if we couldn't fit all into a perfect square, - // increase the amount of slots to the left - itemSlotsToLeft = (int) Math.ceil(sqrt); - itemSlotsToDown = itemSlotsToLeft - 1; - // if we still can't fit all the slots in a grid, - // increase the amount of slots on the bottom - if (itemInputsCount > itemSlotsToLeft * itemSlotsToDown) { - itemSlotsToDown = itemSlotsToLeft; - } - } - return new int[] { itemSlotsToLeft, itemSlotsToDown }; + return null; } /** - * This height is used to determine size of background texture on JEI. + * @deprecated {@link RecipeMapUI#getPropertyHeightShift()} */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated public int getPropertyHeightShift() { - int maxPropertyCount = 0; - if (shouldShiftWidgets()) { - for (Recipe recipe : getRecipeList()) { - if (recipe.getPropertyCount() > maxPropertyCount) - maxPropertyCount = recipe.getPropertyCount(); - } - } - return maxPropertyCount * 10; // GTRecipeWrapper#LINE_HEIGHT + return recipeMapUI.getPropertyHeightShift(); } + /** + * @deprecated {@link RecipeMapUI#shouldShiftWidgets()} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated private boolean shouldShiftWidgets() { - return getMaxInputs() + getMaxOutputs() >= 6 || - getMaxFluidInputs() + getMaxFluidOutputs() >= 6; + return false; } @Method(modid = GTValues.MODID_GROOVYSCRIPT) @@ -1259,16 +1261,23 @@ protected void buildFromItemStacks(@NotNull List> li } } + /** + * @deprecated {@link RecipeMapUI#setSpecialTexture(TextureArea, int, int, int, int)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated protected RecipeMap setSpecialTexture(int x, int y, int width, int height, TextureArea area) { - this.specialTexturePosition = new int[] { x, y, width, height }; - this.specialTexture = area; + recipeMapUI.setSpecialTexture(area, x, y, width, height); return this; } + /** + * @deprecated {@link RecipeMapUI#addSpecialTexture(ModularUI.Builder)} + */ + @ApiStatus.ScheduledForRemoval(inVersion = "2.9") + @Deprecated protected ModularUI.Builder addSpecialTexture(ModularUI.Builder builder) { - builder.image(specialTexturePosition[0], specialTexturePosition[1], specialTexturePosition[2], - specialTexturePosition[3], specialTexture); - return builder; + return recipeMapUI.addSpecialTexture(builder); } public Collection getRecipeList() { @@ -1277,7 +1286,7 @@ public Collection getRecipeList() { .collect(Collectors.toList()); } - public SoundEvent getSound() { + public @Nullable SoundEvent getSound() { return sound; } @@ -1296,7 +1305,7 @@ public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidSt @ZenGetter("recipes") @Method(modid = GTValues.MODID_CT) - public List ccGetRecipeList() { + public List ctGetRecipeList() { return getRecipeList().stream().map(recipe -> new CTRecipe(this, recipe)).collect(Collectors.toList()); } @@ -1326,10 +1335,9 @@ public R recipeBuilder() { * @param ingredients list of input ingredients. * @param branchMap the current branch in the recursion. */ - @Nullable - private Recipe recurseIngredientTreeRemove(@NotNull Recipe recipeToRemove, - @NotNull List> ingredients, - @NotNull Branch branchMap, int depth) { + private @Nullable Recipe recurseIngredientTreeRemove(@NotNull Recipe recipeToRemove, + @NotNull List> ingredients, + @NotNull Branch branchMap, int depth) { // for every ingredient for (List current : ingredients) { // for all possibilities as keys @@ -1397,10 +1405,11 @@ public int getMaxInputs() { @ZenSetter("maxInputs") public void setMaxInputs(int maxInputs) { - if (modifyItemInputs) { - this.maxInputs = Math.max(this.maxInputs, maxInputs); - } else { - throw new UnsupportedOperationException("Cannot change max item input amount for " + getUnlocalizedName()); + this.maxInputs = Math.max(this.maxInputs, maxInputs); + if (!recipeMapUI.canModifyItemInputs()) { + GTLog.logger.warn( + "RecipeMap {} ui does not support changing max item inputs. Replace with a supporting UI for proper behavior.", + getUnlocalizedName(), new Throwable()); } } @@ -1411,10 +1420,11 @@ public int getMaxOutputs() { @ZenSetter("maxOutputs") public void setMaxOutputs(int maxOutputs) { - if (modifyItemOutputs) { - this.maxOutputs = Math.max(this.maxOutputs, maxOutputs); - } else { - throw new UnsupportedOperationException("Cannot change max item output amount for " + getUnlocalizedName()); + this.maxOutputs = Math.max(this.maxOutputs, maxOutputs); + if (!recipeMapUI.canModifyItemOutputs()) { + GTLog.logger.warn( + "RecipeMap {} ui does not support changing max item outputs. Replace with a supporting UI for proper behavior.", + getUnlocalizedName(), new Throwable()); } } @@ -1425,10 +1435,11 @@ public int getMaxFluidInputs() { @ZenSetter("maxFluidInputs") public void setMaxFluidInputs(int maxFluidInputs) { - if (modifyFluidInputs) { - this.maxFluidInputs = Math.max(this.maxFluidInputs, maxFluidInputs); - } else { - throw new UnsupportedOperationException("Cannot change max fluid input amount for " + getUnlocalizedName()); + this.maxFluidInputs = Math.max(this.maxFluidInputs, maxFluidInputs); + if (!recipeMapUI.canModifyFluidInputs()) { + GTLog.logger.warn( + "RecipeMap {} ui does not support changing max fluid inputs. Replace with a supporting UI for proper behavior.", + getUnlocalizedName(), new Throwable()); } } @@ -1439,11 +1450,11 @@ public int getMaxFluidOutputs() { @ZenSetter("maxFluidOutputs") public void setMaxFluidOutputs(int maxFluidOutputs) { - if (modifyFluidOutputs) { - this.maxFluidOutputs = Math.max(this.maxFluidOutputs, maxFluidOutputs); - } else { - throw new UnsupportedOperationException( - "Cannot change max fluid output amount for " + getUnlocalizedName()); + this.maxFluidOutputs = Math.max(this.maxFluidOutputs, maxFluidOutputs); + if (!recipeMapUI.canModifyFluidOutputs()) { + GTLog.logger.warn( + "RecipeMap {} ui does not support changing max fluid outputs. Replace with a supporting UI for proper behavior.", + getUnlocalizedName(), new Throwable()); } } @@ -1458,10 +1469,28 @@ public Map> getRecipesByCategory() { return Collections.unmodifiableMap(recipeByCategory); } + /** + * @return the current ui for the recipemap + */ + public @NotNull RecipeMapUI getRecipeMapUI() { + return recipeMapUI; + } + + /** + * @param recipeMapUI the recipemap ui to set + */ + public void setRecipeMapUI(@NotNull RecipeMapUI recipeMapUI) { + if (this.recipeMapUI.recipeMap() != recipeMapUI.recipeMap()) { + throw new IllegalArgumentException("RecipeMap UI RecipeMap '" + recipeMapUI.recipeMap().unlocalizedName + + "' does not match this RecipeMap '" + this.unlocalizedName + "'"); + } + this.recipeMapUI = recipeMapUI; + } + @Override @ZenMethod public String toString() { - return "RecipeMap{" + "unlocalizedName='" + unlocalizedName + '\'' + '}'; + return "RecipeMap{" + unlocalizedName + '}'; } @Override diff --git a/src/main/java/gregtech/api/recipes/RecipeMapBuilder.java b/src/main/java/gregtech/api/recipes/RecipeMapBuilder.java new file mode 100644 index 00000000000..2d6e810cac8 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/RecipeMapBuilder.java @@ -0,0 +1,265 @@ +package gregtech.api.recipes; + +import gregtech.api.gui.resources.TextureArea; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.recipes.ui.RecipeMapUI; +import gregtech.api.recipes.ui.RecipeMapUIFunction; + +import net.minecraft.util.SoundEvent; + +import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static gregtech.api.recipes.ui.RecipeMapUI.computeOverlayKey; + +public class RecipeMapBuilder> { + + private final String unlocalizedName; + private final B defaultRecipeBuilder; + + private final Byte2ObjectMap slotOverlays = new Byte2ObjectArrayMap<>(); + + private int itemInputs; + private boolean modifyItemInputs = true; + private int itemOutputs; + private boolean modifyItemOutputs = true; + private int fluidInputs; + private boolean modifyFluidInputs = true; + private int fluidOutputs; + private boolean modifyFluidOutputs = true; + + private @Nullable TextureArea progressBar; + private @Nullable ProgressWidget.MoveType moveType; + + private @Nullable TextureArea specialTexture; + private int @Nullable [] specialTextureLocation; + + private RecipeMapUIFunction recipeMapUIFunction = this::buildUI; + + private SoundEvent sound; + private boolean allowEmptyOutputs; + + /** + * @param unlocalizedName the name of the recipemap + * @param defaultRecipeBuilder the default recipe builder of the recipemap + */ + public RecipeMapBuilder(@NotNull String unlocalizedName, @NotNull B defaultRecipeBuilder) { + this.unlocalizedName = unlocalizedName; + this.defaultRecipeBuilder = defaultRecipeBuilder; + } + + /** + * @param itemInputs the amount of item inputs + * @return this + */ + public @NotNull RecipeMapBuilder itemInputs(int itemInputs) { + this.itemInputs = itemInputs; + return this; + } + + /** + * @param modifyItemInputs if item input limit modification should be allowed + * @return this + */ + public @NotNull RecipeMapBuilder modifyItemInputs(boolean modifyItemInputs) { + this.modifyItemInputs = modifyItemInputs; + return this; + } + + /** + * @param itemOutputs the amount of item outputs + * @return this + */ + public @NotNull RecipeMapBuilder itemOutputs(int itemOutputs) { + this.itemOutputs = itemOutputs; + return this; + } + + /** + * @param modifyItemOutputs if item output limit modification should be allowed + * @return this + */ + public @NotNull RecipeMapBuilder modifyItemOutputs(boolean modifyItemOutputs) { + this.modifyItemOutputs = modifyItemOutputs; + return this; + } + + /** + * @param fluidInputs the amount of fluid inputs + * @return this + */ + public @NotNull RecipeMapBuilder fluidInputs(int fluidInputs) { + this.fluidInputs = fluidInputs; + return this; + } + + /** + * @param modifyFluidInputs if fluid input limit modification should be allowed + * @return this + */ + public @NotNull RecipeMapBuilder modifyFluidInputs(boolean modifyFluidInputs) { + this.modifyFluidInputs = modifyFluidInputs; + return this; + } + + /** + * @param fluidOutputs the amount of fluid outputs + * @return this + */ + public @NotNull RecipeMapBuilder fluidOutputs(int fluidOutputs) { + this.fluidOutputs = fluidOutputs; + return this; + } + + /** + * @param modifyFluidOutputs if fluid output limit modification should be allowed + * @return this + */ + public @NotNull RecipeMapBuilder modifyFluidOutputs(boolean modifyFluidOutputs) { + this.modifyFluidOutputs = modifyFluidOutputs; + return this; + } + + /** + * @param progressBar the progress bar texture to use + * @return this + */ + public @NotNull RecipeMapBuilder progressBar(@Nullable TextureArea progressBar) { + this.progressBar = progressBar; + return this; + } + + /** + * @param progressBar the progress bar texture to use + * @param moveType the progress bar move type to use + * @return this + */ + public @NotNull RecipeMapBuilder progressBar(@Nullable TextureArea progressBar, + @Nullable ProgressWidget.MoveType moveType) { + this.progressBar = progressBar; + this.moveType = moveType; + return this; + } + + /** + * @param texture the texture to use + * @param isOutput if the slot is an output slot + * @return this + */ + public @NotNull RecipeMapBuilder itemSlotOverlay(@NotNull TextureArea texture, boolean isOutput) { + this.slotOverlays.put(computeOverlayKey(isOutput, false, false), texture); + this.slotOverlays.put(computeOverlayKey(isOutput, false, true), texture); + return this; + } + + /** + * @param texture the texture to use + * @param isOutput if the slot is an output slot + * @param isLastSlot if the slot is the last slot + * @return this + */ + public @NotNull RecipeMapBuilder itemSlotOverlay(@NotNull TextureArea texture, boolean isOutput, + boolean isLastSlot) { + this.slotOverlays.put(computeOverlayKey(isOutput, false, isLastSlot), texture); + return this; + } + + /** + * @param texture the texture to use + * @param isOutput if the slot is an output slot + * @return this + */ + public @NotNull RecipeMapBuilder fluidSlotOverlay(@NotNull TextureArea texture, boolean isOutput) { + this.slotOverlays.put(computeOverlayKey(isOutput, true, false), texture); + this.slotOverlays.put(computeOverlayKey(isOutput, true, true), texture); + return this; + } + + /** + * @param texture the texture to use + * @param isOutput if the slot is an output slot + * @param isLastSlot if the slot is the last slot + * @return this + */ + public @NotNull RecipeMapBuilder fluidSlotOverlay(@NotNull TextureArea texture, boolean isOutput, + boolean isLastSlot) { + this.slotOverlays.put(computeOverlayKey(isOutput, true, isLastSlot), texture); + return this; + } + + public @NotNull RecipeMapBuilder specialTexture(@NotNull TextureArea texture, int x, int y, int width, + int height) { + this.specialTexture = texture; + this.specialTextureLocation = new int[] { x, y, width, height }; + return this; + } + + /** + * @param recipeMapUIFunction the custom function for creating the RecipeMap's ui + * @return this + */ + public @NotNull RecipeMapBuilder ui(@NotNull RecipeMapUIFunction recipeMapUIFunction) { + this.recipeMapUIFunction = recipeMapUIFunction; + return this; + } + + /** + * @param recipeMap the recipemap associated with the ui + * @return the RecipeMap's ui + */ + private @NotNull RecipeMapUI buildUI(@NotNull RecipeMap recipeMap) { + RecipeMapUI ui = new RecipeMapUI<>(recipeMap, modifyItemInputs, modifyItemOutputs, modifyFluidInputs, + modifyFluidOutputs); + if (progressBar != null) { + ui.setProgressBarTexture(progressBar); + } + if (moveType != null) { + ui.setProgressBarMoveType(moveType); + } + if (specialTexture != null && specialTextureLocation != null) { + ui.setSpecialTexture(specialTexture, specialTextureLocation); + } + for (var entry : slotOverlays.byte2ObjectEntrySet()) { + ui.setSlotOverlay(entry.getByteKey(), entry.getValue()); + } + + return ui; + } + + /** + * @param sound the sound to use + * @return this + */ + public @NotNull RecipeMapBuilder sound(@NotNull SoundEvent sound) { + this.sound = sound; + return this; + } + + /** + * Make the recipemap accept recipes without any outputs + * + * @return this + */ + public @NotNull RecipeMapBuilder allowEmptyOutputs() { + this.allowEmptyOutputs = true; + return this; + } + + /** + * Do not call this twice. RecipeMapBuilders are not re-usable. + * + * @return a new RecipeMap + */ + public @NotNull RecipeMap build() { + RecipeMap recipeMap = new RecipeMap<>(unlocalizedName, defaultRecipeBuilder, this.recipeMapUIFunction, + itemInputs, + itemOutputs, fluidInputs, fluidOutputs); + recipeMap.setSound(sound); + if (allowEmptyOutputs) { + recipeMap.allowEmptyOutput(); + } + return recipeMap; + } +} diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index cd222d4105b..e61261ddd09 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -4,9 +4,32 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.gui.widgets.ProgressWidget.MoveType; -import gregtech.api.recipes.builders.*; +import gregtech.api.recipes.builders.AssemblerRecipeBuilder; +import gregtech.api.recipes.builders.AssemblyLineRecipeBuilder; +import gregtech.api.recipes.builders.BlastRecipeBuilder; +import gregtech.api.recipes.builders.CircuitAssemblerRecipeBuilder; +import gregtech.api.recipes.builders.ComputationRecipeBuilder; +import gregtech.api.recipes.builders.FuelRecipeBuilder; +import gregtech.api.recipes.builders.FusionRecipeBuilder; +import gregtech.api.recipes.builders.GasCollectorRecipeBuilder; +import gregtech.api.recipes.builders.ImplosionRecipeBuilder; +import gregtech.api.recipes.builders.PrimitiveRecipeBuilder; +import gregtech.api.recipes.builders.SimpleRecipeBuilder; +import gregtech.api.recipes.builders.UniversalDistillationRecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeInput; -import gregtech.api.recipes.machines.*; +import gregtech.api.recipes.machines.RecipeMapAssemblyLine; +import gregtech.api.recipes.machines.RecipeMapFluidCanner; +import gregtech.api.recipes.machines.RecipeMapFormingPress; +import gregtech.api.recipes.machines.RecipeMapFurnace; +import gregtech.api.recipes.machines.RecipeMapResearchStation; +import gregtech.api.recipes.machines.RecipeMapScanner; +import gregtech.api.recipes.ui.RecipeMapUI; +import gregtech.api.recipes.ui.impl.AssemblyLineUI; +import gregtech.api.recipes.ui.impl.CokeOvenUI; +import gregtech.api.recipes.ui.impl.CrackerUnitUI; +import gregtech.api.recipes.ui.impl.DistillationTowerUI; +import gregtech.api.recipes.ui.impl.FormingPressUI; +import gregtech.api.recipes.ui.impl.ResearchStationUI; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Materials; import gregtech.api.unification.stack.ItemMaterialInfo; @@ -24,21 +47,21 @@ /** * Notes: - * + *

* All Examples here are for creating recipes in a Java mod, either in GTCEu or an addon mod, for CraftTweaker examples, * see the wiki, where plenty of examples are listed. - * + *

* It is preferable to use GTValues.VA[VOLTAGE_TIER] instead of GTValues.V[VOLTAGE_TIER] for the Recipe's EUt, * as the former accounts for cable loss, preventing full Amp recipes which can be annoying to deal with. * */ @ZenClass("mods.gregtech.recipe.RecipeMaps") @ZenRegister -public class RecipeMaps { +public final class RecipeMaps { /** * Example: - * + * *

      * RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder()
      *         .input(OrePrefix.ingot, Materials.Tin)
@@ -53,15 +76,18 @@ public class RecipeMaps {
      * Note that the use of OrePrefix ensures that OreDictionary Entries are used for the recipe.
      */
     @ZenProperty
-    public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 2, 1, 0,
-            0, new SimpleRecipeBuilder(), false)
-                    .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.FURNACE);
+    public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMapBuilder<>("alloy_smelter",
+            new SimpleRecipeBuilder())
+                    .itemInputs(2)
+                    .itemOutputs(1)
+                    .itemSlotOverlay(GuiTextures.FURNACE_OVERLAY_1, false)
+                    .progressBar(GuiTextures.PROGRESS_BAR_ARROW)
+                    .sound(GTSoundEvents.FURNACE)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.ARC_FURNACE_RECIPES.recipeBuilder()
      *         .input(OrePrefix.ingot, Materials.Iron)
@@ -89,20 +115,25 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 9, 1, 1, - new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC) + public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMapBuilder<>("arc_furnace", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(9) + .fluidInputs(1) + .fluidOutputs(1) + .progressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE) + .sound(GTSoundEvents.ARC) + .build() .onRecipeBuild(recipeBuilder -> { recipeBuilder.invalidateOnBuildAction(); if (recipeBuilder.getFluidInputs().isEmpty()) { - recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); + recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.getDuration())); } }); /** * Example: - * + * *
      * RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder()
      *         .circuitMeta(2)
@@ -113,17 +144,21 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 9, 1, 1, 0, - new AssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) + public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMapBuilder<>("assembler", + new AssemblerRecipeBuilder()) + .itemInputs(9) + .itemOutputs(1) + .fluidInputs(1) + .itemSlotOverlay(GuiTextures.CIRCUIT_OVERLAY, false) + .progressBar(GuiTextures.PROGRESS_BAR_CIRCUIT) + .sound(GTSoundEvents.ASSEMBLER) + .build() .onRecipeBuild(recipeBuilder -> { recipeBuilder.invalidateOnBuildAction(); - if (recipeBuilder.fluidInputs.size() == 1 && - recipeBuilder.fluidInputs.get(0).getInputFluidStack().getFluid() == - Materials.SolderingAlloy.getFluid()) { - int amount = recipeBuilder.fluidInputs.get(0).getInputFluidStack().amount; + var fluidInputs = recipeBuilder.getFluidInputs(); + if (fluidInputs.size() == 1 && fluidInputs.get(0).getInputFluidStack().getFluid() == + Materials.SolderingAlloy.getFluid()) { + int amount = fluidInputs.get(0).getInputFluidStack().amount; recipeBuilder.copy().clearFluidInputs().fluidInputs(Materials.Tin.getFluid(amount * 2)) .buildAndRegister(); @@ -142,7 +177,7 @@ public class RecipeMaps { /** * Example: - * + * *
      * RecipeMaps.ASSEMBLY_LINE_RECIPES.recipeBuilder()
      *         .input(OrePrefix.stickLong, Materials.SamariumMagnetic)
@@ -161,14 +196,12 @@ public class RecipeMaps {
      */
     @ZenProperty
     public static final RecipeMap ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>(
-            "assembly_line", 16, false, 1, false, 4, false, 1, false, new AssemblyLineRecipeBuilder(), false)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.ASSEMBLER)
+            "assembly_line", new AssemblyLineRecipeBuilder(), AssemblyLineUI::new)
                     .onRecipeBuild(AssemblyLineManager::createDefaultResearchRecipe);
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.AUTOCLAVE_RECIPES.recipeBuilder()
      *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Carbon, 16))
@@ -180,16 +213,21 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 2, 2, 1, 1, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMapBuilder<>("autoclave", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(2) + .fluidInputs(1) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, false) + .itemSlotOverlay(GuiTextures.CRYSTAL_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION) + .sound(GTSoundEvents.FURNACE) + .build(); /** * Example: - * + * *
      * RecipeMap.BENDER_RECIPES.recipeBuilder()
      *         .input(OrePrefix.plate, Materials.Tin, 12)
@@ -203,16 +241,19 @@ public class RecipeMaps {
      * Just like other SimpleRecipeBuilder RecipeMaps, circuit can be used to easily set a circuit
      */
     @ZenProperty
-    public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 1, 0, 0,
-            new SimpleRecipeBuilder(), false)
-                    .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY)
-                    .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.MOTOR);
+    public static final RecipeMap BENDER_RECIPES = new RecipeMapBuilder<>("bender",
+            new SimpleRecipeBuilder())
+                    .itemInputs(2)
+                    .itemOutputs(1)
+                    .itemSlotOverlay(GuiTextures.BENDER_OVERLAY, false, false)
+                    .itemSlotOverlay(GuiTextures.INT_CIRCUIT_OVERLAY, false, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_BENDING)
+                    .sound(GTSoundEvents.MOTOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.BLAST_RECIPES.recipeBuilder()
      *         .inputs(OreDictUnifier.get(OrePrefix.dust, Materials.Glass),
@@ -228,19 +269,24 @@ public class RecipeMaps {
      * The Electric Blast Furnace requires specification of a blast furnace temperature through the builder call of
      * blastFurnaceTemp. This value will set the temperature required for the recipe to run, restricting recipes
      * to certain coils.
-     *
+     * 

* Anything with a Blast Furnace Temperature of greater than 1750K will also autogenerate a hot ingot and a hot * ingot * cooling recipe. */ @ZenProperty - public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 3, 3, 1, - 1, new BlastRecipeBuilder(), false) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap BLAST_RECIPES = new RecipeMapBuilder<>("electric_blast_furnace", + new BlastRecipeBuilder()) + .itemInputs(3) + .itemOutputs(3) + .fluidInputs(1) + .fluidOutputs(1) + .sound(GTSoundEvents.FURNACE) + .build(); /** * Example: - * + * *

      * RecipeMap.BREWING_RECIPES.recipeBuilder()
      *         .input(MetaItems.BIO_CHAFF)
@@ -254,15 +300,19 @@ public class RecipeMaps {
      * Any Recipe added to the Brewery not specifying an EUt value will default 4.
      */
     @ZenProperty
-    public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 0, 1, 1,
-            new SimpleRecipeBuilder().duration(128).EUt(4), false)
-                    .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.CHEMICAL_REACTOR);
+    public static final RecipeMap BREWING_RECIPES = new RecipeMapBuilder<>("brewery",
+            new SimpleRecipeBuilder().duration(128).EUt(4))
+                    .itemInputs(1)
+                    .fluidInputs(1)
+                    .fluidOutputs(1)
+                    .itemSlotOverlay(GuiTextures.BREWER_OVERLAY, false)
+                    .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE)
+                    .sound(GTSoundEvents.CHEMICAL_REACTOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.CANNER_RECIPES.recipeBuilder()
      *         .input(MetaItems.BATTERY_HULL_LV)
@@ -278,19 +328,22 @@ public class RecipeMaps {
      * It will empty or fill any fluid handler, so there is no need to add explicit recipes for the fluid handlers.
      */
     @ZenProperty
-    public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner", 2, 2, 1, 1,
-            new SimpleRecipeBuilder(), false)
-                    .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY)
-                    .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY)
-                    .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY)
-                    .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY)
-                    .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.BATH);
+    public static final RecipeMap CANNER_RECIPES = new RecipeMapFluidCanner("canner",
+            new SimpleRecipeBuilder(), recipeMap -> {
+
+                RecipeMapUI ui = new RecipeMapUI<>(recipeMap, true, true, true, true);
+                ui.setItemSlotOverlay(GuiTextures.CANNER_OVERLAY, false, false);
+                ui.setItemSlotOverlay(GuiTextures.CANISTER_OVERLAY, false, true);
+                ui.setItemSlotOverlay(GuiTextures.CANISTER_OVERLAY, true);
+                ui.setFluidSlotOverlay(GuiTextures.DARK_CANISTER_OVERLAY, false);
+                ui.setFluidSlotOverlay(GuiTextures.DARK_CANISTER_OVERLAY, true);
+                ui.setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, ProgressWidget.MoveType.HORIZONTAL);
+                return ui;
+            });
 
     /**
      * Examples:
-     * 
+     *
      * 
      * RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.ImpureNaquadriaSolution.getFluid(2000))
@@ -304,21 +357,26 @@ public class RecipeMaps {
      *
      * Most Centrifuge recipes exist because of automatic material decomposition recipes, but non-decomposition recipes
      * can still be added to the centrifuge.
-     *
+     * 

* Any Centrifuge recipe not specifying an EUt value will have the value default to 5. */ @ZenProperty - public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMap<>("centrifuge", 2, 6, 1, 6, - new SimpleRecipeBuilder().EUt(5), false) - .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CENTRIFUGE); + public static final RecipeMap CENTRIFUGE_RECIPES = new RecipeMapBuilder<>("centrifuge", + new SimpleRecipeBuilder().EUt(5)) + .itemInputs(2) + .itemOutputs(6) + .fluidInputs(1) + .fluidOutputs(6) + .itemSlotOverlay(GuiTextures.EXTRACTOR_OVERLAY, false, false) + .itemSlotOverlay(GuiTextures.CANISTER_OVERLAY, false, true) + .fluidSlotOverlay(GuiTextures.CENTRIFUGE_OVERLAY, false, true) + .progressBar(GuiTextures.PROGRESS_BAR_EXTRACT) + .sound(GTSoundEvents.CENTRIFUGE) + .build(); /** * Example: - * + * *

      * RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder()
      *         .input(OrePrefix.gem, Materials.EnderEye)
@@ -329,17 +387,21 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 6, 1, - 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.BATH); + public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMapBuilder<>("chemical_bath", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(6) + .fluidInputs(1) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.BREWER_OVERLAY, false, true) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .sound(GTSoundEvents.BATH) + .build(); /** * Example: - * + * *
      *      RecipeMap.CHEMICAL_RECIPES.recipeBuilder()
      * 				.circuitMeta(1))
@@ -355,22 +417,27 @@ public class RecipeMaps {
      * The Chemical Reactor has a special action that is performed for any recipe added to its recipe map, seen in its
      * onRecipeBuild call. Any recipe that is added to the Chemical Reactor will also be added to the
      * Large Chemical Reactor recipe map, with matching inputs, outputs, EUt, and duration.
-     *
+     * 

* This action cannot be negated, unlike special build actions for other recipe maps. - * + *

* Any recipe added to the Chemical Reactor not specifying an EUt value will default to 30. */ @ZenProperty - public static final RecipeMap CHEMICAL_RECIPES = new RecipeMap<>("chemical_reactor", 2, 2, 3, - 2, new SimpleRecipeBuilder().EUt(VA[LV]), false) - .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) - .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) - .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR) + public static final RecipeMap CHEMICAL_RECIPES = new RecipeMapBuilder<>("chemical_reactor", + new SimpleRecipeBuilder().EUt(VA[LV])) + .itemInputs(2) + .itemOutputs(2) + .fluidInputs(3) + .fluidOutputs(2) + .itemSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_1, false, false) + .itemSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_2, false, true) + .itemSlotOverlay(GuiTextures.VIAL_OVERLAY_1, true) + .fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_3, false, false) + .fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_4, false, true) + .fluidSlotOverlay(GuiTextures.VIAL_OVERLAY_2, true) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.CHEMICAL_REACTOR) + .build() .onRecipeBuild(recipeBuilder -> { recipeBuilder.invalidateOnBuildAction(); RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder() @@ -381,14 +448,14 @@ public class RecipeMaps { .fluidOutputs(recipeBuilder.getFluidOutputs()) .chancedFluidOutputs(recipeBuilder.getChancedFluidOutputs()) .cleanroom(recipeBuilder.getCleanroom()) - .duration(recipeBuilder.duration) - .EUt(recipeBuilder.EUt) + .duration(recipeBuilder.getDuration()) + .EUt(recipeBuilder.getEUt()) .buildAndRegister(); }); /** * Example: - * + * *

      * RecipeMap.CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder()
      *         .input(MetaItems.BASIC_CIRCUIT_BOARD)
@@ -405,40 +472,43 @@ public class RecipeMaps {
      * The Circuit Assembler has a special action that is performed for any recipe added to its recipe map, seen in its
      * onRecipeBuild call. Any recipe that is added to the Circuit Assembler that does not specify a fluid input
      * in the recipe will automatically have recipes generated using Soldering Alloy and Tin for the input fluids.
-     *
+     * 

* The amount of these fluids is based on the Soldering Multiplier, which is a special addition to the * Circuit Assembler Recipe Builder. It is called through .solderMultiplier(int multiplier) on the Recipe * Builder. * The Multiplier itself is limited to numbers between 1 and (64000 / 144) inclusive. - * + *

* This action can be negated by simply specifying a fluid input in the recipe. */ @ZenProperty - public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMap<>( - "circuit_assembler", 6, 1, 1, 0, new CircuitAssemblerRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ASSEMBLER) + public static final RecipeMap CIRCUIT_ASSEMBLER_RECIPES = new RecipeMapBuilder<>( + "circuit_assembler", new CircuitAssemblerRecipeBuilder()) + .itemInputs(6) + .itemOutputs(1) + .fluidInputs(1) + .itemSlotOverlay(GuiTextures.CIRCUIT_OVERLAY, false) + .progressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER) + .sound(GTSoundEvents.ASSEMBLER) + .build() .onRecipeBuild(recipeBuilder -> { recipeBuilder.invalidateOnBuildAction(); if (recipeBuilder.getFluidInputs().isEmpty()) { recipeBuilder.copy() .fluidInputs(Materials.SolderingAlloy.getFluid(Math.max(1, - (GTValues.L / 2) * ((CircuitAssemblerRecipeBuilder) recipeBuilder) - .getSolderMultiplier()))) + (GTValues.L / 2) * recipeBuilder.getSolderMultiplier()))) .buildAndRegister(); // Don't call buildAndRegister as we are mutating the original recipe and already in the // middle of a buildAndRegister call. // Adding a second call will result in duplicate recipe generation attempts recipeBuilder.fluidInputs(Materials.Tin.getFluid(Math.max(1, GTValues.L * - ((CircuitAssemblerRecipeBuilder) recipeBuilder).getSolderMultiplier()))); + recipeBuilder.getSolderMultiplier()))); } }); /** * Example: - * + * *

      * RecipeMap.COKE_OVEN_RECIPES.recipeBuilder()
      *         .input(OrePrefix.log, Materials.Wood)
@@ -451,13 +521,18 @@ public class RecipeMaps {
      * As a Primitive Machine, the Coke Oven does not need an EUt parameter specified for the Recipe Builder.
      */
     @ZenProperty
-    public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapCokeOven<>("coke_oven", 1,
-            false, 1, false, 0, false, 1, false, new PrimitiveRecipeBuilder(), false)
-                    .setSound(GTSoundEvents.FIRE);
+    public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMapBuilder<>("coke_oven",
+            new PrimitiveRecipeBuilder())
+                    .itemInputs(1)
+                    .itemOutputs(1)
+                    .fluidOutputs(1)
+                    .ui(CokeOvenUI::new)
+                    .sound(GTSoundEvents.FIRE)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.COMPRESSOR_RECIPES.recipeBuilder()
      *         .input(OrePrefix.dust, Materials.Fireclay)
@@ -471,15 +546,18 @@ public class RecipeMaps {
      * Any Recipe added to the Compressor not specifying a duration value will default to 200.
      */
     @ZenProperty
-    public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 0, 0,
-            new SimpleRecipeBuilder().duration(200).EUt(2), false)
-                    .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.COMPRESSOR);
+    public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMapBuilder<>("compressor",
+            new SimpleRecipeBuilder().duration(200).EUt(2))
+                    .itemInputs(1)
+                    .itemOutputs(1)
+                    .itemSlotOverlay(GuiTextures.COMPRESSOR_OVERLAY, false)
+                    .progressBar(GuiTextures.PROGRESS_BAR_COMPRESS)
+                    .sound(GTSoundEvents.COMPRESSOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      *      RecipeMap.CRACKING_RECIPES.recipeBuilder()
      *              .circuitMeta(1))
@@ -492,17 +570,18 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap CRACKING_RECIPES = new RecipeMapCrackerUnit<>("cracker", 1, true, - 0, true, 2, false, 2, true, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap CRACKING_RECIPES = new RecipeMapBuilder<>("cracker", + new SimpleRecipeBuilder()) + .itemInputs(1) + .fluidInputs(2) + .fluidOutputs(2) + .ui(CrackerUnitUI::new) + .sound(GTSoundEvents.FIRE) + .build(); /** * Example: - * + * *
      * RecipeMap.CUTTER_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.LOG, 1, GTValues.W))
@@ -515,37 +594,43 @@ public class RecipeMaps {
      * The Cutting Machine has a special action that will be performed when its recipe is built, signified by the
      * onRecipeBuild call. If there is no fluid input specified in the passed recipe for the Cutting Machine,
      * recipes will automatically be generated using Water, Distilled Water, and Lubricant.
-     *
+     * 

* The amount of these fluids used is some arcane formula, probably copied from GT5 - * + *

* To negate this onRecipeBuild action, simply add a fluid input to the recipe passed to the Cutter Recipe * Map. */ @ZenProperty - public static final RecipeMap CUTTER_RECIPES = new RecipeMap<>("cutter", 1, 2, 1, 0, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) - .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT) + public static final RecipeMap CUTTER_RECIPES = new RecipeMapBuilder<>("cutter", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(2) + .fluidInputs(1) + .itemSlotOverlay(GuiTextures.SAWBLADE_OVERLAY, false) + .itemSlotOverlay(GuiTextures.CUTTER_OVERLAY, true, false) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true, true) + .progressBar(GuiTextures.PROGRESS_BAR_SLICE) + .sound(GTSoundEvents.CUT) + .build() .onRecipeBuild(recipeBuilder -> { recipeBuilder.invalidateOnBuildAction(); if (recipeBuilder.getFluidInputs().isEmpty()) { + int duration = recipeBuilder.getDuration(); + int eut = recipeBuilder.getEUt(); recipeBuilder .copy() .fluidInputs(Materials.Water.getFluid(Math.max(4, - Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt / 320)))) - .duration(recipeBuilder.duration * 2) + Math.min(1000, duration * eut / 320)))) + .duration(duration * 2) .buildAndRegister(); recipeBuilder .copy() .fluidInputs(Materials.DistilledWater.getFluid(Math.max(3, - Math.min(750, recipeBuilder.duration * recipeBuilder.EUt / 426)))) - .duration((int) (recipeBuilder.duration * 1.5)) + Math.min(750, duration * eut / 426)))) + .duration((int) (duration * 1.5)) .buildAndRegister(); // Don't call buildAndRegister as we are mutating the original recipe and already in the @@ -553,15 +638,15 @@ public class RecipeMaps { // Adding a second call will result in duplicate recipe generation attempts recipeBuilder .fluidInputs(Materials.Lubricant.getFluid(Math.max(1, - Math.min(250, recipeBuilder.duration * recipeBuilder.EUt / 1280)))) - .duration(Math.max(1, recipeBuilder.duration)); + Math.min(250, duration * eut / 1280)))) + .duration(Math.max(1, duration)); } }); /** * Examples: - * + * *

      * RecipeMap.DISTILLATION_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.CoalTar.getFluid(1000))
@@ -582,17 +667,22 @@ public class RecipeMaps {
      * this recipe is built, 2 separate recipes will be created in the Distillery. One for fluid A into the first
      * output,
      * and the second for fluid A into the second output.
-     *
+     * 

* This behavior can be disabled by adding a .disableDistilleryRecipes() onto the recipe builder. */ @ZenProperty - public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower( - "distillation_tower", 0, true, 1, true, 1, true, 12, false, new UniversalDistillationRecipeBuilder(), false) - .setSound(GTSoundEvents.CHEMICAL_REACTOR); + public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapBuilder<>( + "distillation_tower", new UniversalDistillationRecipeBuilder()) + .itemOutputs(1) + .fluidInputs(1) + .fluidOutputs(12) + .ui(DistillationTowerUI::new) + .sound(GTSoundEvents.CHEMICAL_REACTOR) + .build(); /** * Example: - * + * *

      * RecipeMap.DISTILLERY_RECIPES.recipeBuilder()
      *         .circuitMeta(1)
@@ -604,18 +694,23 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap DISTILLERY_RECIPES = new RecipeMap<>("distillery", 1, 1, 1, 1, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap DISTILLERY_RECIPES = new RecipeMapBuilder<>("distillery", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .fluidInputs(1) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.INT_CIRCUIT_OVERLAY, false, true) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true) + .fluidSlotOverlay(GuiTextures.BEAKER_OVERLAY_1, false) + .fluidSlotOverlay(GuiTextures.BEAKER_OVERLAY_4, true) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(GTSoundEvents.BOILER) + .build(); /** * Examples: - * + * *
      * RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.SaltWater.getFluid(1000))
@@ -628,17 +723,22 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMap<>("electrolyzer", 2, 6, 1, - 6, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap ELECTROLYZER_RECIPES = new RecipeMapBuilder<>("electrolyzer", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(6) + .fluidInputs(1) + .fluidOutputs(6) + .itemSlotOverlay(GuiTextures.LIGHTNING_OVERLAY_1, false, false) + .itemSlotOverlay(GuiTextures.CANISTER_OVERLAY, false, true) + .fluidSlotOverlay(GuiTextures.LIGHTNING_OVERLAY_2, false) + .progressBar(GuiTextures.PROGRESS_BAR_EXTRACT) + .sound(GTSoundEvents.ELECTROLYZER) + .build(); /** * Example: - * + * *
      * RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder()
      *         .input(OrePrefix.dustPure, Materials.Aluminium)
@@ -651,16 +751,19 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>( - "electromagnetic_separator", 1, 3, 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMapBuilder<>( + "electromagnetic_separator", new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(3) + .itemSlotOverlay(GuiTextures.CRUSHED_ORE_OVERLAY, false) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_MAGNET) + .sound(GTSoundEvents.ARC) + .build(); /** * Example: - * + * *
      * RecipeMap.EXTRACTOR_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(MetaBlocks.RUBBER_LEAVES, 16))
@@ -673,15 +776,19 @@ public class RecipeMaps {
      * Any Recipe added to the Extractor not specifying an duration value will default to 400.
      */
     @ZenProperty
-    public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 1, 1, 0, 1,
-            new SimpleRecipeBuilder().duration(400).EUt(2), false)
-                    .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.COMPRESSOR);
+    public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMapBuilder<>("extractor",
+            new SimpleRecipeBuilder().duration(400).EUt(2))
+                    .itemInputs(1)
+                    .itemOutputs(1)
+                    .fluidOutputs(1)
+                    .itemSlotOverlay(GuiTextures.EXTRACTOR_OVERLAY, false)
+                    .progressBar(GuiTextures.PROGRESS_BAR_EXTRACT)
+                    .sound(GTSoundEvents.COMPRESSOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.EXTRUDER_RECIPES.recipeBuilder()
      *         .input(OrePrefix.ingot, Materials.BorosilicateGlass)
@@ -693,15 +800,18 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 1, 0, 0, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap EXTRUDER_RECIPES = new RecipeMapBuilder<>("extruder", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(1) + .itemSlotOverlay(GuiTextures.MOLD_OVERLAY, false, true) + .progressBar(GuiTextures.PROGRESS_BAR_EXTRUDER) + .sound(GTSoundEvents.ARC) + .build(); /** * Example: - * + * *
      * RecipeMap.FERMENTING_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.Biomass.getFluid(100))
@@ -713,16 +823,20 @@ public class RecipeMaps {
      * Any Recipe added to the Fermenter not specifying an EUt value will default to 2.
      */
     @ZenProperty
-    public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 1, 1, 1, 1,
-            new SimpleRecipeBuilder().EUt(2), false)
-                    .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY)
-                    .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.CHEMICAL_REACTOR);
+    public static final RecipeMap FERMENTING_RECIPES = new RecipeMapBuilder<>("fermenter",
+            new SimpleRecipeBuilder().EUt(2))
+                    .itemInputs(1)
+                    .itemOutputs(1)
+                    .fluidInputs(1)
+                    .fluidOutputs(1)
+                    .itemSlotOverlay(GuiTextures.DUST_OVERLAY, false, true)
+                    .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true, true)
+                    .sound(GTSoundEvents.CHEMICAL_REACTOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.FLUID_HEATER_RECIPES.recipeBuilder()
      *         .circuitMeta(1)
@@ -734,17 +848,20 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 0, 1, - 1, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.BOILER); + public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMapBuilder<>("fluid_heater", + new SimpleRecipeBuilder()) + .itemInputs(1) + .fluidInputs(1) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.INT_CIRCUIT_OVERLAY, false, true) + .fluidSlotOverlay(GuiTextures.HEATING_OVERLAY_1, false) + .fluidSlotOverlay(GuiTextures.HEATING_OVERLAY_2, true) + .sound(GTSoundEvents.BOILER) + .build(); /** * Example: - * + * *
      * RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder()
      *         .notConsumable(MetaItems.SHAPE_MOLD_CYLINDER)
@@ -756,15 +873,18 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", - 1, 1, 1, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMapBuilder<>( + "fluid_solidifier", new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .fluidInputs(1) + .itemSlotOverlay(GuiTextures.SOLIDIFIER_OVERLAY, false) + .sound(GTSoundEvents.COOLING) + .build(); /** * Example: - * + * *
      * RecipeMap.FORGE_HAMMER_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.STONE))
@@ -775,16 +895,19 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 0, - 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) - .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) - .setSound(GTSoundEvents.FORGE_HAMMER); + public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMapBuilder<>("forge_hammer", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .itemSlotOverlay(GuiTextures.HAMMER_OVERLAY, false) + .specialTexture(GuiTextures.PROGRESS_BAR_HAMMER_BASE, 78, 42, 20, 6) + .progressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL_DOWNWARDS) + .sound(GTSoundEvents.FORGE_HAMMER) + .build(); /** * Example: - * + * *
      * RecipeMap.FORMING_PRESS_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.STONE))
@@ -796,14 +919,12 @@ public class RecipeMaps {
      */
     @ZenProperty
     public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress(
-            "forming_press", 6, 1, 0, 0, new SimpleRecipeBuilder(), false)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.COMPRESSOR);
+            "forming_press", new SimpleRecipeBuilder(), FormingPressUI::new);
 
     /**
      *
      * Example:
-     * 
+     *
      * 
      * RecipeMap.FURNACE_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.SAND))
@@ -816,20 +937,22 @@ public class RecipeMaps {
      * When looking up recipes from the GTCEu Furnaces, they will first check the Vanilla Furnace Recipe list, therefore
      * our Furnaces can perform any recipe that is in the Vanilla Furnace Recipe List. This also means there is no need
      * to add Furnace Recipes that duplicate Vanilla recipes.
-     *
+     * 

* However, when adding a recipe to our Furnace Recipe Map, these new recipes are not added to the Vanilla Furnace * Recipe List, so any recipes added will be exclusive to the GTCEu Furnaces. */ @ZenProperty - public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, - 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FURNACE); + public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", + new SimpleRecipeBuilder(), recipeMap -> { + RecipeMapUI ui = new RecipeMapUI<>(recipeMap, true, true, true, true); + ui.setItemSlotOverlay(GuiTextures.FURNACE_OVERLAY_1, false); + ui.setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL); + return ui; + }); /** * Example: - * + * *

      * RecipeMap.FUSION_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.Lithium.getFluid(16), Materials.Tungsten.getFluid(16))
@@ -843,29 +966,35 @@ public class RecipeMaps {
      * The Fusion Reactor requires an EUToStart call, which is used to gate recipes behind requiring different
      * tier
      * Fusion Reactors. This value must be greater than 0.
-     *
+     * 

* The Breakpoints for this value currently are: * MK1: 160MEU and lower * MK2: 160MEU - 320MEU * MK3: 320MEU - 640MEU */ @ZenProperty - public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 2, 1, - new FusionRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap FUSION_RECIPES = new RecipeMapBuilder<>("fusion_reactor", + new FusionRecipeBuilder()) + .fluidInputs(2) + .fluidOutputs(1) + .progressBar(GuiTextures.PROGRESS_BAR_FUSION) + .sound(GTSoundEvents.ARC) + .build(); @ZenProperty - public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, - 0, 0, 1, new GasCollectorRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) - .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COOLING); + public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMapBuilder<>( + "gas_collector", new GasCollectorRecipeBuilder()) + .itemInputs(1) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.INT_CIRCUIT_OVERLAY, false, true) + .fluidSlotOverlay(GuiTextures.CENTRIFUGE_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR) + .sound(GTSoundEvents.COOLING) + .build(); /** * Example: - * + * *

      * RecipeMap.IMPLOSION_RECIPES.recipeBuilder()
      *         .input(OreDictUnifier.get(OrePrefix.gem, Materials.Coal, 64))
@@ -892,23 +1021,27 @@ public class RecipeMaps {
      * explosivesAmount(int amount), which will generate a recipe using TNT as the explosive, with the count of
      * TNT
      * being the passed amount. Note that this must be between 1 and 64 inclusive.
-     *
+     * 

* The second method is to use explosivesType(ItemStack item). In this case, the passed ItemStack will be * used * as the explosive, with the number of explosives being the count of the passed ItemStack. * Note that the count must be between 1 and 64 inclusive */ @ZenProperty - public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 3, - 2, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(VA[LV]), false) - .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) - .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSound(SoundEvents.ENTITY_GENERIC_EXPLODE); + public static final RecipeMap IMPLOSION_RECIPES = new RecipeMapBuilder<>( + "implosion_compressor", new ImplosionRecipeBuilder().duration(20).EUt(VA[LV])) + .itemInputs(3) + .itemOutputs(2) + .itemSlotOverlay(GuiTextures.IMPLOSION_OVERLAY_1, false, true) + .itemSlotOverlay(GuiTextures.IMPLOSION_OVERLAY_2, false, false) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true, true) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(SoundEvents.ENTITY_GENERIC_EXPLODE) + .build(); /** * Example: - * + * *

      * RecipeMap.LARGE_CHEMICAL_RECIPES.recipeBuilder()
      *         .fluidInputs(Materials.NitrogenDioxide.getFluid(4000))
@@ -922,25 +1055,30 @@ public class RecipeMaps {
      *
      * Note that any recipes added to the Large Chemical Reactor recipe map will be exclusive to the LCR, unlike
      * recipes added to the Chemical Reactor, which will be mirrored to the LCR.
-     *
+     * 

* Any Recipe added to the Large Chemical Reactor not specifying an EUt value will default to 30. */ @ZenProperty - public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMap<>( - "large_chemical_reactor", 3, 3, 5, 4, new SimpleRecipeBuilder().EUt(VA[LV]), false) - .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) - .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) - .setSlotOverlay(false, true, false, GuiTextures.MOLECULAR_OVERLAY_3) - .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) - .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CHEMICAL_REACTOR) + public static final RecipeMap LARGE_CHEMICAL_RECIPES = new RecipeMapBuilder<>( + "large_chemical_reactor", new SimpleRecipeBuilder().EUt(VA[LV])) + .itemInputs(3) + .itemOutputs(3) + .fluidInputs(5) + .fluidOutputs(4) + .itemSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_1, false, false) + .itemSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_2, false, true) + .itemSlotOverlay(GuiTextures.VIAL_OVERLAY_1, true) + .fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_3, false, false) + .fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_4, false, true) + .fluidSlotOverlay(GuiTextures.VIAL_OVERLAY_2, true) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(GTSoundEvents.CHEMICAL_REACTOR) + .build() .setSmallRecipeMap(CHEMICAL_RECIPES); /** * Example: - * + * *

      * RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder()
      *         .input(MetaItems.SILICON_WAFER)
@@ -952,15 +1090,17 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 1, - 0, 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMapBuilder<>("laser_engraver", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(1) + .itemSlotOverlay(GuiTextures.LENS_OVERLAY, false, true) + .sound(GTSoundEvents.ELECTROLYZER) + .build(); /** * Example: - * + * *
      * RecipeMap.LATHE_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.WOODEN_SLAB, 1, GTValues.W))
@@ -971,18 +1111,21 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap LATHE_RECIPES = new RecipeMap<>("lathe", 1, 2, 0, 0, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) - .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) - .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.CUT); + public static final RecipeMap LATHE_RECIPES = new RecipeMapBuilder<>("lathe", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(2) + .itemSlotOverlay(GuiTextures.PIPE_OVERLAY_1, false) + .itemSlotOverlay(GuiTextures.PIPE_OVERLAY_2, true, false) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true, true) + .specialTexture(GuiTextures.PROGRESS_BAR_LATHE_BASE, 98, 24, 5, 18) + .progressBar(GuiTextures.PROGRESS_BAR_LATHE) + .sound(GTSoundEvents.CUT) + .build(); /** * Example: - * + * *
      * RecipeMap.MACERATOR_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Items.CHICKEN))
@@ -995,30 +1138,37 @@ public class RecipeMaps {
      * Any Recipe added to the Macerator not specifying a duration value will default to 150.
      */
     @ZenProperty
-    public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 4, 0, 0,
-            new SimpleRecipeBuilder().duration(150).EUt(2), false)
-                    .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
-                    .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.MACERATOR);
+    public static final RecipeMap MACERATOR_RECIPES = new RecipeMapBuilder<>("macerator",
+            new SimpleRecipeBuilder().duration(150).EUt(2))
+                    .itemInputs(1)
+                    .itemOutputs(4)
+                    .itemSlotOverlay(GuiTextures.CRUSHED_ORE_OVERLAY, false)
+                    .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_MACERATE)
+                    .sound(GTSoundEvents.MACERATOR)
+                    .build();
 
     /**
      * Currently unused
      */
     @ZenProperty
     @SuppressWarnings("unused")
-    public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMap<>("mass_fabricator", 1,
-            0, 1, 2, new SimpleRecipeBuilder(), false)
-                    .setSlotOverlay(false, false, GuiTextures.ATOMIC_OVERLAY_1)
-                    .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2)
-                    .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY)
-                    .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.REPLICATOR);
+    public static final RecipeMap MASS_FABRICATOR_RECIPES = new RecipeMapBuilder<>(
+            "mass_fabricator", new SimpleRecipeBuilder())
+                    .itemInputs(1)
+                    .fluidInputs(1)
+                    .fluidOutputs(2)
+                    .itemSlotOverlay(GuiTextures.ATOMIC_OVERLAY_1, false)
+                    .fluidSlotOverlay(GuiTextures.ATOMIC_OVERLAY_2, false)
+                    .fluidSlotOverlay(GuiTextures.POSITIVE_MATTER_OVERLAY, true)
+                    .fluidSlotOverlay(GuiTextures.NEUTRAL_MATTER_OVERLAY, true, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_MASS_FAB)
+                    .sound(GTSoundEvents.REPLICATOR)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * 		RecipeMap.MIXER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.dust, Materials.Redstone, 5)
@@ -1030,16 +1180,21 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 6, 1, 2, 1, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) - .setSound(GTSoundEvents.MIXER); + public static final RecipeMap MIXER_RECIPES = new RecipeMapBuilder<>("mixer", + new SimpleRecipeBuilder()) + .itemInputs(6) + .itemOutputs(1) + .fluidInputs(2) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, false) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR) + .sound(GTSoundEvents.MIXER) + .build(); /** * Example: - * + * *
      * 		RecipeMap.ORE_WASHER_RECIPES.recipeBuilder()
      * 				.input(OrePrefix.crushed, Materials.Aluminum)
@@ -1053,16 +1208,20 @@ public class RecipeMaps {
      * Any Recipe added to the Ore Washer not specifying a duration value will default to 400.
      */
     @ZenProperty
-    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 2, 3, 1, 0,
-            new SimpleRecipeBuilder().duration(400).EUt(16), false)
-                    .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
-                    .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
-                    .setSound(GTSoundEvents.BATH);
+    public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMapBuilder<>("ore_washer",
+            new SimpleRecipeBuilder().duration(400).EUt(16))
+                    .itemInputs(2)
+                    .itemOutputs(3)
+                    .fluidInputs(1)
+                    .itemSlotOverlay(GuiTextures.CRUSHED_ORE_OVERLAY, false)
+                    .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.CIRCULAR)
+                    .sound(GTSoundEvents.BATH)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * 		RecipeMap.PACKER_RECIPES.recipeBuilder()
      * 				.inputs(new ItemStack(Items.WHEAT, 9))
@@ -1076,16 +1235,19 @@ public class RecipeMaps {
      * Any Recipe added to the Packer not specifying a duration value will default to 10.
      */
     @ZenProperty
-    public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 0, 0,
-            new SimpleRecipeBuilder().EUt(12).duration(10), false)
-                    .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY)
-                    .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.ASSEMBLER);
+    public static final RecipeMap PACKER_RECIPES = new RecipeMapBuilder<>("packer",
+            new SimpleRecipeBuilder().EUt(12).duration(10))
+                    .itemInputs(2)
+                    .itemOutputs(2)
+                    .itemSlotOverlay(GuiTextures.BOX_OVERLAY, false, true)
+                    .itemSlotOverlay(GuiTextures.BOXED_OVERLAY, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_UNPACKER)
+                    .sound(GTSoundEvents.ASSEMBLER)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.POLARIZER_RECIPES.recipeBuilder()
      *         .inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Iron))
@@ -1096,14 +1258,17 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 0, 0, - new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ARC); + public static final RecipeMap POLARIZER_RECIPES = new RecipeMapBuilder<>("polarizer", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .progressBar(GuiTextures.PROGRESS_BAR_MAGNET) + .sound(GTSoundEvents.ARC) + .build(); /** * Example: - * + * *
      *      RecipeMap.PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder()
      *     			.input(OrePrefix.ingot, Materials.Iron)
@@ -1118,13 +1283,20 @@ public class RecipeMaps {
      * Recipe Builder.
      */
     @ZenProperty
-    public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>(
-            "primitive_blast_furnace", 3, false, 3, false, 0, false, 0, false, new PrimitiveRecipeBuilder(), false)
-                    .setSound(GTSoundEvents.FIRE);
+    public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMapBuilder<>(
+            "primitive_blast_furnace", new PrimitiveRecipeBuilder())
+                    .itemInputs(3)
+                    .modifyItemInputs(false)
+                    .itemOutputs(3)
+                    .modifyItemOutputs(false)
+                    .modifyFluidInputs(false)
+                    .modifyFluidOutputs(false)
+                    .sound(GTSoundEvents.FIRE)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.PYROLYSE_RECIPES.recipeBuilder()
      *         .input(OrePrefix.log, Materials.Wood, 16)
@@ -1138,43 +1310,53 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 1, 1, 1, - new SimpleRecipeBuilder(), false) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap PYROLYSE_RECIPES = new RecipeMapBuilder<>("pyrolyse_oven", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(1) + .fluidInputs(1) + .fluidOutputs(1) + .sound(GTSoundEvents.FIRE) + .build(); /** * Currently unused */ @ZenProperty - public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 2, 1, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.ATOMIC_OVERLAY_1) - .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) - .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.REPLICATOR); + @SuppressWarnings("unused") + public static final RecipeMap REPLICATOR_RECIPES = new RecipeMapBuilder<>("replicator", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(1) + .fluidInputs(2) + .fluidOutputs(1) + .itemSlotOverlay(GuiTextures.DATA_ORB_OVERLAY, false) + .itemSlotOverlay(GuiTextures.ATOMIC_OVERLAY_1, true) + .fluidSlotOverlay(GuiTextures.NEUTRAL_MATTER_OVERLAY, false) + .fluidSlotOverlay(GuiTextures.POSITIVE_MATTER_OVERLAY, false, true) + .fluidSlotOverlay(GuiTextures.ATOMIC_OVERLAY_2, true) + .progressBar(GuiTextures.PROGRESS_BAR_REPLICATOR) + .sound(GTSoundEvents.REPLICATOR) + .build(); @ZenProperty public static final RecipeMap RESEARCH_STATION_RECIPES = new RecipeMapResearchStation<>( - "research_station", 2, 1, 0, 0, new ComputationRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY) - .setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); + "research_station", new ComputationRecipeBuilder(), ResearchStationUI::new); @ZenProperty - public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 4, 0, - 0, new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) - .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.FIRE); + public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMapBuilder<>("rock_breaker", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(4) + .itemSlotOverlay(GuiTextures.DUST_OVERLAY, false) + .itemSlotOverlay(GuiTextures.CRUSHED_ORE_OVERLAY, true) + .progressBar(GuiTextures.PROGRESS_BAR_MACERATE) + .sound(GTSoundEvents.FIRE) + .build(); /** * Example: - * + * *
      * RecipeMaps.SCANNER_RECIPES.recipeBuilder()
      *         .inputNBT(MetaItems.TOOL_DATA_STICK, NBTMatcher.ANY, NBTCondition.ANY)
@@ -1186,16 +1368,18 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", 2, 1, 1, 0, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.ELECTROLYZER); + public static final RecipeMap SCANNER_RECIPES = new RecipeMapScanner("scanner", + new SimpleRecipeBuilder(), recipeMap -> { + RecipeMapUI ui = new RecipeMapUI<>(recipeMap, true, true, true, true); + ui.setItemSlotOverlay(GuiTextures.DATA_ORB_OVERLAY, false, false); + ui.setItemSlotOverlay(GuiTextures.SCANNER_OVERLAY, false, true); + ui.setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL); + return ui; + }); /** * Example: - * + * *
      * RecipeMap.SIFTER_RECIPES.recipeBuilder()
      *         .inputs(new ItemStack(Blocks.SAND))
@@ -1210,14 +1394,17 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 6, 0, 0, - new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) - .setSound(SoundEvents.BLOCK_SAND_PLACE); + public static final RecipeMap SIFTER_RECIPES = new RecipeMapBuilder<>("sifter", + new SimpleRecipeBuilder()) + .itemInputs(1) + .itemOutputs(6) + .progressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_DOWNWARDS) + .sound(SoundEvents.BLOCK_SAND_PLACE) + .build(); /** * Example: - * + * *
      * RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder()
      *         .input(OrePrefix.crushed, Materials.Aluminum)
@@ -1233,16 +1420,19 @@ public class RecipeMaps {
      * Any Recipe added to the Thermal Centrifuge not specifying a duration value will default to 400.
      */
     @ZenProperty
-    public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>(
-            "thermal_centrifuge", 1, 3, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(30), false)
-                    .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
-                    .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
-                    .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL)
-                    .setSound(GTSoundEvents.CENTRIFUGE);
+    public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMapBuilder<>(
+            "thermal_centrifuge", new SimpleRecipeBuilder().duration(400).EUt(30))
+                    .itemInputs(1)
+                    .itemOutputs(3)
+                    .itemSlotOverlay(GuiTextures.CRUSHED_ORE_OVERLAY, false)
+                    .itemSlotOverlay(GuiTextures.DUST_OVERLAY, true)
+                    .progressBar(GuiTextures.PROGRESS_BAR_MACERATE)
+                    .sound(GTSoundEvents.CENTRIFUGE)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.VACUUM_RECIPES.recipeBuilder()
      *         .fluidInputs(Air.getFluid(4000))
@@ -1254,13 +1444,18 @@ public class RecipeMaps {
      * Any Recipe added to the Thermal Centrifuge not specifying an EUt value will default to 120.
      */
     @ZenProperty
-    public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 1, 1, 2, 1,
-            new SimpleRecipeBuilder().EUt(VA[MV]), false)
-                    .setSound(GTSoundEvents.COOLING);
+    public static final RecipeMap VACUUM_RECIPES = new RecipeMapBuilder<>("vacuum_freezer",
+            new SimpleRecipeBuilder().EUt(VA[MV]))
+                    .itemInputs(1)
+                    .itemOutputs(1)
+                    .fluidInputs(2)
+                    .fluidOutputs(1)
+                    .sound(GTSoundEvents.COOLING)
+                    .build();
 
     /**
      * Example:
-     * 
+     *
      * 
      * RecipeMap.WIREMILL_RECIPES.recipeBuilder()
      *         .input(OrePrefix.ingot, Materials.Iron)
@@ -1271,54 +1466,71 @@ public class RecipeMaps {
      * 
*/ @ZenProperty - public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 2, 1, 0, 0, - new SimpleRecipeBuilder(), false) - .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) - .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.MOTOR); + public static final RecipeMap WIREMILL_RECIPES = new RecipeMapBuilder<>("wiremill", + new SimpleRecipeBuilder()) + .itemInputs(2) + .itemOutputs(1) + .itemSlotOverlay(GuiTextures.WIREMILL_OVERLAY, false) + .itemSlotOverlay(GuiTextures.INT_CIRCUIT_OVERLAY, false, true) + .progressBar(GuiTextures.PROGRESS_BAR_WIREMILL) + .sound(GTSoundEvents.MOTOR) + .build(); ////////////////////////////////////// // Fuel Recipe Maps // ////////////////////////////////////// @ZenProperty - public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMap<>( - "combustion_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap COMBUSTION_GENERATOR_FUELS = new RecipeMapBuilder<>( + "combustion_generator", new FuelRecipeBuilder()) + .fluidInputs(1) + .fluidSlotOverlay(GuiTextures.FURNACE_OVERLAY_2, false) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(GTSoundEvents.COMBUSTION) + .allowEmptyOutputs() + .build(); @ZenProperty - public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMap<>("gas_turbine", 0, 0, 1, 0, - new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap GAS_TURBINE_FUELS = new RecipeMapBuilder<>("gas_turbine", + new FuelRecipeBuilder()) + .fluidInputs(1) + .fluidSlotOverlay(GuiTextures.DARK_CANISTER_OVERLAY, false) + .progressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR) + .sound(GTSoundEvents.TURBINE) + .allowEmptyOutputs() + .build(); @ZenProperty - public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMap<>("steam_turbine", 0, 0, 1, 1, - new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap STEAM_TURBINE_FUELS = new RecipeMapBuilder<>("steam_turbine", + new FuelRecipeBuilder()) + .fluidInputs(1) + .fluidOutputs(1) + .fluidSlotOverlay(GuiTextures.CENTRIFUGE_OVERLAY, false) + .progressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR) + .sound(GTSoundEvents.TURBINE) + .allowEmptyOutputs() + .build(); @ZenProperty - public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMap<>( - "semi_fluid_generator", 0, 0, 1, 0, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.COMBUSTION) - .allowEmptyOutput(); + public static final RecipeMap SEMI_FLUID_GENERATOR_FUELS = new RecipeMapBuilder<>( + "semi_fluid_generator", new FuelRecipeBuilder()) + .fluidInputs(1) + .fluidSlotOverlay(GuiTextures.FURNACE_OVERLAY_2, false) + .progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE) + .sound(GTSoundEvents.COMBUSTION) + .allowEmptyOutputs() + .build(); @ZenProperty - public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMap<>("plasma_generator", 0, 0, - 1, 1, new FuelRecipeBuilder(), false) - .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) - .setSound(GTSoundEvents.TURBINE) - .allowEmptyOutput(); + public static final RecipeMap PLASMA_GENERATOR_FUELS = new RecipeMapBuilder<>("plasma_generator", + new FuelRecipeBuilder()) + .fluidInputs(1) + .fluidOutputs(1) + .fluidSlotOverlay(GuiTextures.CENTRIFUGE_OVERLAY, false) + .progressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR) + .sound(GTSoundEvents.TURBINE) + .allowEmptyOutputs() + .build(); + + private RecipeMaps() {} } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java index efd953ea099..098d93ab589 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java @@ -1,83 +1,32 @@ package gregtech.api.recipes.machines; -import gregtech.api.capability.impl.FluidTankList; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.ProgressWidget; -import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipeproperties.ResearchProperty; import gregtech.api.recipes.recipeproperties.ResearchPropertyData; - -import net.minecraftforge.items.IItemHandlerModifiable; +import gregtech.api.recipes.ui.RecipeMapUIFunction; +import gregtech.core.sound.GTSoundEvents; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Map; +@ApiStatus.Internal public class RecipeMapAssemblyLine> extends RecipeMap implements IResearchRecipeMap { /** Contains the recipes for each research key */ private final Map> researchEntries = new Object2ObjectOpenHashMap<>(); - public RecipeMapAssemblyLine(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, - boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, - boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, - modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); - } - - @Override - @NotNull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, - FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 176) - .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, - ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, - ProgressWidget.MoveType.VERTICAL)); - this.addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); - this.addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); - return builder; - } - - @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, @NotNull IItemHandlerModifiable itemHandler, - @NotNull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { - int startInputsX = 80 - 4 * 18; - int fluidInputsCount = fluidHandler.getTanks(); - int startInputsY = 37 - 2 * 18; - - if (!isOutputs) { - // Data Slot - builder.widget(new SlotWidget(itemHandler, 16, startInputsX + 18 * 7, 1 + 18 * 2, true, true) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)); - - // item input slots - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - int slotIndex = i * 4 + j; - addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, - false, false); - } - } - - // fluid slots - int startFluidX = startInputsX + 18 * 5; - for (int i = 0; i < 4; i++) { - addSlot(builder, startFluidX, startInputsY + 18 * i, i, itemHandler, fluidHandler, true, false); - } - } else { - // output slot - addSlot(builder, startInputsX + 18 * 7, 1, 0, itemHandler, fluidHandler, false, true); - } + public RecipeMapAssemblyLine(@NotNull String unlocalizedName, @NotNull R defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 16, 1, 4, 0); + setSound(GTSoundEvents.ASSEMBLER); } @Override diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java deleted file mode 100644 index a0af84c51dc..00000000000 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCrackerUnit.java +++ /dev/null @@ -1,73 +0,0 @@ -package gregtech.api.recipes.machines; - -import gregtech.api.capability.impl.FluidTankList; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.ProgressWidget; -import gregtech.api.gui.widgets.RecipeProgressWidget; -import gregtech.api.recipes.RecipeBuilder; -import gregtech.api.recipes.RecipeMap; - -import net.minecraftforge.items.IItemHandlerModifiable; - -import com.google.common.util.concurrent.AtomicDouble; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.function.DoubleSupplier; - -public class RecipeMapCrackerUnit> extends RecipeMap { - - public RecipeMapCrackerUnit(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, - boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, - boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, - modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); - } - - @Override - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, - FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { - ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); - if (getMaxInputs() == 1) { - addSlot(builder, 52, 24 + yOffset, 0, importItems, importFluids, false, false); - } else { - int[] grid = determineSlotsGrid(getMaxInputs()); - for (int y = 0; y < grid[1]; y++) { - for (int x = 0; x < grid[0]; x++) { - addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), - 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, - y * grid[0] + x, importItems, importFluids, false, false); - } - } - } - - addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); - addSlot(builder, 52, 24 + yOffset + 19 + 18, 0, importItems, importFluids, true, false); - addSlot(builder, 34, 24 + yOffset + 19 + 18, 1, importItems, importFluids, true, false); - - Pair suppliers = createPairedSupplier(200, 41, 0.5); - builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, - GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, this)); - builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture, - moveType, this)); - return builder; - } - - public static Pair createPairedSupplier(int ticksPerCycle, int width, - double splitPoint) { - AtomicDouble tracker = new AtomicDouble(0.0); - DoubleSupplier supplier1 = new ProgressWidget.TimedProgressSupplier(ticksPerCycle, width, false) { - - @Override - public double getAsDouble() { - double val = super.getAsDouble(); - tracker.set(val); - return val >= splitPoint ? 1.0 : (1.0 / splitPoint) * val; - } - }; - DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? - (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; - return Pair.of(supplier1, supplier2); - } -} diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 19a32b23d0a..719cde4c311 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -4,21 +4,27 @@ import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeItemInput; +import gregtech.api.recipes.ui.RecipeMapUIFunction; +import gregtech.core.sound.GTSoundEvents; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; +@ApiStatus.Internal public class RecipeMapFluidCanner extends RecipeMap { - public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, - int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); + public RecipeMapFluidCanner(@NotNull String unlocalizedName, @NotNull SimpleRecipeBuilder defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 2, 2, 1, 1); + setSound(GTSoundEvents.BATH); } @Override diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index bbd546f7437..492ae4080c1 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -1,33 +1,33 @@ package gregtech.api.recipes.machines; -import gregtech.api.capability.impl.FluidTankList; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.resources.TextureArea; -import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.recipes.ingredients.GTRecipeItemInput; +import gregtech.api.recipes.ui.RecipeMapUIFunction; import gregtech.api.util.GTUtility; import gregtech.common.items.MetaItems; +import gregtech.core.sound.GTSoundEvents; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; +@ApiStatus.Internal public class RecipeMapFormingPress extends RecipeMap { private static ItemStack NAME_MOLD = ItemStack.EMPTY; - public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, - int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); + public RecipeMapFormingPress(@NotNull String unlocalizedName, @NotNull SimpleRecipeBuilder defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 6, 1, 0, 0); + setSound(GTSoundEvents.COMPRESSOR); } @Override @@ -77,21 +77,4 @@ public Recipe findRecipe(long voltage, List inputs, List } return recipe; } - - @Override - protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, - FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { - SlotWidget slotWidget = new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs); - TextureArea base = GuiTextures.SLOT; - if (isOutputs) - slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_3); - else if (slotIndex == 0 || slotIndex == 3) - slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_2); - else if (slotIndex == 1 || slotIndex == 4) - slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_4); - else if (slotIndex == 2 || slotIndex == 5) - slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_1); - - builder.widget(slotWidget); - } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java index cdfb13448c1..2c1b3d442e2 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java @@ -4,23 +4,29 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; +import gregtech.api.recipes.ui.RecipeMapUIFunction; import gregtech.api.util.GTUtility; +import gregtech.core.sound.GTSoundEvents; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; +@ApiStatus.Internal public class RecipeMapFurnace extends RecipeMap { public static final int RECIPE_EUT = 4; public static final int RECIPE_DURATION = 128; - public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, - int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); + public RecipeMapFurnace(@NotNull String unlocalizedName, @NotNull SimpleRecipeBuilder defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 1, 1, 0, 0); + setSound(GTSoundEvents.FURNACE); } @Override diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java index f75138d6f27..de0295359cc 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapResearchStation.java @@ -1,45 +1,20 @@ package gregtech.api.recipes.machines; -import gregtech.api.capability.impl.FluidTankList; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.ImageWidget; -import gregtech.api.gui.widgets.ProgressWidget; -import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.GTValues; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUIFunction; +import gregtech.core.sound.GTSoundEvents; -import net.minecraftforge.items.IItemHandlerModifiable; - -import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; -import java.util.function.DoubleSupplier; - +@ApiStatus.Internal public class RecipeMapResearchStation> extends RecipeMap implements IScannerRecipeMap { - public RecipeMapResearchStation(@NotNull String unlocalizedName, int maxInputs, int maxOutputs, - int maxFluidInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, - boolean isHidden) { - super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipeBuilder, isHidden); - } - - @Override - @NotNull - public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, - FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { - Pair pairedSuppliers = RecipeMapCrackerUnit.createPairedSupplier(200, 90, 0.75); - return ModularUI.builder(GuiTextures.BACKGROUND, 176, 166) - .widget(new ImageWidget(10, 0, 84, 60, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_BASE)) - .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, - GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) - .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, - GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) - .widget(new SlotWidget(importItems, 0, 115, 50, true, true) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)) - .widget(new SlotWidget(importItems, 1, 43, 21, true, true) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.SCANNER_OVERLAY)) - .widget(new SlotWidget(exportItems, 0, 97, 21, true, true) - .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.RESEARCH_STATION_OVERLAY)); + public RecipeMapResearchStation(@NotNull String unlocalizedName, @NotNull R defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 2, 1, 0, 0); + setSound(GTValues.FOOLS.get() ? GTSoundEvents.SCIENCE : GTSoundEvents.COMPUTATION); } } diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java index 472c00469a2..f76c7b10814 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapScanner.java @@ -3,23 +3,28 @@ import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.builders.SimpleRecipeBuilder; +import gregtech.api.recipes.ui.RecipeMapUIFunction; +import gregtech.core.sound.GTSoundEvents; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +@ApiStatus.Internal public class RecipeMapScanner extends RecipeMap implements IScannerRecipeMap { private static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); - public RecipeMapScanner(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, - int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden); + public RecipeMapScanner(@NotNull String unlocalizedName, @NotNull SimpleRecipeBuilder defaultRecipeBuilder, + @NotNull RecipeMapUIFunction recipeMapUI) { + super(unlocalizedName, defaultRecipeBuilder, recipeMapUI, 2, 1, 1, 0); + setSound(GTSoundEvents.ELECTROLYZER); } @Override diff --git a/src/main/java/gregtech/api/recipes/ui/RecipeMapUI.java b/src/main/java/gregtech/api/recipes/ui/RecipeMapUI.java new file mode 100644 index 00000000000..569efa103b6 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/RecipeMapUI.java @@ -0,0 +1,477 @@ +package gregtech.api.recipes.ui; + +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.resources.TextureArea; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.RecipeProgressWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.gui.widgets.TankWidget; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMap; + +import net.minecraftforge.items.IItemHandlerModifiable; + +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnmodifiableView; + +import java.util.function.DoubleSupplier; + +@ApiStatus.Experimental +public class RecipeMapUI> { + + private final Byte2ObjectMap slotOverlays = new Byte2ObjectOpenHashMap<>(); + + private final R recipeMap; + private final boolean modifyItemInputs; + private final boolean modifyItemOutputs; + private final boolean modifyFluidInputs; + private final boolean modifyFluidOutputs; + + private TextureArea progressBarTexture = GuiTextures.PROGRESS_BAR_ARROW; + private ProgressWidget.MoveType moveType = ProgressWidget.MoveType.HORIZONTAL; + private @Nullable TextureArea specialTexture; + private int @Nullable [] specialTexturePosition; + + private boolean isJEIVisible = true; + + /** + * @param recipeMap the recipemap corresponding to this ui + * @param modifyItemInputs if item input amounts can be modified + * @param modifyItemOutputs if item output amounts can be modified + * @param modifyFluidInputs if fluid input amounts can be modified + * @param modifyFluidOutputs if fluid output amounts can be modified + */ + public RecipeMapUI(@NotNull R recipeMap, boolean modifyItemInputs, boolean modifyItemOutputs, + boolean modifyFluidInputs, boolean modifyFluidOutputs) { + this.recipeMap = recipeMap; + this.modifyItemInputs = modifyItemInputs; + this.modifyItemOutputs = modifyItemOutputs; + this.modifyFluidInputs = modifyFluidInputs; + this.modifyFluidOutputs = modifyFluidOutputs; + } + + /** + * Compute the storage key for slot overlays. + * + * @param isOutput if the slot is an output slot + * @param isFluid if the slot is a fluid slot + * @param isLast if the slot is the last slot of its type + * @return the key + */ + @ApiStatus.Internal + public static byte computeOverlayKey(boolean isOutput, boolean isFluid, boolean isLast) { + return (byte) ((isOutput ? 2 : 0) + (isFluid ? 1 : 0) + (isLast ? 4 : 0)); + } + + /** + * Determines the slot grid for an item input amount + * + * @param itemInputsCount the item input amount + * @return [slots to the left, slots downwards] + */ + @Contract("_ -> new") + public static int @NotNull [] determineSlotsGrid(int itemInputsCount) { + int itemSlotsToLeft; + int itemSlotsToDown; + double sqrt = Math.sqrt(itemInputsCount); + // if the number of input has an integer root + // return it. + if (sqrt % 1 == 0) { + itemSlotsToLeft = (int) sqrt; + itemSlotsToDown = itemSlotsToLeft; + } else if (itemInputsCount == 3) { + itemSlotsToLeft = 3; + itemSlotsToDown = 1; + } else { + // if we couldn't fit all into a perfect square, + // increase the amount of slots to the left + itemSlotsToLeft = (int) Math.ceil(sqrt); + itemSlotsToDown = itemSlotsToLeft - 1; + // if we still can't fit all the slots in a grid, + // increase the amount of slots on the bottom + if (itemInputsCount > itemSlotsToLeft * itemSlotsToDown) { + itemSlotsToDown = itemSlotsToLeft; + } + } + return new int[] { itemSlotsToLeft, itemSlotsToDown }; + } + + /** + * Create a JEI UI Template + * + * @param importItems the input item inventory + * @param exportItems the output item inventory + * @param importFluids the input fluid inventory + * @param exportFluids the output fluid inventory + * @param yOffset the y offset for the gui + * @return the populated builder + */ + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); + builder.widget(new RecipeProgressWidget(200, 78, 23 + yOffset, 20, 20, progressBarTexture, + moveType, recipeMap)); + addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); + addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); + if (specialTexture != null && specialTexturePosition != null) { + addSpecialTexture(builder); + } + return builder; + } + + /** + * This DOES NOT include machine control widgets or binds player inventory + * + * @param progressSupplier a supplier for the progress bar + * @param importItems the input item inventory + * @param exportItems the output item inventory + * @param importFluids the input fluid inventory + * @param exportFluids the output fluid inventory + * @param yOffset the y offset for the gui + * @return the populated builder + */ + public ModularUI.Builder createUITemplate(DoubleSupplier progressSupplier, IItemHandlerModifiable importItems, + IItemHandlerModifiable exportItems, FluidTankList importFluids, + FluidTankList exportFluids, int yOffset) { + ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); + builder.widget( + new RecipeProgressWidget(progressSupplier, 78, 23 + yOffset, 20, 20, progressBarTexture, + moveType, recipeMap)); + addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); + addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); + if (specialTexture != null && specialTexturePosition != null) { + addSpecialTexture(builder); + } + return builder; + } + + /** + * This DOES NOT include machine control widgets or binds player inventory + * + * @param progressSupplier a supplier for the progress bar + * @param importItems the input item inventory + * @param exportItems the output item inventory + * @param importFluids the input fluid inventory + * @param exportFluids the output fluid inventory + * @param yOffset the y offset for the gui + * @return the populated builder + */ + public ModularUI.Builder createUITemplateNoOutputs(DoubleSupplier progressSupplier, + IItemHandlerModifiable importItems, + IItemHandlerModifiable exportItems, FluidTankList importFluids, + FluidTankList exportFluids, int yOffset) { + ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); + builder.widget( + new RecipeProgressWidget(progressSupplier, 78, 23 + yOffset, 20, 20, progressBarTexture, + moveType, recipeMap)); + addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); + if (specialTexture != null && specialTexturePosition != null) { + addSpecialTexture(builder); + } + return builder; + } + + /** + * @param builder the builder to add to + * @param itemHandler the item handler to use + * @param fluidHandler the fluid handler to use + * @param isOutputs if slots should be output slots + * @param yOffset the y offset for the gui + */ + protected void addInventorySlotGroup(@NotNull ModularUI.Builder builder, + @NotNull IItemHandlerModifiable itemHandler, + @NotNull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + int itemInputsCount = itemHandler.getSlots(); + int fluidInputsCount = fluidHandler.getTanks(); + boolean invertFluids = false; + if (itemInputsCount == 0) { + int tmp = itemInputsCount; + itemInputsCount = fluidInputsCount; + fluidInputsCount = tmp; + invertFluids = true; + } + int[] inputSlotGrid = determineSlotsGrid(itemInputsCount); + int itemSlotsToLeft = inputSlotGrid[0]; + int itemSlotsToDown = inputSlotGrid[1]; + int startInputsX = isOutputs ? 106 : 70 - itemSlotsToLeft * 18; + int startInputsY = 33 - (int) (itemSlotsToDown / 2.0 * 18) + yOffset; + boolean wasGroup = itemHandler.getSlots() + fluidHandler.getTanks() == 12; + if (wasGroup) startInputsY -= 9; + else if (itemHandler.getSlots() >= 6 && fluidHandler.getTanks() >= 2 && !isOutputs) startInputsY -= 9; + for (int i = 0; i < itemSlotsToDown; i++) { + for (int j = 0; j < itemSlotsToLeft; j++) { + int slotIndex = i * itemSlotsToLeft + j; + if (slotIndex >= itemInputsCount) break; + int x = startInputsX + 18 * j; + int y = startInputsY + 18 * i; + addSlot(builder, x, y, slotIndex, itemHandler, fluidHandler, invertFluids, isOutputs); + } + } + if (wasGroup) startInputsY += 2; + if (fluidInputsCount > 0 || invertFluids) { + if (itemSlotsToDown >= fluidInputsCount && itemSlotsToLeft < 3) { + int startSpecX = isOutputs ? startInputsX + itemSlotsToLeft * 18 : startInputsX - 18; + for (int i = 0; i < fluidInputsCount; i++) { + int y = startInputsY + 18 * i; + addSlot(builder, startSpecX, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs); + } + } else { + int startSpecY = startInputsY + itemSlotsToDown * 18; + for (int i = 0; i < fluidInputsCount; i++) { + int x = isOutputs ? startInputsX + 18 * (i % 3) : + startInputsX + itemSlotsToLeft * 18 - 18 - 18 * (i % 3); + int y = startSpecY + (i / 3) * 18; + addSlot(builder, x, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs); + } + } + } + } + + /** + * Add a slot to this ui + * + * @param builder the builder to add to + * @param x the x coordinate of the slot + * @param y the y coordinate of the slot + * @param slotIndex the slot index of the slot + * @param itemHandler the item handler to use + * @param fluidHandler the fluid handler to use + * @param isFluid if the slot is a fluid slot + * @param isOutputs if slots should be output slots + */ + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + if (!isFluid) { + builder.widget(new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs).setBackgroundTexture( + getOverlaysForSlot(isOutputs, false, slotIndex == itemHandler.getSlots() - 1))); + } else { + builder.widget(new TankWidget(fluidHandler.getTankAt(slotIndex), x, y, 18, 18).setAlwaysShowFull(true) + .setBackgroundTexture(getOverlaysForSlot(isOutputs, true, slotIndex == fluidHandler.getTanks() - 1)) + .setContainerClicking(true, !isOutputs)); + } + } + + /** + * @param isOutput if the slot is an output slot + * @param isFluid if the slot is a fluid slot + * @param isLast if the slot is the last slot of its type + * @return the overlays for a slot + */ + protected TextureArea[] getOverlaysForSlot(boolean isOutput, boolean isFluid, boolean isLast) { + TextureArea base = isFluid ? GuiTextures.FLUID_SLOT : GuiTextures.SLOT; + byte overlayKey = computeOverlayKey(isOutput, isFluid, isLast); + if (slotOverlays.containsKey(overlayKey)) { + return new TextureArea[] { base, slotOverlays.get(overlayKey) }; + } + return new TextureArea[] { base }; + } + + /** + * @return the height used to determine size of background texture in JEI + */ + public int getPropertyHeightShift() { + int maxPropertyCount = 0; + if (shouldShiftWidgets()) { + for (Recipe recipe : recipeMap.getRecipeList()) { + if (recipe.getPropertyCount() > maxPropertyCount) + maxPropertyCount = recipe.getPropertyCount(); + } + } + return maxPropertyCount * 10; // GTRecipeWrapper#LINE_HEIGHT + } + + /** + * @return widgets should be shifted + */ + private boolean shouldShiftWidgets() { + return recipeMap.getMaxInputs() + recipeMap.getMaxOutputs() >= 6 || + recipeMap.getMaxFluidInputs() + recipeMap.getMaxFluidOutputs() >= 6; + } + + /** + * @return the progress bar's move type + */ + public @NotNull ProgressWidget.MoveType progressBarMoveType() { + return moveType; + } + + /** + * @param moveType the new progress bar move type + */ + public void setProgressBarMoveType(@NotNull ProgressWidget.MoveType moveType) { + this.moveType = moveType; + } + + /** + * @return the texture of the progress bar + */ + public @NotNull TextureArea progressBarTexture() { + return progressBarTexture; + } + + /** + * @param progressBarTexture the new progress bar texture + */ + public void setProgressBarTexture(@NotNull TextureArea progressBarTexture) { + this.progressBarTexture = progressBarTexture; + } + + /** + * @param progressBarTexture the new progress bar texture + * @param moveType the new progress bar move type + */ + public void setProgressBar(@NotNull TextureArea progressBarTexture, @NotNull ProgressWidget.MoveType moveType) { + this.progressBarTexture = progressBarTexture; + this.moveType = moveType; + } + + /** + * @param specialTexture the special texture to set + * @param x the x coordinate of the texture + * @param y the y coordinate of the texture + * @param width the width of the texture + * @param height the height of the texture + */ + public void setSpecialTexture(@NotNull TextureArea specialTexture, int x, int y, int width, int height) { + setSpecialTexture(specialTexture, new int[] { x, y, width, height }); + } + + /** + * @param specialTexture the special texture to set + * @param position the position of the texture: [x, y, width, height] + */ + public void setSpecialTexture(@NotNull TextureArea specialTexture, int @NotNull [] position) { + this.specialTexture = specialTexture; + this.specialTexturePosition = position; + } + + /** + * @return the special texture + */ + public @Nullable TextureArea specialTexture() { + return this.specialTexture; + } + + /** + * @return the special texture's position + */ + public int @Nullable @UnmodifiableView [] specialTexturePosition() { + return this.specialTexturePosition; + } + + /** + * Add a special texture to a builder + * + * @param builder the builder to add to + * @return the updated builder + */ + public @NotNull ModularUI.Builder addSpecialTexture(@NotNull ModularUI.Builder builder) { + if (specialTexturePosition != null) { + builder.image(specialTexturePosition[0], specialTexturePosition[1], + specialTexturePosition[2], + specialTexturePosition[3], specialTexture); + } + return builder; + } + + /** + * @return if this ui should be visible in JEI + */ + public boolean isJEIVisible() { + return isJEIVisible; + } + + /** + * @param isJEIVisible if the ui should be visible in JEI + */ + public void setJEIVisible(boolean isJEIVisible) { + this.isJEIVisible = isJEIVisible; + } + + /** + * @return if item input slot amounts can be modified + */ + public boolean canModifyItemInputs() { + return modifyItemInputs; + } + + /** + * @return if item output slot amounts can be modified + */ + public boolean canModifyItemOutputs() { + return modifyItemOutputs; + } + + /** + * @return if fluid input slot amounts can be modified + */ + public boolean canModifyFluidInputs() { + return modifyFluidInputs; + } + + /** + * @return if fluid output slot amounts can be modified + */ + public boolean canModifyFluidOutputs() { + return modifyFluidOutputs; + } + + /** + * @param texture the texture to set + * @param isOutput if the slot is an output slot + */ + public void setItemSlotOverlay(@NotNull TextureArea texture, boolean isOutput) { + this.slotOverlays.put(computeOverlayKey(isOutput, false, false), texture); + this.slotOverlays.put(computeOverlayKey(isOutput, false, true), texture); + } + + /** + * @param texture the texture to set + * @param isOutput if the slot is an output slot + * @param isLastSlot if the slot is the last slot + */ + public void setItemSlotOverlay(@NotNull TextureArea texture, boolean isOutput, boolean isLastSlot) { + this.slotOverlays.put(computeOverlayKey(isOutput, false, isLastSlot), texture); + } + + /** + * @param texture the texture to set + * @param isOutput if the slot is an output slot + */ + public void setFluidSlotOverlay(@NotNull TextureArea texture, boolean isOutput) { + this.slotOverlays.put(computeOverlayKey(isOutput, true, false), texture); + this.slotOverlays.put(computeOverlayKey(isOutput, true, true), texture); + } + + /** + * @param texture the texture to set + * @param isOutput if the slot is an output slot + * @param isLastSlot if the slot is the last slot + */ + public void setFluidSlotOverlay(@NotNull TextureArea texture, boolean isOutput, boolean isLastSlot) { + this.slotOverlays.put(computeOverlayKey(isOutput, true, isLastSlot), texture); + } + + /** + * @param key the key to store the slot's texture with + * @param texture the texture to store + */ + @ApiStatus.Internal + public void setSlotOverlay(byte key, @NotNull TextureArea texture) { + this.slotOverlays.put(key, texture); + } + + /** + * @return the UI's recipemap + */ + public @NotNull R recipeMap() { + return recipeMap; + } +} diff --git a/src/main/java/gregtech/api/recipes/ui/RecipeMapUIFunction.java b/src/main/java/gregtech/api/recipes/ui/RecipeMapUIFunction.java new file mode 100644 index 00000000000..f654996e31e --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/RecipeMapUIFunction.java @@ -0,0 +1,18 @@ +package gregtech.api.recipes.ui; + +import gregtech.api.recipes.RecipeMap; + +import org.jetbrains.annotations.NotNull; + +@FunctionalInterface +public interface RecipeMapUIFunction { + + /** + * Create a RecipeMapUI using a RecipeMap. + * + * @param recipeMap the recipemap to associate with the ui + * @return the ui + */ + @NotNull + RecipeMapUI apply(@NotNull RecipeMap recipeMap); +} diff --git a/src/main/java/gregtech/api/recipes/ui/impl/AssemblyLineUI.java b/src/main/java/gregtech/api/recipes/ui/impl/AssemblyLineUI.java new file mode 100644 index 00000000000..244bba47b35 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/impl/AssemblyLineUI.java @@ -0,0 +1,72 @@ +package gregtech.api.recipes.ui.impl; + +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUI; + +import net.minecraftforge.items.IItemHandlerModifiable; + +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public final class AssemblyLineUI> extends RecipeMapUI { + + /** + * @param recipeMap the recipemap corresponding to this ui + */ + public AssemblyLineUI(@NotNull R recipeMap) { + super(recipeMap, false, false, false, false); + setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL); + } + + @Override + @NotNull + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 176) + .widget(new ProgressWidget(200, 80, 1, 54, 72, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE, + ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(200, 138, 19, 10, 18, GuiTextures.PROGRESS_BAR_ASSEMBLY_LINE_ARROW, + ProgressWidget.MoveType.VERTICAL)); + this.addInventorySlotGroup(builder, importItems, importFluids, false, yOffset); + this.addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); + return builder; + } + + @Override + protected void addInventorySlotGroup(@NotNull ModularUI.Builder builder, + @NotNull IItemHandlerModifiable itemHandler, + @NotNull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + int startInputsX = 80 - 4 * 18; + int startInputsY = 37 - 2 * 18; + + if (!isOutputs) { + // Data Slot + builder.widget(new SlotWidget(itemHandler, 16, startInputsX + 18 * 7, 1 + 18 * 2, true, true) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)); + + // item input slots + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + int slotIndex = i * 4 + j; + addSlot(builder, startInputsX + 18 * j, startInputsY + 18 * i, slotIndex, itemHandler, fluidHandler, + false, false); + } + } + + // fluid slots + int startFluidX = startInputsX + 18 * 5; + for (int i = 0; i < 4; i++) { + addSlot(builder, startFluidX, startInputsY + 18 * i, i, itemHandler, fluidHandler, true, false); + } + } else { + // output slot + addSlot(builder, startInputsX + 18 * 7, 1, 0, itemHandler, fluidHandler, false, true); + } + } +} diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java b/src/main/java/gregtech/api/recipes/ui/impl/CokeOvenUI.java similarity index 58% rename from src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java rename to src/main/java/gregtech/api/recipes/ui/impl/CokeOvenUI.java index 034ec60c4b9..910d4e4908b 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapCokeOven.java +++ b/src/main/java/gregtech/api/recipes/ui/impl/CokeOvenUI.java @@ -1,22 +1,25 @@ -package gregtech.api.recipes.machines; +package gregtech.api.recipes.ui.impl; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.widgets.ProgressWidget; -import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUI; import net.minecraftforge.items.IItemHandlerModifiable; -public class RecipeMapCokeOven> extends RecipeMap { +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; - public RecipeMapCokeOven(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, - boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, - boolean modifyFluidOutputs, R defaultRecipe, boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, - modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); +@ApiStatus.Internal +public class CokeOvenUI> extends RecipeMapUI { + + /** + * @param recipeMap the recipemap corresponding to this ui + */ + public CokeOvenUI(@NotNull R recipeMap) { + super(recipeMap, false, false, false, false); } @Override diff --git a/src/main/java/gregtech/api/recipes/ui/impl/CrackerUnitUI.java b/src/main/java/gregtech/api/recipes/ui/impl/CrackerUnitUI.java new file mode 100644 index 00000000000..fb4a6698e40 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/impl/CrackerUnitUI.java @@ -0,0 +1,59 @@ +package gregtech.api.recipes.ui.impl; + +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.RecipeProgressWidget; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUI; +import gregtech.api.util.GTUtility; + +import net.minecraftforge.items.IItemHandlerModifiable; + +import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +import java.util.function.DoubleSupplier; + +@ApiStatus.Internal +public class CrackerUnitUI> extends RecipeMapUI { + + public CrackerUnitUI(@NotNull R recipeMap) { + super(recipeMap, true, true, false, true); + setFluidSlotOverlay(GuiTextures.CRACKING_OVERLAY_1, false); + setFluidSlotOverlay(GuiTextures.CRACKING_OVERLAY_2, true); + setItemSlotOverlay(GuiTextures.CIRCUIT_OVERLAY, false); + setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, ProgressWidget.MoveType.HORIZONTAL); + } + + @Override + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); + if (recipeMap().getMaxInputs() == 1) { + addSlot(builder, 52, 24 + yOffset, 0, importItems, importFluids, false, false); + } else { + int[] grid = determineSlotsGrid(recipeMap().getMaxInputs()); + for (int y = 0; y < grid[1]; y++) { + for (int x = 0; x < grid[0]; x++) { + addSlot(builder, 34 + (x * 18) - (Math.max(0, grid[0] - 2) * 18), + 24 + (y * 18) - (Math.max(0, grid[1] - 1) * 18) + yOffset, + y * grid[0] + x, importItems, importFluids, false, false); + } + } + } + + addInventorySlotGroup(builder, exportItems, exportFluids, true, yOffset); + addSlot(builder, 52, 24 + yOffset + 19 + 18, 0, importItems, importFluids, true, false); + addSlot(builder, 34, 24 + yOffset + 19 + 18, 1, importItems, importFluids, true, false); + + Pair suppliers = GTUtility.createPairedSupplier(200, 41, 0.5); + builder.widget(new RecipeProgressWidget(suppliers.getLeft(), 42, 24 + yOffset + 18, 21, 19, + GuiTextures.PROGRESS_BAR_CRACKING_INPUT, ProgressWidget.MoveType.VERTICAL, recipeMap())); + builder.widget(new RecipeProgressWidget(suppliers.getRight(), 78, 23 + yOffset, 20, 20, progressBarTexture(), + progressBarMoveType(), recipeMap())); + return builder; + } +} diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java b/src/main/java/gregtech/api/recipes/ui/impl/DistillationTowerUI.java similarity index 75% rename from src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java rename to src/main/java/gregtech/api/recipes/ui/impl/DistillationTowerUI.java index d338f8c5898..f87d1767ac1 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapDistillationTower.java +++ b/src/main/java/gregtech/api/recipes/ui/impl/DistillationTowerUI.java @@ -1,4 +1,4 @@ -package gregtech.api.recipes.machines; +package gregtech.api.recipes.ui.impl; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.gui.GuiTextures; @@ -8,19 +8,16 @@ import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.recipes.RecipeMap; -import gregtech.api.recipes.builders.UniversalDistillationRecipeBuilder; +import gregtech.api.recipes.ui.RecipeMapUI; import net.minecraftforge.items.IItemHandlerModifiable; -public class RecipeMapDistillationTower extends RecipeMap { +import org.jetbrains.annotations.NotNull; - public RecipeMapDistillationTower(String unlocalizedName, int maxInputs, boolean modifyItemInputs, int maxOutputs, - boolean modifyItemOutputs, - int maxFluidInputs, boolean modifyFluidInputs, int maxFluidOutputs, - boolean modifyFluidOutputs, UniversalDistillationRecipeBuilder defaultRecipe, - boolean isHidden) { - super(unlocalizedName, maxInputs, modifyItemInputs, maxOutputs, modifyItemOutputs, maxFluidInputs, - modifyFluidInputs, maxFluidOutputs, modifyFluidOutputs, defaultRecipe, isHidden); +public class DistillationTowerUI> extends RecipeMapUI { + + public DistillationTowerUI(@NotNull R recipeMap) { + super(recipeMap, true, true, true, false); } @Override @@ -52,7 +49,6 @@ else if (slotIndex == 2 || slotIndex == 5 || slotIndex == 8 || slotIndex == 11) } @Override - // this DOES NOT include machine control widgets or binds player inventory public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { ModularUI.Builder builder = ModularUI.defaultBuilder(yOffset); @@ -60,14 +56,16 @@ public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, ProgressWidget.MoveType.HORIZONTAL)); addInventorySlotGroup(builder, importItems, importFluids, false, 9); addInventorySlotGroup(builder, exportItems, exportFluids, true, 9); - if (this.specialTexture != null && this.specialTexturePosition != null) + if (specialTexture() != null && specialTexturePosition() != null) { addSpecialTexture(builder); + } return builder; } @Override - protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler, - FluidTankList fluidHandler, boolean isOutputs, int yOffset) { + protected void addInventorySlotGroup(@NotNull ModularUI.Builder builder, + @NotNull IItemHandlerModifiable itemHandler, + @NotNull FluidTankList fluidHandler, boolean isOutputs, int yOffset) { int itemInputsCount = itemHandler.getSlots(); int fluidInputsCount = fluidHandler.getTanks(); boolean invertFluids = false; @@ -77,7 +75,7 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi fluidInputsCount = tmp; invertFluids = true; } - int[] inputSlotGrid = determineSlotsGrid(itemInputsCount); + int[] inputSlotGrid = RecipeMapUI.determineSlotsGrid(itemInputsCount); int itemSlotsToLeft = inputSlotGrid[0]; int itemSlotsToDown = inputSlotGrid[1]; int startInputsX = isOutputs ? 104 : 68 - itemSlotsToLeft * 18; @@ -85,17 +83,17 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi boolean wasGroupOutput = itemHandler.getSlots() + fluidHandler.getTanks() == 12; if (wasGroupOutput && isOutputs) startInputsY -= 9; if (itemHandler.getSlots() == 6 && fluidHandler.getTanks() == 2 && !isOutputs) startInputsY -= 9; - if (!isOutputs) + if (!isOutputs) { addSlot(builder, 40, startInputsY + (itemSlotsToDown - 1) * 18 - 18, 0, itemHandler, fluidHandler, invertFluids, false); - else + } else { addSlot(builder, 94, startInputsY + (itemSlotsToDown - 1) * 18, 0, itemHandler, fluidHandler, invertFluids, true); + } if (wasGroupOutput) startInputsY += 2; - if (!isOutputs) - return; + if (!isOutputs) return; if (!invertFluids) { startInputsY -= 18; @@ -103,7 +101,6 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi } if (fluidInputsCount > 0 || invertFluids) { - int startSpecY = startInputsY + itemSlotsToDown * 18; for (int i = 0; i < fluidInputsCount; i++) { int x = startInputsX + 18 * (i % 3); diff --git a/src/main/java/gregtech/api/recipes/ui/impl/FormingPressUI.java b/src/main/java/gregtech/api/recipes/ui/impl/FormingPressUI.java new file mode 100644 index 00000000000..7d63ff00da7 --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/impl/FormingPressUI.java @@ -0,0 +1,41 @@ +package gregtech.api.recipes.ui.impl; + +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.resources.TextureArea; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUI; + +import net.minecraftforge.items.IItemHandlerModifiable; + +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public class FormingPressUI> extends RecipeMapUI { + + public FormingPressUI(@NotNull R recipeMap) { + super(recipeMap, true, true, true, true); + setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, ProgressWidget.MoveType.HORIZONTAL); + } + + @Override + protected void addSlot(ModularUI.Builder builder, int x, int y, int slotIndex, IItemHandlerModifiable itemHandler, + FluidTankList fluidHandler, boolean isFluid, boolean isOutputs) { + SlotWidget slotWidget = new SlotWidget(itemHandler, slotIndex, x, y, true, !isOutputs); + TextureArea base = GuiTextures.SLOT; + if (isOutputs) + slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_3); + else if (slotIndex == 0 || slotIndex == 3) + slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_2); + else if (slotIndex == 1 || slotIndex == 4) + slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_4); + else if (slotIndex == 2 || slotIndex == 5) + slotWidget.setBackgroundTexture(base, GuiTextures.PRESS_OVERLAY_1); + + builder.widget(slotWidget); + } +} diff --git a/src/main/java/gregtech/api/recipes/ui/impl/ResearchStationUI.java b/src/main/java/gregtech/api/recipes/ui/impl/ResearchStationUI.java new file mode 100644 index 00000000000..917fc953dab --- /dev/null +++ b/src/main/java/gregtech/api/recipes/ui/impl/ResearchStationUI.java @@ -0,0 +1,49 @@ +package gregtech.api.recipes.ui.impl; + +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.ImageWidget; +import gregtech.api.gui.widgets.ProgressWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.ui.RecipeMapUI; +import gregtech.api.util.GTUtility; + +import net.minecraftforge.items.IItemHandlerModifiable; + +import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +import java.util.function.DoubleSupplier; + +@ApiStatus.Internal +public class ResearchStationUI> extends RecipeMapUI { + + public ResearchStationUI(@NotNull R recipeMap) { + super(recipeMap, true, true, true, true); + setItemSlotOverlay(GuiTextures.SCANNER_OVERLAY, false); + setItemSlotOverlay(GuiTextures.RESEARCH_STATION_OVERLAY, true); + setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressWidget.MoveType.HORIZONTAL); + } + + @Override + @NotNull + public ModularUI.Builder createJeiUITemplate(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, + FluidTankList importFluids, FluidTankList exportFluids, int yOffset) { + Pair pairedSuppliers = GTUtility.createPairedSupplier(200, 90, 0.75); + return ModularUI.builder(GuiTextures.BACKGROUND, 176, 166) + .widget(new ImageWidget(10, 0, 84, 60, GuiTextures.PROGRESS_BAR_RESEARCH_STATION_BASE)) + .widget(new ProgressWidget(pairedSuppliers.getLeft(), 72, 28, 54, 5, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_1, ProgressWidget.MoveType.HORIZONTAL)) + .widget(new ProgressWidget(pairedSuppliers.getRight(), 119, 32, 10, 18, + GuiTextures.PROGRESS_BAR_RESEARCH_STATION_2, ProgressWidget.MoveType.VERTICAL_DOWNWARDS)) + .widget(new SlotWidget(importItems, 0, 115, 50, true, true) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.DATA_ORB_OVERLAY)) + .widget(new SlotWidget(importItems, 1, 43, 21, true, true) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.SCANNER_OVERLAY)) + .widget(new SlotWidget(exportItems, 0, 97, 21, true, true) + .setBackgroundTexture(GuiTextures.SLOT, GuiTextures.RESEARCH_STATION_OVERLAY)); + } +} diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index bf88330a68b..2b95a31fe0f 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -6,6 +6,7 @@ import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.cover.CoverDefinition; import gregtech.api.fluids.GTFluid; +import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.items.behavior.CoverItemBehavior; import gregtech.api.items.metaitem.MetaItem; import gregtech.api.items.metaitem.stats.IItemBehaviour; @@ -53,15 +54,22 @@ import net.minecraftforge.items.IItemHandlerModifiable; import com.google.common.collect.Lists; +import com.google.common.util.concurrent.AtomicDouble; import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.AbstractList; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Random; +import java.util.Set; import java.util.function.BooleanSupplier; +import java.util.function.DoubleSupplier; import java.util.function.Function; import java.util.function.Predicate; @@ -858,4 +866,21 @@ public static TextComponentTranslation getFluidTranslation(@Nullable Fluid fluid } return new TextComponentTranslation(fluid.getUnlocalizedName()); } + + public static @NotNull Pair createPairedSupplier(int ticksPerCycle, int width, + double splitPoint) { + AtomicDouble tracker = new AtomicDouble(0.0); + DoubleSupplier supplier1 = new ProgressWidget.TimedProgressSupplier(ticksPerCycle, width, false) { + + @Override + public double getAsDouble() { + double val = super.getAsDouble(); + tracker.set(val); + return val >= splitPoint ? 1.0 : (1.0 / splitPoint) * val; + } + }; + DoubleSupplier supplier2 = () -> tracker.get() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (tracker.get() - splitPoint) : 0; + return Pair.of(supplier1, supplier2); + } } diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index b6c1d9519bf..be7c1bd50ca 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -28,9 +28,20 @@ import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.IntegrationSubmodule; -import gregtech.integration.jei.basic.*; +import gregtech.integration.jei.basic.GTFluidVeinCategory; +import gregtech.integration.jei.basic.GTFluidVeinInfo; +import gregtech.integration.jei.basic.GTOreCategory; +import gregtech.integration.jei.basic.GTOreInfo; +import gregtech.integration.jei.basic.MaterialTree; +import gregtech.integration.jei.basic.MaterialTreeCategory; +import gregtech.integration.jei.basic.OreByProduct; +import gregtech.integration.jei.basic.OreByProductCategory; import gregtech.integration.jei.multiblock.MultiblockInfoCategory; -import gregtech.integration.jei.recipe.*; +import gregtech.integration.jei.recipe.FacadeRegistryPlugin; +import gregtech.integration.jei.recipe.GTRecipeWrapper; +import gregtech.integration.jei.recipe.IntCircuitCategory; +import gregtech.integration.jei.recipe.IntCircuitRecipeWrapper; +import gregtech.integration.jei.recipe.RecipeMapCategory; import gregtech.integration.jei.utils.MachineSubtypeHandler; import gregtech.integration.jei.utils.MetaItemSubtypeHandler; import gregtech.integration.jei.utils.ModularUIGuiHandler; @@ -46,7 +57,13 @@ import net.minecraftforge.fml.relauncher.Side; import mezz.jei.Internal; -import mezz.jei.api.*; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.IJeiRuntime; +import mezz.jei.api.IModPlugin; +import mezz.jei.api.IModRegistry; +import mezz.jei.api.ISubtypeRegistry; +import mezz.jei.api.JEIPlugin; import mezz.jei.api.ingredients.IIngredientRegistry; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeCategoryRegistration; @@ -105,7 +122,7 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { registry.addRecipeCategories(new IntCircuitCategory(registry.getJeiHelpers().getGuiHelper())); registry.addRecipeCategories(new MultiblockInfoCategory(registry.getJeiHelpers())); for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { - if (!recipeMap.isHidden) { + if (recipeMap.getRecipeMapUI().isJEIVisible()) { for (GTRecipeCategory category : recipeMap.getRecipesByCategory().keySet()) { registry.addRecipeCategories( new RecipeMapCategory(recipeMap, category, registry.getJeiHelpers().getGuiHelper())); @@ -146,7 +163,7 @@ public void register(IModRegistry registry) { VanillaRecipeCategoryUid.CRAFTING); for (RecipeMap recipeMap : RecipeMap.getRecipeMaps()) { - if (!recipeMap.isHidden) { + if (recipeMap.getRecipeMapUI().isJEIVisible()) { for (Map.Entry> entry : recipeMap.getRecipesByCategory().entrySet()) { Stream recipeStream = entry.getValue().stream() .filter(recipe -> !recipe.isHidden() && recipe.hasValidInputsForDisplay()); diff --git a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java index ce0c074e933..52039a21b07 100644 --- a/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java +++ b/src/main/java/gregtech/integration/jei/recipe/RecipeMapCategory.java @@ -70,7 +70,7 @@ public RecipeMapCategory(@NotNull RecipeMap recipeMap, @NotNull GTRecipeCateg FluidTank[] exportFluidTanks = new FluidTank[recipeMap.getMaxFluidOutputs()]; for (int i = 0; i < exportFluidTanks.length; i++) exportFluidTanks[i] = new FluidTank(16000); - this.modularUI = recipeMap.createJeiUITemplate( + this.modularUI = recipeMap.getRecipeMapUI().createJeiUITemplate( (importItems = new ItemStackHandler( recipeMap.getMaxInputs() + (recipeMap == RecipeMaps.ASSEMBLY_LINE_RECIPES ? 1 : 0))), (exportItems = new ItemStackHandler(recipeMap.getMaxOutputs())), @@ -79,7 +79,7 @@ public RecipeMapCategory(@NotNull RecipeMap recipeMap, @NotNull GTRecipeCateg .build(new BlankUIHolder(), Minecraft.getMinecraft().player); this.modularUI.initWidgets(); this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), - modularUI.getHeight() * 2 / 3 + recipeMap.getPropertyHeightShift()); + modularUI.getHeight() * 2 / 3 + recipeMap.getRecipeMapUI().getPropertyHeightShift()); gtCategories.put(category, this); recipeMapCategories.compute(recipeMap, (k, v) -> { if (v == null) v = new ArrayList<>(); From 055ce6a0cfd327f5915651521c37d491aae56e18 Mon Sep 17 00:00:00 2001 From: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:43:45 -0500 Subject: [PATCH 75/77] fix data stick entry removal from AL (#2279) --- .../gregtech/api/recipes/machines/RecipeMapAssemblyLine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java index 098d93ab589..28cd542d11d 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapAssemblyLine.java @@ -52,8 +52,9 @@ public boolean removeRecipe(@NotNull Recipe recipe) { ResearchPropertyData data = recipe.getProperty(ResearchProperty.getInstance(), null); if (data != null) { for (ResearchPropertyData.ResearchEntry entry : data) { - return removeDataStickEntry(entry.getResearchId(), recipe); + removeDataStickEntry(entry.getResearchId(), recipe); } + return true; } return false; } From 11e4397ac12cbc51740fc2f538079f068b9e6570 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Sun, 10 Dec 2023 19:32:57 -0700 Subject: [PATCH 76/77] Fix Large Gas Turbine not displaying Max Voltage when fully spun up (#2283) --- .../multi/electric/generator/MetaTileEntityLargeTurbine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java index 777307110af..16522799167 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java @@ -106,7 +106,7 @@ protected void formStructure(PatternMatchContext context) { protected long getMaxVoltage() { long maxProduction = recipeMapWorkable.getMaxVoltage(); long currentProduction = ((LargeTurbineWorkableHandler) recipeMapWorkable).boostProduction((int) maxProduction); - if (isActive() && currentProduction < maxProduction) { + if (isActive() && currentProduction <= maxProduction) { return recipeMapWorkable.getMaxVoltage(); } else { return 0L; From 13f58f6f498f6769140b694c28e1fa6c4b4c0b9d Mon Sep 17 00:00:00 2001 From: Serenibyss <10861407+serenibyss@users.noreply.github.com> Date: Sun, 10 Dec 2023 21:45:52 -0600 Subject: [PATCH 77/77] Remove forestry src/api class (#2284) --- .../api/arboriculture/IToolGrafter.java | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/api/java/forestry/api/arboriculture/IToolGrafter.java diff --git a/src/api/java/forestry/api/arboriculture/IToolGrafter.java b/src/api/java/forestry/api/arboriculture/IToolGrafter.java deleted file mode 100644 index cd25031ac20..00000000000 --- a/src/api/java/forestry/api/arboriculture/IToolGrafter.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright 2011-2014 SirSengir - * - * This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details. - ******************************************************************************/ -package forestry.api.arboriculture; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public interface IToolGrafter { - /** - * Called by leaves to determine the increase in sapling droprate. - * - * @param stack ItemStack containing the grafter. - * @param world Minecraft world the player and the target block inhabit. - * @param pos Coordinate of the broken leaf block. - * @return Float representing the factor the usual drop chance is to be multiplied by. - */ - float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, BlockPos pos); -}